This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
patch, xcoff static linking
- From: Tom Rix <trix at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Tue, 30 Apr 2002 00:25:57 -0500
- Subject: patch, xcoff static linking
This patch fixes a hash table corruption problem.
The problem is reproduced by cross static linking a "Hello World"
program.
Tom
--
Tom Rix
GCC Engineer
trix@redhat.com
2002-04-30 Tom Rix <trix@redhat.com>
* xcofflink.c (xcoff_link_add_symbols): Always copy undef C_EXT
symbol names into the hash table.
Index: bfd/xcofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/xcofflink.c,v
retrieving revision 1.24
diff -d -u -p -r1.24 xcofflink.c
--- bfd/xcofflink.c 26 Apr 2002 13:43:10 -0000 1.24
+++ bfd/xcofflink.c 30 Apr 2002 04:09:05 -0000
@@ -1778,12 +1778,19 @@ xcoff_link_add_symbols (abfd, info)
if (info->hash->creator == abfd->xvec)
{
if (! bfd_is_und_section (section))
- *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info),
- name, true, copy, false);
+ {
+ *sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info),
+ name, true, copy, false);
+ }
else
- *sym_hash = ((struct xcoff_link_hash_entry *)
- bfd_wrapped_link_hash_lookup (abfd, info, name,
- true, copy, false));
+ {
+ /* Make a copy of the symbol name to prevent problems with
+ merging symbols. */
+ *sym_hash = ((struct xcoff_link_hash_entry *)
+ bfd_wrapped_link_hash_lookup (abfd, info, name,
+ true, true,
+ false));
+ }
if (*sym_hash == NULL)
goto error_return;
if (((*sym_hash)->root.type == bfd_link_hash_defined