* 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.
+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.
/* 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>.
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
/* 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);
/* 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.
(*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
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;
/* 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)
/* 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)
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.
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. */
/* 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;
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))
/* 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.
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.
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;
/* 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. */
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);
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))
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;
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;
/* 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.
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;
&& 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;
}
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);
/* 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
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
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.
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;
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))
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;
/* 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.
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;
&& 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;
}
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);
/* 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.
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;
&& 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;
}
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);
/* 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.
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
/* 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;
}
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
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
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;
}
/* 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.
/* 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"),
{
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
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)
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),
= csect->alignment_power;
}
- if (info->hash->creator == abfd->xvec)
+ if (info->output_bfd->xvec == abfd->xvec)
{
int flag;
/* 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)
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);
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))
{
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;
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)
{
/* 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
|| 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
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)
+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.
/* 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.
{
/* 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;
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;
+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.
/* 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>
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;
}
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");
}
}
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");
}
/* 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))
}
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",
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");
}
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);
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))
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;
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 = {
# 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.
#
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;
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 ();
}
/* 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.
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,
/* 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);
# 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.
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,
{
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. */
/* 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. */
/* 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);
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);
# 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.
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");
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");
}
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;
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;
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.
/* 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;
}
\f
# 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.
#
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;
}
}
}
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))
}
/* 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;
| 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;
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;
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);
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",
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
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)))
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");
}
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)
/* 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");
}
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 ();
# 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.
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 *
# 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.
#
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;
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);
}
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)
{
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,
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;
# 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.
#
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 ();
}
/* 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>
/* 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 ();
break;
}
}
- bfd_set_arch_mach (output_bfd, ldfile_output_architecture,
+ bfd_set_arch_mach (link_info.output_bfd, ldfile_output_architecture,
ldfile_output_machine);
}
# 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.
#
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)
}
/* 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))
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;
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");
}
# 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.
#
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);
}
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
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;
}
/* 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");
# 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.
#
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 ();
}
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)
{
(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.
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 ();
|| 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,
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
/* 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);
#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);
}
/* 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
/* 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)
{
/* 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");
}
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.
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 ();
#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 */
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
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);
}
/* 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)
{
/* 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");
}
# 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.
#
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;
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");
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;
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 = '.';
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;
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. */
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. */
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");
}
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));
}
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");
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,
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");
}
# 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)
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,
# 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.
#
/* 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)
{
/* 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)
{
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. */
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
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 ();
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)
{
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
/* 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)
{
/* 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;
== 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);
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)
{
"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);
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;
{
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. */
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");
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)
{
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);
{
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);
}
/* 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>
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;
{
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))
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))
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");
}
/* 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)
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);
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
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;
# 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
#include "sysdep.h"
#include "bfd.h"
+#include "bfdlink.h"
#include "ld.h"
#include "ldmisc.h"
{
/* 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 *
# 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.
#
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");
}
# 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.
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"));
# 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
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
/* 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.
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;
/* 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.
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;
/* 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.
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);
}
/* 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>.
/* 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;
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
{
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)
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;
}
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)
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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));
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, "."),
}
if (place->section == NULL)
- place->section = &output_bfd->sections;
+ place->section = &link_info.output_bfd->sections;
as = *place->section;
/* 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
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)
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;
if (isec)
bfd_init_private_section_data (isec->owner, isec,
- output_bfd, s->bfd_section,
+ link_info.output_bfd, s->bfd_section,
&link_info);
}
/* 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
}
}
- 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);
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
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:
new->name = xstrdup (name);
- if (output_bfd != NULL)
+ if (link_info.output_bfd != NULL)
insert_undefined (new->name);
}
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;
}
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,
&& !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--;
}
}
++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
{
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);
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)
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--)
{
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. */
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;
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));
}
/* 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)
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);
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;
}
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
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
/* 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
{
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
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. */
}
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))
{
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"
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)
{
/* 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;
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;
}
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. */
/* 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)
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)
{
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;
}
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;
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"));
/* 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
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;
{
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);
}
/* 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 ();
}
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
/* 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"));
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 ();
/* 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.
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;
/* 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.
{
char *demangled;
- demangled = bfd_demangle (output_bfd, name,
+ demangled = bfd_demangle (link_info.output_bfd, name,
DMGL_ANSI | DMGL_PARAMS);
if (demangled != NULL)
{
/* 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.
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"));
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
{
}
}
- 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;
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:
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"));
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
{
{
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
{
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)
{
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;
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
/* 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.
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;
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");
}
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)
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);
}
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++;