Handle local IFUNC symbols in shared object
[deliverable/binutils-gdb.git] / bfd / elf32-i386.c
index ab3945de00b280275cfdc9b6e0bab0fa72db7f3c..ac3c2f467c60e6cc334f17dfa2c668a137c47e0a 100644 (file)
@@ -1808,7 +1808,15 @@ elf_i386_check_relocs (bfd *abfd,
          if (eh != NULL && (sec->flags & SEC_CODE) != 0)
            eh->has_non_got_reloc = 1;
 do_relocation:
-         if (h != NULL && bfd_link_executable (info))
+         /* 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.  */
+         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))))
            {
              /* If this reloc is in a read-only section, we might
                 need a copy reloc.  We can't check reliably at this
This page took 0.023028 seconds and 4 git commands to generate.