simplify assertion check in _dl_fini()

Alexandre Oliva aoliva@redhat.com
Mon Nov 29 19:44:00 GMT 2004


_dl_fini() makes a special exception in its assertion checking for the
main map, because ld.so may have been removed from the object list in
rtld.c.  I'm not sure that's such a good idea in itself, since a
program without DT_NEEDED entries might legitimately dlopen a library
that DT_NEEDs ld.so, and we don't want to load it in again.

I haven't tested this case though.

What I did test was a PIE without any DT_NEEDED libs, without any
dlopening, and found out it crashed with FC3/x86's glibc.  I didn't
investigate much further, but while looking into it I noticed the
_dl_fini() assert could probably be simplified, based on what I'd just
found out while investigating an assertion failure under similar
conditions on an older glibc snapshot ported to Fujitsu FR-V.

The port is yet to be contributed, but I thought I'd contribute this
fix right away, since something may have regressed in glibc in this
regard, since the only failure in my port is the assertion failure at
the end, whereas on x86 mainline it crashes quite early.

The patch is attached below.  The test program was as simple as
`main(){}', compiled on x86 with -pie -Wl,-Bstatic.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: glibc-rtld-removed-from-list.patch
Type: text/x-patch
Size: 1362 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-hacker/attachments/20041129/85fdc9ab/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


More information about the Libc-hacker mailing list