PATCH: PR ld/16428: autoconf tests don't terminate on ix86-linux-gnu with -static -fPIE -pie on glibc-2.18 based systems
H.J. Lu
hjl.tools@gmail.com
Wed Jan 15 12:04:00 GMT 2014
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.
More information about the Binutils
mailing list