[llvm-dev] [CMake][ELF] Add -fno-semantic-interposition and -Bsymbolic-functions
Fāng-ruì Sòng via llvm-dev
llvm-dev at lists.llvm.org
Fri Jun 4 15:07:09 PDT 2021
On Fri, May 7, 2021 at 1:28 PM Fangrui Song <maskray at google.com> wrote:
> Motivated by a recent rant on too slow clang (linking against libLLVM.so and libclang-cpp.so)
> when building the Linux kernel, I just created a CMake patch https://reviews.llvm.org/D102090
> which will add -fno-semantic-interposition and -Wl,-Bsymbolic-functions to our build.
> (My x86 kernel defconfig build is at least 15% faster)
> I have added some distribution packagers as reviewers. Sending this message to
> attract more users.
Circling back on this. Two patches have landed and will benefit Clang
https://reviews.llvm.org/D102090 [CMake][ELF] Link libLLVM.so and
libclang-cpp.so with -Bsymbolic-functions
(my Linux kernel build with the libLLVM.so and libclang-cpp.so clang
is more than 15%+ faster, presumably due to much fewer symbol lookups.
~90% fewer JUMP_SLOT dynamic relocations)
https://reviews.llvm.org/D102453 [CMake][ELF] Add
-fno-semantic-interposition for GCC and Clang>=13
measures 3~4% improvement when compiled with GCC!
the binary size is 2% smaller)
More information about the llvm-dev