Re: [PATCH 2/3] kbuild: enable objtool for *.mod.o and additional kernel objects
From: Nathan Chancellor
Date: Mon Nov 18 2024 - 21:27:47 EST
Hi Masahiro,
On Thu, Nov 14, 2024 at 08:45:22AM +0900, Masahiro Yamada wrote:
> Currently, objtool is disabled in scripts/Makefile.{modfinal,vmlinux}.
>
> This commit moves rule_cc_o_c and rule_as_o_S to scripts/Makefile.lib
> and set objtool-enabled to y there.
>
> With this change, *.mod.o, .module-common.o, builtin-dtb.o, and
> vmlinux.export.o will now be covered by objtool.
>
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
I am seeing some build failures when LTO is enabled with this change in
-next as commit d8d3f6c6690c ("kbuild: enable objtool for *.mod.o and
additional kernel objects").
$ printf 'CONFIG_LTO_%s\n' NONE=n CLANG_THIN=y >kernel/configs/thinlto.config
$ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper {def,thinlto.}config all
...
.vmlinux.export.o: warning: objtool: gelf_getehdr: invalid `Elf' handle
make[4]: *** [scripts/Makefile.vmlinux:13: .vmlinux.export.o] Error 1
...
When LTO is enabled, these files are LLVM bitcode, not ELF, so objtool
can't process them:
$ file .vmlinux.export.o
.vmlinux.export.o: LLVM IR bitcode
Cheers,
Nathan