[PATCH] Fix ld segv when asked to relocate based on local symboles
Julien LEMOINE
speedblue@debian.org
Fri Apr 18 23:54:00 GMT 2003
This patch fix ld segv. With patch, ld fail with an assertion.
full bug report is available at :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=126150
Best Regards.
--
Julien LEMOINE / SpeedBlue
-------------- 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