Discussion:
Linux kernel compiling with LTO
Yury Norov
2017-11-08 12:31:42 UTC
Permalink
Hi Maxim, all,

Alex Matveev and I try to enable LTO optimization for Linux kernel
on ARM64. The work is based on patches from Andi Kleen, and is not
complete yet. Maxim recommended to work tightly with toolchain group
to understand how to fix problems better - on kernel or compiler side.

Links:
My unfinished branch:
https://github.com/norov/linux/tree/lto
Andi Kleen tree:
https://github.com/andikleen/linux-misc/tree/lto-411-1
Sami Tolvanen's recent work for clang:
https://lkml.org/lkml/2017/11/3/606

Question we have for now:
There's mrs_s/msr_s macro that doesn't work with LTO - linker
complains very loudly that macro is either not declared, or declared
multiple times. (To reproduce - try to build my kernel branch w/o last
patch).

The same (?) problem is observed with clang, and people there
considered it as feature, not a bug.

https://bugs.llvm.org/show_bug.cgi?id=19749

We have the fix for both clang and gcc, but it looks hacky. Maybe it
worth to fix mrs/msr issue on toolchain side?

Thanks,
Yury

Loading...