From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor 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 13:57:00 -0000 Message-id: <19990506205631.27563.qmail@daffy.airs.com> References: <4.2.0.37.19990506183739.0372b0e0@mail.lauterbach.com> <4.2.0.37.19990506133808.0363a9f0@mail.lauterbach.com> <4.2.0.37.19990506133808.0363a9f0@mail.lauterbach.com> <4.2.0.37.19990506183739.0372b0e0@mail.lauterbach.com> <4.2.0.37.19990506203809.03673a50@mail.lauterbach.com> <4.2.0.37.19990506203809.03673a50@mail.lauterbach.com> X-SW-Source: 1999/msg00093.html Date: Thu, 06 May 1999 20:42:53 +0200 From: Franz Sirl 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