summaryrefslogtreecommitdiffstats
path: root/ld
diff options
context:
space:
mode:
authorDave Korn <dave.korn@artimi.com>2009-12-17 19:51:35 +0000
committerDave Korn <dave.korn@artimi.com>2009-12-17 19:51:35 +0000
commit9dda37c1b4875049529c87e239f3b9337d00b9e0 (patch)
tree9c6c381e2c6818aa4f9eacb607734dce050278b3 /ld
parentb41d91a7bc3686d0bd44c54b6b9a1fdca3bc74af (diff)
downloadppe42-binutils-9dda37c1b4875049529c87e239f3b9337d00b9e0.tar.gz
ppe42-binutils-9dda37c1b4875049529c87e239f3b9337d00b9e0.zip
* pe-dll.c (generate_reloc): Take account of wrapper options when
testing if a weak symbol is defined or not, and when it is not, consider whether the default value requires a base reloc anyway.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/pe-dll.c25
2 files changed, 28 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 261cdc8080..00df7969bb 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
2009-12-17 Dave Korn <dave.korn.cygwin@gmail.com>
+ * pe-dll.c (generate_reloc): Take account of wrapper options when
+ testing if a weak symbol is defined or not, and when it is not,
+ consider whether the default value requires a base reloc anyway.
+
+2009-12-17 Dave Korn <dave.korn.cygwin@gmail.com>
+
* deffilep.y (def_file_free): Add missing shadow parameter renaming.
(def_file_print): Likewise.
(def_stash_module): Likewise.
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 9b3c699fb1..2ddbdc16c4 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -1361,10 +1361,29 @@ generate_reloc (bfd *abfd, struct bfd_link_info *info)
if (sym->flags == BSF_WEAK)
{
struct bfd_link_hash_entry *blhe
- = bfd_link_hash_lookup (info->hash, sym->name,
+ = bfd_wrapped_link_hash_lookup (abfd, info, sym->name,
FALSE, FALSE, FALSE);
- if (!blhe || blhe->type != bfd_link_hash_defined)
- continue;
+ if (blhe && blhe->type == bfd_link_hash_undefweak)
+ {
+ /* Check aux sym and see if it is defined or not. */
+ struct coff_link_hash_entry *h, *h2;
+ h = (struct coff_link_hash_entry *)blhe;
+ if (h->symbol_class != C_NT_WEAK || h->numaux != 1)
+ continue;
+ h2 = h->auxbfd->tdata.coff_obj_data->sym_hashes
+ [h->aux->x_sym.x_tagndx.l];
+ /* We don't want a base reloc if the aux sym is not
+ found, undefined, or if it is the constant ABS
+ zero default value. (We broaden that slightly by
+ not testing the value, just the section; there's
+ no reason we'd want a reference to any absolute
+ address to get relocated during rebasing). */
+ if (!h2 || h2->root.type == bfd_link_hash_undefined
+ || h2->root.u.def.section == &bfd_abs_section)
+ continue;
+ }
+ else if (!blhe || blhe->type != bfd_link_hash_defined)
+ continue;
}
sym_vma = (relocs[i]->addend
OpenPOWER on IntegriCloud