Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scripts/gen-btf.sh: Fix .btf.o generation when compiling for RISCV

gen-btf.sh emits a .btf.o file with BTF sections to be linked into
vmlinux in link-vmlinux.sh

This .btf.o file is created by compiling an emptystring with ${CC},
and then adding BTF sections into it with ${OBJCOPY}.

To ensure the .btf.o is linkable when cross-compiling with LLVM, we
have to also pass ${KBUILD_FLAGS}, which in particular control the
target word size.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512240559.2M06DSX7-lkp@intel.com/
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20251229202823.569619-1-ihor.solodrai@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Ihor Solodrai and committed by
Alexei Starovoitov
60060585 f14cdb13

+1 -1
+1 -1
scripts/gen-btf.sh
··· 96 96 # deletes all symbols including __start_BTF and __stop_BTF, which will 97 97 # be redefined in the linker script. 98 98 info OBJCOPY "${btf_data}" 99 - echo "" | ${CC} ${CLANG_FLAGS} -c -x c -o ${btf_data} - 99 + echo "" | ${CC} ${CLANG_FLAGS} ${KBUILD_CFLAGS} -c -x c -o ${btf_data} - 100 100 ${OBJCOPY} --add-section .BTF=${ELF_FILE}.BTF \ 101 101 --set-section-flags .BTF=alloc,readonly ${btf_data} 102 102 ${OBJCOPY} --only-section=.BTF --strip-all ${btf_data}