/* Routines to help build PEI-format DLLs (Win32 etc)
- Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Written by DJ Delorie <dj@cygnus.com>
This file is part of GLD, the Gnu Linker.
11 /* ARM_RVA32 */,
PE_ARCH_arm,
bfd_arch_arm,
- 0
+ 1
},
{
"epoc-pei-arm-little",
{ "_cygwin_crt0_common@8", 21 },
{ "_cygwin_noncygwin_dll_entry@12", 30 },
{ "impure_ptr", 10 },
+ { "_pei386_runtime_relocator", 25 },
+ { "do_pseudo_reloc", 15 },
+ { "cygwin_crt0", 11 },
{ NULL, 0 }
};
}
}
+ /* 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
+ && !(info->shared))
+ return;
+
/* Now, maybe export everything else the default way. */
if (pe_dll_export_everything || pe_def_file->num_exports == 0)
{
overflowing this buffer... */
{
free (fixup_name);
- /* New buffer size is length of symbol, plus 25, but then
- rounded up to the nearest multiple of 128. */
+ /* New buffer size is length of symbol, plus 25, but
+ then rounded up to the nearest multiple of 128. */
buffer_len = ((strlen (sym->name) + 25) + 127) & ~127;
fixup_name = (char *) xmalloc (buffer_len);
}
}
/* .section .rdata
- .rva __pei386_runtime_relocator */
+ .rva __pei386_runtime_relocator */
static bfd *
pe_create_runtime_relocator_reference (parent)
to enable symbolic dll linking. */
dll_name = pe_as32 (expdata + 12) + erva;
+ /* Check to see if the dll has already been added to
+ the definition list and if so return without error.
+ This avoids multiple symbol definitions. */
+ if (def_get_module (pe_def_file, dll_name))
+ {
+ if (pe_dll_extra_pe_debug)
+ printf ("%s is already loaded\n", dll_name);
+ return TRUE;
+ }
+
/* Iterate through the list of symbols. */
for (i = 0; i < nexp; i++)
{
pe_dll_id_target (bfd_get_target (abfd));
process_def_file (abfd, info);
+ if (pe_def_file->num_exports == 0 && !(info->shared))
+ return;
+
generate_edata (abfd, info);
build_filler_bfd (1);
}
/* Resize the sections. */
lang_size_sections (stat_ptr->head, abs_output_section,
- &stat_ptr->head, 0, (bfd_vma) 0, NULL);
+ &stat_ptr->head, 0, (bfd_vma) 0, NULL, TRUE);
/* Redo special stuff. */
ldemul_after_allocation ();
fill_edata (abfd, info);
- pe_data (abfd)->dll = 1;
+ if (info->shared)
+ pe_data (abfd)->dll = 1;
edata_s->contents = edata_d;
reloc_s->contents = reloc_d;
/* Resize the sections. */
lang_size_sections (stat_ptr->head, abs_output_section,
- &stat_ptr->head, 0, (bfd_vma) 0, NULL);
+ &stat_ptr->head, 0, (bfd_vma) 0, NULL, TRUE);
/* Redo special stuff. */
ldemul_after_allocation ();