Call _bfd_elf_create_ifunc_sections only for ifunc
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 20 Apr 2016 12:34:02 +0000 (05:34 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 20 Apr 2016 12:34:15 +0000 (05:34 -0700)
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.

bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c

index a0304b682a2f4d847e8c2b5dd14d437cd6e31059..46ee8fd3975c7c968fa4c6f8e4938a560705977a 100644 (file)
@@ -1,3 +1,9 @@
+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.
index 470fcd10ccc896e7b279460c894ac04b75a1f433..0a2ac9d75e92307da93b6d7d11283eaec9342b89 100644 (file)
@@ -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;
            }
index 5533b4ad526940a6e1f7478635d0c26c8317db20..197a1b8cdecb11dd4c4113dd346e8fa1678803bb 100644 (file)
@@ -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;
            }
This page took 0.035552 seconds and 4 git commands to generate.