This is the mail archive of the libc-alpha@cygnus.com 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]

Fwd: possible dynamic linker bug?


Hi,

current cvs-binutils produces one FAIL in the ld testsuite on 
powerpc-linux-gnu (and other platforms?) at least up to glibc-2.1.1pre2. 
I'm forwarding Ian Taylor's thoughts on this problem.

Franz.


>Delivered-To: Franz.Sirl-kernel@lauterbach.com
>Date: 6 May 1999 20:56:31 -0000
>From: Ian Lance Taylor <ian@zembu.com>
>To: Franz.Sirl-kernel@lauterbach.com
>CC: gas2@sourceware.cygnus.com
>Subject: Re: strip looses original file ownership and file permissions
>
>    Date: Thu, 06 May 1999 20:42:53 +0200
>    From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
>
>    Btw, have you ever looked at the patch in
>    http://sourceware.cygnus.com/ml/gas2/1999/msg00041.html ? Is it the 
> correct
>    fix for the make check FAIL on powerpc-linux-gnu?
>
>No, I don't think it is.  I think this is a problem in the glibc
>dynamic linker.  (I looked at glibc 2.0.7; I don't know about other
>versions.)
>
>The GNU linker does not ordinarily create a PT_PHDR program segment
>for a shared library.  This follows the lead of the Solaris linker.
>
>When the glibc 2.0.7 dynamic linker does not find a PT_PHDR program
>segment, it assumes that the program headers may be found at the start
>of the first PT_LOAD segment.  However, ELF does not require this.
>The comment in the glibc sources (in dl-load.c) says this:
>
>         /* There was no PT_PHDR specified.  We need to find the phdr in the
>            load image ourselves.  We assume it is in fact in the load image
>            somewhere, and that the first load command starts at the
>            beginning of the file and thus contains the ELF file header.  */
>
>However, I believe the dynamic linker should be able to operate
>without having the program headers in the load segment at all.
>
>What your patch changes is whether the linker puts the program headers
>at the start of the first PT_LOAD segment.  Without your patch, the
>linker does not put the program headers in loadable memory.  With your
>patch, it does.
>
>Since with the current script the program headers are not loaded, the
>dynamic linker will wind up looking at nonsensical memory for the
>program headers, and it will fail.  However, the dynamic linker does
>know how to find the correct program headers by reading the file.
>However, after reading the program headers, it throws them away, and
>uses the copy which it expects to find in the file.  If there is no
>PT_PHDR segment, it should instead keep and use its own copy.
>
>Ian



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