This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: more prelink

On Fri, Sep 27, 2002 at 10:58:24AM -0400, Daniel Jacobowitz wrote:
> > It will always be the case, as long as there will be some broken
> > statically linked binaries someone cares about.
> > The fix went in 2002-03-30, so any statically linked binary using nss
> > linked with older glibc, unless that glibc has been explicitely linked
> > with -DNDEBUG (I don't know about other distros, but we added that in ~7.0
> > I think) would stop working.
> > When one prelinks manually, it is a form of saying I don't have such
> > binaries (and if he finds he has them, he can prelink -u).
> Wait - prelinking breaks static binaries?  Do you mean prelinking
> an _old_  Because it doesn't make much sense that prelinking a
> dynamic library on the system will break a static binary...

No, I mean prelinking the /lib/ or how is called on a
particular machine.
gcc -static -xc - -o test <<EOF
#include <netdb.h>

int main (void)
strace ./test

You'll see it loading /lib/ (because needs it).
Now, the diff between say 2 years old dynamic-link.h and now in elf_get_dynamic_info
-      else
-       assert (! "bad dynamic tag");
+      else if ((Elf32_Word) DT_VALTAGIDX (dyn->d_tag) < DT_VALNUM)
+       info[DT_VALTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
+            + DT_VERSIONTAGNUM + DT_EXTRANUM] = dyn;
+      else if ((Elf32_Word) DT_ADDRTAGIDX (dyn->d_tag) < DT_ADDRNUM)
+       info[DT_ADDRTAGIDX (dyn->d_tag) + DT_NUM + DT_THISPROCNUM
elf_get_dynamic_info is compiled into the static binary, that's how it can
load shared libraries.
If libc.a was at that time compiled without -DNDEBUG, those binaries
will ICE immediately if they see prelinked

A workaround can certainly be to copy /lib/ and other
shared libraries ever used during nss lookups to say /lib/staticcompat,
prelink /lib/ and tell people if their crappy old
static binary during nss lookups fails with bad dynamic tag abort
that they should LD_LIBRARY_PATH=/lib/staticcompat /usr/local/bin/staticcrap


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]