x86 .plt and symbol visibility

Alan Modra amodra@bigpond.net.au
Thu Sep 27 09:09:00 GMT 2001


Squashes one obscure bug with the .plt and symbol visibility changes that
could result in .rel.plt being the wrong size and relocs being written
past the end of the section.

bfd/ChangeLog
	* elf32-i386.c (allocate_dynrelocs): Don't create a .plt entry
	without a reloc when symbol visibilty makes a function local.

-- 
Alan Modra

Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.49
diff -u -p -w -r1.49 elf32-i386.c
--- elf32-i386.c	2001/09/26 09:25:04	1.49
+++ elf32-i386.c	2001/09/27 16:07:49
@@ -1263,6 +1263,8 @@ allocate_dynrelocs (h, inf)
 	    return false;
 	}
 
+      if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h))
+	{
       s = htab->splt;
       if (s == NULL)
 	abort ();
@@ -1296,13 +1298,16 @@ allocate_dynrelocs (h, inf)
 	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



More information about the Binutils mailing list