public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* ld: Change visibility of __start_* __stop_* symbols
@ 2020-06-02 21:12 Fangrui Song
  2020-06-03 14:00 ` Michael Matz
  0 siblings, 1 reply; 2+ messages in thread
From: Fangrui Song @ 2020-06-02 21:12 UTC (permalink / raw)
  To: binutils; +Cc: phosek

GNU ld defined __start_*/__stop_* symbols used to be STV_HIDDEN. 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).

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

If yes, what do you think of
-z start-stop-symbols={protected,hidden}
or simply
-z start-stop={protected,hidden}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ld: Change visibility of __start_* __stop_* symbols
  2020-06-02 21:12 ld: Change visibility of __start_* __stop_* symbols Fangrui Song
@ 2020-06-03 14:00 ` Michael Matz
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Matz @ 2020-06-03 14:00 UTC (permalink / raw)
  To: Fangrui Song; +Cc: binutils, phosek

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-03 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 21:12 ld: Change visibility of __start_* __stop_* symbols Fangrui Song
2020-06-03 14:00 ` Michael Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).