Re: [bpf-next:master 8/9] ld.lld: error: .tmp_vmlinux1.btf.o is incompatible with elf32lriscv

Nathan Chancellor
2025-12-28T21:56:17Z

On Wed, Dec 24, 2025 at 06:02:31AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> head: f14cdb1367b947d373215e36cfe9c69768dbafc9
> commit: 522397d05e7d4a7c30b91841492360336b24f833 [8/9] resolve_btfids: Change in-place update with raw binary output
> config: riscv-randconfig-002-20251224 (https://download.01.org/0day-ci/archive/20251224/202512240559.2M06DSX7-lkp@intel.com/config)
> compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 4ef602d446057dabf5f61fb221669ecbeda49279)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251224/202512240559.2M06DSX7-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202512240559.2M06DSX7-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> >> ld.lld: error: .tmp_vmlinux1.btf.o is incompatible with elf32lriscv

While I have not verified this, I suspect this error occurs because the
${CC} command in gen_btf_o() in scripts/gen-btf.sh only includes
CLANG_FLAGS for the target selection but not '-m32' or '-m64' from
KBUILD_CFLAGS to control the word size (as documented in
scripts/Makefile.clang).

Cheers,
Nathan