[PATCH] gold: Add -Bsymbolic-non-weak-functions
Thu May 27 04:21:03 GMT 2021
On 2021-05-27, Alan Modra wrote:
>On Wed, May 26, 2021 at 04:22:46PM -0700, Fangrui Song wrote:
>> This will be a great addition to the ELF world. (My libLLVM.so
>> libclang-cpp.so linked clang is more than 15% faster due to saved
>> dynamic relocations)
>That is quite an impressive speedup, but couldn't you get exactly the
>same effect or better by giving functions protected visibility?
The existing -fvisibility=protected is coarse-grained. There isn't an
option to exclude variables.
Even if we introduce a -fvisibility-functions=protected, there is pointer
equality issue for C++.
The address of an inline function may be different from the address seen from
outside the shared object.
(On x86, it is more unfortunate:
-Bsymbolic-non-weak-functions is safer.
We only one thing from compilers https://gcc.gnu.org/PR100593
[ELF] -fno-pic: Use GOT to take address of an external default visibility function
For many distributions, -fno-pic is very uncommon. The canonical PLT entry problem can mostly be ignored.
More information about the Binutils