* bfdlink.h (struct bfd_link_hash_table): Delete creator field.
	(struct bfd_link_info): Add output_bfd.
bfd/
	* elflink.c: Replace all accesses to hash->creator field with
	output_bfd->xvec.
	* cofflink.c: Likewise.
	* coff-h8300.c: Likewise.
	* ecoff.c: Likewise.
	* elf32-m68hc1x.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elfxx-mips.c: Likewise.
	* i386linux.c: Likewise.
	* m68klinux.c: Likewise.
	* sparclinux.c: Likewise.
	* sunos.c: Likewise.
	* xcofflink.c: Likewise.
	* linker.c: Likewise.
	(_bfd_link_hash_table_init): Don't store creator.
ld/
	* ldmain.h (output_bfd): Delete.
	* ldmain.c (output_bfd): Delete.
	Replace all occurrences of output_bfd with link_info.output_bfd.
	* ldcref.c: Likewise.
	* ldctor.c: Likewise.
	* ldemul.c: Likewise.
	* ldexp.c: Likewise.
	* ldfile.c: Likewise.
	* ldlang.c: Likewise.
	* ldmisc.c: Likewise.
	* ldwrite.c: Likewise.
	* pe-dll.c: Likewise.
	* emultempl/aix.em: Likewise.
	* emultempl/alphaelf.em: Likewise.
	* emultempl/armcoff.em: Likewise.
	* emultempl/armelf.em: Likewise.
	* emultempl/avrelf.em: Likewise.
	* emultempl/beos.em: Likewise.
	* emultempl/elf-generic.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/gld960.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/irix.em: Likewise.
	* emultempl/linux.em: Likewise.
	* emultempl/lnk960.em: Likewise.
	* emultempl/m68hc1xelf.em: Likewise.
	* emultempl/mmix-elfnmmo.em: Likewise.
	* emultempl/mmo.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/ppc32elf.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/scoreelf.em: Likewise.
	* emultempl/sh64elf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/sunos.em: Likewise.
	* emultempl/vanilla.em: Likewise.
	* emultempl/vxworks.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
	* emultempl/z80.em: Likewise.
	* ldlang.c (open_output): Don't return output, instead write
	link_info_output_bfd directly.
	* emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator
	with link_info.output_bfd->xvec.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/ppc32elf.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
This commit is contained in:
Alan Modra 2008-02-15 03:35:53 +00:00
parent 54aff08f3b
commit f13a99db51
59 changed files with 575 additions and 442 deletions

View File

@ -1,3 +1,24 @@
2008-02-15 Alan Modra <amodra@bigpond.net.au>
* elflink.c: Replace all accesses to hash->creator field with
output_bfd->xvec.
* cofflink.c: Likewise.
* coff-h8300.c: Likewise.
* ecoff.c: Likewise.
* elf32-m68hc1x.c: Likewise.
* elf32-ppc.c: Likewise.
* elf64-alpha.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-sparc.c: Likewise.
* elfxx-mips.c: Likewise.
* i386linux.c: Likewise.
* m68klinux.c: Likewise.
* sparclinux.c: Likewise.
* sunos.c: Likewise.
* xcofflink.c: Likewise.
* linker.c: Likewise.
(_bfd_link_hash_table_init): Don't store creator.
2008-02-14 Peter Jones <pjones@redhat.com>
* efi-rtdrv-ia32.c: New file.

View File

@ -1,6 +1,6 @@
/* BFD back-end for Renesas H8/300 COFF binaries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain, <sac@cygnus.com>.
@ -1116,11 +1116,11 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info,
struct h8300_coff_link_hash_table *htab;
asection *vectors_sec;
if (link_info->hash->creator != abfd->xvec)
if (link_info->output_bfd->xvec != abfd->xvec)
{
(*_bfd_error_handler)
(_("cannot handle R_MEM_INDIRECT reloc when using %s output"),
link_info->hash->creator->name);
link_info->output_bfd->xvec->name);
/* What else can we do? This function doesn't allow return
of an error, and we don't want to call abort as that
@ -1264,7 +1264,7 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
/* Add the symbols using the generic code. */
_bfd_generic_link_add_symbols (abfd, info);
if (info->hash->creator != abfd->xvec)
if (info->output_bfd->xvec != abfd->xvec)
return TRUE;
htab = h8300_coff_hash_table (info);

View File

@ -1,6 +1,6 @@
/* COFF specific linker code.
Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -482,7 +482,7 @@ coff_link_add_symbols (bfd *abfd,
(*sym_hash)->root.u.c.p->alignment_power
= bfd_coff_default_section_alignment_power (abfd);
if (info->hash->creator->flavour == bfd_get_flavour (abfd))
if (bfd_get_flavour (info->output_bfd) == bfd_get_flavour (abfd))
{
/* If we don't have any symbol information currently in
the hash table, or if we are looking at a symbol
@ -574,7 +574,7 @@ coff_link_add_symbols (bfd *abfd,
optimize the handling of any .stab/.stabstr sections. */
if (! info->relocatable
&& ! info->traditional_format
&& info->hash->creator->flavour == bfd_get_flavour (abfd)
&& bfd_get_flavour (info->output_bfd) == bfd_get_flavour (abfd)
&& (info->strip != strip_all && info->strip != strip_debugger))
{
asection *stabstr;

View File

@ -3402,7 +3402,7 @@ ecoff_link_add_externals (bfd *abfd,
/* If we are building an ECOFF hash table, save the external
symbol information. */
if (info->hash->creator->flavour == bfd_get_flavour (abfd))
if (bfd_get_flavour (info->output_bfd) == bfd_get_flavour (abfd))
{
if (h->abfd == NULL
|| (! bfd_is_und_section (section)

View File

@ -1,5 +1,5 @@
/* Motorola 68HC11/HC12-specific support for 32-bit ELF
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
@ -232,7 +232,7 @@ elf32_m68hc11_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
htab = m68hc11_elf_hash_table (info);
if (htab->root.root.creator->flavour != bfd_target_elf_flavour)
if (bfd_get_flavour (info->output_bfd) != bfd_target_elf_flavour)
return 0;
/* Count the number of input BFDs and find the top input section id.

View File

@ -2772,7 +2772,7 @@ ppc_elf_add_symbol_hook (bfd *abfd,
if (sym->st_shndx == SHN_COMMON
&& !info->relocatable
&& sym->st_size <= elf_gp_size (abfd)
&& is_ppc_elf_target (info->hash->creator))
&& is_ppc_elf_target (info->output_bfd->xvec))
{
/* Common symbols less than or equal to -G nn bytes are automatically
put into .sbss. */

View File

@ -3104,7 +3104,7 @@ elf64_alpha_relax_opt_call (struct alpha_relax_info *info, bfd_vma symval)
/* We've now determined that we can skip an initial gp load. Verify
that the call and the target use the same gp. */
if (info->link_info->hash->creator != info->tsec->owner->xvec
if (info->link_info->output_bfd->xvec != info->tsec->owner->xvec
|| info->gotobj != alpha_elf_tdata (info->tsec->owner)->gotobj)
return 0;

View File

@ -4275,7 +4275,7 @@ ppc64_elf_check_directives (bfd *ibfd, struct bfd_link_info *info)
struct ppc_link_hash_entry **p, *eh;
htab = ppc_hash_table (info);
if (!is_ppc64_elf_target (htab->elf.root.creator))
if (!is_ppc64_elf_target (info->output_bfd->xvec))
return TRUE;
if (is_ppc64_elf_target (ibfd->xvec))

View File

@ -1,6 +1,6 @@
/* SPARC-specific support for 64-bit ELF
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2007 Free Software Foundation, Inc.
2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -441,7 +441,7 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
return FALSE;
}
if (info->hash->creator != abfd->xvec
if (info->output_bfd->xvec != abfd->xvec
|| (abfd->flags & DYNAMIC) != 0)
{
/* STT_REGISTER only works when linking an elf64_sparc object.
@ -510,7 +510,7 @@ elf64_sparc_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
return TRUE;
}
else if (*namep && **namep
&& info->hash->creator == abfd->xvec)
&& info->output_bfd->xvec == abfd->xvec)
{
int i;
struct _bfd_sparc_elf_app_reg *p;

View File

@ -884,7 +884,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
/* This code is for coping with dynamic objects, and is only useful
if we are doing an ELF link. */
if (info->hash->creator != abfd->xvec)
if (info->output_bfd->xvec != abfd->xvec)
return TRUE;
/* For merging, we only care about real symbols. */
@ -3336,7 +3336,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
the format of the output file. */
if (info->relocatable
|| !is_elf_hash_table (htab)
|| htab->root.creator != abfd->xvec)
|| info->output_bfd->xvec != abfd->xvec)
{
if (info->relocatable)
bfd_set_error (bfd_error_invalid_operation);
@ -3433,7 +3433,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
format as the output, we can't make a shared library. */
if (info->shared
&& is_elf_hash_table (htab)
&& htab->root.creator == abfd->xvec
&& info->output_bfd->xvec == abfd->xvec
&& !htab->dynamic_sections_created)
{
if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
@ -4674,7 +4674,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
if (! dynamic
&& is_elf_hash_table (htab)
&& bed->check_relocs != NULL
&& (*bed->relocs_compatible) (abfd->xvec, htab->root.creator))
&& (*bed->relocs_compatible) (abfd->xvec, info->output_bfd->xvec))
{
asection *o;

View File

@ -6083,7 +6083,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
if (SGI_COMPAT (abfd)
&& ! info->shared
&& info->hash->creator == abfd->xvec
&& info->output_bfd->xvec == abfd->xvec
&& strcmp (*namep, "__rld_obj_head") == 0)
{
struct elf_link_hash_entry *h;

View File

@ -1,6 +1,6 @@
/* BFD back-end for linux flavored i386 a.out binaries.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2001, 2002, 2003,
2004, 2006, 2007 Free Software Foundation, Inc.
2004, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -346,9 +346,9 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
If we do, and the defining entry is from a shared library, we
need to create the dynamic sections.
FIXME: What if abfd->xvec != info->hash->creator? We may want to
be able to link Linux a.out and ELF objects together, but serious
confusion is possible. */
FIXME: What if abfd->xvec != info->output_bfd->xvec? We may
want to be able to link Linux a.out and ELF objects together,
but serious confusion is possible. */
insert = FALSE;
@ -356,7 +356,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
&& (flags & BSF_CONSTRUCTOR) != 0
&& abfd->xvec == info->hash->creator)
&& abfd->xvec == info->output_bfd->xvec)
{
if (! linux_link_create_dynamic_sections (abfd, info))
return FALSE;
@ -365,7 +365,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
}
if (bfd_is_abs_section (section)
&& abfd->xvec == info->hash->creator)
&& abfd->xvec == info->output_bfd->xvec)
{
h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
FALSE, FALSE);

View File

@ -1,6 +1,6 @@
/* linker.c -- BFD linker routines
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007
2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
@ -151,9 +151,9 @@ SUBSUBSECTION
Sometimes the <<_bfd_link_add_symbols>> function must store
some information in the hash table entry to be used by the
<<_bfd_final_link>> function. In such a case the <<creator>>
field of the hash table must be checked to make sure that the
hash table was created by an object file of the same format.
<<_bfd_final_link>> function. In such a case the output bfd
xvec must be checked to make sure that the hash table was
created by an object file of the same format.
The <<_bfd_final_link>> routine must be prepared to handle a
hash entry without any extra information added by the
@ -165,7 +165,7 @@ SUBSUBSECTION
initialization function.
See <<ecoff_link_add_externals>> for an example of how to
check the <<creator>> field before saving information (in this
check the output bfd before saving information (in this
case, the ECOFF external symbol debugging information) in a
hash table entry.
@ -471,13 +471,12 @@ _bfd_link_hash_newfunc (struct bfd_hash_entry *entry,
bfd_boolean
_bfd_link_hash_table_init
(struct bfd_link_hash_table *table,
bfd *abfd,
bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *,
struct bfd_hash_table *,
const char *),
unsigned int entsize)
{
table->creator = abfd->xvec;
table->undefs = NULL;
table->undefs_tail = NULL;
table->type = bfd_link_generic_hash_table;
@ -1359,7 +1358,7 @@ generic_link_add_symbol_list (bfd *abfd,
hash table other than the generic hash table, so we only
do this if we are certain that the hash table is a
generic one. */
if (info->hash->creator == abfd->xvec)
if (info->output_bfd->xvec == abfd->xvec)
{
if (h->sym == NULL
|| (! bfd_is_und_section (bfd_get_section (p))
@ -2243,7 +2242,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
this routine will be called with a hash table
other than a generic hash table, so we double
check that. */
if (info->hash->creator == input_bfd->xvec)
if (info->output_bfd->xvec == input_bfd->xvec)
{
if (h->sym != NULL)
*sym_ptr = sym = h->sym;

View File

@ -1,6 +1,6 @@
/* BFD back-end for linux flavored m68k a.out binaries.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
2003, 2004, 2006, 2007 Free Software Foundation, Inc.
2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -350,9 +350,9 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
If we do, and the defining entry is from a shared library, we
need to create the dynamic sections.
FIXME: What if abfd->xvec != info->hash->creator? We may want to
be able to link Linux a.out and ELF objects together, but serious
confusion is possible. */
FIXME: What if abfd->xvec != info->output_bfd->xvec? We may
want to be able to link Linux a.out and ELF objects together,
but serious confusion is possible. */
insert = FALSE;
@ -360,7 +360,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
&& (flags & BSF_CONSTRUCTOR) != 0
&& abfd->xvec == info->hash->creator)
&& abfd->xvec == info->output_bfd->xvec)
{
if (! linux_link_create_dynamic_sections (abfd, info))
return FALSE;
@ -369,7 +369,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
}
if (bfd_is_abs_section (section)
&& abfd->xvec == info->hash->creator)
&& abfd->xvec == info->output_bfd->xvec)
{
h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
FALSE, FALSE);

View File

@ -1,6 +1,6 @@
/* BFD back-end for linux flavored sparc a.out binaries.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
2003, 2004, 2006, 2007 Free Software Foundation, Inc.
2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@ -346,9 +346,9 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
If we do, and the defining entry is from a shared library, we
need to create the dynamic sections.
FIXME: What if abfd->xvec != info->hash->creator? We may want to
be able to link Linux a.out and ELF objects together, but serious
confusion is possible. */
FIXME: What if abfd->xvec != info->output_bfd->xvec? We may
want to be able to link Linux a.out and ELF objects together,
but serious confusion is possible. */
insert = FALSE;
@ -356,7 +356,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
&& linux_hash_table (info)->dynobj == NULL
&& strcmp (name, SHARABLE_CONFLICTS) == 0
&& (flags & BSF_CONSTRUCTOR) != 0
&& abfd->xvec == info->hash->creator)
&& abfd->xvec == info->output_bfd->xvec)
{
if (! linux_link_create_dynamic_sections (abfd, info))
return FALSE;
@ -365,7 +365,7 @@ linux_add_one_symbol (info, abfd, name, flags, section, value, string,
}
if (bfd_is_abs_section (section)
&& abfd->xvec == info->hash->creator)
&& abfd->xvec == info->output_bfd->xvec)
{
h = linux_link_hash_lookup (linux_hash_table (info), name, FALSE,
FALSE, FALSE);

View File

@ -1,6 +1,7 @@
/* BFD backend for SunOS binaries.
Copyright 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -829,7 +830,7 @@ sunos_add_dynamic_symbols (bfd *abfd,
unsigned long need;
/* Make sure we have all the required sections. */
if (info->hash->creator == abfd->xvec)
if (info->output_bfd->xvec == abfd->xvec)
{
if (! sunos_create_dynamic_sections (abfd, info,
((abfd->flags & DYNAMIC) != 0
@ -870,7 +871,7 @@ sunos_add_dynamic_symbols (bfd *abfd,
/* There's no hope of using a dynamic object which does not exactly
match the format of the output file. */
if (info->hash->creator != abfd->xvec)
if (info->output_bfd->xvec != abfd->xvec)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
@ -1121,7 +1122,7 @@ sunos_add_one_symbol (struct bfd_link_info *info,
}
if ((abfd->flags & DYNAMIC) != 0
&& abfd->xvec == info->hash->creator
&& abfd->xvec == info->output_bfd->xvec
&& (h->flags & SUNOS_CONSTRUCTOR) != 0)
/* The existing symbol is a constructor symbol, and this symbol
is from a dynamic object. A constructor symbol is actually a
@ -1145,7 +1146,7 @@ sunos_add_one_symbol (struct bfd_link_info *info,
hashp))
return FALSE;
if (abfd->xvec == info->hash->creator)
if (abfd->xvec == info->output_bfd->xvec)
{
/* Set a flag in the hash table entry indicating the type of
reference or definition we just found. Keep a count of the
@ -1191,7 +1192,7 @@ struct bfd_link_needed_list *
bfd_sunos_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED,
struct bfd_link_info *info)
{
if (info->hash->creator != &MY (vec))
if (info->output_bfd->xvec != &MY (vec))
return NULL;
return sunos_hash_table (info)->needed;
}

View File

@ -1,6 +1,6 @@
/* POWER/PowerPC XCOFF linker support.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -560,7 +560,7 @@ xcoff_link_add_dynamic_symbols (bfd *abfd, struct bfd_link_info *info)
/* We can only handle a dynamic object if we are generating an XCOFF
output file. */
if (info->hash->creator != abfd->xvec)
if (info->output_bfd->xvec != abfd->xvec)
{
(*_bfd_error_handler)
(_("%s: XCOFF shared object when not producing XCOFF output"),
@ -786,7 +786,7 @@ xcoff_link_create_extra_sections (bfd * abfd, struct bfd_link_info *info)
{
bfd_boolean return_value = FALSE;
if (info->hash->creator == abfd->xvec)
if (info->output_bfd->xvec == abfd->xvec)
{
/* We need to build a .loader section, so we do it here. This
won't work if we're producing an XCOFF output file with no
@ -1294,7 +1294,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
place. */
if (aux.x_csect.x_smclas == XMC_TC
&& sym.n_sclass == C_HIDEXT
&& info->hash->creator == abfd->xvec
&& info->output_bfd->xvec == abfd->xvec
&& ((bfd_xcoff_is_xcoff32 (abfd)
&& aux.x_csect.x_scnlen.l == 4)
|| (bfd_xcoff_is_xcoff64 (abfd)
@ -1664,7 +1664,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
shared object, which will cause symbol redefinitions,
although this is an easier case to detect. */
if (info->hash->creator == abfd->xvec)
if (info->output_bfd->xvec == abfd->xvec)
{
if (! bfd_is_und_section (section))
*sym_hash = xcoff_link_hash_lookup (xcoff_hash_table (info),
@ -1789,7 +1789,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
= csect->alignment_power;
}
if (info->hash->creator == abfd->xvec)
if (info->output_bfd->xvec == abfd->xvec)
{
int flag;
@ -1848,7 +1848,7 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
/* We identify all symbols which are called, so that we
can create glue code for calls to functions imported
from dynamic objects. */
if (info->hash->creator == abfd->xvec
if (info->output_bfd->xvec == abfd->xvec
&& *rel_csect != bfd_und_section_ptr
&& (rel->r_type == R_BR
|| rel->r_type == R_RBR)
@ -2066,7 +2066,7 @@ xcoff_link_check_ar_symbols (bfd *abfd,
if ((abfd->flags & DYNAMIC) != 0
&& ! info->static_link
&& info->hash->creator == abfd->xvec)
&& info->output_bfd->xvec == abfd->xvec)
return xcoff_link_check_dynamic_ar_symbols (abfd, info, pneeded);
symesz = bfd_coff_symesz (abfd);
@ -2099,7 +2099,7 @@ xcoff_link_check_ar_symbols (bfd *abfd,
undefined references in shared objects. */
if (h != NULL
&& h->type == bfd_link_hash_undefined
&& (info->hash->creator != abfd->xvec
&& (info->output_bfd->xvec != abfd->xvec
|| (((struct xcoff_link_hash_entry *) h)->flags
& XCOFF_DEF_DYNAMIC) == 0))
{
@ -2180,7 +2180,7 @@ _bfd_xcoff_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
while (member != NULL)
{
if (bfd_check_format (member, bfd_object)
&& (info->hash->creator == member->xvec)
&& (info->output_bfd->xvec == member->xvec)
&& (! bfd_has_map (abfd) || (member->flags & DYNAMIC) != 0))
{
bfd_boolean needed;
@ -2252,7 +2252,7 @@ xcoff_mark (struct bfd_link_info *info, asection *sec)
sec->flags |= SEC_MARK;
if (sec->owner->xvec == info->hash->creator
if (sec->owner->xvec == info->output_bfd->xvec
&& coff_section_data (sec->owner, sec) != NULL
&& xcoff_section_data (sec->owner, sec) != NULL)
{
@ -2386,7 +2386,7 @@ xcoff_sweep (struct bfd_link_info *info)
/* Keep all sections from non-XCOFF input files. Keep
special sections. Keep .debug sections for the
moment. */
if (sub->xvec != info->hash->creator
if (sub->xvec != info->output_bfd->xvec
|| o == xcoff_hash_table (info)->debug_section
|| o == xcoff_hash_table (info)->loader_section
|| o == xcoff_hash_table (info)->linkage_section
@ -2759,7 +2759,7 @@ xcoff_build_ldsyms (struct xcoff_link_hash_entry *h, void * p)
|| h->root.type == bfd_link_hash_defweak)
&& (h->root.u.def.section->owner == NULL
|| (h->root.u.def.section->owner->xvec
!= ldinfo->info->hash->creator)))
!= ldinfo->info->output_bfd->xvec)))
h->flags |= XCOFF_MARK;
/* If this symbol is called and defined in a dynamic object, or it
@ -3257,7 +3257,7 @@ bfd_xcoff_size_dynamic_sections (bfd *output_bfd,
bfd_byte *esym, *esymend;
bfd_size_type symesz;
if (sub->xvec != info->hash->creator)
if (sub->xvec != info->output_bfd->xvec)
continue;
subdeb = bfd_get_section_by_name (sub, ".debug");
if (subdeb == NULL || subdeb->size == 0)

View File

@ -1,3 +1,8 @@
2008-02-15 Alan Modra <amodra@bigpond.net.au>
* bfdlink.h (struct bfd_link_hash_table): Delete creator field.
(struct bfd_link_info): Add output_bfd.
2008-02-11 Bob Wilson <bob.wilson@acm.org>
* xtensa-config.h (XCHAL_HAVE_THREADPTR): Redefine to zero.

View File

@ -1,6 +1,6 @@
/* bfdlink.h -- header file for BFD link routines
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@ -160,11 +160,6 @@ struct bfd_link_hash_table
{
/* The hash table itself. */
struct bfd_hash_table table;
/* The back end which created this hash table. This indicates the
type of the entries in the hash table, which is sometimes
important information when linking object files of different
types together. */
const bfd_target *creator;
/* A linked list of undefined and common symbols, linked through the
next field in the bfd_link_hash_entry structure. */
struct bfd_link_hash_entry *undefs;
@ -396,6 +391,9 @@ struct bfd_link_info
option). If this is NULL, no symbols are being wrapped. */
struct bfd_hash_table *wrap_hash;
/* The output BFD. */
bfd *output_bfd;
/* The list of input BFD's involved in the link. These are chained
together via the link_next field. */
bfd *input_bfds;

View File

@ -1,3 +1,54 @@
2008-02-15 Alan Modra <amodra@bigpond.net.au>
* ldmain.h (output_bfd): Delete.
* ldmain.c (output_bfd): Delete.
Replace all occurrences of output_bfd with link_info.output_bfd.
* ldcref.c: Likewise.
* ldctor.c: Likewise.
* ldemul.c: Likewise.
* ldexp.c: Likewise.
* ldfile.c: Likewise.
* ldlang.c: Likewise.
* ldmisc.c: Likewise.
* ldwrite.c: Likewise.
* pe-dll.c: Likewise.
* emultempl/aix.em: Likewise.
* emultempl/alphaelf.em: Likewise.
* emultempl/armcoff.em: Likewise.
* emultempl/armelf.em: Likewise.
* emultempl/avrelf.em: Likewise.
* emultempl/beos.em: Likewise.
* emultempl/elf-generic.em: Likewise.
* emultempl/elf32.em: Likewise.
* emultempl/gld960.em: Likewise.
* emultempl/hppaelf.em: Likewise.
* emultempl/irix.em: Likewise.
* emultempl/linux.em: Likewise.
* emultempl/lnk960.em: Likewise.
* emultempl/m68hc1xelf.em: Likewise.
* emultempl/mmix-elfnmmo.em: Likewise.
* emultempl/mmo.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/scoreelf.em: Likewise.
* emultempl/sh64elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
* emultempl/sunos.em: Likewise.
* emultempl/vanilla.em: Likewise.
* emultempl/vxworks.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
* emultempl/z80.em: Likewise.
* ldlang.c (open_output): Don't return output, instead write
link_info_output_bfd directly.
* emultempl/alphaelf.em: Replace occurrences of link_info.hash->creator
with link_info.output_bfd->xvec.
* emultempl/hppaelf.em: Likewise.
* emultempl/ppc32elf.em: Likewise.
* emultempl/ppc64elf.em: Likewise.
* emultempl/spuelf.em: Likewise.
2008-02-07 Alan Modra <amodra@bigpond.net.au>
* ldlang.c (new_afile): Don't pass unadorned NULL to concat.

View File

@ -10,7 +10,7 @@ fragment <<EOF
/* AIX emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007
2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
@ -575,7 +575,7 @@ gld${EMULATION_NAME}_after_open (void)
executable. Of course, we only want to do this if we are
producing an XCOFF output file. */
r = link_info.relocatable;
if (strstr (bfd_get_target (output_bfd), "xcoff") != NULL)
if (strstr (bfd_get_target (link_info.output_bfd), "xcoff") != NULL)
link_info.relocatable = TRUE;
ldctor_build_sets ();
link_info.relocatable = r;
@ -600,7 +600,8 @@ gld${EMULATION_NAME}_after_open (void)
}
size = (p->count + 2) * 4;
if (!bfd_xcoff_link_record_set (output_bfd, &link_info, p->h, size))
if (!bfd_xcoff_link_record_set (link_info.output_bfd, &link_info,
p->h, size))
einfo ("%F%P: bfd_xcoff_link_record_set failed: %E\n");
}
}
@ -627,7 +628,7 @@ gld${EMULATION_NAME}_before_allocation (void)
h = bfd_link_hash_lookup (link_info.hash, el->name, FALSE, FALSE, FALSE);
if (h == NULL)
einfo ("%P%F: bfd_link_hash_lookup of export symbol failed: %E\n");
if (!bfd_xcoff_export_symbol (output_bfd, &link_info, h))
if (!bfd_xcoff_export_symbol (link_info.output_bfd, &link_info, h))
einfo ("%P%F: bfd_xcoff_export_symbol failed: %E\n");
}
@ -703,7 +704,7 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Let the XCOFF backend set up the .loader section. */
if (!bfd_xcoff_size_dynamic_sections
(output_bfd, &link_info, libpath, entry_symbol.name, file_align,
(link_info.output_bfd, &link_info, libpath, entry_symbol.name, file_align,
maxstack, maxdata, gc && !unix_ld ? TRUE : FALSE,
modtype, textro ? TRUE : FALSE, unix_ld, special_sections,
rtld ? TRUE : FALSE))
@ -1159,7 +1160,8 @@ gld${EMULATION_NAME}_read_file (const char *filename, bfd_boolean import)
}
else
{
if (!bfd_xcoff_import_symbol (output_bfd, &link_info, h,
if (!bfd_xcoff_import_symbol (link_info.output_bfd,
&link_info, h,
address, imppath, impfile,
impmember, syscall_flag))
einfo ("%X%s:%d: failed to import symbol %s: %E\n",
@ -1206,7 +1208,8 @@ gld${EMULATION_NAME}_find_relocs (lang_statement_union_type *s)
rs = &s->reloc_statement;
if (rs->name == NULL)
einfo ("%F%P: only relocations against symbols are permitted\n");
if (!bfd_xcoff_link_count_reloc (output_bfd, &link_info, rs->name))
if (!bfd_xcoff_link_count_reloc (link_info.output_bfd, &link_info,
rs->name))
einfo ("%F%P: bfd_xcoff_link_count_reloc failed: %E\n");
}
@ -1232,7 +1235,8 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
case etree_assign:
if (strcmp (exp->assign.dst, ".") != 0)
{
if (!bfd_xcoff_record_link_assignment (output_bfd, &link_info,
if (!bfd_xcoff_record_link_assignment (link_info.output_bfd,
&link_info,
exp->assign.dst))
einfo ("%P%F: failed to record assignment to %s: %E\n",
exp->assign.dst);
@ -1317,7 +1321,7 @@ static void
gld${EMULATION_NAME}_create_output_section_statements (void)
{
/* __rtinit */
if ((bfd_get_flavour (output_bfd) == bfd_target_xcoff_flavour)
if ((bfd_get_flavour (link_info.output_bfd) == bfd_target_xcoff_flavour)
&& (link_info.init_function != NULL
|| link_info.fini_function != NULL
|| rtld))
@ -1326,11 +1330,11 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
lang_input_file_is_file_enum,
NULL);
initfini_file->the_bfd = bfd_create ("initfini", output_bfd);
initfini_file->the_bfd = bfd_create ("initfini", link_info.output_bfd);
if (initfini_file->the_bfd == NULL
|| ! bfd_set_arch_mach (initfini_file->the_bfd,
bfd_get_arch (output_bfd),
bfd_get_mach (output_bfd)))
bfd_get_arch (link_info.output_bfd),
bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create BFD %E\n");
return;
@ -1355,13 +1359,13 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
static void
gld${EMULATION_NAME}_set_output_arch (void)
{
bfd_set_arch_mach (output_bfd,
bfd_xcoff_architecture (output_bfd),
bfd_xcoff_machine (output_bfd));
bfd_set_arch_mach (link_info.output_bfd,
bfd_xcoff_architecture (link_info.output_bfd),
bfd_xcoff_machine (link_info.output_bfd));
ldfile_output_architecture = bfd_get_arch (output_bfd);
ldfile_output_machine = bfd_get_mach (output_bfd);
ldfile_output_machine_name = bfd_printable_name (output_bfd);
ldfile_output_architecture = bfd_get_arch (link_info.output_bfd);
ldfile_output_machine = bfd_get_mach (link_info.output_bfd);
ldfile_output_machine_name = bfd_printable_name (link_info.output_bfd);
}
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
# Copyright 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -42,8 +42,8 @@ extern const bfd_target bfd_elf64_alpha_freebsd_vec;
static void
alpha_after_open (void)
{
if (link_info.hash->creator == &bfd_elf64_alpha_vec
|| link_info.hash->creator == &bfd_elf64_alpha_freebsd_vec)
if (link_info.output_bfd->xvec == &bfd_elf64_alpha_vec
|| link_info.output_bfd->xvec == &bfd_elf64_alpha_freebsd_vec)
{
unsigned int num_plt;
lang_output_section_statement_type *os;
@ -98,7 +98,7 @@ static void
alpha_finish (void)
{
if (limit_32bit)
elf_elfheader (output_bfd)->e_flags |= EF_ALPHA_32BIT;
elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
gld${EMULATION_NAME}_finish ();
}

View File

@ -5,7 +5,7 @@ fragment <<EOF
/* emulate the original gld for the given ${EMULATION_NAME}
Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2007 Free Software Foundation, Inc.
2004, 2005, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of the GNU Binutils.
@ -133,7 +133,7 @@ gld${EMULATION_NAME}_before_allocation (void)
static void
gld${EMULATION_NAME}_after_open (void)
{
if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
if (strstr (bfd_get_target (link_info.output_bfd), "arm") == NULL)
{
/* The arm backend needs special fields in the output hash structure.
These will only be created if the output format is an arm format,
@ -173,7 +173,7 @@ gld${EMULATION_NAME}_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
+ bfd_get_section_vma (output_bfd,
+ bfd_get_section_vma (link_info.output_bfd,
h->u.def.section->output_section)
+ h->u.def.section->output_offset);

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
# 2004, 2005, 2007
# 2004, 2005, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@ -53,7 +53,7 @@ gld${EMULATION_NAME}_before_parse (void)
static void
arm_elf_after_open (void)
{
if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
if (strstr (bfd_get_target (link_info.output_bfd), "arm") == NULL)
{
/* The arm backend needs special fields in the output hash structure.
These will only be created if the output format is an arm format,
@ -86,7 +86,7 @@ arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement)
{
asection *output_section = i->output_section;
ASSERT (output_section->owner == output_bfd);
ASSERT (output_section->owner == link_info.output_bfd);
/* Don't attach the interworking stubs to a dynamic object, to
an empty section, etc. */
@ -130,7 +130,7 @@ arm_elf_before_allocation (void)
/* Choose type of VFP11 erratum fix, or warn if specified fix is unnecessary
due to architecture version. */
bfd_elf32_arm_set_vfp11_fix (output_bfd, &link_info);
bfd_elf32_arm_set_vfp11_fix (link_info.output_bfd, &link_info);
/* We should be able to set the size of the interworking stub section. We
can't do it until later if we have dynamic sections, though. */
@ -212,7 +212,7 @@ arm_elf_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
+ bfd_get_section_vma (output_bfd,
+ bfd_get_section_vma (link_info.output_bfd,
h->u.def.section->output_section)
+ h->u.def.section->output_offset);
@ -241,7 +241,8 @@ arm_elf_finish (void)
static void
arm_elf_create_output_section_statements (void)
{
bfd_elf32_arm_set_target_relocs (output_bfd, &link_info, target1_is_rel,
bfd_elf32_arm_set_target_relocs (link_info.output_bfd, &link_info,
target1_is_rel,
target2_type, fix_v4bx, use_blx,
vfp11_denorm_fix, no_enum_size_warning,
pic_veneer);

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2006, 2007
# Copyright 2006, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@ -85,7 +85,7 @@ avr_elf_${EMULATION_NAME}_before_allocation (void)
if (avr_no_stubs)
return;
ret = elf32_avr_setup_section_lists (output_bfd, &link_info);
ret = elf32_avr_setup_section_lists (link_info.output_bfd, &link_info);
if (ret < 0)
einfo ("%X%P: can not setup the input section list: %E\n");
@ -94,7 +94,7 @@ avr_elf_${EMULATION_NAME}_before_allocation (void)
return;
/* Call into the BFD backend to do the real "stub"-work. */
if (! elf32_avr_size_stubs (output_bfd, &link_info, TRUE))
if (! elf32_avr_size_stubs (link_info.output_bfd, &link_info, TRUE))
einfo ("%X%P: can not size stub section: %E\n");
}
@ -110,11 +110,11 @@ avr_elf_create_output_section_statements (void)
lang_input_file_is_fake_enum,
NULL);
stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| !bfd_set_arch_mach (stub_file->the_bfd,
bfd_get_arch (output_bfd),
bfd_get_mach (output_bfd)))
bfd_get_arch (link_info.output_bfd),
bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create stub BFD %E\n");
return;
@ -157,7 +157,7 @@ avr_elf_finish (void)
stubs with the correct symbol addresses. Since there could have
been relaxation, the symbol addresses that were found during
first call may no longer be correct. */
if (!elf32_avr_size_stubs (output_bfd, &link_info, FALSE))
if (!elf32_avr_size_stubs (link_info.output_bfd, &link_info, FALSE))
{
einfo ("%X%P: can not size stub section: %E\n");
return;

View File

@ -8,7 +8,7 @@ fi
fragment <<EOF
/* This file is part of GLD, the Gnu Linker.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@ -382,13 +382,13 @@ gld_${EMULATION_NAME}_after_open (void)
/* Pass the wacky PE command line options into the output bfd.
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
if (!coff_data(output_bfd)->pe)
if (!coff_data(link_info.output_bfd)->pe)
{
einfo ("%F%P: PE operations on non PE file.\n");
}
pe_data(output_bfd)->pe_opthdr = pe;
pe_data(output_bfd)->dll = init[DLLOFF].value;
pe_data(link_info.output_bfd)->pe_opthdr = pe;
pe_data(link_info.output_bfd)->dll = init[DLLOFF].value;
}

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2006, 2007 Free Software Foundation, Inc.
# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -47,30 +47,34 @@ gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
need_layout = FALSE;
}
if (output_bfd->xvec->flavour == bfd_target_elf_flavour
if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
&& !link_info.relocatable)
{
bfd_size_type phdr_size;
phdr_size = elf_tdata (output_bfd)->program_header_size;
phdr_size = elf_tdata (link_info.output_bfd)->program_header_size;
/* If we don't have user supplied phdrs, throw away any
previous linker generated program headers. */
if (lang_phdr_list == NULL)
elf_tdata (output_bfd)->segment_map = NULL;
if (!_bfd_elf_map_sections_to_segments (output_bfd, &link_info))
elf_tdata (link_info.output_bfd)->segment_map = NULL;
if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
&link_info))
einfo ("%F%P: map sections to segments failed: %E\n");
if (phdr_size != elf_tdata (output_bfd)->program_header_size)
if (phdr_size
!= elf_tdata (link_info.output_bfd)->program_header_size)
{
if (tries > 6)
/* The first few times we allow any change to
phdr_size . */
need_layout = TRUE;
else if (phdr_size < elf_tdata (output_bfd)->program_header_size)
else if (phdr_size
< elf_tdata (link_info.output_bfd)->program_header_size)
/* After that we only allow the size to grow. */
need_layout = TRUE;
else
elf_tdata (output_bfd)->program_header_size = phdr_size;
elf_tdata (link_info.output_bfd)->program_header_size
= phdr_size;
}
}
}

View File

@ -307,7 +307,7 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed,
const char *soname;
int class;
abfd = bfd_openr (name, bfd_get_target (output_bfd));
abfd = bfd_openr (name, bfd_get_target (link_info.output_bfd));
if (abfd == NULL)
return FALSE;
if (! bfd_check_format (abfd, bfd_object))
@ -322,7 +322,7 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed,
}
/* For DT_NEEDED, they have to match. */
if (abfd->xvec != output_bfd->xvec)
if (abfd->xvec != link_info.output_bfd->xvec)
{
bfd_close (abfd);
return FALSE;
@ -1064,7 +1064,7 @@ gld${EMULATION_NAME}_after_open (void)
| SEC_READONLY | SEC_DATA);
if (s != NULL && bfd_set_section_alignment (abfd, s, 2))
{
struct elf_obj_tdata *t = elf_tdata (output_bfd);
struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
struct build_id_info *b = xmalloc (sizeof *b);
b->style = link_info.emit_note_gnu_build_id;
b->sec = s;
@ -1127,7 +1127,7 @@ gld${EMULATION_NAME}_after_open (void)
loop. */
if (!link_info.executable)
return;
needed = bfd_elf_get_needed_list (output_bfd, &link_info);
needed = bfd_elf_get_needed_list (link_info.output_bfd, &link_info);
for (l = needed; l != NULL; l = l->next)
{
struct bfd_link_needed_list *ll;
@ -1231,7 +1231,7 @@ fi
if [ "x${USE_LIBPATH}" = xyes ] ; then
fragment <<EOF
found = 0;
rp = bfd_elf_get_runpath_list (output_bfd, &link_info);
rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info);
for (; !found && rp != NULL; rp = rp->next)
{
char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
@ -1322,7 +1322,8 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
will do no harm. */
if (strcmp (exp->assign.dst, ".") != 0)
{
if (!bfd_elf_record_link_assignment (output_bfd, &link_info,
if (!bfd_elf_record_link_assignment (link_info.output_bfd,
&link_info,
exp->assign.dst, provide,
exp->assign.hidden))
einfo ("%P%F: failed to record assignment to %s: %E\n",
@ -1391,7 +1392,7 @@ gld${EMULATION_NAME}_before_allocation (void)
asection *sinterp;
if (link_info.hash->type == bfd_link_elf_hash_table)
_bfd_elf_tls_setup (output_bfd, &link_info);
_bfd_elf_tls_setup (link_info.output_bfd, &link_info);
/* If we are going to make any variable assignments, we need to let
the ELF backend know about them in case the variables are
@ -1404,7 +1405,7 @@ gld${EMULATION_NAME}_before_allocation (void)
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
if (! (bfd_elf_size_dynamic_sections
(output_bfd, command_line.soname, rpath,
(link_info.output_bfd, command_line.soname, rpath,
command_line.filter_shlib,
(const char * const *) command_line.auxiliary_filters,
&link_info, &sinterp, lang_elf_version_info)))
@ -1472,7 +1473,7 @@ ${ELF_INTERPRETER_SET_DEFAULT}
before_allocation_default ();
if (!bfd_elf_size_dynsym_hash_dynstr (output_bfd, &link_info))
if (!bfd_elf_size_dynsym_hash_dynstr (link_info.output_bfd, &link_info))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
}
@ -1710,7 +1711,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s)
if (os != NULL
&& (os->bfd_section == NULL
|| os->bfd_section->flags == 0
|| (_bfd_elf_match_sections_by_type (output_bfd,
|| (_bfd_elf_match_sections_by_type (link_info.output_bfd,
os->bfd_section,
s->owner, s)
&& ((s->flags ^ os->bfd_section->flags)
@ -1801,10 +1802,11 @@ gld${EMULATION_NAME}_place_orphan (asection *s)
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
loadable or allocatable characteristics. */
if (bfd_get_section_by_name (output_bfd, secname) != NULL)
if (bfd_get_section_by_name (link_info.output_bfd, secname) != NULL)
{
static int count = 1;
secname = bfd_get_unique_section_name (output_bfd, secname, &count);
secname = bfd_get_unique_section_name (link_info.output_bfd,
secname, &count);
if (secname == NULL)
einfo ("%F%P: place_orphan failed: %E\n");
}
@ -1822,7 +1824,8 @@ fragment <<EOF
static void
gld${EMULATION_NAME}_finish (void)
{
bfd_boolean need_layout = bfd_elf_discard_info (output_bfd, &link_info);
bfd_boolean need_layout = bfd_elf_discard_info (link_info.output_bfd,
&link_info);
gld${EMULATION_NAME}_map_segments (need_layout);
finish_default ();

View File

@ -1,7 +1,7 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
fragment <<EOF
/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007
/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@ -54,7 +54,8 @@ static void gld960_before_parse (void)
static void
gld960_set_output_arch (void)
{
bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
bfd_set_arch_mach (link_info.output_bfd,
ldfile_output_architecture, bfd_mach_i960_core);
}
static char *

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2007 Free Software Foundation, Inc.
# 2005, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -71,19 +71,19 @@ hppaelf_create_output_section_statements (void)
extern const bfd_target bfd_elf32_hppa_nbsd_vec;
extern const bfd_target bfd_elf32_hppa_vec;
if (link_info.hash->creator != &bfd_elf32_hppa_linux_vec
&& link_info.hash->creator != &bfd_elf32_hppa_nbsd_vec
&& link_info.hash->creator != &bfd_elf32_hppa_vec)
if (link_info.output_bfd->xvec != &bfd_elf32_hppa_linux_vec
&& link_info.output_bfd->xvec != &bfd_elf32_hppa_nbsd_vec
&& link_info.output_bfd->xvec != &bfd_elf32_hppa_vec)
return;
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| ! bfd_set_arch_mach (stub_file->the_bfd,
bfd_get_arch (output_bfd),
bfd_get_mach (output_bfd)))
bfd_get_arch (link_info.output_bfd),
bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create BFD %E\n");
return;
@ -236,7 +236,7 @@ build_section_lists (lang_statement_union_type *statement)
if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
&& i->output_section->owner == output_bfd)
&& i->output_section->owner == link_info.output_bfd)
{
elf32_hppa_next_input_section (&link_info, i);
}
@ -254,14 +254,15 @@ gld${EMULATION_NAME}_finish (void)
ie. doesn't affect any code, so we can delay resizing the
sections. It's likely we'll resize everything in the process of
adding stubs. */
if (bfd_elf_discard_info (output_bfd, &link_info))
if (bfd_elf_discard_info (link_info.output_bfd, &link_info))
need_laying_out = 1;
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
if (stub_file != NULL && !link_info.relocatable)
{
int ret = elf32_hppa_setup_section_lists (output_bfd, &link_info);
int ret = elf32_hppa_setup_section_lists (link_info.output_bfd,
&link_info);
if (ret != 0)
{
@ -274,7 +275,7 @@ gld${EMULATION_NAME}_finish (void)
lang_for_each_statement (build_section_lists);
/* Call into the BFD backend to do the real work. */
if (! elf32_hppa_size_stubs (output_bfd,
if (! elf32_hppa_size_stubs (link_info.output_bfd,
stub_file->the_bfd,
&link_info,
multi_subspace,
@ -294,7 +295,7 @@ gld${EMULATION_NAME}_finish (void)
if (! link_info.relocatable)
{
/* Set the global data pointer. */
if (! elf32_hppa_set_gp (output_bfd, &link_info))
if (! elf32_hppa_set_gp (link_info.output_bfd, &link_info))
{
einfo ("%X%P: can not set gp\n");
return;

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2004, 2006, 2007 Free Software Foundation, Inc.
# Copyright 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -33,7 +33,8 @@ static void
irix_after_open (void)
{
if (link_info.shared && command_line.soname == 0)
command_line.soname = (char *) lbasename (bfd_get_filename (output_bfd));
command_line.soname
= (char *) lbasename (bfd_get_filename (link_info.output_bfd));
gld${EMULATION_NAME}_after_open ();
}

View File

@ -10,7 +10,7 @@ fragment <<EOF
/* Linux a.out emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2007 Free Software Foundation, Inc.
2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
Linux support by Eric Youngdale <ericy@cais.cais.com>
@ -120,7 +120,8 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Let the backend work out the sizes of any sections required by
dynamic linking. */
if (! bfd_${EMULATION_NAME}_size_dynamic_sections (output_bfd, &link_info))
if (! bfd_${EMULATION_NAME}_size_dynamic_sections (link_info.output_bfd,
&link_info))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
before_allocation_default ();

View File

@ -189,7 +189,7 @@ lnk960_set_output_arch (void)
break;
}
}
bfd_set_arch_mach (output_bfd, ldfile_output_architecture,
bfd_set_arch_mach (link_info.output_bfd, ldfile_output_architecture,
ldfile_output_machine);
}

View File

@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2007
# Free Software Foundation, Inc.
# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2007,
# 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -72,7 +72,7 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation (void)
if (link_info.relocatable)
return;
ret = elf32_m68hc11_setup_section_lists (output_bfd, &link_info);
ret = elf32_m68hc11_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0 && no_trampoline == 0)
{
if (ret < 0)
@ -82,7 +82,7 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation (void)
}
/* Call into the BFD backend to do the real work. */
if (!elf32_m68hc11_size_stubs (output_bfd,
if (!elf32_m68hc11_size_stubs (link_info.output_bfd,
stub_file->the_bfd,
&link_info,
&m68hc11elf_add_stub_section))
@ -145,11 +145,11 @@ m68hc11elf_create_output_section_statements (void)
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| !bfd_set_arch_mach (stub_file->the_bfd,
bfd_get_arch (output_bfd),
bfd_get_mach (output_bfd)))
bfd_get_arch (link_info.output_bfd),
bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create BFD %E\n");
return;
@ -299,14 +299,14 @@ m68hc11elf_finish (void)
stubs with the correct symbol addresses. Since there could have
been relaxation, the symbol addresses that were found during
first call may no longer be correct. */
if (!elf32_m68hc11_size_stubs (output_bfd,
if (!elf32_m68hc11_size_stubs (link_info.output_bfd,
stub_file->the_bfd,
&link_info, 0))
{
einfo ("%X%P: can not size stub section: %E\n");
return;
}
if (!elf32_m68hc11_build_stubs (output_bfd, &link_info))
if (!elf32_m68hc11_build_stubs (link_info.output_bfd, &link_info))
einfo ("%X%P: can not build stubs: %E\n");
}

View File

@ -1,5 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
# Copyright 2001, 2002, 2003, 2004, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -43,7 +44,7 @@ mmix_before_allocation (void)
link). */
command_line.relax = TRUE;
if (!_bfd_mmix_before_linker_allocation (output_bfd, &link_info))
if (!_bfd_mmix_before_linker_allocation (link_info.output_bfd, &link_info))
einfo ("%X%P: Internal problems setting up section %s",
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
}
@ -56,7 +57,8 @@ static void
mmix_after_allocation (void)
{
asection *sec
= bfd_get_section_by_name (output_bfd, MMIX_REG_CONTENTS_SECTION_NAME);
= bfd_get_section_by_name (link_info.output_bfd,
MMIX_REG_CONTENTS_SECTION_NAME);
bfd_signed_vma regvma;
/* If there's no register section, we don't need to do anything. On the
@ -72,7 +74,7 @@ mmix_after_allocation (void)
there. */
if (sec == NULL)
sec
= bfd_get_section_by_name (output_bfd,
= bfd_get_section_by_name (link_info.output_bfd,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
if (sec == NULL)
return;
@ -91,16 +93,16 @@ mmix_after_allocation (void)
}
/* Set vma to correspond to first such register number * 8. */
bfd_set_section_vma (output_bfd, sec, (bfd_vma) regvma);
bfd_set_section_vma (link_info.output_bfd, sec, (bfd_vma) regvma);
/* Simplify symbol output for the register section (without contents;
created for register symbols) by setting the output offset to 0.
This section is only present when there are register symbols. */
sec = bfd_get_section_by_name (output_bfd, MMIX_REG_SECTION_NAME);
sec = bfd_get_section_by_name (link_info.output_bfd, MMIX_REG_SECTION_NAME);
if (sec != NULL)
bfd_set_section_vma (abfd, sec, 0);
if (!_bfd_mmix_after_linker_allocation (output_bfd, &link_info))
if (!_bfd_mmix_after_linker_allocation (link_info.output_bfd, &link_info))
{
/* This is a fatal error; make einfo call not return. */
einfo ("%F%P: Can't finalize linker-allocated global registers\n");

View File

@ -1,5 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
# Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -120,7 +121,7 @@ mmo_wipe_sec_reloc_flag (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED)
static void
mmo_finish (void)
{
bfd_map_over_sections (output_bfd, mmo_wipe_sec_reloc_flag, NULL);
bfd_map_over_sections (link_info.output_bfd, mmo_wipe_sec_reloc_flag, NULL);
gld${EMULATION_NAME}_map_segments (FALSE);
finish_default ();
}
@ -139,7 +140,7 @@ mmo_after_open (void)
example), we'd count relocs twice because they'd also be counted
along the usual route for ELF-only linking, which would lead to an
internal accounting error. */
if (bfd_get_flavour (output_bfd) != bfd_target_elf_flavour)
if (bfd_get_flavour (link_info.output_bfd) != bfd_target_elf_flavour)
{
LANG_FOR_EACH_INPUT_STATEMENT (is)
{

View File

@ -10,7 +10,7 @@ rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
fragment <<EOF
/* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
2005, 2006, 2007 Free Software Foundation, Inc.
2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@ -1008,18 +1008,20 @@ gld_${EMULATION_NAME}_after_open (void)
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == 0)
einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"), output_bfd);
if (coff_data (link_info.output_bfd) == NULL
|| coff_data (link_info.output_bfd)->pe == 0)
einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"),
link_info.output_bfd);
pe_data (output_bfd)->pe_opthdr = pe;
pe_data (output_bfd)->dll = init[DLLOFF].value;
pe_data (output_bfd)->real_flags |= real_flags;
pe_data (link_info.output_bfd)->pe_opthdr = pe;
pe_data (link_info.output_bfd)->dll = init[DLLOFF].value;
pe_data (link_info.output_bfd)->real_flags |= real_flags;
#ifdef DLL_SUPPORT
if (pe_enable_stdcall_fixup) /* -1=warn or 1=disable */
pe_fixup_stdcalls ();
pe_process_import_defs (output_bfd, & link_info);
pe_process_import_defs (link_info.output_bfd, &link_info);
pe_find_data_imports ();
@ -1028,17 +1030,17 @@ gld_${EMULATION_NAME}_after_open (void)
|| defined (TARGET_IS_arm_epoc_pe) \
|| defined (TARGET_IS_arm_wince_pe)
if (!link_info.relocatable)
pe_dll_build_sections (output_bfd, &link_info);
pe_dll_build_sections (link_info.output_bfd, &link_info);
else
pe_exe_build_sections (output_bfd, &link_info);
pe_exe_build_sections (link_info.output_bfd, &link_info);
#else
if (link_info.shared)
pe_dll_build_sections (output_bfd, &link_info);
pe_dll_build_sections (link_info.output_bfd, &link_info);
#endif
#endif /* DLL_SUPPORT */
#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe)
if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
if (strstr (bfd_get_target (link_info.output_bfd), "arm") == NULL)
{
/* The arm backend needs special fields in the output hash structure.
These will only be created if the output format is an arm format,
@ -1451,13 +1453,14 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
if (pe_def_file->base_address != (bfd_vma)(-1))
{
pe.ImageBase =
pe_data (output_bfd)->pe_opthdr.ImageBase =
init[IMAGEBASEOFF].value = pe_def_file->base_address;
pe.ImageBase
= pe_data (link_info.output_bfd)->pe_opthdr.ImageBase
= init[IMAGEBASEOFF].value
= pe_def_file->base_address;
init[IMAGEBASEOFF].inited = 1;
if (image_base_statement)
image_base_statement->exp =
exp_assop ('=', "__image_base__", exp_intop (pe.ImageBase));
image_base_statement->exp = exp_assop ('=', "__image_base__",
exp_intop (pe.ImageBase));
}
if (pe_def_file->stack_reserve != -1
@ -1531,7 +1534,7 @@ gld_${EMULATION_NAME}_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
+ bfd_get_section_vma (output_bfd,
+ bfd_get_section_vma (link_info.output_bfd,
h->u.def.section->output_section)
+ h->u.def.section->output_offset);
@ -1563,7 +1566,7 @@ gld_${EMULATION_NAME}_finish (void)
#endif
)
{
pe_dll_fill_sections (output_bfd, &link_info);
pe_dll_fill_sections (link_info.output_bfd, &link_info);
if (pe_implib_filename)
pe_dll_generate_implib (pe_def_file, pe_implib_filename);
}
@ -1571,7 +1574,7 @@ gld_${EMULATION_NAME}_finish (void)
/* ARM doesn't need relocs. */
else
{
pe_exe_fill_sections (output_bfd, &link_info);
pe_exe_fill_sections (link_info.output_bfd, &link_info);
}
#endif
@ -1581,7 +1584,7 @@ gld_${EMULATION_NAME}_finish (void)
/* I don't know where .idata gets set as code, but it shouldn't be. */
{
asection *asec = bfd_get_section_by_name (output_bfd, ".idata");
asection *asec = bfd_get_section_by_name (link_info.output_bfd, ".idata");
if (asec)
{
@ -1719,10 +1722,11 @@ gld_${EMULATION_NAME}_place_orphan (asection *s)
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
loadable or allocatable characteristics. */
if (bfd_get_section_by_name (output_bfd, secname) != NULL)
if (bfd_get_section_by_name (link_info.output_bfd, secname) != NULL)
{
static int count = 1;
secname = bfd_get_unique_section_name (output_bfd, secname, &count);
secname = bfd_get_unique_section_name (link_info.output_bfd,
secname, &count);
if (secname == NULL)
einfo ("%F%P: place_orphan failed: %E\n");
}

View File

@ -9,7 +9,7 @@ fi
rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
fragment <<EOF
/* Copyright 2006, 2007 Free Software Foundation, Inc.
/* Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Kai Tietz, OneVision Software GmbH&CoKg.
This file is part of the GNU Binutils.
@ -967,18 +967,20 @@ gld_${EMULATION_NAME}_after_open (void)
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == 0)
einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"), output_bfd);
if (coff_data (link_info.output_bfd) == NULL
|| coff_data (link_info.output_bfd)->pe == 0)
einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"),
link_info.output_bfd);
pe_data (output_bfd)->pe_opthdr = pep;
pe_data (output_bfd)->dll = init[DLLOFF].value;
pe_data (output_bfd)->real_flags |= real_flags;
pe_data (link_info.output_bfd)->pe_opthdr = pep;
pe_data (link_info.output_bfd)->dll = init[DLLOFF].value;
pe_data (link_info.output_bfd)->real_flags |= real_flags;
#ifdef DLL_SUPPORT
if (pep_enable_stdcall_fixup) /* -1=warn or 1=disable */
pep_fixup_stdcalls ();
pep_process_import_defs (output_bfd, & link_info);
pep_process_import_defs (link_info.output_bfd, &link_info);
pep_find_data_imports ();
@ -987,11 +989,11 @@ gld_${EMULATION_NAME}_after_open (void)
#else
if (!link_info.relocatable)
#endif
pep_dll_build_sections (output_bfd, &link_info);
pep_dll_build_sections (link_info.output_bfd, &link_info);
#ifndef TARGET_IS_i386pep
else
pep_exe_build_sections (output_bfd, &link_info);
pep_exe_build_sections (link_info.output_bfd, &link_info);
#endif
#endif /* DLL_SUPPORT */
@ -1280,13 +1282,14 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
if (pep_def_file->base_address != (bfd_vma)(-1))
{
pep.ImageBase =
pe_data (output_bfd)->pe_opthdr.ImageBase =
init[IMAGEBASEOFF].value = pep_def_file->base_address;
pep.ImageBase
= pe_data (link_info.output_bfd)->pe_opthdr.ImageBase
= init[IMAGEBASEOFF].value
= pep_def_file->base_address;
init[IMAGEBASEOFF].inited = 1;
if (image_base_statement)
image_base_statement->exp =
exp_assop ('=', "__image_base__", exp_intop (pep.ImageBase));
image_base_statement->exp = exp_assop ('=', "__image_base__",
exp_intop (pep.ImageBase));
}
if (pep_def_file->stack_reserve != -1
@ -1332,7 +1335,7 @@ gld_${EMULATION_NAME}_finish (void)
if (link_info.shared
|| (!link_info.relocatable && pep_def_file->num_exports != 0))
{
pep_dll_fill_sections (output_bfd, &link_info);
pep_dll_fill_sections (link_info.output_bfd, &link_info);
if (pep_implib_filename)
pep_dll_generate_implib (pep_def_file, pep_implib_filename);
}
@ -1343,7 +1346,7 @@ gld_${EMULATION_NAME}_finish (void)
/* I don't know where .idata gets set as code, but it shouldn't be. */
{
asection *asec = bfd_get_section_by_name (output_bfd, ".idata");
asection *asec = bfd_get_section_by_name (link_info.output_bfd, ".idata");
if (asec)
{
@ -1481,10 +1484,11 @@ gld_${EMULATION_NAME}_place_orphan (asection *s)
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
loadable or allocatable characteristics. */
if (bfd_get_section_by_name (output_bfd, secname) != NULL)
if (bfd_get_section_by_name (link_info.output_bfd, secname) != NULL)
{
static int count = 1;
secname = bfd_get_unique_section_name (output_bfd, secname, &count);
secname = bfd_get_unique_section_name (link_info.output_bfd,
secname, &count);
if (secname == NULL)
einfo ("%F%P: place_orphan failed: %E\n");
}

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
# Copyright 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -52,7 +52,7 @@ static int old_got = 0;
static void
ppc_after_open (void)
{
if (is_ppc_elf32_vec (link_info.hash->creator))
if (is_ppc_elf32_vec (link_info.output_bfd->xvec))
{
int new_plt;
int keep_new;
@ -63,8 +63,8 @@ ppc_after_open (void)
lang_output_section_statement_type *got_os[2];
emit_stub_syms |= link_info.emitrelocations;
new_plt = ppc_elf_select_plt_layout (output_bfd, &link_info, plt_style,
emit_stub_syms);
new_plt = ppc_elf_select_plt_layout (link_info.output_bfd, &link_info,
plt_style, emit_stub_syms);
if (new_plt < 0)
einfo ("%X%P: select_plt_layout problem %E\n");
@ -109,11 +109,11 @@ ppc_after_open (void)
static void
ppc_before_allocation (void)
{
if (is_ppc_elf32_vec (link_info.hash->creator))
if (is_ppc_elf32_vec (link_info.output_bfd->xvec))
{
if (ppc_elf_tls_setup (output_bfd, &link_info) && !notlsopt)
if (ppc_elf_tls_setup (link_info.output_bfd, &link_info) && !notlsopt)
{
if (!ppc_elf_tls_optimize (output_bfd, &link_info))
if (!ppc_elf_tls_optimize (link_info.output_bfd, &link_info))
{
einfo ("%X%P: TLS problem %E\n");
return;

View File

@ -75,8 +75,8 @@ ppc_create_output_section_statements (void)
extern const bfd_target bfd_elf64_powerpc_vec;
extern const bfd_target bfd_elf64_powerpcle_vec;
if (link_info.hash->creator != &bfd_elf64_powerpc_vec
&& link_info.hash->creator != &bfd_elf64_powerpcle_vec)
if (link_info.output_bfd->xvec != &bfd_elf64_powerpc_vec
&& link_info.output_bfd->xvec != &bfd_elf64_powerpcle_vec)
return;
link_info.wrap_char = '.';
@ -84,11 +84,11 @@ ppc_create_output_section_statements (void)
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| !bfd_set_arch_mach (stub_file->the_bfd,
bfd_get_arch (output_bfd),
bfd_get_mach (output_bfd)))
bfd_get_arch (link_info.output_bfd),
bfd_get_mach (link_info.output_bfd)))
{
einfo ("%F%P: can not create BFD %E\n");
return;
@ -105,10 +105,12 @@ ppc_before_allocation (void)
if (stub_file != NULL)
{
if (!no_opd_opt
&& !ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd))
&& !ppc64_elf_edit_opd (link_info.output_bfd, &link_info,
non_overlapping_opd))
einfo ("%X%P: can not edit %s %E\n", "opd");
if (ppc64_elf_tls_setup (output_bfd, &link_info) && !no_tls_opt)
if (ppc64_elf_tls_setup (link_info.output_bfd, &link_info)
&& !no_tls_opt)
{
/* Size the sections. This is premature, but we want to know the
TLS segment layout so that certain optimizations can be done. */
@ -116,7 +118,7 @@ ppc_before_allocation (void)
expld.dataseg.phase = exp_dataseg_none;
one_lang_size_sections_pass (NULL, TRUE);
if (!ppc64_elf_tls_optimize (output_bfd, &link_info))
if (!ppc64_elf_tls_optimize (link_info.output_bfd, &link_info))
einfo ("%X%P: TLS problem %E\n");
/* We must not cache anything from the preliminary sizing. */
@ -125,7 +127,7 @@ ppc_before_allocation (void)
if (!no_toc_opt
&& !link_info.relocatable
&& !ppc64_elf_edit_toc (output_bfd, &link_info))
&& !ppc64_elf_edit_toc (link_info.output_bfd, &link_info))
einfo ("%X%P: can not edit %s %E\n", "toc");
}
@ -271,7 +273,8 @@ static void
gld${EMULATION_NAME}_after_allocation (void)
{
if (!link_info.relocatable)
_bfd_set_gp_value (output_bfd, ppc64_elf_toc (output_bfd));
_bfd_set_gp_value (link_info.output_bfd,
ppc64_elf_toc (link_info.output_bfd));
}
@ -300,7 +303,7 @@ build_section_lists (lang_statement_union_type *statement)
if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
&& i->output_section->owner == output_bfd)
&& i->output_section->owner == link_info.output_bfd)
{
if (!ppc64_elf_next_input_section (&link_info, i))
einfo ("%X%P: can not size stub section: %E\n");
@ -323,29 +326,30 @@ gld${EMULATION_NAME}_finish (void)
ie. doesn't affect any code, so we can delay resizing the
sections. It's likely we'll resize everything in the process of
adding stubs. */
if (bfd_elf_discard_info (output_bfd, &link_info))
if (bfd_elf_discard_info (link_info.output_bfd, &link_info))
need_laying_out = 1;
/* If generating a relocatable output file, then we don't have any
stubs. */
if (stub_file != NULL && !link_info.relocatable)
{
int ret = ppc64_elf_setup_section_lists (output_bfd, &link_info,
int ret = ppc64_elf_setup_section_lists (link_info.output_bfd,
&link_info,
no_multi_toc);
if (ret < 0)
einfo ("%X%P: can not size stub section: %E\n");
else if (ret > 0)
{
toc_section = bfd_get_section_by_name (output_bfd, ".got");
toc_section = bfd_get_section_by_name (link_info.output_bfd, ".got");
if (toc_section != NULL)
lang_for_each_statement (build_toc_list);
ppc64_elf_reinit_toc (output_bfd, &link_info);
ppc64_elf_reinit_toc (link_info.output_bfd, &link_info);
lang_for_each_statement (build_section_lists);
/* Call into the BFD backend to do the real work. */
if (!ppc64_elf_size_stubs (output_bfd,
if (!ppc64_elf_size_stubs (link_info.output_bfd,
&link_info,
group_size,
&ppc_add_stub_section,
@ -359,9 +363,9 @@ gld${EMULATION_NAME}_finish (void)
if (link_info.relocatable)
{
asection *toc = bfd_get_section_by_name (output_bfd, ".toc");
asection *toc = bfd_get_section_by_name (link_info.output_bfd, ".toc");
if (toc != NULL
&& bfd_section_size (output_bfd, toc) > 0x10000)
&& bfd_section_size (link_info.output_bfd, toc) > 0x10000)
einfo ("%X%P: TOC section size exceeds 64k\n");
}

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2006, 2007 Free Software Foundation, Inc.
# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
# Contributed by:
# Mei Ligang (ligang@sunnorth.com.cn)
# Pei-Lin Tsai (pltsai@sunplus.com)
@ -40,7 +40,7 @@ gld${EMULATION_NAME}_before_parse ()
static void
score_elf_after_open (void)
{
if (strstr (bfd_get_target (output_bfd), "score") == NULL)
if (strstr (bfd_get_target (link_info.output_bfd), "score") == NULL)
{
/* The score backend needs special fields in the output hash structure.
These will only be created if the output format is an score format,

View File

@ -1,5 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
# Copyright 2000, 2001, 2002, 2003, 2004, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -53,7 +54,8 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
/* Call main function; we're just extending it. */
gld${EMULATION_NAME}_before_allocation ();
cranges = bfd_get_section_by_name (output_bfd, SH64_CRANGES_SECTION_NAME);
cranges = bfd_get_section_by_name (link_info.output_bfd,
SH64_CRANGES_SECTION_NAME);
if (cranges != NULL)
{
@ -117,7 +119,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
/* For each non-empty input section in each output section, check if it
has the same SH64-specific flags. If some input section differs, we
need a .cranges section. */
for (osec = output_bfd->sections;
for (osec = link_info.output_bfd->sections;
osec != NULL;
osec = osec->next)
{
@ -125,13 +127,13 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
bfd_vma oflags_isa = 0;
bfd_vma iflags_isa = 0;
if (bfd_get_flavour (output_bfd) != bfd_target_elf_flavour)
if (bfd_get_flavour (link_info.output_bfd) != bfd_target_elf_flavour)
einfo (_("%FError: non-ELF output formats are not supported by this target's linker.\n"));
sh64_sec_data = sh64_elf_section_data (osec)->sh64_info;
/* Omit excluded or garbage-collected sections. */
if (bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE)
if (bfd_get_section_flags (link_info.output_bfd, osec) & SEC_EXCLUDE)
continue;
/* Make sure we have the target section data initialized. */
@ -201,10 +203,10 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
sh64_elf_section_data; no need to set it
specifically here. */
cranges
= bfd_make_section (output_bfd,
= bfd_make_section (link_info.output_bfd,
SH64_CRANGES_SECTION_NAME);
if (cranges == NULL
|| !bfd_set_section_flags (output_bfd,
|| !bfd_set_section_flags (link_info.output_bfd,
cranges,
SEC_LINKER_CREATED
| SEC_KEEP
@ -245,8 +247,8 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
asection *osec;
bfd_byte *crangesp;
asection *cranges
= bfd_get_section_by_name (output_bfd, SH64_CRANGES_SECTION_NAME);
asection *cranges = bfd_get_section_by_name (link_info.output_bfd,
SH64_CRANGES_SECTION_NAME);
/* If this ever starts doing something, we will pick it up. */
after_allocation_default ();
@ -261,7 +263,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
first non-discarded section. For each input section in osec, we
check if it has the same flags. If it does not, we set flags to mark
a mixed section (and exit the loop early). */
for (osec = output_bfd->sections;
for (osec = link_info.output_bfd->sections;
osec != NULL;
osec = osec->next)
{
@ -269,7 +271,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
bfd_boolean need_check_cranges = FALSE;
/* Omit excluded or garbage-collected sections. */
if (bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE)
if (bfd_get_section_flags (link_info.output_bfd, osec) & SEC_EXCLUDE)
continue;
/* First find an input section so we have flags to compare with; the
@ -408,7 +410,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
/* Now pass over the sections again, and make reloc orders for the new
.cranges entries. Constants are set as we go. */
for (osec = output_bfd->sections;
for (osec = link_info.output_bfd->sections;
osec != NULL;
osec = osec->next)
{
@ -419,7 +421,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
/* Omit excluded or garbage-collected sections, and output sections
which were not marked as needing further processing. */
if ((bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE) != 0
if ((bfd_get_section_flags (link_info.output_bfd, osec) & SEC_EXCLUDE) != 0
|| (sh64_elf_section_data (osec)->sh64_info->contents_flags
!= SHF_SH5_ISA32_MIXED))
continue;
@ -477,7 +479,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
== osec->vma + isec->output_offset))
{
last_cr_size += cr_size;
bfd_put_32 (output_bfd, last_cr_size,
bfd_put_32 (link_info.output_bfd, last_cr_size,
crangesp - SH64_CRANGE_SIZE
+ SH64_CRANGE_CR_SIZE_OFFSET);
@ -494,7 +496,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
would leave us free to do some optimizations
later. */
cr_addr_order
= bfd_new_link_order (output_bfd, cranges);
= bfd_new_link_order (link_info.output_bfd, cranges);
if (cr_addr_order == NULL)
{
@ -518,12 +520,12 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
"partial inplace" REL-like relocation for this,
we put the addend in the contents and specify 0
for the reloc. */
bfd_put_32 (output_bfd, isec->output_offset,
bfd_put_32 (link_info.output_bfd, isec->output_offset,
crangesp + SH64_CRANGE_CR_ADDR_OFFSET);
cr_addr_order->u.reloc.p->addend = 0;
}
else
bfd_put_32 (output_bfd,
bfd_put_32 (link_info.output_bfd,
osec->vma + isec->output_offset,
crangesp + SH64_CRANGE_CR_ADDR_OFFSET);
@ -531,10 +533,10 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
it, but we would have to have a symbol for the size
of the _input_ section and there's no way to
generate that. */
bfd_put_32 (output_bfd, cr_size,
bfd_put_32 (link_info.output_bfd, cr_size,
crangesp + SH64_CRANGE_CR_SIZE_OFFSET);
bfd_put_16 (output_bfd, cr_type,
bfd_put_16 (link_info.output_bfd, cr_type,
crangesp + SH64_CRANGE_CR_TYPE_OFFSET);
last_cr_type = cr_type;

View File

@ -64,7 +64,7 @@ is_spu_target (void)
{
extern const bfd_target bfd_elf32_spu_vec;
return link_info.hash->creator == &bfd_elf32_spu_vec;
return link_info.output_bfd->xvec == &bfd_elf32_spu_vec;
}
/* Create our note section. */
@ -75,7 +75,7 @@ spu_after_open (void)
if (is_spu_target ()
&& !link_info.relocatable
&& link_info.input_bfds != NULL
&& !spu_elf_create_sections (output_bfd, &link_info,
&& !spu_elf_create_sections (link_info.output_bfd, &link_info,
stack_analysis, emit_stack_syms))
einfo ("%X%P: can not create note section: %E\n");
@ -198,11 +198,11 @@ spu_before_allocation (void)
one_lang_size_sections_pass (NULL, TRUE);
/* Find overlays by inspecting section vmas. */
if (spu_elf_find_overlays (output_bfd, &link_info))
if (spu_elf_find_overlays (link_info.output_bfd, &link_info))
{
int ret;
ret = spu_elf_size_stubs (output_bfd, &link_info,
ret = spu_elf_size_stubs (link_info.output_bfd, &link_info,
spu_place_special_section,
non_overlay_stubs);
if (ret == 0)
@ -225,7 +225,7 @@ gld${EMULATION_NAME}_finish (void)
{
int need_laying_out;
need_laying_out = bfd_elf_discard_info (output_bfd, &link_info);
need_laying_out = bfd_elf_discard_info (link_info.output_bfd, &link_info);
gld${EMULATION_NAME}_map_segments (need_laying_out);
@ -233,7 +233,8 @@ gld${EMULATION_NAME}_finish (void)
{
asection *s;
s = spu_elf_check_vma (output_bfd, local_store_lo, local_store_hi);
s = spu_elf_check_vma (link_info.output_bfd,
local_store_lo, local_store_hi);
if (s != NULL)
einfo ("%X%P: %A exceeds local store range\n", s);
}

View File

@ -10,7 +10,7 @@ fragment <<EOF
/* SunOS emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
SunOS shared library support by Ian Lance Taylor <ian@cygnus.com>
@ -378,7 +378,7 @@ gld${EMULATION_NAME}_after_open (void)
include another without requiring special action by the person
doing the link. Note that the needed list can actually grow
while we are stepping through this loop. */
needed = bfd_sunos_get_needed_list (output_bfd, &link_info);
needed = bfd_sunos_get_needed_list (link_info.output_bfd, &link_info);
for (l = needed; l != NULL; l = l->next)
{
struct bfd_link_needed_list *ll;
@ -405,7 +405,7 @@ gld${EMULATION_NAME}_after_open (void)
{
bfd *abfd;
abfd = bfd_openr (lname, bfd_get_target (output_bfd));
abfd = bfd_openr (lname, bfd_get_target (link_info.output_bfd));
if (abfd != NULL)
{
if (! bfd_check_format (abfd, bfd_object))
@ -555,7 +555,7 @@ gld${EMULATION_NAME}_try_needed (const char *dir, const char *name)
alc = (char *) xmalloc (strlen (dir) + strlen (file) + 2);
sprintf (alc, "%s/%s", dir, file);
free (file);
abfd = bfd_openr (alc, bfd_get_target (output_bfd));
abfd = bfd_openr (alc, bfd_get_target (link_info.output_bfd));
if (abfd == NULL)
return FALSE;
if (! bfd_check_format (abfd, bfd_object))
@ -715,7 +715,7 @@ gld${EMULATION_NAME}_before_allocation (void)
FALSE);
if (hdyn == NULL)
einfo ("%P%F: bfd_link_hash_lookup: %E\n");
if (! bfd_sunos_record_link_assignment (output_bfd, &link_info,
if (! bfd_sunos_record_link_assignment (link_info.output_bfd, &link_info,
"__DYNAMIC"))
einfo ("%P%F: failed to record assignment to __DYNAMIC: %E\n");
}
@ -727,8 +727,8 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Let the backend linker work out the sizes of any sections
required by dynamic linking. */
if (! bfd_sunos_size_dynamic_sections (output_bfd, &link_info, &sdyn,
&sneed, &srules))
if (! bfd_sunos_size_dynamic_sections (link_info.output_bfd, &link_info,
&sdyn, &sneed, &srules))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
if (sneed != NULL)
@ -847,7 +847,8 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
if (strcmp (exp->assign.dst, ".") != 0)
{
if (! bfd_sunos_record_link_assignment (output_bfd, &link_info,
if (! bfd_sunos_record_link_assignment (link_info.output_bfd,
&link_info,
exp->assign.dst))
einfo ("%P%F: failed to record assignment to %s: %E\n",
exp->assign.dst);
@ -914,12 +915,13 @@ gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp)
Instead, we use offsets, and rely on the BFD backend to
finish the section up correctly. FIXME: Talk about lack of
referential locality. */
bfd_put_32 (output_bfd, need_pnames - need_contents, need_pinfo);
bfd_put_32 (link_info.output_bfd, need_pnames - need_contents,
need_pinfo);
if (! inp->is_archive)
{
bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 4);
bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 8);
bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 10);
bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 4);
bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 8);
bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 10);
strcpy ((char *) need_pnames, inp->filename);
}
else
@ -927,22 +929,23 @@ gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp)
char *verstr;
int maj, min;
bfd_put_32 (output_bfd, (bfd_vma) 0x80000000, need_pinfo + 4);
bfd_put_32 (link_info.output_bfd, (bfd_vma) 0x80000000,
need_pinfo + 4);
maj = 0;
min = 0;
verstr = strstr (inp->filename, ".so.");
if (verstr != NULL)
sscanf (verstr, ".so.%d.%d", &maj, &min);
bfd_put_16 (output_bfd, (bfd_vma) maj, need_pinfo + 8);
bfd_put_16 (output_bfd, (bfd_vma) min, need_pinfo + 10);
bfd_put_16 (link_info.output_bfd, (bfd_vma) maj, need_pinfo + 8);
bfd_put_16 (link_info.output_bfd, (bfd_vma) min, need_pinfo + 10);
strcpy ((char *) need_pnames, inp->local_sym_name + 2);
}
c = (need_pinfo - need_contents) / NEED_ENTRY_SIZE;
if (c + 1 >= need_entries)
bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 12);
bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 12);
else
bfd_put_32 (output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE,
bfd_put_32 (link_info.output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE,
need_pinfo + 12);
need_pinfo += NEED_ENTRY_SIZE;

View File

@ -2,7 +2,7 @@
# It does some substitutions.
fragment <<EOF
/* A vanilla emulation with no defaults
Copyright 1991, 1992, 1994, 2000, 2001, 2002, 2003, 2007
Copyright 1991, 1992, 1994, 2000, 2001, 2002, 2003, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
@ -25,6 +25,7 @@ fragment <<EOF
#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"
#include "ld.h"
#include "ldmisc.h"
@ -44,7 +45,8 @@ vanilla_set_output_arch (void)
{
/* Set the output architecture and machine if possible */
unsigned long machine = 0;
bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine);
bfd_set_arch_mach (link_info.output_bfd,
ldfile_output_architecture, machine);
}
static char *

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2007 Free Software Foundation, Inc.
# Copyright 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@ -41,14 +41,14 @@ vxworks_after_open (void)
if (force_dynamic
&& link_info.input_bfds
&& output_bfd->xvec->flavour == bfd_target_elf_flavour
&& bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
&& !_bfd_elf_link_create_dynamic_sections (link_info.input_bfds,
&link_info))
einfo ("%X%P: Cannot create dynamic sections %E\n");
if (!force_dynamic
&& !link_info.shared
&& output_bfd->xvec->flavour == bfd_target_elf_flavour
&& bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
&& elf_hash_table (&link_info)->dynamic_sections_created)
einfo ("%X%P: Dynamic sections created in non-dynamic link\n");
}

View File

@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
# Copyright 2003, 2004, 2005, 2006, 2007
# Copyright 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@ -434,12 +434,14 @@ elf_xtensa_before_allocation (void)
required to process relocations) for the selected Xtensa
configuration. */
if (is_big_endian && output_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
if (is_big_endian
&& link_info.output_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
{
einfo (_("%F%P: little endian output does not match "
"Xtensa configuration\n"));
}
if (!is_big_endian && output_bfd->xvec->byteorder == BFD_ENDIAN_BIG)
if (!is_big_endian
&& link_info.output_bfd->xvec->byteorder == BFD_ENDIAN_BIG)
{
einfo (_("%F%P: big endian output does not match "
"Xtensa configuration\n"));

View File

@ -1,7 +1,7 @@
# This shell script emits C code -*- C -*-
# to keep track of the machine type of Z80 object files
# It does some substitutions.
# Copyright 2007 Free Software Foundation, Inc.
# Copyright 2007, 2008 Free Software Foundation, Inc.
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
@ -96,7 +96,7 @@ gldz80_after_open (void)
default:
mach_type = 0;
}
bfd_set_arch_mach (output_bfd, bfd_arch_z80, mach_type);
bfd_set_arch_mach (link_info.output_bfd, bfd_arch_z80, mach_type);
}
/* --- \end{z80.em} */
EOF

View File

@ -1,6 +1,6 @@
/* ldcref.c -- output a cross reference table
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006,
2007 Free Software Foundation, Inc.
2007, 2008 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>
This file is part of the GNU Binutils.
@ -327,7 +327,7 @@ cref_fill_array (struct cref_hash_entry *h, void *data)
struct cref_hash_entry ***pph = data;
ASSERT (h->demangled == NULL);
h->demangled = bfd_demangle (output_bfd, h->root.string,
h->demangled = bfd_demangle (link_info.output_bfd, h->root.string,
DMGL_ANSI | DMGL_PARAMS);
if (h->demangled == NULL)
h->demangled = h->root.string;

View File

@ -1,6 +1,6 @@
/* ldctor.c -- constructor support routines
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
By Steve Chamberlain <sac@cygnus.com>
This file is part of the GNU Binutils.
@ -273,13 +273,13 @@ ldctor_build_sets (void)
except that we use the right size instead of .long. When
generating relocatable output, we generate relocs instead of
addresses. */
howto = bfd_reloc_type_lookup (output_bfd, p->reloc);
howto = bfd_reloc_type_lookup (link_info.output_bfd, p->reloc);
if (howto == NULL)
{
if (link_info.relocatable)
{
einfo (_("%P%X: %s does not support reloc %s for set %s\n"),
bfd_get_target (output_bfd),
bfd_get_target (link_info.output_bfd),
bfd_get_reloc_code_name (p->reloc),
p->h->root.string);
continue;

View File

@ -1,6 +1,6 @@
/* ldemul.c -- clearing house for ld emulation states
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2005, 2007
2001, 2002, 2003, 2005, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@ -218,14 +218,14 @@ void
finish_default (void)
{
if (!link_info.relocatable)
_bfd_fix_excluded_sec_syms (output_bfd, &link_info);
_bfd_fix_excluded_sec_syms (link_info.output_bfd, &link_info);
}
void
set_output_arch_default (void)
{
/* Set the output architecture and machine if possible. */
bfd_set_arch_mach (output_bfd,
bfd_set_arch_mach (link_info.output_bfd,
ldfile_output_architecture, ldfile_output_machine);
}

View File

@ -1,6 +1,6 @@
/* This module handles expression trees.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>.
@ -489,7 +489,7 @@ fold_name (etree_type *tree)
/* Don't find the real header size if only marking sections;
The bfd function may cache incorrect data. */
if (expld.phase != lang_mark_phase_enum)
hdr_size = bfd_sizeof_headers (output_bfd, &link_info);
hdr_size = bfd_sizeof_headers (link_info.output_bfd, &link_info);
new_abs (hdr_size);
}
break;
@ -503,7 +503,8 @@ fold_name (etree_type *tree)
int def_iteration
= lang_symbol_definition_iteration (tree->name.name);
h = bfd_wrapped_link_hash_lookup (output_bfd, &link_info,
h = bfd_wrapped_link_hash_lookup (link_info.output_bfd,
&link_info,
tree->name.name,
FALSE, FALSE, TRUE);
expld.result.value = (h != NULL
@ -526,7 +527,8 @@ fold_name (etree_type *tree)
{
struct bfd_link_hash_entry *h;
h = bfd_wrapped_link_hash_lookup (output_bfd, &link_info,
h = bfd_wrapped_link_hash_lookup (link_info.output_bfd,
&link_info,
tree->name.name,
TRUE, FALSE, TRUE);
if (!h)
@ -628,7 +630,8 @@ fold_name (etree_type *tree)
bfd_vma val;
if (tree->type.node_code == SIZEOF)
val = os->bfd_section->size / bfd_octets_per_byte (output_bfd);
val = (os->bfd_section->size
/ bfd_octets_per_byte (link_info.output_bfd));
else
val = (bfd_vma)1 << os->bfd_section->alignment_power;

View File

@ -272,11 +272,11 @@ ldfile_try_open_bfd (const char *attempt,
}
if (entry->search_dirs_flag
&& !bfd_arch_get_compatible (check, output_bfd,
&& !bfd_arch_get_compatible (check, link_info.output_bfd,
command_line.accept_unknown_input_arch)
/* XCOFF archives can have 32 and 64 bit objects. */
&& ! (bfd_get_flavour (check) == bfd_target_xcoff_flavour
&& bfd_get_flavour (output_bfd) == bfd_target_xcoff_flavour
&& bfd_get_flavour (link_info.output_bfd) == bfd_target_xcoff_flavour
&& bfd_check_format (entry->the_bfd, bfd_archive)))
{
if (command_line.warn_search_mismatch)

View File

@ -1312,7 +1312,8 @@ lang_output_section_find_by_flags (const asection *sec,
if (look->bfd_section != NULL)
{
flags = look->bfd_section->flags;
if (match_type && !match_type (output_bfd, look->bfd_section,
if (match_type && !match_type (link_info.output_bfd,
look->bfd_section,
sec->owner, sec))
continue;
}
@ -1337,7 +1338,8 @@ lang_output_section_find_by_flags (const asection *sec,
if (look->bfd_section != NULL)
{
flags = look->bfd_section->flags;
if (match_type && !match_type (output_bfd, look->bfd_section,
if (match_type && !match_type (link_info.output_bfd,
look->bfd_section,
sec->owner, sec))
continue;
}
@ -1356,7 +1358,8 @@ lang_output_section_find_by_flags (const asection *sec,
if (look->bfd_section != NULL)
{
flags = look->bfd_section->flags;
if (match_type && !match_type (output_bfd, look->bfd_section,
if (match_type && !match_type (link_info.output_bfd,
look->bfd_section,
sec->owner, sec))
continue;
}
@ -1376,7 +1379,8 @@ lang_output_section_find_by_flags (const asection *sec,
if (look->bfd_section != NULL)
{
flags = look->bfd_section->flags;
if (match_type && !match_type (output_bfd, look->bfd_section,
if (match_type && !match_type (link_info.output_bfd,
look->bfd_section,
sec->owner, sec))
continue;
}
@ -1397,7 +1401,8 @@ lang_output_section_find_by_flags (const asection *sec,
if (look->bfd_section != NULL)
{
flags = look->bfd_section->flags;
if (match_type && !match_type (output_bfd, look->bfd_section,
if (match_type && !match_type (link_info.output_bfd,
look->bfd_section,
sec->owner, sec))
continue;
}
@ -1416,7 +1421,8 @@ lang_output_section_find_by_flags (const asection *sec,
if (look->bfd_section != NULL)
{
flags = look->bfd_section->flags;
if (match_type && !match_type (output_bfd, look->bfd_section,
if (match_type && !match_type (link_info.output_bfd,
look->bfd_section,
sec->owner, sec))
continue;
}
@ -1560,7 +1566,7 @@ lang_insert_orphan (asection *s,
etree_type *e_align;
symname = (char *) xmalloc (ps - secname + sizeof "__start_" + 1);
symname[0] = bfd_get_symbol_leading_char (output_bfd);
symname[0] = bfd_get_symbol_leading_char (link_info.output_bfd);
sprintf (symname + (symname[0] != 0), "__start_%s", secname);
e_align = exp_unop (ALIGN_K,
exp_intop ((bfd_vma) 1 << s->alignment_power));
@ -1595,7 +1601,7 @@ lang_insert_orphan (asection *s,
stat_ptr = &add;
symname = (char *) xmalloc (ps - secname + sizeof "__stop_" + 1);
symname[0] = bfd_get_symbol_leading_char (output_bfd);
symname[0] = bfd_get_symbol_leading_char (link_info.output_bfd);
sprintf (symname + (symname[0] != 0), "__stop_%s", secname);
lang_add_assignment (exp_provide (symname,
exp_nameop (NAME, "."),
@ -1632,7 +1638,7 @@ lang_insert_orphan (asection *s,
}
if (place->section == NULL)
place->section = &output_bfd->sections;
place->section = &link_info.output_bfd->sections;
as = *place->section;
@ -1641,18 +1647,18 @@ lang_insert_orphan (asection *s,
/* Put the section at the end of the list. */
/* Unlink the section. */
bfd_section_list_remove (output_bfd, snew);
bfd_section_list_remove (link_info.output_bfd, snew);
/* Now tack it back on in the right place. */
bfd_section_list_append (output_bfd, snew);
bfd_section_list_append (link_info.output_bfd, snew);
}
else if (as != snew && as->prev != snew)
{
/* Unlink the section. */
bfd_section_list_remove (output_bfd, snew);
bfd_section_list_remove (link_info.output_bfd, snew);
/* Now tack it back on in the right place. */
bfd_section_list_insert_before (output_bfd, as, snew);
bfd_section_list_insert_before (link_info.output_bfd, as, snew);
}
/* Save the end of this list. Further ophans of this type will
@ -1757,7 +1763,7 @@ lang_map (void)
for (s = file->the_bfd->sections; s != NULL; s = s->next)
if ((s->output_section == NULL
|| s->output_section->owner != output_bfd)
|| s->output_section->owner != link_info.output_bfd)
&& (s->flags & (SEC_LINKER_CREATED | SEC_KEEP)) == 0)
{
if (! dis_header_printed)
@ -1882,14 +1888,14 @@ init_os (lang_output_section_statement_type *s, asection *isec,
if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
einfo (_("%P%F: Illegal use of `%s' section\n"), DISCARD_SECTION_NAME);
s->bfd_section = bfd_get_section_by_name (output_bfd, s->name);
s->bfd_section = bfd_get_section_by_name (link_info.output_bfd, s->name);
if (s->bfd_section == NULL)
s->bfd_section = bfd_make_section_with_flags (output_bfd, s->name,
flags);
s->bfd_section = bfd_make_section_with_flags (link_info.output_bfd,
s->name, flags);
if (s->bfd_section == NULL)
{
einfo (_("%P%F: output format %s cannot represent section called %s\n"),
output_bfd->xvec->name, s->name);
link_info.output_bfd->xvec->name, s->name);
}
s->bfd_section->output_section = s->bfd_section;
s->bfd_section->output_offset = 0;
@ -1916,7 +1922,7 @@ init_os (lang_output_section_statement_type *s, asection *isec,
if (isec)
bfd_init_private_section_data (isec->owner, isec,
output_bfd, s->bfd_section,
link_info.output_bfd, s->bfd_section,
&link_info);
}
@ -2763,11 +2769,9 @@ lang_get_output_target (void)
/* Open the output file. */
static bfd *
static void
open_output (const char *name)
{
bfd *output;
output_target = lang_get_output_target ();
/* Has the user requested a particular endianness on the command
@ -2819,9 +2823,9 @@ open_output (const char *name)
}
}
output = bfd_openw (name, output_target);
link_info.output_bfd = bfd_openw (name, output_target);
if (output == NULL)
if (link_info.output_bfd == NULL)
{
if (bfd_get_error () == bfd_error_invalid_target)
einfo (_("%P%F: target %s not found\n"), output_target);
@ -2831,19 +2835,18 @@ open_output (const char *name)
delete_output_file_on_failure = TRUE;
if (! bfd_set_format (output, bfd_object))
if (! bfd_set_format (link_info.output_bfd, bfd_object))
einfo (_("%P%F:%s: can not make object file: %E\n"), name);
if (! bfd_set_arch_mach (output,
if (! bfd_set_arch_mach (link_info.output_bfd,
ldfile_output_architecture,
ldfile_output_machine))
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
link_info.hash = bfd_link_hash_table_create (output);
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
if (link_info.hash == NULL)
einfo (_("%P%F: can not create hash table: %E\n"));
bfd_set_gp_size (output, g_switch_value);
return output;
bfd_set_gp_size (link_info.output_bfd, g_switch_value);
}
static void
@ -2852,21 +2855,21 @@ ldlang_open_output (lang_statement_union_type *statement)
switch (statement->header.type)
{
case lang_output_statement_enum:
ASSERT (output_bfd == NULL);
output_bfd = open_output (statement->output_statement.name);
ASSERT (link_info.output_bfd == NULL);
open_output (statement->output_statement.name);
ldemul_set_output_arch ();
if (config.magic_demand_paged && !link_info.relocatable)
output_bfd->flags |= D_PAGED;
link_info.output_bfd->flags |= D_PAGED;
else
output_bfd->flags &= ~D_PAGED;
link_info.output_bfd->flags &= ~D_PAGED;
if (config.text_read_only)
output_bfd->flags |= WP_TEXT;
link_info.output_bfd->flags |= WP_TEXT;
else
output_bfd->flags &= ~WP_TEXT;
link_info.output_bfd->flags &= ~WP_TEXT;
if (link_info.traditional_format)
output_bfd->flags |= BFD_TRADITIONAL_FORMAT;
link_info.output_bfd->flags |= BFD_TRADITIONAL_FORMAT;
else
output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT;
link_info.output_bfd->flags &= ~BFD_TRADITIONAL_FORMAT;
break;
case lang_target_statement_enum:
@ -3078,7 +3081,7 @@ ldlang_add_undef (const char *const name)
new->name = xstrdup (name);
if (output_bfd != NULL)
if (link_info.output_bfd != NULL)
insert_undefined (new->name);
}
@ -3446,17 +3449,17 @@ process_insert_statements (void)
if (first_sec->prev != NULL)
first_sec->prev->next = last_sec->next;
else
output_bfd->sections = last_sec->next;
link_info.output_bfd->sections = last_sec->next;
if (last_sec->next != NULL)
last_sec->next->prev = first_sec->prev;
else
output_bfd->section_last = first_sec->prev;
link_info.output_bfd->section_last = first_sec->prev;
/* Add back. */
last_sec->next = sec->next;
if (sec->next != NULL)
sec->next->prev = last_sec;
else
output_bfd->section_last = last_sec;
link_info.output_bfd->section_last = last_sec;
first_sec->prev = sec;
sec->next = first_sec;
}
@ -3516,7 +3519,7 @@ strip_excluded_output_sections (void)
exclude = (output_section->rawsize == 0
&& (output_section->flags & SEC_KEEP) == 0
&& !bfd_section_removed_from_list (output_bfd,
&& !bfd_section_removed_from_list (link_info.output_bfd,
output_section));
/* Some sections have not yet been sized, notably .gnu.version,
@ -3548,8 +3551,8 @@ strip_excluded_output_sections (void)
&& !os->update_dot_tree)
os->ignored = TRUE;
output_section->flags |= SEC_EXCLUDE;
bfd_section_list_remove (output_bfd, output_section);
output_bfd->section_count--;
bfd_section_list_remove (link_info.output_bfd, output_section);
link_info.output_bfd->section_count--;
}
}
@ -3799,7 +3802,8 @@ print_input_section (asection *i)
++len;
}
if (i->output_section != NULL && i->output_section->owner == output_bfd)
if (i->output_section != NULL
&& i->output_section->owner == link_info.output_bfd)
addr = i->output_section->vma + i->output_offset;
else
{
@ -3826,7 +3830,8 @@ print_input_section (asection *i)
minfo (_("%W (size before relaxing)\n"), i->rawsize);
}
if (i->output_section != NULL && i->output_section->owner == output_bfd)
if (i->output_section != NULL
&& i->output_section->owner == link_info.output_bfd)
{
if (link_info.reduce_memory_overheads)
bfd_link_hash_traverse (link_info.hash, print_one_symbol, i);
@ -4300,15 +4305,15 @@ lang_check_section_addresses (void)
bfd_size_type amt;
lang_memory_region_type *m;
if (bfd_count_sections (output_bfd) <= 1)
if (bfd_count_sections (link_info.output_bfd) <= 1)
return;
amt = bfd_count_sections (output_bfd) * sizeof (asection *);
amt = bfd_count_sections (link_info.output_bfd) * sizeof (asection *);
sections = xmalloc (amt);
/* Scan all sections in the output list. */
count = 0;
for (s = output_bfd->sections; s != NULL; s = s->next)
for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
{
/* Only consider loadable sections with real contents. */
if (IGNORE_SECTION (s) || s->size == 0)
@ -4326,7 +4331,7 @@ lang_check_section_addresses (void)
spp = sections;
s = *spp++;
s_start = bfd_section_lma (output_bfd, s);
s_start = bfd_section_lma (link_info.output_bfd, s);
s_end = s_start + TO_ADDR (s->size) - 1;
for (count--; count; count--)
{
@ -4337,7 +4342,7 @@ lang_check_section_addresses (void)
os_start = s_start;
os_end = s_end;
s = *spp++;
s_start = bfd_section_lma (output_bfd, s);
s_start = bfd_section_lma (link_info.output_bfd, s);
s_end = s_start + TO_ADDR (s->size) - 1;
/* Look for an overlap. */
@ -4445,8 +4450,10 @@ lang_size_sections_1
address from the input section. FIXME: This is COFF
specific; it would be cleaner if there were some other way
to do this, but nothing simple comes to mind. */
if ((bfd_get_flavour (output_bfd) == bfd_target_ecoff_flavour
|| bfd_get_flavour (output_bfd) == bfd_target_coff_flavour)
if (((bfd_get_flavour (link_info.output_bfd)
== bfd_target_ecoff_flavour)
|| (bfd_get_flavour (link_info.output_bfd)
== bfd_target_coff_flavour))
&& (os->bfd_section->flags & SEC_COFF_SHARED_LIBRARY) != 0)
{
asection *input;
@ -4516,12 +4523,12 @@ lang_size_sections_1
if (command_line.check_section_addresses)
einfo (_("%P%F: error: no memory region specified"
" for loadable section `%s'\n"),
bfd_get_section_name (output_bfd,
bfd_get_section_name (link_info.output_bfd,
os->bfd_section));
else
einfo (_("%P: warning: no memory region specified"
" for loadable section `%s'\n"),
bfd_get_section_name (output_bfd,
bfd_get_section_name (link_info.output_bfd,
os->bfd_section));
}
@ -5010,7 +5017,7 @@ lang_size_sections (bfd_boolean *relax, bfd_boolean check_regions)
/* Find maximum alignment power of sections between
DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END. */
for (sec = output_bfd->sections; sec; sec = sec->next)
for (sec = link_info.output_bfd->sections; sec; sec = sec->next)
if (sec->vma >= expld.dataseg.base
&& sec->vma < expld.dataseg.relro_end
&& sec->alignment_power > max_alignment_power)
@ -5209,13 +5216,13 @@ lang_set_startof (void)
if (link_info.relocatable)
return;
for (s = output_bfd->sections; s != NULL; s = s->next)
for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
{
const char *secname;
char *buf;
struct bfd_link_hash_entry *h;
secname = bfd_get_section_name (output_bfd, s);
secname = bfd_get_section_name (link_info.output_bfd, s);
buf = xmalloc (10 + strlen (secname));
sprintf (buf, ".startof.%s", secname);
@ -5223,7 +5230,7 @@ lang_set_startof (void)
if (h != NULL && h->type == bfd_link_hash_undefined)
{
h->type = bfd_link_hash_defined;
h->u.def.value = bfd_get_section_vma (output_bfd, s);
h->u.def.value = bfd_get_section_vma (link_info.output_bfd, s);
h->u.def.section = bfd_abs_section_ptr;
}
@ -5278,10 +5285,10 @@ lang_end (void)
bfd_vma val;
val = (h->u.def.value
+ bfd_get_section_vma (output_bfd,
+ bfd_get_section_vma (link_info.output_bfd,
h->u.def.section->output_section)
+ h->u.def.section->output_offset);
if (! bfd_set_start_address (output_bfd, val))
if (! bfd_set_start_address (link_info.output_bfd, val))
einfo (_("%P%F:%s: can't set start address\n"), entry_symbol.name);
}
else
@ -5294,7 +5301,7 @@ lang_end (void)
val = bfd_scan_vma (entry_symbol.name, &send, 0);
if (*send == '\0')
{
if (! bfd_set_start_address (output_bfd, val))
if (! bfd_set_start_address (link_info.output_bfd, val))
einfo (_("%P%F: can't set start address\n"));
}
else
@ -5303,17 +5310,17 @@ lang_end (void)
/* Can't find the entry symbol, and it's not a number. Use
the first address in the text section. */
ts = bfd_get_section_by_name (output_bfd, entry_section);
ts = bfd_get_section_by_name (link_info.output_bfd, entry_section);
if (ts != NULL)
{
if (warn)
einfo (_("%P: warning: cannot find entry symbol %s;"
" defaulting to %V\n"),
entry_symbol.name,
bfd_get_section_vma (output_bfd, ts));
if (! bfd_set_start_address (output_bfd,
bfd_get_section_vma (output_bfd,
ts)))
bfd_get_section_vma (link_info.output_bfd, ts));
if (!(bfd_set_start_address
(link_info.output_bfd,
bfd_get_section_vma (link_info.output_bfd, ts))))
einfo (_("%P%F: can't set start address\n"));
}
else
@ -5354,7 +5361,7 @@ lang_check (void)
{
input_bfd = file->input_statement.the_bfd;
compatible
= bfd_arch_get_compatible (input_bfd, output_bfd,
= bfd_arch_get_compatible (input_bfd, link_info.output_bfd,
command_line.accept_unknown_input_arch);
/* In general it is not possible to perform a relocatable
@ -5365,13 +5372,14 @@ lang_check (void)
relocs for other link purposes than a final link). */
if ((link_info.relocatable || link_info.emitrelocations)
&& (compatible == NULL
|| bfd_get_flavour (input_bfd) != bfd_get_flavour (output_bfd))
|| (bfd_get_flavour (input_bfd)
!= bfd_get_flavour (link_info.output_bfd)))
&& (bfd_get_file_flags (input_bfd) & HAS_RELOC) != 0)
{
einfo (_("%P%F: Relocatable linking with relocations from"
" format %s (%B) to format %s (%B) is not supported\n"),
bfd_get_target (input_bfd), input_bfd,
bfd_get_target (output_bfd), output_bfd);
bfd_get_target (link_info.output_bfd), link_info.output_bfd);
/* einfo with %F exits. */
}
@ -5381,7 +5389,7 @@ lang_check (void)
einfo (_("%P%X: %s architecture of input file `%B'"
" is incompatible with %s output\n"),
bfd_printable_name (input_bfd), input_bfd,
bfd_printable_name (output_bfd));
bfd_printable_name (link_info.output_bfd));
}
else if (bfd_count_sections (input_bfd))
{
@ -5397,7 +5405,7 @@ lang_check (void)
information which is needed in the output file. */
if (! command_line.warn_mismatch)
pfn = bfd_set_error_handler (ignore_bfd_errors);
if (! bfd_merge_private_bfd_data (input_bfd, output_bfd))
if (! bfd_merge_private_bfd_data (input_bfd, link_info.output_bfd))
{
if (command_line.warn_mismatch)
einfo (_("%P%X: failed to merge target specific data"
@ -5489,7 +5497,7 @@ lang_one_common (struct bfd_link_hash_entry *h, void *info)
header_printed = TRUE;
}
name = bfd_demangle (output_bfd, h->root.string,
name = bfd_demangle (link_info.output_bfd, h->root.string,
DMGL_ANSI | DMGL_PARAMS);
if (name == NULL)
{
@ -5664,7 +5672,7 @@ ldlang_add_file (lang_input_statement_type *entry)
/* The BFD linker needs to have a list of all input BFDs involved in
a link. */
ASSERT (entry->the_bfd->link_next == NULL);
ASSERT (entry->the_bfd != output_bfd);
ASSERT (entry->the_bfd != link_info.output_bfd);
*link_info.input_bfds_tail = entry->the_bfd;
link_info.input_bfds_tail = &entry->the_bfd->link_next;
@ -5786,7 +5794,7 @@ lang_reset_memory_regions (void)
os->processed_lma = FALSE;
}
for (o = output_bfd->sections; o != NULL; o = o->next)
for (o = link_info.output_bfd->sections; o != NULL; o = o->next)
{
/* Save the last size for possible use by bfd_relax_section. */
o->rawsize = o->size;
@ -5858,7 +5866,7 @@ lang_gc_sections (void)
}
if (link_info.gc_sections)
bfd_gc_sections (output_bfd, &link_info);
bfd_gc_sections (link_info.output_bfd, &link_info);
}
/* Worker for lang_find_relro_sections_1. */
@ -5873,7 +5881,7 @@ find_relro_section_callback (lang_wild_statement_type *ptr ATTRIBUTE_UNUSED,
/* Discarded, excluded and ignored sections effectively have zero
size. */
if (section->output_section != NULL
&& section->output_section->owner == output_bfd
&& section->output_section->owner == link_info.output_bfd
&& (section->output_section->flags & SEC_EXCLUDE) == 0
&& !IGNORE_SECTION (section)
&& section->size != 0)
@ -6043,10 +6051,10 @@ lang_process (void)
sections, so that GCed sections are not merged, but before
assigning dynamic symbols, since removing whole input sections
is hard then. */
bfd_merge_sections (output_bfd, &link_info);
bfd_merge_sections (link_info.output_bfd, &link_info);
/* Look for a text section and set the readonly attribute in it. */
found = bfd_get_section_by_name (output_bfd, ".text");
found = bfd_get_section_by_name (link_info.output_bfd, ".text");
if (found != NULL)
{
@ -6376,11 +6384,11 @@ lang_abs_symbol_at_beginning_of (const char *secname, const char *name)
h->type = bfd_link_hash_defined;
sec = bfd_get_section_by_name (output_bfd, secname);
sec = bfd_get_section_by_name (link_info.output_bfd, secname);
if (sec == NULL)
h->u.def.value = 0;
else
h->u.def.value = bfd_get_section_vma (output_bfd, sec);
h->u.def.value = bfd_get_section_vma (link_info.output_bfd, sec);
h->u.def.section = bfd_abs_section_ptr;
}
@ -6407,11 +6415,11 @@ lang_abs_symbol_at_end_of (const char *secname, const char *name)
h->type = bfd_link_hash_defined;
sec = bfd_get_section_by_name (output_bfd, secname);
sec = bfd_get_section_by_name (link_info.output_bfd, secname);
if (sec == NULL)
h->u.def.value = 0;
else
h->u.def.value = (bfd_get_section_vma (output_bfd, sec)
h->u.def.value = (bfd_get_section_vma (link_info.output_bfd, sec)
+ TO_ADDR (sec->size));
h->u.def.section = bfd_abs_section_ptr;
@ -6605,7 +6613,7 @@ lang_record_phdrs (void)
else
at = exp_get_vma (l->at, 0, "phdr load address");
if (! bfd_record_phdr (output_bfd, l->type,
if (! bfd_record_phdr (link_info.output_bfd, l->type,
l->flags != NULL, flags, l->at != NULL,
at, l->filehdr, l->phdrs, c, secs))
einfo (_("%F%P: bfd_record_phdr failed: %E\n"));

View File

@ -1,6 +1,6 @@
/* Main program of GNU linker.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
2002, 2003, 2004, 2005, 2006, 2007
2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
@ -77,9 +77,6 @@ const char *ld_sysroot;
char * ld_canon_sysroot;
int ld_canon_sysroot_len;
/* The file that we're creating. */
bfd *output_bfd = 0;
/* Set by -G argument, for MIPS ECOFF target. */
int g_switch_value = 8;
@ -177,8 +174,8 @@ remove_output (void)
{
if (output_filename)
{
if (output_bfd)
bfd_cache_close (output_bfd);
if (link_info.output_bfd)
bfd_cache_close (link_info.output_bfd);
if (delete_output_file_on_failure)
unlink_if_ordinary (output_filename);
}
@ -463,9 +460,9 @@ main (int argc, char **argv)
/* Print error messages for any missing symbols, for any warning
symbols, and possibly multiple definitions. */
if (link_info.relocatable)
output_bfd->flags &= ~EXEC_P;
link_info.output_bfd->flags &= ~EXEC_P;
else
output_bfd->flags |= EXEC_P;
link_info.output_bfd->flags |= EXEC_P;
ldwrite ();
@ -492,8 +489,8 @@ main (int argc, char **argv)
}
else
{
if (! bfd_close (output_bfd))
einfo (_("%F%B: final close failed: %E\n"), output_bfd);
if (! bfd_close (link_info.output_bfd))
einfo (_("%F%B: final close failed: %E\n"), link_info.output_bfd);
/* If the --force-exe-suffix is enabled, and we're making an
executable file and it doesn't end in .exe, copy it to one
@ -1151,7 +1148,7 @@ constructor_callback (struct bfd_link_info *info,
/* Ensure that BFD_RELOC_CTOR exists now, so that we can give a
useful error message. */
if (bfd_reloc_type_lookup (output_bfd, BFD_RELOC_CTOR) == NULL
if (bfd_reloc_type_lookup (link_info.output_bfd, BFD_RELOC_CTOR) == NULL
&& (info->relocatable
|| bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
einfo (_("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"));
@ -1457,7 +1454,7 @@ reloc_overflow (struct bfd_link_info *info ATTRIBUTE_UNUSED,
reloc_name, entry->root.string,
entry->u.def.section,
entry->u.def.section == bfd_abs_section_ptr
? output_bfd : entry->u.def.section->owner);
? link_info.output_bfd : entry->u.def.section->owner);
break;
default:
abort ();

View File

@ -1,6 +1,6 @@
/* ldmain.h -
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2002, 2003, 2004,
2005, 2007 Free Software Foundation, Inc.
2005, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@ -29,7 +29,6 @@ extern int ld_canon_sysroot_len;
extern FILE *saved_script_handle;
extern FILE *previous_script_handle;
extern bfd_boolean force_make_executable;
extern bfd *output_bfd;
extern char *default_target;
extern bfd_boolean trace_files;
extern bfd_boolean trace_file_tries;

View File

@ -1,6 +1,6 @@
/* ldmisc.c
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
@ -152,7 +152,7 @@ vfinfo (FILE *fp, const char *fmt, va_list arg, bfd_boolean is_warning)
{
char *demangled;
demangled = bfd_demangle (output_bfd, name,
demangled = bfd_demangle (link_info.output_bfd, name,
DMGL_ANSI | DMGL_PARAMS);
if (demangled != NULL)
{

View File

@ -1,6 +1,6 @@
/* ldwrite.c -- write out the linked file
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002,
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain sac@cygnus.com
This file is part of the GNU Binutils.
@ -49,9 +49,9 @@ build_link_order (lang_statement_union_type *statement)
bfd_boolean big_endian = FALSE;
output_section = statement->data_statement.output_section;
ASSERT (output_section->owner == output_bfd);
ASSERT (output_section->owner == link_info.output_bfd);
link_order = bfd_new_link_order (output_bfd, output_section);
link_order = bfd_new_link_order (link_info.output_bfd, output_section);
if (link_order == NULL)
einfo (_("%P%F: bfd_new_link_order failed\n"));
@ -66,9 +66,9 @@ build_link_order (lang_statement_union_type *statement)
By convention, the bfd_put routines for an unknown
endianness are big endian, so we must swap here if the
input file is little endian. */
if (bfd_big_endian (output_bfd))
if (bfd_big_endian (link_info.output_bfd))
big_endian = TRUE;
else if (bfd_little_endian (output_bfd))
else if (bfd_little_endian (link_info.output_bfd))
big_endian = FALSE;
else
{
@ -132,13 +132,14 @@ build_link_order (lang_statement_union_type *statement)
}
}
ASSERT (output_section->owner == output_bfd);
ASSERT (output_section->owner == link_info.output_bfd);
switch (statement->data_statement.type)
{
case QUAD:
case SQUAD:
if (sizeof (bfd_vma) >= QUAD_SIZE)
bfd_put_64 (output_bfd, value, link_order->u.data.contents);
bfd_put_64 (link_info.output_bfd, value,
link_order->u.data.contents);
else
{
bfd_vma high;
@ -149,25 +150,28 @@ build_link_order (lang_statement_union_type *statement)
high = 0;
else
high = (bfd_vma) -1;
bfd_put_32 (output_bfd, high,
bfd_put_32 (link_info.output_bfd, high,
(link_order->u.data.contents
+ (big_endian ? 0 : 4)));
bfd_put_32 (output_bfd, value,
bfd_put_32 (link_info.output_bfd, value,
(link_order->u.data.contents
+ (big_endian ? 4 : 0)));
}
link_order->size = QUAD_SIZE;
break;
case LONG:
bfd_put_32 (output_bfd, value, link_order->u.data.contents);
bfd_put_32 (link_info.output_bfd, value,
link_order->u.data.contents);
link_order->size = LONG_SIZE;
break;
case SHORT:
bfd_put_16 (output_bfd, value, link_order->u.data.contents);
bfd_put_16 (link_info.output_bfd, value,
link_order->u.data.contents);
link_order->size = SHORT_SIZE;
break;
case BYTE:
bfd_put_8 (output_bfd, value, link_order->u.data.contents);
bfd_put_8 (link_info.output_bfd, value,
link_order->u.data.contents);
link_order->size = BYTE_SIZE;
break;
default:
@ -185,9 +189,9 @@ build_link_order (lang_statement_union_type *statement)
rs = &statement->reloc_statement;
output_section = rs->output_section;
ASSERT (output_section->owner == output_bfd);
ASSERT (output_section->owner == link_info.output_bfd);
link_order = bfd_new_link_order (output_bfd, output_section);
link_order = bfd_new_link_order (link_info.output_bfd, output_section);
if (link_order == NULL)
einfo (_("%P%F: bfd_new_link_order failed\n"));
@ -202,7 +206,7 @@ build_link_order (lang_statement_union_type *statement)
if (rs->name == NULL)
{
link_order->type = bfd_section_reloc_link_order;
if (rs->section->owner == output_bfd)
if (rs->section->owner == link_info.output_bfd)
link_order->u.reloc.p->u.section = rs->section;
else
{
@ -229,7 +233,7 @@ build_link_order (lang_statement_union_type *statement)
{
asection *output_section = i->output_section;
ASSERT (output_section->owner == output_bfd);
ASSERT (output_section->owner == link_info.output_bfd);
if ((output_section->flags & SEC_HAS_CONTENTS) != 0
|| ((output_section->flags & SEC_LOAD) != 0
@ -237,7 +241,8 @@ build_link_order (lang_statement_union_type *statement)
{
struct bfd_link_order *link_order;
link_order = bfd_new_link_order (output_bfd, output_section);
link_order = bfd_new_link_order (link_info.output_bfd,
output_section);
if (i->flags & SEC_NEVER_LOAD)
{
@ -269,13 +274,14 @@ build_link_order (lang_statement_union_type *statement)
output_section = statement->padding_statement.output_section;
ASSERT (statement->padding_statement.output_section->owner
== output_bfd);
== link_info.output_bfd);
if (((output_section->flags & SEC_HAS_CONTENTS) != 0
|| ((output_section->flags & SEC_LOAD) != 0
&& (output_section->flags & SEC_THREAD_LOCAL)))
&& (output_section->flags & SEC_NEVER_LOAD) == 0)
{
link_order = bfd_new_link_order (output_bfd, output_section);
link_order = bfd_new_link_order (link_info.output_bfd,
output_section);
link_order->type = bfd_data_link_order;
link_order->size = statement->padding_statement.size;
link_order->offset = statement->padding_statement.output_offset;
@ -557,8 +563,8 @@ ldwrite (void)
if (config.split_by_reloc != (unsigned) -1
|| config.split_by_file != (bfd_size_type) -1)
split_sections (output_bfd, &link_info);
if (!bfd_final_link (output_bfd, &link_info))
split_sections (link_info.output_bfd, &link_info);
if (!bfd_final_link (link_info.output_bfd, &link_info))
{
/* If there was an error recorded, print it out. Otherwise assume
an appropriate error message like unknown symbol was printed

View File

@ -1,6 +1,6 @@
/* Routines to help build PEI-format DLLs (Win32 etc)
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008 Free Software Foundation, Inc.
Written by DJ Delorie <dj@cygnus.com>
This file is part of the GNU Binutils.
@ -858,11 +858,12 @@ build_filler_bfd (int include_edata)
filler_file = lang_add_input_file ("dll stuff",
lang_input_file_is_fake_enum,
NULL);
filler_file->the_bfd = filler_bfd = bfd_create ("dll stuff", output_bfd);
filler_file->the_bfd = filler_bfd = bfd_create ("dll stuff",
link_info.output_bfd);
if (filler_bfd == NULL
|| !bfd_set_arch_mach (filler_bfd,
bfd_get_arch (output_bfd),
bfd_get_mach (output_bfd)))
bfd_get_arch (link_info.output_bfd),
bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create BFD: %E\n");
return;
@ -1445,9 +1446,10 @@ pe_dll_generate_def_file (const char *pe_out_def_filename)
quoteput (pe_def_file->name, out, 1);
if (pe_data (output_bfd)->pe_opthdr.ImageBase)
if (pe_data (link_info.output_bfd)->pe_opthdr.ImageBase)
fprintf (out, " BASE=0x%lx",
(unsigned long) pe_data (output_bfd)->pe_opthdr.ImageBase);
(unsigned long)
pe_data (link_info.output_bfd)->pe_opthdr.ImageBase);
fprintf (out, "\n");
}
@ -2334,12 +2336,12 @@ pe_create_import_fixup (arelent *rel, asection *s, int addend)
if (!name_thunk_sym || name_thunk_sym->type != bfd_link_hash_defined)
{
bfd *b = make_singleton_name_thunk (name, output_bfd);
bfd *b = make_singleton_name_thunk (name, link_info.output_bfd);
add_bfd_to_link (b, b->filename, &link_info);
/* If we ever use autoimport, we have to cast text section writable. */
config.text_read_only = FALSE;
output_bfd->flags &= ~WP_TEXT;
link_info.output_bfd->flags &= ~WP_TEXT;
}
if (addend == 0 || link_info.pei386_runtime_pseudo_reloc)
@ -2347,7 +2349,8 @@ pe_create_import_fixup (arelent *rel, asection *s, int addend)
extern char * pe_data_import_dll;
char * dll_symname = pe_data_import_dll ? pe_data_import_dll : "unknown";
b = make_import_fixup_entry (name, fixup_name, dll_symname, output_bfd);
b = make_import_fixup_entry (name, fixup_name, dll_symname,
link_info.output_bfd);
add_bfd_to_link (b, b->filename, &link_info);
}
@ -2358,12 +2361,13 @@ pe_create_import_fixup (arelent *rel, asection *s, int addend)
if (pe_dll_extra_pe_debug)
printf ("creating runtime pseudo-reloc entry for %s (addend=%d)\n",
fixup_name, addend);
b = make_runtime_pseudo_reloc (name, fixup_name, addend, output_bfd);
b = make_runtime_pseudo_reloc (name, fixup_name, addend,
link_info.output_bfd);
add_bfd_to_link (b, b->filename, &link_info);
if (runtime_pseudo_relocs_created == 0)
{
b = pe_create_runtime_relocator_reference (output_bfd);
b = pe_create_runtime_relocator_reference (link_info.output_bfd);
add_bfd_to_link (b, b->filename, &link_info);
}
runtime_pseudo_relocs_created++;