This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: objcopy --weaken
- From: "Peter S. Mazinger" <ps dot m at gmx dot net>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: binutils at sourceware dot org
- Date: Wed, 12 Apr 2006 12:28:40 +0200 (CEST)
- Subject: Re: objcopy --weaken
On Wed, 12 Apr 2006, Daniel Jacobowitz wrote:
> On Wed, Apr 12, 2006 at 01:56:50AM +0200, Peter S. Mazinger wrote:
> > That is true if modern=glibc (there is though some compat
> > option/environment setting to disable this behaviour).
>
> (A) I believe Solaris does the same thing nowadays. (B) I believe
> they've threatened several times to remove the option.
>
> > At link time if libpthread.so and libc.so provide the same symbol (could
> > happen w/ any other 2 libs, the example is "real-life", the linker fails,
> > if one of them is not weak.
>
> Er, is this really true? Why should it be?
>
> If there's a good reason for it, e.g. detecting non-deterministic
> binding, weakening one is just going to give you unpredictable bugs
> later. The strong one will not be reliably picked at runtime.
for the libc.so libpthread.so pair the symbol has to be weakened in
libc.so, then linker does not complain and ld.so takes care of the rest,
because libc.so is last in the scanned libs, so the app will find the
libpthread.so version first.
For other lib combos it is indeed unreliable, depending on the order ld.so
loads them.
Peter
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2