This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

x86 .plt and symbol visibility


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]