/* Routines to help build PEI-format DLLs (Win32 etc)
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1998-2014 Free Software Foundation, Inc.
Written by DJ Delorie <dj@cygnus.com>
This file is part of the GNU Binutils.
{ STRING_COMMA_LEN ("_impure_ptr") },
{ STRING_COMMA_LEN ("_fmode") },
{ STRING_COMMA_LEN ("environ") },
+ { STRING_COMMA_LEN ("__dso_handle") },
{ NULL, 0 }
};
/* First, run around to all the objects looking for the .drectve
sections, and push those into the def file too. */
- for (b = info->input_bfds; b; b = b->link_next)
+ for (b = info->input_bfds; b; b = b->link.next)
{
s = bfd_get_section_by_name (b, ".drectve");
if (s)
if ((pe_dll_export_everything || pe_def_file->num_exports == 0)
&& !pe_dll_exclude_all_symbols)
{
- for (b = info->input_bfds; b; b = b->link_next)
+ for (b = info->input_bfds; b; b = b->link.next)
{
asymbol **symbols;
int nsyms;
/* We should export symbols which are either global or not
anything at all. (.bss data is the latter)
We should not export undefined symbols. */
- bfd_boolean would_export = 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_ptr
+ && ((symbols[j]->flags & BSF_GLOBAL)
+ || (symbols[j]->flags == 0)));
if (link_info.version_info && would_export)
would_export
= !bfd_hide_sym_by_version (link_info.version_info,
{
for (i = 0; i < NE; i++)
{
- if (strchr (pe_def_file->exports[i].name, '@'))
+ /* Check for fastcall/stdcall-decoration, but ignore
+ C++ mangled names. */
+ if (pe_def_file->exports[i].name[0] != '?'
+ && strchr (pe_def_file->exports[i].name, '@'))
{
/* This will preserve internal_name, which may have been
pointing to the same memory as name, or might not
have. */
int lead_at = (*pe_def_file->exports[i].name == '@');
char *tmp = xstrdup (pe_def_file->exports[i].name + lead_at);
- char *tmp_at = strchr (tmp, '@');
+ char *tmp_at = strrchr (tmp, '@');
if (tmp_at)
*tmp_at = 0;
unsigned char *enameptrs;
unsigned char *eordinals;
char *enamestr;
- time_t now;
-
- time (&now);
edata_d = xmalloc (edata_sz);
+ edata_s->output_section->vma - image_base)
memset (edata_d, 0, edata_sz);
- bfd_put_32 (abfd, now, edata_d + 4);
+
+ if (pe_data (abfd)->insert_timestamp)
+ H_PUT_32 (abfd, time (0), edata_d + 4);
+
if (pe_def_file->version_major != -1)
{
bfd_put_16 (abfd, pe_def_file->version_major, edata_d + 8);
bfd *b;
asection *s;
- for (b = info->input_bfds; b; b = b->link_next)
+ for (b = info->input_bfds; b; b = b->link.next)
{
asymbol **symbols;
struct bfd_section *s;
total_relocs = 0;
- for (b = info->input_bfds; b; b = b->link_next)
+ for (b = info->input_bfds; b; b = b->link.next)
for (s = b->sections; s; s = s->next)
total_relocs += s->reloc_count;
total_relocs = 0;
bi = 0;
- for (bi = 0, b = info->input_bfds; b; bi++, b = b->link_next)
+ for (bi = 0, b = info->input_bfds; b; bi++, b = b->link.next)
{
arelent **relocs;
int relsize, nrelocs;
/* I don't know why there would be a reloc for these, but I've
seen it happen - DJ */
- if (s->output_section == &bfd_abs_section)
+ if (s->output_section == bfd_abs_section_ptr)
continue;
if (s->output_section->vma == 0)
no reason we'd want a reference to any absolute
address to get relocated during rebasing). */
if (!h2 || h2->root.type == bfd_link_hash_undefined
- || h2->root.u.def.section == &bfd_abs_section)
+ || h2->root.u.def.section == bfd_abs_section_ptr)
continue;
}
else if (!blhe || blhe->type != bfd_link_hash_defined)
static const char *dll_filename;
static char *dll_symname;
-#define UNDSEC (asection *) &bfd_und_section
+#define UNDSEC bfd_und_section_ptr
static asection *
quick_section (bfd *abfd, const char *name, int flags, int align)
BSF_NO_FLAGS, 0);
bfd_set_section_size (abfd, extern_rt_rel, PE_IDATA5_SIZE);
- extern_rt_rel_d = xmalloc (PE_IDATA5_SIZE);
+ extern_rt_rel_d = xcalloc (1, PE_IDATA5_SIZE);
extern_rt_rel->contents = extern_rt_rel_d;
quick_reloc (abfd, 0, BFD_RELOC_RVA, 1);
return;
}
- /* xgettext:c-format */
- info_msg (_("Creating library file: %s\n"), impfilename);
+ if (verbose)
+ /* xgettext:c-format */
+ info_msg (_("Creating library file: %s\n"), impfilename);
bfd_set_format (outarch, bfd_archive);
outarch->has_armap = 1;
ar_head = make_head (outarch);
/* Iterate the input BFDs, looking for exclude-modules-for-implib. */
- for (ibfd = info->input_bfds; ibfd; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd; ibfd = ibfd->link.next)
{
/* Iterate the exclude list. */
struct exclude_list_struct *ex;
const char *oname;
};
-struct key_value *udef_table;
+static struct key_value *udef_table;
static int undef_sort_cmp (const void *l1, const void *r1)
{
struct key_value *kv;
struct key_value key;
char *at, *lname = (char *) alloca (strlen (name) + 3);
-
+
strcpy (lname, name);
at = strchr (lname + (lname[0] == '@'), '@');
if (h->type == bfd_link_hash_undefined)
return h;
}
-
+
return NULL;
}