]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* elf32-i386.c (allocate_dynrelocs): Don't create a .plt entry
authorAlan Modra <amodra@gmail.com>
Thu, 27 Sep 2001 16:10:28 +0000 (16:10 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 27 Sep 2001 16:10:28 +0000 (16:10 +0000)
without a reloc when symbol visibilty makes a function local.

bfd/ChangeLog
bfd/elf32-i386.c

index 3b190962775d43adde7dec1dae5a12a3819a9839..856930169ea402909a814b2e8dbfd97af27df434 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-28  Alan Modra  <amodra@bigpond.net.au>
+
+       * elf32-i386.c (allocate_dynrelocs): Don't create a .plt entry
+       without a reloc when symbol visibilty makes a function local.
+
 2001-09-27  Nick Clifton  <nickc@cambridge.redhat.com>
 
        * elf32-arm.h (elf32_arm_merge_private_bfd_data): Fix detection of
index 019a2d067162fd634aa6828eb7bfa1c6ba077779..4cfd0faf72fc79287bc02e017b890700f7716d18 100644 (file)
@@ -1263,47 +1263,52 @@ allocate_dynrelocs (h, inf)
            return false;
        }
 
-      s = htab->splt;
-      if (s == NULL)
-       abort ();
+      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+       {
+         s = htab->splt;
+         if (s == NULL)
+           abort ();
 
-      /* If this is the first .plt entry, make room for the special
-        first entry.  */
-      if (s->_raw_size == 0)
-       s->_raw_size += PLT_ENTRY_SIZE;
+         /* If this is the first .plt entry, make room for the special
+            first entry.  */
+         if (s->_raw_size == 0)
+           s->_raw_size += PLT_ENTRY_SIZE;
 
-      h->plt.offset = s->_raw_size;
+         h->plt.offset = s->_raw_size;
 
-      /* If this symbol is not defined in a regular file, and we are
-        not generating a shared library, then set the symbol to this
-        location in the .plt.  This is required to make function
-        pointers compare as equal between the normal executable and
-        the shared library.  */
-      if (! info->shared
-         && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
-       {
-         h->root.u.def.section = s;
-         h->root.u.def.value = h->plt.offset;
-       }
+         /* If this symbol is not defined in a regular file, and we are
+            not generating a shared library, then set the symbol to this
+            location in the .plt.  This is required to make function
+            pointers compare as equal between the normal executable and
+            the shared library.  */
+         if (! info->shared
+             && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
+           {
+             h->root.u.def.section = s;
+             h->root.u.def.value = h->plt.offset;
+           }
 
-      /* Make room for this entry.  */
-      s->_raw_size += PLT_ENTRY_SIZE;
+         /* Make room for this entry.  */
+         s->_raw_size += PLT_ENTRY_SIZE;
 
-      /* We also need to make an entry in the .got.plt section, which
-        will be placed in the .got section by the linker script.  */
-      s = htab->sgotplt;
-      if (s == NULL)
-       abort ();
-      s->_raw_size += 4;
+         /* We also need to make an entry in the .got.plt section, which
+            will be placed in the .got section by the linker script.  */
+         s = htab->sgotplt;
+         if (s == NULL)
+           abort ();
+         s->_raw_size += 4;
 
-      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
-       {
          /* We also need to make an entry in the .rel.plt section.  */
          s = htab->srelplt;
          if (s == NULL)
            abort ();
          s->_raw_size += sizeof (Elf32_External_Rel);
        }
+      else
+       {
+         h->plt.offset = (bfd_vma) -1;
+         h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT;
+       }
     }
   else
     {