This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: RFC: Don't output symbol version requirement for non-DT_NEEDED libs
- From: Alan Modra <amodra at gmail dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: Joseph Myers <joseph at codesourcery dot com>, binutils at sourceware dot org, libc-alpha at sourceware dot org
- Date: Mon, 1 Dec 2014 14:20:48 +1030
- Subject: Re: RFC: Don't output symbol version requirement for non-DT_NEEDED libs
- Authentication-results: sourceware.org; auth=none
- References: <20141127081644 dot GA20383 at bubble dot grove dot modra dot org> <54775069 dot 2090905 at redhat dot com> <alpine dot DEB dot 2 dot 10 dot 1411272358160 dot 15307 at digraph dot polyomino dot org dot uk> <5478945E dot 5010402 at redhat dot com>
On Fri, Nov 28, 2014 at 10:27:26AM -0500, Carlos O'Donell wrote:
> On 11/27/2014 07:06 PM, Joseph Myers wrote:
> > Actually, I think it's a linker bug not a glibc bug. If you don't link
> > with a library providing a symbol you use, I don't think any information
> > at all about how it might be resolved with some library you didn't link
> > against should be embedded in the binary: not a DT_NEEDED entry, and not a
> > version requirement. I don't think you can presume at static link time,
> > with a weak undefined symbol like that, "this symbol isn't needed, but if
> > defined at runtime it must have this version" (as opposed to "this symbol
> > isn't needed, and might have any version at runtime", which is the safe
> > assumption).
>
> I had not considered it like that. I agree with your rationale.
>
> In which case this is clearly a bug in binutils and Alan's patch
> is correct.
>
> I tried to come up with a case where this would matter, but from
> first principles I couldn't construct any sensible test cases.
If the version *does* matter, then mentioning on the command line
the library that defines the symbol will result in both the symbol
being versioned and the library in DT_NEEDED.
I've gone ahead and committed the linker patch, to 2.25 too. Thanks
to all who contributed to this thread.
--
Alan Modra
Australia Development Lab, IBM