aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/coffgen.c18
2 files changed, 22 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index a1ab388..d912e1a 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-07 gingold <gingold@gingold-Precision-7510>
+
+ * coffgen.c (_bfd_coff_gc_mark_hook): Handle PE weak
+ external symbols with a definition.
+ (_bfd_coff_gc_mark_extra_sections): Fix typo.
+
2017-04-07 Alan Modra <amodra@gmail.com>
* po/SRC-POTFILES.in: Regenerate.
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 3c60ed4..18f423b 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2785,8 +2785,22 @@ _bfd_coff_gc_mark_hook (asection *sec,
case bfd_link_hash_common:
return h->root.u.c.p->section;
- case bfd_link_hash_undefined:
case bfd_link_hash_undefweak:
+ if (h->symbol_class == C_NT_WEAK && h->numaux == 1)
+ {
+ /* PE weak externals. A weak symbol may include an auxiliary
+ record indicating that if the weak symbol is not resolved,
+ another external symbol is used instead. */
+ struct coff_link_hash_entry *h2 =
+ h->auxbfd->tdata.coff_obj_data->sym_hashes[
+ h->aux->x_sym.x_tagndx.l];
+
+ if (h2 && h2->root.type != bfd_link_hash_undefined)
+ return h2->root.u.def.section;
+ }
+ break;
+
+ case bfd_link_hash_undefined:
default:
break;
}
@@ -2897,7 +2911,7 @@ _bfd_coff_gc_mark_extra_sections (struct bfd_link_info *info,
asection *isec;
bfd_boolean some_kept;
- if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour)
continue;
/* Ensure all linker created sections are kept, and see whether