Re: [PATCH v2 00/28] Add support for Clang LTO

From: Masahiro Yamada
Date: Thu Sep 10 2020 - 14:11:57 EST


On Fri, Sep 11, 2020 at 2:46 AM 'Nick Desaulniers' via Clang Built
Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
>
> Hey Ian,
> It was nice to meet you at Linux plumbers. You might want to take a
> look at this series. It implements builds of the Linux kernel with
> LTO. It would be good to get eyes on it and help review it from folks
> working on this from the GCC angle. The series has some configs that
> split where Clang specific changes need to be made; it might be of
> interest to think about what would the similar changes be needed for
> GCC. Also, congrats on your LWN article!
> https://lwn.net/Articles/830300/


FYI.

Some people may remember GCC LTO was posted in 2014
(and rejected by Linus).

https://lore.kernel.org/linux-kbuild/20140407201919.GA15838@xxxxxxxxxxxxx/


In my understanding, GCC LTO does not work for relocatable objects
because GNU linker is agnostic about LTO.

GCC LTO was implemented in the final link stage (i.e. vmlinux)
by using $(CC) as a linker driver.


On the other hand, Clang LTO, in this series implementation,
works in the pre-mospost stage (i.e. vmlinux.o).




--
Best Regards
Masahiro Yamada