}
static void
-process_def_file (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
+process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
{
int i, j;
struct bfd_link_hash_entry *blhe;
}
}
+ /* Process aligned common symbol information from the
+ .drectve sections now; common symbol allocation is
+ done before final link, so it will be too late to
+ process them in process_embedded_commands() called
+ from _bfd_coff_link_input_bfd(). */
+ if (pe_def_file->aligncomms)
+ {
+ def_file_aligncomm *ac = pe_def_file->aligncomms;
+ while (ac)
+ {
+ struct coff_link_hash_entry *sym_hash;
+ sym_hash = coff_link_hash_lookup (coff_hash_table (info),
+ ac->symbol_name, FALSE, FALSE, FALSE);
+ if (sym_hash && sym_hash->root.type == bfd_link_hash_common
+ && sym_hash->root.u.c.p->alignment_power < (unsigned) ac->alignment)
+ {
+ sym_hash->root.u.c.p->alignment_power = (unsigned) ac->alignment;
+ }
+ ac = ac->next;
+ }
+ }
+
/* If we are not building a DLL, when there are no exports
we do not build an export table at all. */
if (!pe_dll_export_everything && pe_def_file->num_exports == 0
/* We should export symbols which are either global or not
anything at all. (.bss data is the latter)
We should not export undefined symbols. */
- if (symbols[j]->section != &bfd_und_section
- && ((symbols[j]->flags & BSF_GLOBAL)
- || (symbols[j]->flags == 0)))
+ bfd_boolean would_export = symbols[j]->section != &bfd_und_section
+ && ((symbols[j]->flags & BSF_GLOBAL)
+ || (symbols[j]->flags == 0));
+ if (lang_elf_version_info && would_export)
+ {
+ bfd_boolean hide = 0;
+ char ofs = pe_details->underscored && symbols[j]->name[0] == '_';
+ (void) bfd_find_version_for_sym (lang_elf_version_info,
+ symbols[j]->name + ofs, &hide);
+ would_export = !hide;
+ }
+ if (would_export)
{
const char *sn = symbols[j]->name;
#undef NE
#define NE pe_def_file->num_exports
+ /* Don't create an empty export table. */
+ if (NE == 0)
+ return;
+
/* Canonicalize the export list. */
if (pe_dll_kill_ats)
{
}
/* Fill the exported symbol offsets. The preliminary work has already
- been done in process_def_file(). */
+ been done in process_def_file_and_drectve(). */
static void
fill_exported_offsets (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
{
pe_dll_id_target (bfd_get_target (abfd));
pe_output_file_set_long_section_names (abfd);
- process_def_file (abfd, info);
+ process_def_file_and_drectve (abfd, info);
if (pe_def_file->num_exports == 0 && !info->shared)
return;