From: H.J. Lu Date: Wed, 15 Jan 2014 11:59:42 +0000 (-0800) Subject: Revert the last change X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c353e543fe20cb01262548486ee2c9af70608a01;p=binutils-gdb.git Revert the last change It has been fixed by commit 4199e3b8669d0a36448687850374fdc2ad7240b6 Author: Alan Modra Date: Wed Jan 15 21:50:55 2014 +1030 non-PIC references to __ehdr_start in pie and shared Rather than hacking every backend to not discard dynamic relocations against an undefined hidden __ehdr_start, make it appear to be defined early. 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 with a non-PIC reference. 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.) * elf32-i386.c (elf_i386_allocate_dynrelocs): Revert the last change. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index f4acda0ad2e..0bf76654e1b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2014-01-15 H.J. Lu + + * elf32-i386.c (elf_i386_allocate_dynrelocs): Revert the last + change. + * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Likewise. + 2014-01-14 H.J. Lu PR ld/16428 diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index e834a5a1152..4d391e13c7d 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2390,12 +2390,9 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) } /* Also discard relocs on undefined weak syms with non-default - visibility. Don't discard relocs against __ehdr_start which - will be defined by assign_file_positions_for_non_load_sections - later. */ + visibility. */ if (eh->dyn_relocs != NULL - && h->root.type == bfd_link_hash_undefweak - && strcmp (h->root.root.string, "__ehdr_start") != 0) + && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) eh->dyn_relocs = NULL; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index f364fe43dce..edee8ecefd5 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -2473,12 +2473,9 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf) } /* Also discard relocs on undefined weak syms with non-default - visibility. Don't discard relocs against __ehdr_start which - will be defined by assign_file_positions_for_non_load_sections - later. */ + visibility. */ if (eh->dyn_relocs != NULL - && h->root.type == bfd_link_hash_undefweak - && strcmp (h->root.root.string, "__ehdr_start") != 0) + && h->root.type == bfd_link_hash_undefweak) { if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) eh->dyn_relocs = NULL;