aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorSenthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com>2016-03-18 09:51:47 +0000
committerNick Clifton <nickc@redhat.com>2016-03-18 09:51:47 +0000
commit41f46ed9fea1a066de95b6a85c56393beef0b8b8 (patch)
tree74d49a75ad394fc318a67c240313c73421fe5837 /ld/pe-dll.c
parente101a78be9388651099af079899b8654292d24f6 (diff)
downloadgdb-41f46ed9fea1a066de95b6a85c56393beef0b8b8.zip
gdb-41f46ed9fea1a066de95b6a85c56393beef0b8b8.tar.gz
gdb-41f46ed9fea1a066de95b6a85c56393beef0b8b8.tar.bz2
Fix possible failure in the AVR linker tests.
* ld-avr/gc-section-debugline.d: Relax regex check for CU.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 14f963b..ccdbed0 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -895,6 +895,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
for (i = 0; i < NE; i++)
{
char *name;
+
name = xmalloc (strlen (pe_def_file->exports[i].internal_name) + 2);
if (pe_details->underscored
&& (*pe_def_file->exports[i].internal_name != '@'))
@@ -2790,7 +2791,44 @@ pe_dll_generate_implib (def_file *def, const char *impfilename, struct bfd_link_
/* Don't add PRIVATE entries to import lib. */
if (pe_def_file->exports[i].flag_private)
continue;
+
def->exports[i].internal_name = def->exports[i].name;
+
+ /* PR 19803: If a symbol has been discard due to garbage
+ collection then do not create any exports for it. */
+ {
+ struct coff_link_hash_entry *h;
+
+ h = coff_link_hash_lookup (coff_hash_table (info), internal,
+ FALSE, FALSE, FALSE);
+ if (h != NULL
+ /* If the symbol is hidden and undefined then it
+ has been swept up by garbage collection. */
+ && h->symbol_class == C_HIDDEN
+ && h->root.u.def.section == bfd_und_section_ptr)
+ continue;
+
+ /* If necessary, check with an underscore prefix as well. */
+ if (pe_details->underscored && internal[0] != '@')
+ {
+ char *name;
+
+ name = xmalloc (strlen (internal) + 2);
+ sprintf (name, "_%s", internal);
+
+ h = coff_link_hash_lookup (coff_hash_table (info), name,
+ FALSE, FALSE, FALSE);
+ free (name);
+
+ if (h != NULL
+ /* If the symbol is hidden and undefined then it
+ has been swept up by garbage collection. */
+ && h->symbol_class == C_HIDDEN
+ && h->root.u.def.section == bfd_und_section_ptr)
+ continue;
+ }
+ }
+
n = make_one (def->exports + i, outarch,
! (def->exports + i)->flag_data);
n->archive_next = head;