aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-06-15 10:35:38 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-06-16 11:28:29 -0700
commitbf52d7c72035679e6b3ab601133c56a4388f4dc9 (patch)
treeae10258fcb4672d6938c782bdf1808d1b7a7d7b5 /bfd
parentf92339b8f316de65add11aeb9cd8ea72630aa556 (diff)
downloadgdb-bf52d7c72035679e6b3ab601133c56a4388f4dc9.zip
gdb-bf52d7c72035679e6b3ab601133c56a4388f4dc9.tar.gz
gdb-bf52d7c72035679e6b3ab601133c56a4388f4dc9.tar.bz2
Don't check undefined symbol for IFUNC reloc
Since x86 elf_*_check_relocs is called after all symbols have been resolved, there is no need to check undefined symbols for relocations against IFUNC symbols. bfd/ * elf32-i386.c (elf_i386_check_relocs): Don't check undefined symbols for relocations against IFUNC symbols. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. ld/ * testsuite/ld-i386/i386.exp: Run pr19636-2e-nacl. * testsuite/ld-i386/pr19636-2e.d: Skip for NaCl targets. Remove .rel.plt section. * testsuite/ld-i386/pr19636-2e-nacl.d: New file.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf32-i386.c11
-rw-r--r--bfd/elf64-x86-64.c11
2 files changed, 8 insertions, 14 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index a519778..2b7de33 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -2149,15 +2149,12 @@ elf_i386_check_relocs (bfd *abfd,
if (eh != NULL && (sec->flags & SEC_CODE) != 0)
eh->has_non_got_reloc = 1;
do_relocation:
- /* STT_GNU_IFUNC symbol must go through PLT even if it is
- locally defined and undefined symbol may turn out to be
- a STT_GNU_IFUNC symbol later. */
+ /* We are called after all symbols have been resolved. Only
+ relocation against STT_GNU_IFUNC symbol must go through
+ PLT. */
if (h != NULL
&& (bfd_link_executable (info)
- || ((h->type == STT_GNU_IFUNC
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)
- && SYMBOLIC_BIND (info, h))))
+ || h->type == STT_GNU_IFUNC))
{
/* If this reloc is in a read-only section, we might
need a copy reloc. We can't check reliably at this
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 9044aab..57a3c73 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -2541,15 +2541,12 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
pointer:
if (eh != NULL && (sec->flags & SEC_CODE) != 0)
eh->has_non_got_reloc = 1;
- /* STT_GNU_IFUNC symbol must go through PLT even if it is
- locally defined and undefined symbol may turn out to be
- a STT_GNU_IFUNC symbol later. */
+ /* We are called after all symbols have been resolved. Only
+ relocation against STT_GNU_IFUNC symbol must go through
+ PLT. */
if (h != NULL
&& (bfd_link_executable (info)
- || ((h->type == STT_GNU_IFUNC
- || h->root.type == bfd_link_hash_undefweak
- || h->root.type == bfd_link_hash_undefined)
- && SYMBOLIC_BIND (info, h))))
+ || h->type == STT_GNU_IFUNC))
{
/* If this reloc is in a read-only section, we might
need a copy reloc. We can't check reliably at this