aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-04-20 05:34:02 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-04-20 05:34:15 -0700
commit466ee2af4a927fc6aaaaa62b0abd3b0cff9bcef7 (patch)
treefd1b6f03bb7bbee3d8be51584755205fb7f71af2 /bfd
parentd968975277ba280372002800c6c25bb1b29f496e (diff)
downloadgdb-466ee2af4a927fc6aaaaa62b0abd3b0cff9bcef7.zip
gdb-466ee2af4a927fc6aaaaa62b0abd3b0cff9bcef7.tar.gz
gdb-466ee2af4a927fc6aaaaa62b0abd3b0cff9bcef7.tar.bz2
Call _bfd_elf_create_ifunc_sections only for ifunc
Since x86 check_relocs is called after opening all input files, we need to call _bfd_elf_create_ifunc_sections only for STT_GNU_IFUNC symbols. * elf32-i386.c (elf_i386_check_relocs): Call _bfd_elf_create_ifunc_sections only for STT_GNU_IFUNC symbol. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf32-i386.c9
-rw-r--r--bfd/elf64-x86-64.c9
3 files changed, 14 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a0304b6..46ee8fd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@
2016-04-20 H.J. Lu <hongjiu.lu@intel.com>
+ * elf32-i386.c (elf_i386_check_relocs): Call
+ _bfd_elf_create_ifunc_sections only for STT_GNU_IFUNC symbol.
+ * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
+
+2016-04-20 H.J. Lu <hongjiu.lu@intel.com>
+
* elf-bfd.h (_bfd_elf_link_check_relocs): New.
* elflink.c (_bfd_elf_link_check_relocs): New function.
(elf_link_add_object_symbols): Call _bfd_elf_link_check_relocs
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 470fcd1..0a2ac9d 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -1603,10 +1603,6 @@ elf_i386_check_relocs (bfd *abfd,
eh = (struct elf_i386_link_hash_entry *) h;
if (h != NULL)
{
- /* Create the ifunc sections for static executables. If we
- never see an indirect function symbol nor we are building
- a static executable, those sections will be empty and
- won't appear in output. */
switch (r_type)
{
default:
@@ -1621,7 +1617,10 @@ elf_i386_check_relocs (bfd *abfd,
case R_386_GOT32X:
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
- if (!_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info))
+ /* Create the ifunc sections for static executables. */
+ if (h->type == STT_GNU_IFUNC
+ && !_bfd_elf_create_ifunc_sections (htab->elf.dynobj,
+ info))
return FALSE;
break;
}
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 5533b4a..197a1b8 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1712,10 +1712,6 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
if (h != NULL)
{
- /* Create the ifunc sections for static executables. If we
- never see an indirect function symbol nor we are building
- a static executable, those sections will be empty and
- won't appear in output. */
switch (r_type)
{
default:
@@ -1774,7 +1770,10 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_X86_64_GOTPCREL64:
if (htab->elf.dynobj == NULL)
htab->elf.dynobj = abfd;
- if (!_bfd_elf_create_ifunc_sections (htab->elf.dynobj, info))
+ /* Create the ifunc sections for static executables. */
+ if (h->type == STT_GNU_IFUNC
+ && !_bfd_elf_create_ifunc_sections (htab->elf.dynobj,
+ info))
return FALSE;
break;
}