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

From: Josh Poimboeuf
Date: Fri May 27 2022 - 11:32:05 EST


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@xxxxxxxxxx>
> Reviewed-by: Nicolas Schier <nicolas@xxxxxxxxx>
> Tested-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> Reviewed-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> Tested-by: Sedat Dilek <sedat.dilek@xxxxxxxxx> # LLVM-14 (x86-64)

Acked-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>

--
Josh