Binutils Patches

Julien LEMOINE speedblue@debian.org
Thu Apr 17 22:24:00 GMT 2003


Hello,
  (cc me answers since I am not subsribed)

  I have done some patches for debian/binutils, here is a list with
descriptions (urls are bug reports):

 * binutils-segv : Fixsegv when asked to relocate based on local symboles
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=126150
 * binutils-prelink : Fix objdump -R internal error on prelinked binaries
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=180088
 * binutils-gc : fix '--gc-sections doesn't work on Linux/x86'
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=182910
 * binutils-gdwarf2 : Fix crash on alpha with --gdwarf2
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=187211
 * binutils-alpha fix segv with ld on alpha
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=185556
 * binutils-flex: fix compilation with last flex release
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=188876

Feel free to contact me if there is an error in a patch or if you have 
questions.

Best Regards.
-- 
Julien LEMOINE / SpeedBlue

-------------- next part --------------
--- binutils-2.13.90.0.18/bfd/elf64-alpha.c	2003-01-21 19:21:32.000000000 +0100
+++ binutils-2.13.90.0.18-modif/bfd/elf64-alpha.c	2003-04-11 01:24:26.000000000 +0200
@@ -4184,9 +4184,12 @@
 
   loc = srel->contents;
   loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
-  bfd_elf64_swap_reloca_out (abfd, &outrel, loc);
-  BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
-	      <= srel->_cooked_size);
+  if (loc)
+    {
+      bfd_elf64_swap_reloca_out (abfd, &outrel, loc);
+      BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
+		  <= srel->_cooked_size);
+    }
 }
 
 /* Relocate an Alpha ELF section for a relocatable link.
-------------- next part --------------
diff -r -u binutils-2.13.90.0.18.old/ld/ldlex.l binutils-2.13.90.0.18/ld/ldlex.l
--- binutils-2.13.90.0.18.old/ld/ldlex.l	2002-11-09 20:08:31.000000000 +0100
+++ binutils-2.13.90.0.18/ld/ldlex.l	2003-04-13 16:25:44.000000000 +0200
@@ -611,7 +611,7 @@
      int max_size;
 {
   *result = 0; 
-  if (yy_current_buffer->yy_input_file)
+  if (YY_CURRENT_BUFFER->yy_input_file)
     {
       if (yyin)
 	{
-------------- next part --------------
diff -bBdNrw -U5 binutils-2.13.90.0.18.orig/bfd/elflink.h binutils-2.13.90.0.18/bfd/elflink.h
--- binutils-2.13.90.0.18.orig/bfd/elflink.h	2003-01-21 19:21:32.000000000 +0100
+++ binutils-2.13.90.0.18/bfd/elflink.h	2003-04-17 00:09:34.000000000 +0200
@@ -7849,12 +7849,12 @@
   asection * (*gc_mark_hook)
     PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
 	     struct elf_link_hash_entry *h, Elf_Internal_Sym *));
 
   if (!get_elf_backend_data (abfd)->can_gc_sections
-      || info->relocateable || info->emitrelocations
-      || elf_hash_table (info)->dynamic_sections_created)
+      || info->relocateable || info->emitrelocations)
+    //      || elf_hash_table (info)->dynamic_sections_created)
     return TRUE;
 
   /* Apply transitive closure to the vtable entry usage info.  */
   elf_link_hash_traverse (elf_hash_table (info),
 			  elf_gc_propagate_vtable_entries_used,
-------------- next part --------------
--- inutils-2.13.90.0.18.orig/gas/dwarf2dbg.c	2003-04-14 23:52:23.000000000 +0200
+++ inutils-2.13.90.0.18/gas/dwarf2dbg.c	2003-04-15 00:54:49.000000000 +0200
@@ -332,7 +332,8 @@
       return last_used;
 
   for (i = 1; i < files_in_use; ++i)
-    if (strcmp (filename, files[i].filename) == 0)
+    if (files && files[i].filename &&
+	strcmp (filename, files[i].filename) == 0)
       return i;
 
   if (i >= files_allocated)
@@ -350,7 +351,12 @@
   files[i].dir = 0;
   files_in_use = i + 1;
   last_used = i;
-
+  
+  if (!files[1].filename)
+    {
+      files[1].filename = xstrdup (filename);
+      files[1].dir = 0;
+    }
   return i;
 }
 
-------------- next part --------------
diff -bBdNrw -U5 binutils-2.13.90.0.18.orig/bfd/elfcode.h binutils-2.13.90.0.18/bfd/elfcode.h
--- binutils-2.13.90.0.18.orig/bfd/elfcode.h	2002-12-16 21:22:52.000000000 +0100
+++ binutils-2.13.90.0.18/bfd/elfcode.h	2003-04-16 21:53:08.000000000 +0200
@@ -1363,13 +1363,13 @@
 	    relent->sym_ptr_ptr = s->section->symbol_ptr_ptr;
 	}
 
       relent->addend = rela.r_addend;
 
-      if (entsize == sizeof (Elf_External_Rela))
-	(*ebd->elf_info_to_howto) (abfd, relent, &rela);
-      else
+      //if (entsize == sizeof (Elf_External_Rela))
+      //  (*ebd->elf_info_to_howto) (abfd, relent, &rela);
+      //else
 	(*ebd->elf_info_to_howto_rel) (abfd, relent, &rela);
     }
 
   if (allocated != NULL)
     free (allocated);
-------------- next part --------------
diff -bBdNrw -U5 binutils-2.13.90.0.18.orig/bfd/elflink.h binutils-2.13.90.0.18/bfd/elflink.h
--- binutils-2.13.90.0.18.orig/bfd/elflink.h	2003-01-21 19:21:32.000000000 +0100
+++ binutils-2.13.90.0.18/bfd/elflink.h	2003-04-16 22:22:10.000000000 +0200
@@ -6877,18 +6877,19 @@
 			 reloc to point to the global hash table entry
 			 for this symbol.  The symbol index is then
 			 set at the end of elf_bfd_final_link.  */
 		      indx = r_symndx - extsymoff;
 		      rh = elf_sym_hashes (input_bfd)[indx];
-		      while (rh->root.type == bfd_link_hash_indirect
-			     || rh->root.type == bfd_link_hash_warning)
+		      while (rh && (rh->root.type == bfd_link_hash_indirect
+				    || rh->root.type == bfd_link_hash_warning))
 			rh = (struct elf_link_hash_entry *) rh->root.u.i.link;
 
 		      /* Setting the index to -2 tells
 			 elf_link_output_extsym that this symbol is
 			 used by a reloc.  */
-		      BFD_ASSERT (rh->indx < 0);
+		      BFD_ASSERT (rh && rh->indx < 0);
+		      if (rh)
 		      rh->indx = -2;
 
 		      *rel_hash = rh;
 
 		      continue;


More information about the Binutils mailing list