This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH,committed] Fix NT weak undef aux symbol lookup [was Re: Oops, serious ld bug cropped up]
- From: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- To: Dave Korn <dave dot korn dot cygwin at googlemail dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, Tristan Gingold <gingold at adacore dot com>
- Date: Thu, 01 Oct 2009 21:02:55 +0100
- Subject: [PATCH,committed] Fix NT weak undef aux symbol lookup [was Re: Oops, serious ld bug cropped up]
- References: <4AC4D4ED.8000506@gmail.com> <4AC4E7F3.3090003@gmail.com> <4AC4FBAA.2050709@gmail.com>
Dave Korn wrote:
> Neither. The undef symbol exists in two object files. When relocating the
> second, it looks up the symbol in the hash, finds the aux entry, looks up the
> aux symbol index in that - but then assumes that the aux entry must be in the
> same bfd's symtab, which isn't the case. Shouldn't be at all hard to fix.
Trivial, in fact; a 6-character fix! :-) We just use the auxbfd field,
because that is what it is for.
2009-10-01 Dave Korn <dave.korn.cygwin@gmail.com>
* cofflink.c (_bfd_coff_generic_relocate_section): Look for the aux
symbol for a weak undef in the auxbfd, not the input bfd.
Built and regtested on i686-pc-cygwin, and verified that it resolves the
reported problem compiling gettext.
Committed to HEAD. Tristan, I'm sure it's a formality, but, OK for 2.20?
cheers,
DaveK
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.71
diff -p -u -r1.71 cofflink.c
--- bfd/cofflink.c 9 Sep 2009 21:38:57 -0000 1.71
+++ bfd/cofflink.c 1 Oct 2009 19:41:17 -0000
@@ -2959,7 +2959,7 @@ _bfd_coff_generic_relocate_section (bfd
See also linker.c: generic_link_check_archive_element. */
asection *sec;
struct coff_link_hash_entry *h2 =
- input_bfd->tdata.coff_obj_data->sym_hashes[
+ h->auxbfd->tdata.coff_obj_data->sym_hashes[
h->aux->x_sym.x_tagndx.l];
if (!h2 || h2->root.type == bfd_link_hash_undefined)