This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: PR ld/16428: autoconf tests don't terminate on ix86-linux-gnu with -static -fPIE -pie on glibc-2.18 based systems
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Wed, 15 Jan 2014 04:04:35 -0800
- Subject: Re: PATCH: PR ld/16428: autoconf tests don't terminate on ix86-linux-gnu with -static -fPIE -pie on glibc-2.18 based systems
- Authentication-results: sourceware.org; auth=none
- References: <20140114190659 dot GA1027 at intel dot com> <20140114235539 dot GU5390 at bubble dot grove dot modra dot org> <CAMe9rOrAhWy+vh6rdk7iq=N=Zn+Gg0=ZL1hJT642hDN6hUhqdA at mail dot gmail dot com> <CAMe9rOrR-zoVPdXphO2b0MMXNZ8giUtx1LaVv0Qtv+kfymvEJw at mail dot gmail dot com> <CAMe9rOoDTxtbfPkjoqswaXOGS47Z_GCQNka5zhN477E3MAZx8g at mail dot gmail dot com> <20140115091956 dot GW5390 at bubble dot grove dot modra dot org>
On Wed, Jan 15, 2014 at 1:19 AM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Jan 14, 2014 at 04:47:40PM -0800, H.J. Lu wrote:
>> We discard dynamic relocations against weak undef
>> __ehdr_start which is defined by
>> assign_file_positions_for_non_load_sections later.
>> Glibc 2.18 started using __ehdr_start and we
>> under allocate dynamic relocations. I checked in
>> this patch to check __ehdr_start.
>>
>> Alan, many backends have the same problem.
>
> This is a bit of a pest. We want __ehdr_start hidden before
> size_dynamic_sections so that it isn't put in .dynsym, but we do need
> the dynamic relocations for a PIE or shared library. The only way to
> ensure we emit the dynamic relocations is to define the symbol
> early, or hack all backends. But, defining it early is wrong if we
> don't actually define the symbol later to its proper value. (In some
> cases we want to leave the symbol undefined, for example, when the ELF
> header isn't loaded, and we don't have this infomation available in
> before_allocation.)
>
> I really don't want to hack all the backends. So, lets see if this
> generic hack passes testing..
>
> ld/
> * emultempl/elf32.em (gld${EMULATION_NAME}_before_allocation): Define
> __ehdr_start before size_dynamic_sections and restore afterwards.
> ld/testsuite/
> * ld-elf/ehdr_start-shared.d: New.
>
I reverted my i386/x86-64 hack.
Thanks.
--
H.J.