This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Elf32 using wrong bfd_add_symbols (shows up as SEGV in arm-linux-ld)
- To: binutils at sources dot redhat dot com
- Subject: Elf32 using wrong bfd_add_symbols (shows up as SEGV in arm-linux-ld)
- From: Jan Vroonhof <jan dot vroonhof at insignia dot com>
- Date: 24 Aug 2000 09:41:25 +0100
[Please CC. I'm not subscribed]
Linenumbers below are from binutils 2.10 (but the crash is also
observed with late 2.9.5 versions).
One of our applications currently doesn't link when crosscompiling for linux-arm.
Both collect2 from gcc-2.95.2 and ld give a segmentation fault in elf_output_bfd
on line 5638 of elflink.h which does
rh = elf_sym_hashes (input_bfd)[indx];
The problem is that the sym_hashes array is NULL. The reason for that is
that the bfd library calls the generic bfd_link_add_symbols instead of the elf32
version.
I can't figure out at the moment how that happens, but hand-editing out the superfluous test
in elf32-target,h make the SEGV go away.
Jan
diff -u /scratch/jvroonhof/binutils-2.10.0.18/builddir-arm/bfd/elf32-target.h~ /scratch/jvroonhof/binutils-2.10.0.18/builddir-arm/bfd/elf32-target.h
--- /scratch/jvroonhof/binutils-2.10.0.18/builddir-arm/bfd/elf32-target.h~ Thu Aug 24 09:27:17 2000
+++ /scratch/jvroonhof/binutils-2.10.0.18/builddir-arm/bfd/elf32-target.h Thu Aug 24 09:27:17 2000
@@ -161,8 +161,9 @@
#define bfd_elf32_bfd_link_hash_table_create \
_bfd_generic_link_hash_table_create
#endif
-#ifndef bfd_elf32_bfd_link_add_symbols
-#define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols
+#if 0
+ /* bfd_elf32_bfd_link_add_symbol */
+#define bfd_elf32_bfd_link_add_symbols bfd_elf_link_add_symbols
#endif
#ifndef bfd_elf32_bfd_final_link
#define bfd_elf32_bfd_final_link _bfd_generic_final_link