This is the mail archive of the binutils@sourceware.org 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]
Other format: [Raw text]

Fix powerpc secure-plt segfault


Looks like I lost track of indentation level here.  plt.offset wasn't
being set to -1 for all unused entries, which later resulted in a
segfault due to uninitialised glink_offset.  Also, clearing plt.plist
at the wrong level meant there was a possibility of wrongly losing the
plt entry when using --gc-sections.

	PR ld/4267
	* elf32-ppc.c (allocate_dynrelocs): Set plt.offset to -1 for
	unused entries.  Don't clear plt.plist in loop.

Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.211
diff -u -p -r1.211 elf32-ppc.c
--- bfd/elf32-ppc.c	26 Mar 2007 12:23:00 -0000	1.211
+++ bfd/elf32-ppc.c	29 Mar 2007 00:47:48 -0000
@@ -4500,13 +4500,15 @@ allocate_dynrelocs (struct elf_link_hash
 	      }
 	    else
 	      ent->plt.offset = (bfd_vma) -1;
-
-	    if (!doneone)
-	      {
-		h->plt.plist = NULL;
-		h->needs_plt = 0;
-	      }
 	  }
+	else
+	  ent->plt.offset = (bfd_vma) -1;
+
+      if (!doneone)
+	{
+	  h->plt.plist = NULL;
+	  h->needs_plt = 0;
+	}
     }
   else
     {

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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