This is the mail archive of the
mailing list for the glibc project.
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 ld.so breaks static binaries? Do you mean prelinking
> an _old_ ld.so? 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/ld-linux.so.2 or how is ld.so called on a
gcc -static -xc - -o test <<EOF
int main (void)
You'll see it loading /lib/ld-linux.so.2 (because libc.so needs it).
Now, the diff between say 2 years old dynamic-link.h and now in elf_get_dynamic_info
- 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
+ + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM] = dyn;
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 ld.so.
A workaround can certainly be to copy /lib/ld-linux.so.2 and other
shared libraries ever used during nss lookups to say /lib/staticcompat,
prelink /lib/ld-linux.so.2 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