Re: [PATCH v7 2/8] kbuild: do not create *.prelink.o for Clang LTO or IBT

Josh Poimboeuf
2022-05-27T15:31:57Z

On Fri, May 27, 2022 at 07:01:49PM +0900, Masahiro Yamada wrote:
> New build flow
> ==============
>
> [1] single-object module
>
> Since there is only one object, there is no need to keep the LLVM IR.
> Use $(CC)+$(LD) to generate an ELF object in one build rule. When LTO
> is disabled, $(LD) is unneeded because $(CC) produces an ELF object.
>
> $(CC)+$(LD)+objtool $(LD)
> foo.c ----------------------------> foo.o ---------> foo.ko
> (ELF) |
> |
> foo.mod.o --/
>
> [2] multi-object module
>
> Previously, $(AR) was used to combine LLVM bitcode into an archive,
> but there was no technical reason to do so. Use $(LD) to merge them
> into a single ELF object.
>
> $(LD)
> $(CC) +objtool $(LD)
> foo1.c ---------> foo1.o ---------> foo.o ---------> foo.ko
> | (ELF) |
> foo2.c ---------> foo2.o ----/ |
> (LLVM IR) foo.mod.o --/
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
> Tested-by: Nathan Chancellor <nathan@kernel.org>
> Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
> Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM-14 (x86-64)

Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>

--
Josh