aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-04-04 12:53:33 +0100
committerNick Clifton <nickc@redhat.com>2016-04-04 12:53:33 +0100
commit67f101eece4327a7c9e13f257fe76f8082a5e336 (patch)
tree23720406c938c589efe15bdf8b1aa8f8e7e956a4 /ld
parent26cdfd92055ece05e1abb5248ddb78f3386f857b (diff)
downloadbinutils-67f101eece4327a7c9e13f257fe76f8082a5e336.zip
binutils-67f101eece4327a7c9e13f257fe76f8082a5e336.tar.gz
binutils-67f101eece4327a7c9e13f257fe76f8082a5e336.tar.bz2
Ignore DWARF debug information with a version of 0 - assume that it is padding.
PR 19872 bfd * dwarf2.c (parse_comp_unit): Skip warning about unrecognised version number if the version is zero. bin * dwarf.c (display_debug_aranges): Skip warning about unrecognised version number if the version is zero.
Diffstat (limited to 'ld')
-rw-r--r--ld/emultempl/pe.em92
-rw-r--r--ld/pe-dll.c3
2 files changed, 48 insertions, 47 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index bf146f6..c13fa4d 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1059,10 +1059,38 @@ pe_undef_cdecl_match (struct bfd_link_hash_entry *h, void *inf)
return TRUE;
}
+/* Change UNDEF to a defined symbol, taking data from SYM. */
+
+static void
+change_undef (struct bfd_link_hash_entry * undef,
+ struct bfd_link_hash_entry * sym)
+{
+ static bfd_boolean gave_warning_message = FALSE;
+
+ undef->type = bfd_link_hash_defined;
+ undef->u.def.value = sym->u.def.value;
+ undef->u.def.section = sym->u.def.section;
+
+ if (pe_enable_stdcall_fixup == -1)
+ {
+ einfo (_("Warning: resolving %s by linking to %s\n"),
+ undef->root.string, sym->root.string);
+
+ if (! gave_warning_message)
+ {
+ einfo (_("Use --enable-stdcall-fixup to disable these warnings\n"));
+ einfo (_("Use --disable-stdcall-fixup to disable these fixups\n"));
+ gave_warning_message = TRUE;
+ }
+ }
+
+ /* PR 19803: Make sure that the linked symbol is not garbage collected. */
+ lang_add_gc_name (sym->root.string);
+}
+
static void
pe_fixup_stdcalls (void)
{
- static int gave_warning_message = 0;
struct bfd_link_hash_entry *undef, *sym;
if (pe_dll_extra_pe_debug)
@@ -1071,69 +1099,39 @@ pe_fixup_stdcalls (void)
for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next)
if (undef->type == bfd_link_hash_undefined)
{
- char* at = strchr (undef->root.string, '@');
- int lead_at = (*undef->root.string == '@');
+ const char * name = undef->root.string;
+ char * at;
+ int lead_at = (*name == '@');
+
if (lead_at)
- at = strchr (undef->root.string + 1, '@');
+ at = strchr (name + 1, '@');
+ else
+ at = strchr (name, '@');
if (at || lead_at)
{
/* The symbol is a stdcall symbol, so let's look for a
cdecl symbol with the same name and resolve to that. */
- char *cname = xstrdup (undef->root.string);
+ char *cname = xstrdup (name);
if (lead_at)
*cname = '_';
- at = strchr (cname, '@');
- if (at)
- *at = 0;
- sym = bfd_link_hash_lookup (link_info.hash, cname, 0, 0, 1);
+ if (at)
+ * strchr (cname, '@') = 0;
+ sym = bfd_link_hash_lookup (link_info.hash, cname, FALSE, FALSE, TRUE);
if (sym && sym->type == bfd_link_hash_defined)
- {
- undef->type = bfd_link_hash_defined;
- undef->u.def.value = sym->u.def.value;
- undef->u.def.section = sym->u.def.section;
-
- if (pe_enable_stdcall_fixup == -1)
- {
- einfo (_("Warning: resolving %s by linking to %s\n"),
- undef->root.string, cname);
- if (! gave_warning_message)
- {
- gave_warning_message = 1;
- einfo (_("Use --enable-stdcall-fixup to disable these warnings\n"));
- einfo (_("Use --disable-stdcall-fixup to disable these fixups\n"));
- }
- }
- }
+ change_undef (undef, sym);
}
else
{
/* The symbol is a cdecl symbol, so we look for stdcall
symbols - which means scanning the whole symbol table. */
- pe_undef_found_sym = 0;
+ pe_undef_found_sym = NULL;
bfd_link_hash_traverse (link_info.hash, pe_undef_cdecl_match,
- (char *) undef->root.string);
- sym = pe_undef_found_sym;
- if (sym)
- {
- undef->type = bfd_link_hash_defined;
- undef->u.def.value = sym->u.def.value;
- undef->u.def.section = sym->u.def.section;
-
- if (pe_enable_stdcall_fixup == -1)
- {
- einfo (_("Warning: resolving %s by linking to %s\n"),
- undef->root.string, sym->root.string);
- if (! gave_warning_message)
- {
- gave_warning_message = 1;
- einfo (_("Use --enable-stdcall-fixup to disable these warnings\n"));
- einfo (_("Use --disable-stdcall-fixup to disable these fixups\n"));
- }
- }
- }
+ (char *) name);
+ if (pe_undef_found_sym)
+ change_undef (undef, pe_undef_found_sym);
}
}
}
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index a280647..1f176ec 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -905,6 +905,9 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
{
*name = '_';
strcpy (name + 1, int_name);
+
+ /* PR 19803: The alias must be preserved as well. */
+ lang_add_gc_name (xstrdup (name));
}
else
strcpy (name, int_name);