diff options
Diffstat (limited to 'ld/emultempl/pe.em')
-rw-r--r-- | ld/emultempl/pe.em | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em index 38cb61138bd..7d956bf555c 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em @@ -1189,6 +1189,30 @@ change_undef (struct bfd_link_hash_entry * undef, } static void +set_decoration (const char *undecorated_name, + struct bfd_link_hash_entry * decoration) +{ + static bool gave_warning_message = false; + struct decoration_hash_entry *entry; + + if (is_underscoring () && undecorated_name[0] == '_') + undecorated_name++; + + entry = (struct decoration_hash_entry *) + bfd_hash_lookup (&(coff_hash_table (&link_info)->decoration_hash), + undecorated_name, true /* create */, false /* copy */); + + if (entry->decorated_link != NULL && !gave_warning_message) + { + einfo (_("%P: warning: overwriting decorated name %s with %s\n"), + entry->decorated_link->root.string, undecorated_name); + gave_warning_message = true; + } + + entry->decorated_link = decoration; +} + +static void pe_fixup_stdcalls (void) { struct bfd_link_hash_entry *undef, *sym; @@ -1231,7 +1255,10 @@ pe_fixup_stdcalls (void) bfd_link_hash_traverse (link_info.hash, pe_undef_cdecl_match, (char *) name); if (pe_undef_found_sym) - change_undef (undef, pe_undef_found_sym); + { + change_undef (undef, pe_undef_found_sym); + set_decoration (undef->root.string, pe_undef_found_sym); + } } } } |