ld: Change visibility of __start_* __stop_* symbols

Michael Matz matz@suse.de
Wed Jun 3 14:00:07 GMT 2020


Hi,

On Tue, 2 Jun 2020, Fangrui Song via Binutils wrote:

> GNU ld defined __start_*/__stop_* symbols used to be STV_HIDDEN.

Actually they initially used to be STV_DEFAULT, i.e. global.

> They were made STV_PROTECTED by the resolution in 
> https://sourceware.org/bugzilla/show_bug.cgi?id=21964 The rationale is 
> that "people use dlsym to look them up."
> 
> In GCC/clang, -fvisibility=hidden can make definitions STV_HIDDEN (this
> is a very good way avoid leaking internal definitions).

Which problem do you have with them being protected?

> However, for the linker defined __start_*/__stop_* , there isn't a
> counterpart.
> Should we have a -z option controlling the visibility?

A linker (symbol version) script can be used to localize also the 
start/stop symbols.  Isn't that enough?


Ciao,
Michael.


More information about the Binutils mailing list