+
+ /* 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;
+ }
+ }
+