This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: __start/__stop symbols not always defined
- From: Alan Modra <amodra at gmail dot com>
- To: Michael Matz <matz at suse dot de>
- Cc: binutils at sourceware dot org
- Date: Fri, 19 Jan 2018 12:40:45 +1030
- Subject: Re: __start/__stop symbols not always defined
- Authentication-results: sourceware.org; auth=none
- References: <alpine.LSU.2.21.1801171557320.26317@wotan.suse.de>
On Wed, Jan 17, 2018 at 06:17:48PM +0100, Michael Matz wrote:
> It is (and was) also documented that these symbols are PROVIDEd, and hence
> only defined if referenced.
Right, and that documentation goes all the way back to 2008-05-21.
I'm not discounting your comments about dlopen and dlsym, but I
believe the current behaviour is reasonable and likely gives what most
people want, particularly those who are concerned about symbol table
size.
I suppose you could argue that a defined default visibility symbol in
an ELF shared library is also implicitly a reference due to the way
ELF symbol overriding works, so PROVIDE ought to supply definitions in
that case. That wouldn't help here since we're making __start and
__stop symbols protected visibility..
> linker script to always define these __start/__stop symbols. Indeed I
> can't really see a way to somehow force references to those symbols to
> appear without either wasting code or data space (e.g.
> "void *__unused_global=&__start___verbose"),
-u __start___verbose on the ld command line ought to work.
--
Alan Modra
Australia Development Lab, IBM