aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2008-02-15 03:35:53 +0000
committerAlan Modra <amodra@gmail.com>2008-02-15 03:35:53 +0000
commitf13a99db51c0ca487f4a0a41b14dc255d386c4ff (patch)
treec5941da40d8747eeb0ded9455c971313d8d2db5f /ld/emultempl
parent54aff08f3b1f29d1a6b262b3143475409909d7b9 (diff)
downloadfsf-binutils-gdb-f13a99db51c0ca487f4a0a41b14dc255d386c4ff.zip
fsf-binutils-gdb-f13a99db51c0ca487f4a0a41b14dc255d386c4ff.tar.gz
fsf-binutils-gdb-f13a99db51c0ca487f4a0a41b14dc255d386c4ff.tar.bz2
include/
* 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.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/aix.em40
-rw-r--r--ld/emultempl/alphaelf.em8
-rw-r--r--ld/emultempl/armcoff.em6
-rw-r--r--ld/emultempl/armelf.em13
-rw-r--r--ld/emultempl/avrelf.em14
-rw-r--r--ld/emultempl/beos.em8
-rw-r--r--ld/emultempl/elf-generic.em20
-rw-r--r--ld/emultempl/elf32.em29
-rw-r--r--ld/emultempl/gld960.em5
-rw-r--r--ld/emultempl/hppaelf.em25
-rw-r--r--ld/emultempl/irix.em5
-rw-r--r--ld/emultempl/linux.em5
-rw-r--r--ld/emultempl/lnk960.em2
-rw-r--r--ld/emultempl/m68hc1xelf.em18
-rw-r--r--ld/emultempl/mmix-elfnmmo.em16
-rw-r--r--ld/emultempl/mmo.em7
-rw-r--r--ld/emultempl/pe.em48
-rw-r--r--ld/emultempl/pep.em40
-rw-r--r--ld/emultempl/ppc32elf.em14
-rw-r--r--ld/emultempl/ppc64elf.em40
-rw-r--r--ld/emultempl/scoreelf.em4
-rw-r--r--ld/emultempl/sh64elf.em40
-rw-r--r--ld/emultempl/spuelf.em13
-rw-r--r--ld/emultempl/sunos.em37
-rw-r--r--ld/emultempl/vanilla.em6
-rw-r--r--ld/emultempl/vxworks.em6
-rw-r--r--ld/emultempl/xtensaelf.em8
-rw-r--r--ld/emultempl/z80.em4
28 files changed, 261 insertions, 220 deletions
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 9aa0d50..ecb6645 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -10,7 +10,7 @@ fragment <<EOF
/* AIX emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007
+ 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
@@ -575,7 +575,7 @@ gld${EMULATION_NAME}_after_open (void)
executable. Of course, we only want to do this if we are
producing an XCOFF output file. */
r = link_info.relocatable;
- if (strstr (bfd_get_target (output_bfd), "xcoff") != NULL)
+ if (strstr (bfd_get_target (link_info.output_bfd), "xcoff") != NULL)
link_info.relocatable = TRUE;
ldctor_build_sets ();
link_info.relocatable = r;
@@ -600,7 +600,8 @@ gld${EMULATION_NAME}_after_open (void)
}
size = (p->count + 2) * 4;
- if (!bfd_xcoff_link_record_set (output_bfd, &link_info, p->h, size))
+ if (!bfd_xcoff_link_record_set (link_info.output_bfd, &link_info,
+ p->h, size))
einfo ("%F%P: bfd_xcoff_link_record_set failed: %E\n");
}
}
@@ -627,7 +628,7 @@ gld${EMULATION_NAME}_before_allocation (void)
h = bfd_link_hash_lookup (link_info.hash, el->name, FALSE, FALSE, FALSE);
if (h == NULL)
einfo ("%P%F: bfd_link_hash_lookup of export symbol failed: %E\n");
- if (!bfd_xcoff_export_symbol (output_bfd, &link_info, h))
+ if (!bfd_xcoff_export_symbol (link_info.output_bfd, &link_info, h))
einfo ("%P%F: bfd_xcoff_export_symbol failed: %E\n");
}
@@ -703,7 +704,7 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Let the XCOFF backend set up the .loader section. */
if (!bfd_xcoff_size_dynamic_sections
- (output_bfd, &link_info, libpath, entry_symbol.name, file_align,
+ (link_info.output_bfd, &link_info, libpath, entry_symbol.name, file_align,
maxstack, maxdata, gc && !unix_ld ? TRUE : FALSE,
modtype, textro ? TRUE : FALSE, unix_ld, special_sections,
rtld ? TRUE : FALSE))
@@ -1159,7 +1160,8 @@ gld${EMULATION_NAME}_read_file (const char *filename, bfd_boolean import)
}
else
{
- if (!bfd_xcoff_import_symbol (output_bfd, &link_info, h,
+ if (!bfd_xcoff_import_symbol (link_info.output_bfd,
+ &link_info, h,
address, imppath, impfile,
impmember, syscall_flag))
einfo ("%X%s:%d: failed to import symbol %s: %E\n",
@@ -1206,7 +1208,8 @@ gld${EMULATION_NAME}_find_relocs (lang_statement_union_type *s)
rs = &s->reloc_statement;
if (rs->name == NULL)
einfo ("%F%P: only relocations against symbols are permitted\n");
- if (!bfd_xcoff_link_count_reloc (output_bfd, &link_info, rs->name))
+ if (!bfd_xcoff_link_count_reloc (link_info.output_bfd, &link_info,
+ rs->name))
einfo ("%F%P: bfd_xcoff_link_count_reloc failed: %E\n");
}
@@ -1232,7 +1235,8 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
case etree_assign:
if (strcmp (exp->assign.dst, ".") != 0)
{
- if (!bfd_xcoff_record_link_assignment (output_bfd, &link_info,
+ if (!bfd_xcoff_record_link_assignment (link_info.output_bfd,
+ &link_info,
exp->assign.dst))
einfo ("%P%F: failed to record assignment to %s: %E\n",
exp->assign.dst);
@@ -1317,7 +1321,7 @@ static void
gld${EMULATION_NAME}_create_output_section_statements (void)
{
/* __rtinit */
- if ((bfd_get_flavour (output_bfd) == bfd_target_xcoff_flavour)
+ if ((bfd_get_flavour (link_info.output_bfd) == bfd_target_xcoff_flavour)
&& (link_info.init_function != NULL
|| link_info.fini_function != NULL
|| rtld))
@@ -1326,11 +1330,11 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
lang_input_file_is_file_enum,
NULL);
- initfini_file->the_bfd = bfd_create ("initfini", output_bfd);
+ initfini_file->the_bfd = bfd_create ("initfini", link_info.output_bfd);
if (initfini_file->the_bfd == NULL
|| ! bfd_set_arch_mach (initfini_file->the_bfd,
- bfd_get_arch (output_bfd),
- bfd_get_mach (output_bfd)))
+ bfd_get_arch (link_info.output_bfd),
+ bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create BFD %E\n");
return;
@@ -1355,13 +1359,13 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
static void
gld${EMULATION_NAME}_set_output_arch (void)
{
- bfd_set_arch_mach (output_bfd,
- bfd_xcoff_architecture (output_bfd),
- bfd_xcoff_machine (output_bfd));
+ bfd_set_arch_mach (link_info.output_bfd,
+ bfd_xcoff_architecture (link_info.output_bfd),
+ bfd_xcoff_machine (link_info.output_bfd));
- ldfile_output_architecture = bfd_get_arch (output_bfd);
- ldfile_output_machine = bfd_get_mach (output_bfd);
- ldfile_output_machine_name = bfd_printable_name (output_bfd);
+ ldfile_output_architecture = bfd_get_arch (link_info.output_bfd);
+ ldfile_output_machine = bfd_get_mach (link_info.output_bfd);
+ ldfile_output_machine_name = bfd_printable_name (link_info.output_bfd);
}
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em
index b134140..81bb377 100644
--- a/ld/emultempl/alphaelf.em
+++ b/ld/emultempl/alphaelf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+# Copyright 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -42,8 +42,8 @@ extern const bfd_target bfd_elf64_alpha_freebsd_vec;
static void
alpha_after_open (void)
{
- if (link_info.hash->creator == &bfd_elf64_alpha_vec
- || link_info.hash->creator == &bfd_elf64_alpha_freebsd_vec)
+ if (link_info.output_bfd->xvec == &bfd_elf64_alpha_vec
+ || link_info.output_bfd->xvec == &bfd_elf64_alpha_freebsd_vec)
{
unsigned int num_plt;
lang_output_section_statement_type *os;
@@ -98,7 +98,7 @@ static void
alpha_finish (void)
{
if (limit_32bit)
- elf_elfheader (output_bfd)->e_flags |= EF_ALPHA_32BIT;
+ elf_elfheader (link_info.output_bfd)->e_flags |= EF_ALPHA_32BIT;
gld${EMULATION_NAME}_finish ();
}
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index bc37ea1..07fdcc9 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -5,7 +5,7 @@ fragment <<EOF
/* emulate the original gld for the given ${EMULATION_NAME}
Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2007 Free Software Foundation, Inc.
+ 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
This file is part of the GNU Binutils.
@@ -133,7 +133,7 @@ gld${EMULATION_NAME}_before_allocation (void)
static void
gld${EMULATION_NAME}_after_open (void)
{
- if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+ if (strstr (bfd_get_target (link_info.output_bfd), "arm") == NULL)
{
/* The arm backend needs special fields in the output hash structure.
These will only be created if the output format is an arm format,
@@ -173,7 +173,7 @@ gld${EMULATION_NAME}_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
- + bfd_get_section_vma (output_bfd,
+ + bfd_get_section_vma (link_info.output_bfd,
h->u.def.section->output_section)
+ h->u.def.section->output_offset);
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index e8b3682..7d0320d 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 1991, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2007
+# 2004, 2005, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -53,7 +53,7 @@ gld${EMULATION_NAME}_before_parse (void)
static void
arm_elf_after_open (void)
{
- if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+ if (strstr (bfd_get_target (link_info.output_bfd), "arm") == NULL)
{
/* The arm backend needs special fields in the output hash structure.
These will only be created if the output format is an arm format,
@@ -86,7 +86,7 @@ arm_elf_set_bfd_for_interworking (lang_statement_union_type *statement)
{
asection *output_section = i->output_section;
- ASSERT (output_section->owner == output_bfd);
+ ASSERT (output_section->owner == link_info.output_bfd);
/* Don't attach the interworking stubs to a dynamic object, to
an empty section, etc. */
@@ -130,7 +130,7 @@ arm_elf_before_allocation (void)
/* Choose type of VFP11 erratum fix, or warn if specified fix is unnecessary
due to architecture version. */
- bfd_elf32_arm_set_vfp11_fix (output_bfd, &link_info);
+ bfd_elf32_arm_set_vfp11_fix (link_info.output_bfd, &link_info);
/* We should be able to set the size of the interworking stub section. We
can't do it until later if we have dynamic sections, though. */
@@ -212,7 +212,7 @@ arm_elf_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
- + bfd_get_section_vma (output_bfd,
+ + bfd_get_section_vma (link_info.output_bfd,
h->u.def.section->output_section)
+ h->u.def.section->output_offset);
@@ -241,7 +241,8 @@ arm_elf_finish (void)
static void
arm_elf_create_output_section_statements (void)
{
- bfd_elf32_arm_set_target_relocs (output_bfd, &link_info, target1_is_rel,
+ bfd_elf32_arm_set_target_relocs (link_info.output_bfd, &link_info,
+ target1_is_rel,
target2_type, fix_v4bx, use_blx,
vfp11_denorm_fix, no_enum_size_warning,
pic_veneer);
diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
index 3c242a9..14b9ac2 100644
--- a/ld/emultempl/avrelf.em
+++ b/ld/emultempl/avrelf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2006, 2007
+# Copyright 2006, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -85,7 +85,7 @@ avr_elf_${EMULATION_NAME}_before_allocation (void)
if (avr_no_stubs)
return;
- ret = elf32_avr_setup_section_lists (output_bfd, &link_info);
+ ret = elf32_avr_setup_section_lists (link_info.output_bfd, &link_info);
if (ret < 0)
einfo ("%X%P: can not setup the input section list: %E\n");
@@ -94,7 +94,7 @@ avr_elf_${EMULATION_NAME}_before_allocation (void)
return;
/* Call into the BFD backend to do the real "stub"-work. */
- if (! elf32_avr_size_stubs (output_bfd, &link_info, TRUE))
+ if (! elf32_avr_size_stubs (link_info.output_bfd, &link_info, TRUE))
einfo ("%X%P: can not size stub section: %E\n");
}
@@ -110,11 +110,11 @@ avr_elf_create_output_section_statements (void)
lang_input_file_is_fake_enum,
NULL);
- stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
+ stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| !bfd_set_arch_mach (stub_file->the_bfd,
- bfd_get_arch (output_bfd),
- bfd_get_mach (output_bfd)))
+ bfd_get_arch (link_info.output_bfd),
+ bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create stub BFD %E\n");
return;
@@ -157,7 +157,7 @@ avr_elf_finish (void)
stubs with the correct symbol addresses. Since there could have
been relaxation, the symbol addresses that were found during
first call may no longer be correct. */
- if (!elf32_avr_size_stubs (output_bfd, &link_info, FALSE))
+ if (!elf32_avr_size_stubs (link_info.output_bfd, &link_info, FALSE))
{
einfo ("%X%P: can not size stub section: %E\n");
return;
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index 23d3849..ac27c5a 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -8,7 +8,7 @@ fi
fragment <<EOF
/* This file is part of GLD, the Gnu Linker.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -382,13 +382,13 @@ gld_${EMULATION_NAME}_after_open (void)
/* Pass the wacky PE command line options into the output bfd.
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
- if (!coff_data(output_bfd)->pe)
+ if (!coff_data(link_info.output_bfd)->pe)
{
einfo ("%F%P: PE operations on non PE file.\n");
}
- pe_data(output_bfd)->pe_opthdr = pe;
- pe_data(output_bfd)->dll = init[DLLOFF].value;
+ pe_data(link_info.output_bfd)->pe_opthdr = pe;
+ pe_data(link_info.output_bfd)->dll = init[DLLOFF].value;
}
diff --git a/ld/emultempl/elf-generic.em b/ld/emultempl/elf-generic.em
index 94486f8..d286bb8 100644
--- a/ld/emultempl/elf-generic.em
+++ b/ld/emultempl/elf-generic.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2006, 2007 Free Software Foundation, Inc.
+# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -47,30 +47,34 @@ gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
need_layout = FALSE;
}
- if (output_bfd->xvec->flavour == bfd_target_elf_flavour
+ if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
&& !link_info.relocatable)
{
bfd_size_type phdr_size;
- phdr_size = elf_tdata (output_bfd)->program_header_size;
+ phdr_size = elf_tdata (link_info.output_bfd)->program_header_size;
/* If we don't have user supplied phdrs, throw away any
previous linker generated program headers. */
if (lang_phdr_list == NULL)
- elf_tdata (output_bfd)->segment_map = NULL;
- if (!_bfd_elf_map_sections_to_segments (output_bfd, &link_info))
+ elf_tdata (link_info.output_bfd)->segment_map = NULL;
+ if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
+ &link_info))
einfo ("%F%P: map sections to segments failed: %E\n");
- if (phdr_size != elf_tdata (output_bfd)->program_header_size)
+ if (phdr_size
+ != elf_tdata (link_info.output_bfd)->program_header_size)
{
if (tries > 6)
/* The first few times we allow any change to
phdr_size . */
need_layout = TRUE;
- else if (phdr_size < elf_tdata (output_bfd)->program_header_size)
+ else if (phdr_size
+ < elf_tdata (link_info.output_bfd)->program_header_size)
/* After that we only allow the size to grow. */
need_layout = TRUE;
else
- elf_tdata (output_bfd)->program_header_size = phdr_size;
+ elf_tdata (link_info.output_bfd)->program_header_size
+ = phdr_size;
}
}
}
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 547bc2a..da1bf49 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -307,7 +307,7 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed,
const char *soname;
int class;
- abfd = bfd_openr (name, bfd_get_target (output_bfd));
+ abfd = bfd_openr (name, bfd_get_target (link_info.output_bfd));
if (abfd == NULL)
return FALSE;
if (! bfd_check_format (abfd, bfd_object))
@@ -322,7 +322,7 @@ gld${EMULATION_NAME}_try_needed (struct dt_needed *needed,
}
/* For DT_NEEDED, they have to match. */
- if (abfd->xvec != output_bfd->xvec)
+ if (abfd->xvec != link_info.output_bfd->xvec)
{
bfd_close (abfd);
return FALSE;
@@ -1064,7 +1064,7 @@ gld${EMULATION_NAME}_after_open (void)
| SEC_READONLY | SEC_DATA);
if (s != NULL && bfd_set_section_alignment (abfd, s, 2))
{
- struct elf_obj_tdata *t = elf_tdata (output_bfd);
+ struct elf_obj_tdata *t = elf_tdata (link_info.output_bfd);
struct build_id_info *b = xmalloc (sizeof *b);
b->style = link_info.emit_note_gnu_build_id;
b->sec = s;
@@ -1127,7 +1127,7 @@ gld${EMULATION_NAME}_after_open (void)
loop. */
if (!link_info.executable)
return;
- needed = bfd_elf_get_needed_list (output_bfd, &link_info);
+ needed = bfd_elf_get_needed_list (link_info.output_bfd, &link_info);
for (l = needed; l != NULL; l = l->next)
{
struct bfd_link_needed_list *ll;
@@ -1231,7 +1231,7 @@ fi
if [ "x${USE_LIBPATH}" = xyes ] ; then
fragment <<EOF
found = 0;
- rp = bfd_elf_get_runpath_list (output_bfd, &link_info);
+ rp = bfd_elf_get_runpath_list (link_info.output_bfd, &link_info);
for (; !found && rp != NULL; rp = rp->next)
{
char *tmpname = gld${EMULATION_NAME}_add_sysroot (rp->name);
@@ -1322,7 +1322,8 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
will do no harm. */
if (strcmp (exp->assign.dst, ".") != 0)
{
- if (!bfd_elf_record_link_assignment (output_bfd, &link_info,
+ if (!bfd_elf_record_link_assignment (link_info.output_bfd,
+ &link_info,
exp->assign.dst, provide,
exp->assign.hidden))
einfo ("%P%F: failed to record assignment to %s: %E\n",
@@ -1391,7 +1392,7 @@ gld${EMULATION_NAME}_before_allocation (void)
asection *sinterp;
if (link_info.hash->type == bfd_link_elf_hash_table)
- _bfd_elf_tls_setup (output_bfd, &link_info);
+ _bfd_elf_tls_setup (link_info.output_bfd, &link_info);
/* If we are going to make any variable assignments, we need to let
the ELF backend know about them in case the variables are
@@ -1404,7 +1405,7 @@ gld${EMULATION_NAME}_before_allocation (void)
if (rpath == NULL)
rpath = (const char *) getenv ("LD_RUN_PATH");
if (! (bfd_elf_size_dynamic_sections
- (output_bfd, command_line.soname, rpath,
+ (link_info.output_bfd, command_line.soname, rpath,
command_line.filter_shlib,
(const char * const *) command_line.auxiliary_filters,
&link_info, &sinterp, lang_elf_version_info)))
@@ -1472,7 +1473,7 @@ ${ELF_INTERPRETER_SET_DEFAULT}
before_allocation_default ();
- if (!bfd_elf_size_dynsym_hash_dynstr (output_bfd, &link_info))
+ if (!bfd_elf_size_dynsym_hash_dynstr (link_info.output_bfd, &link_info))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
}
@@ -1710,7 +1711,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s)
if (os != NULL
&& (os->bfd_section == NULL
|| os->bfd_section->flags == 0
- || (_bfd_elf_match_sections_by_type (output_bfd,
+ || (_bfd_elf_match_sections_by_type (link_info.output_bfd,
os->bfd_section,
s->owner, s)
&& ((s->flags ^ os->bfd_section->flags)
@@ -1801,10 +1802,11 @@ gld${EMULATION_NAME}_place_orphan (asection *s)
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
loadable or allocatable characteristics. */
- if (bfd_get_section_by_name (output_bfd, secname) != NULL)
+ if (bfd_get_section_by_name (link_info.output_bfd, secname) != NULL)
{
static int count = 1;
- secname = bfd_get_unique_section_name (output_bfd, secname, &count);
+ secname = bfd_get_unique_section_name (link_info.output_bfd,
+ secname, &count);
if (secname == NULL)
einfo ("%F%P: place_orphan failed: %E\n");
}
@@ -1822,7 +1824,8 @@ fragment <<EOF
static void
gld${EMULATION_NAME}_finish (void)
{
- bfd_boolean need_layout = bfd_elf_discard_info (output_bfd, &link_info);
+ bfd_boolean need_layout = bfd_elf_discard_info (link_info.output_bfd,
+ &link_info);
gld${EMULATION_NAME}_map_segments (need_layout);
finish_default ();
diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em
index 2669c0e..4ba3eec 100644
--- a/ld/emultempl/gld960.em
+++ b/ld/emultempl/gld960.em
@@ -1,7 +1,7 @@
# This shell script emits a C file. -*- C -*-
# It does some substitutions.
fragment <<EOF
-/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007
+/* Copyright 1991, 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008
Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -54,7 +54,8 @@ static void gld960_before_parse (void)
static void
gld960_set_output_arch (void)
{
- bfd_set_arch_mach(output_bfd, ldfile_output_architecture, bfd_mach_i960_core);
+ bfd_set_arch_mach (link_info.output_bfd,
+ ldfile_output_architecture, bfd_mach_i960_core);
}
static char *
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 24b7241..f5808b3 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2007 Free Software Foundation, Inc.
+# 2005, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -71,19 +71,19 @@ hppaelf_create_output_section_statements (void)
extern const bfd_target bfd_elf32_hppa_nbsd_vec;
extern const bfd_target bfd_elf32_hppa_vec;
- if (link_info.hash->creator != &bfd_elf32_hppa_linux_vec
- && link_info.hash->creator != &bfd_elf32_hppa_nbsd_vec
- && link_info.hash->creator != &bfd_elf32_hppa_vec)
+ if (link_info.output_bfd->xvec != &bfd_elf32_hppa_linux_vec
+ && link_info.output_bfd->xvec != &bfd_elf32_hppa_nbsd_vec
+ && link_info.output_bfd->xvec != &bfd_elf32_hppa_vec)
return;
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
- stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
+ stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| ! bfd_set_arch_mach (stub_file->the_bfd,
- bfd_get_arch (output_bfd),
- bfd_get_mach (output_bfd)))
+ bfd_get_arch (link_info.output_bfd),
+ bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create BFD %E\n");
return;
@@ -236,7 +236,7 @@ build_section_lists (lang_statement_union_type *statement)
if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
- && i->output_section->owner == output_bfd)
+ && i->output_section->owner == link_info.output_bfd)
{
elf32_hppa_next_input_section (&link_info, i);
}
@@ -254,14 +254,15 @@ gld${EMULATION_NAME}_finish (void)
ie. doesn't affect any code, so we can delay resizing the
sections. It's likely we'll resize everything in the process of
adding stubs. */
- if (bfd_elf_discard_info (output_bfd, &link_info))
+ if (bfd_elf_discard_info (link_info.output_bfd, &link_info))
need_laying_out = 1;
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
if (stub_file != NULL && !link_info.relocatable)
{
- int ret = elf32_hppa_setup_section_lists (output_bfd, &link_info);
+ int ret = elf32_hppa_setup_section_lists (link_info.output_bfd,
+ &link_info);
if (ret != 0)
{
@@ -274,7 +275,7 @@ gld${EMULATION_NAME}_finish (void)
lang_for_each_statement (build_section_lists);
/* Call into the BFD backend to do the real work. */
- if (! elf32_hppa_size_stubs (output_bfd,
+ if (! elf32_hppa_size_stubs (link_info.output_bfd,
stub_file->the_bfd,
&link_info,
multi_subspace,
@@ -294,7 +295,7 @@ gld${EMULATION_NAME}_finish (void)
if (! link_info.relocatable)
{
/* Set the global data pointer. */
- if (! elf32_hppa_set_gp (output_bfd, &link_info))
+ if (! elf32_hppa_set_gp (link_info.output_bfd, &link_info))
{
einfo ("%X%P: can not set gp\n");
return;
diff --git a/ld/emultempl/irix.em b/ld/emultempl/irix.em
index b4a8f4e..c3ef416 100644
--- a/ld/emultempl/irix.em
+++ b/ld/emultempl/irix.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2004, 2006, 2007 Free Software Foundation, Inc.
+# Copyright 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -33,7 +33,8 @@ static void
irix_after_open (void)
{
if (link_info.shared && command_line.soname == 0)
- command_line.soname = (char *) lbasename (bfd_get_filename (output_bfd));
+ command_line.soname
+ = (char *) lbasename (bfd_get_filename (link_info.output_bfd));
gld${EMULATION_NAME}_after_open ();
}
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index aa4a088..2a2a960 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -10,7 +10,7 @@ fragment <<EOF
/* Linux a.out emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
Linux support by Eric Youngdale <ericy@cais.cais.com>
@@ -120,7 +120,8 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Let the backend work out the sizes of any sections required by
dynamic linking. */
- if (! bfd_${EMULATION_NAME}_size_dynamic_sections (output_bfd, &link_info))
+ if (! bfd_${EMULATION_NAME}_size_dynamic_sections (link_info.output_bfd,
+ &link_info))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
before_allocation_default ();
diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em
index aa5afcc..e13233c 100644
--- a/ld/emultempl/lnk960.em
+++ b/ld/emultempl/lnk960.em
@@ -189,7 +189,7 @@ lnk960_set_output_arch (void)
break;
}
}
- bfd_set_arch_mach (output_bfd, ldfile_output_architecture,
+ bfd_set_arch_mach (link_info.output_bfd, ldfile_output_architecture,
ldfile_output_machine);
}
diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em
index d623233..c54eacd 100644
--- a/ld/emultempl/m68hc1xelf.em
+++ b/ld/emultempl/m68hc1xelf.em
@@ -1,6 +1,6 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2007
-# Free Software Foundation, Inc.
+# Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003, 2007,
+# 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -72,7 +72,7 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation (void)
if (link_info.relocatable)
return;
- ret = elf32_m68hc11_setup_section_lists (output_bfd, &link_info);
+ ret = elf32_m68hc11_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0 && no_trampoline == 0)
{
if (ret < 0)
@@ -82,7 +82,7 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation (void)
}
/* Call into the BFD backend to do the real work. */
- if (!elf32_m68hc11_size_stubs (output_bfd,
+ if (!elf32_m68hc11_size_stubs (link_info.output_bfd,
stub_file->the_bfd,
&link_info,
&m68hc11elf_add_stub_section))
@@ -145,11 +145,11 @@ m68hc11elf_create_output_section_statements (void)
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
- stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
+ stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| !bfd_set_arch_mach (stub_file->the_bfd,
- bfd_get_arch (output_bfd),
- bfd_get_mach (output_bfd)))
+ bfd_get_arch (link_info.output_bfd),
+ bfd_get_mach (link_info.output_bfd)))
{
einfo ("%X%P: can not create BFD %E\n");
return;
@@ -299,14 +299,14 @@ m68hc11elf_finish (void)
stubs with the correct symbol addresses. Since there could have
been relaxation, the symbol addresses that were found during
first call may no longer be correct. */
- if (!elf32_m68hc11_size_stubs (output_bfd,
+ if (!elf32_m68hc11_size_stubs (link_info.output_bfd,
stub_file->the_bfd,
&link_info, 0))
{
einfo ("%X%P: can not size stub section: %E\n");
return;
}
- if (!elf32_m68hc11_build_stubs (output_bfd, &link_info))
+ if (!elf32_m68hc11_build_stubs (link_info.output_bfd, &link_info))
einfo ("%X%P: can not build stubs: %E\n");
}
diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
index 9957268..909c3c4 100644
--- a/ld/emultempl/mmix-elfnmmo.em
+++ b/ld/emultempl/mmix-elfnmmo.em
@@ -1,5 +1,6 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 2003, 2004, 2007, 2008
+# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -43,7 +44,7 @@ mmix_before_allocation (void)
link). */
command_line.relax = TRUE;
- if (!_bfd_mmix_before_linker_allocation (output_bfd, &link_info))
+ if (!_bfd_mmix_before_linker_allocation (link_info.output_bfd, &link_info))
einfo ("%X%P: Internal problems setting up section %s",
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
}
@@ -56,7 +57,8 @@ static void
mmix_after_allocation (void)
{
asection *sec
- = bfd_get_section_by_name (output_bfd, MMIX_REG_CONTENTS_SECTION_NAME);
+ = bfd_get_section_by_name (link_info.output_bfd,
+ MMIX_REG_CONTENTS_SECTION_NAME);
bfd_signed_vma regvma;
/* If there's no register section, we don't need to do anything. On the
@@ -72,7 +74,7 @@ mmix_after_allocation (void)
there. */
if (sec == NULL)
sec
- = bfd_get_section_by_name (output_bfd,
+ = bfd_get_section_by_name (link_info.output_bfd,
MMIX_LD_ALLOCATED_REG_CONTENTS_SECTION_NAME);
if (sec == NULL)
return;
@@ -91,16 +93,16 @@ mmix_after_allocation (void)
}
/* Set vma to correspond to first such register number * 8. */
- bfd_set_section_vma (output_bfd, sec, (bfd_vma) regvma);
+ bfd_set_section_vma (link_info.output_bfd, sec, (bfd_vma) regvma);
/* Simplify symbol output for the register section (without contents;
created for register symbols) by setting the output offset to 0.
This section is only present when there are register symbols. */
- sec = bfd_get_section_by_name (output_bfd, MMIX_REG_SECTION_NAME);
+ sec = bfd_get_section_by_name (link_info.output_bfd, MMIX_REG_SECTION_NAME);
if (sec != NULL)
bfd_set_section_vma (abfd, sec, 0);
- if (!_bfd_mmix_after_linker_allocation (output_bfd, &link_info))
+ if (!_bfd_mmix_after_linker_allocation (link_info.output_bfd, &link_info))
{
/* This is a fatal error; make einfo call not return. */
einfo ("%F%P: Can't finalize linker-allocated global registers\n");
diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em
index 8c46577..8b02fd6 100644
--- a/ld/emultempl/mmo.em
+++ b/ld/emultempl/mmo.em
@@ -1,5 +1,6 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 2003, 2004, 2006, 2007, 2008
+# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -120,7 +121,7 @@ mmo_wipe_sec_reloc_flag (bfd *abfd, asection *sec, void *ptr ATTRIBUTE_UNUSED)
static void
mmo_finish (void)
{
- bfd_map_over_sections (output_bfd, mmo_wipe_sec_reloc_flag, NULL);
+ bfd_map_over_sections (link_info.output_bfd, mmo_wipe_sec_reloc_flag, NULL);
gld${EMULATION_NAME}_map_segments (FALSE);
finish_default ();
}
@@ -139,7 +140,7 @@ mmo_after_open (void)
example), we'd count relocs twice because they'd also be counted
along the usual route for ELF-only linking, which would lead to an
internal accounting error. */
- if (bfd_get_flavour (output_bfd) != bfd_target_elf_flavour)
+ if (bfd_get_flavour (link_info.output_bfd) != bfd_target_elf_flavour)
{
LANG_FOR_EACH_INPUT_STATEMENT (is)
{
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 10887b0..1ef225a 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -10,7 +10,7 @@ rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
fragment <<EOF
/* Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU Binutils.
@@ -1008,18 +1008,20 @@ gld_${EMULATION_NAME}_after_open (void)
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
- if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == 0)
- einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"), output_bfd);
+ if (coff_data (link_info.output_bfd) == NULL
+ || coff_data (link_info.output_bfd)->pe == 0)
+ einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"),
+ link_info.output_bfd);
- pe_data (output_bfd)->pe_opthdr = pe;
- pe_data (output_bfd)->dll = init[DLLOFF].value;
- pe_data (output_bfd)->real_flags |= real_flags;
+ pe_data (link_info.output_bfd)->pe_opthdr = pe;
+ pe_data (link_info.output_bfd)->dll = init[DLLOFF].value;
+ pe_data (link_info.output_bfd)->real_flags |= real_flags;
#ifdef DLL_SUPPORT
if (pe_enable_stdcall_fixup) /* -1=warn or 1=disable */
pe_fixup_stdcalls ();
- pe_process_import_defs (output_bfd, & link_info);
+ pe_process_import_defs (link_info.output_bfd, &link_info);
pe_find_data_imports ();
@@ -1028,17 +1030,17 @@ gld_${EMULATION_NAME}_after_open (void)
|| defined (TARGET_IS_arm_epoc_pe) \
|| defined (TARGET_IS_arm_wince_pe)
if (!link_info.relocatable)
- pe_dll_build_sections (output_bfd, &link_info);
+ pe_dll_build_sections (link_info.output_bfd, &link_info);
else
- pe_exe_build_sections (output_bfd, &link_info);
+ pe_exe_build_sections (link_info.output_bfd, &link_info);
#else
if (link_info.shared)
- pe_dll_build_sections (output_bfd, &link_info);
+ pe_dll_build_sections (link_info.output_bfd, &link_info);
#endif
#endif /* DLL_SUPPORT */
#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_epoc_pe) || defined(TARGET_IS_arm_wince_pe)
- if (strstr (bfd_get_target (output_bfd), "arm") == NULL)
+ if (strstr (bfd_get_target (link_info.output_bfd), "arm") == NULL)
{
/* The arm backend needs special fields in the output hash structure.
These will only be created if the output format is an arm format,
@@ -1451,13 +1453,14 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
if (pe_def_file->base_address != (bfd_vma)(-1))
{
- pe.ImageBase =
- pe_data (output_bfd)->pe_opthdr.ImageBase =
- init[IMAGEBASEOFF].value = pe_def_file->base_address;
+ pe.ImageBase
+ = pe_data (link_info.output_bfd)->pe_opthdr.ImageBase
+ = init[IMAGEBASEOFF].value
+ = pe_def_file->base_address;
init[IMAGEBASEOFF].inited = 1;
if (image_base_statement)
- image_base_statement->exp =
- exp_assop ('=', "__image_base__", exp_intop (pe.ImageBase));
+ image_base_statement->exp = exp_assop ('=', "__image_base__",
+ exp_intop (pe.ImageBase));
}
if (pe_def_file->stack_reserve != -1
@@ -1531,7 +1534,7 @@ gld_${EMULATION_NAME}_finish (void)
/* Special procesing is required for a Thumb entry symbol. The
bottom bit of its address must be set. */
val = (h->u.def.value
- + bfd_get_section_vma (output_bfd,
+ + bfd_get_section_vma (link_info.output_bfd,
h->u.def.section->output_section)
+ h->u.def.section->output_offset);
@@ -1563,7 +1566,7 @@ gld_${EMULATION_NAME}_finish (void)
#endif
)
{
- pe_dll_fill_sections (output_bfd, &link_info);
+ pe_dll_fill_sections (link_info.output_bfd, &link_info);
if (pe_implib_filename)
pe_dll_generate_implib (pe_def_file, pe_implib_filename);
}
@@ -1571,7 +1574,7 @@ gld_${EMULATION_NAME}_finish (void)
/* ARM doesn't need relocs. */
else
{
- pe_exe_fill_sections (output_bfd, &link_info);
+ pe_exe_fill_sections (link_info.output_bfd, &link_info);
}
#endif
@@ -1581,7 +1584,7 @@ gld_${EMULATION_NAME}_finish (void)
/* I don't know where .idata gets set as code, but it shouldn't be. */
{
- asection *asec = bfd_get_section_by_name (output_bfd, ".idata");
+ asection *asec = bfd_get_section_by_name (link_info.output_bfd, ".idata");
if (asec)
{
@@ -1719,10 +1722,11 @@ gld_${EMULATION_NAME}_place_orphan (asection *s)
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
loadable or allocatable characteristics. */
- if (bfd_get_section_by_name (output_bfd, secname) != NULL)
+ if (bfd_get_section_by_name (link_info.output_bfd, secname) != NULL)
{
static int count = 1;
- secname = bfd_get_unique_section_name (output_bfd, secname, &count);
+ secname = bfd_get_unique_section_name (link_info.output_bfd,
+ secname, &count);
if (secname == NULL)
einfo ("%F%P: place_orphan failed: %E\n");
}
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 20523ed..e32f6eb 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -9,7 +9,7 @@ fi
rm -f e${EMULATION_NAME}.c
(echo;echo;echo;echo;echo)>e${EMULATION_NAME}.c # there, now line numbers match ;-)
fragment <<EOF
-/* Copyright 2006, 2007 Free Software Foundation, Inc.
+/* Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Kai Tietz, OneVision Software GmbH&CoKg.
This file is part of the GNU Binutils.
@@ -967,18 +967,20 @@ gld_${EMULATION_NAME}_after_open (void)
FIXME: This should be done via a function, rather than by
including an internal BFD header. */
- if (coff_data (output_bfd) == NULL || coff_data (output_bfd)->pe == 0)
- einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"), output_bfd);
+ if (coff_data (link_info.output_bfd) == NULL
+ || coff_data (link_info.output_bfd)->pe == 0)
+ einfo (_("%F%P: cannot perform PE operations on non PE output file '%B'.\n"),
+ link_info.output_bfd);
- pe_data (output_bfd)->pe_opthdr = pep;
- pe_data (output_bfd)->dll = init[DLLOFF].value;
- pe_data (output_bfd)->real_flags |= real_flags;
+ pe_data (link_info.output_bfd)->pe_opthdr = pep;
+ pe_data (link_info.output_bfd)->dll = init[DLLOFF].value;
+ pe_data (link_info.output_bfd)->real_flags |= real_flags;
#ifdef DLL_SUPPORT
if (pep_enable_stdcall_fixup) /* -1=warn or 1=disable */
pep_fixup_stdcalls ();
- pep_process_import_defs (output_bfd, & link_info);
+ pep_process_import_defs (link_info.output_bfd, &link_info);
pep_find_data_imports ();
@@ -987,11 +989,11 @@ gld_${EMULATION_NAME}_after_open (void)
#else
if (!link_info.relocatable)
#endif
- pep_dll_build_sections (output_bfd, &link_info);
+ pep_dll_build_sections (link_info.output_bfd, &link_info);
#ifndef TARGET_IS_i386pep
else
- pep_exe_build_sections (output_bfd, &link_info);
+ pep_exe_build_sections (link_info.output_bfd, &link_info);
#endif
#endif /* DLL_SUPPORT */
@@ -1280,13 +1282,14 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
if (pep_def_file->base_address != (bfd_vma)(-1))
{
- pep.ImageBase =
- pe_data (output_bfd)->pe_opthdr.ImageBase =
- init[IMAGEBASEOFF].value = pep_def_file->base_address;
+ pep.ImageBase
+ = pe_data (link_info.output_bfd)->pe_opthdr.ImageBase
+ = init[IMAGEBASEOFF].value
+ = pep_def_file->base_address;
init[IMAGEBASEOFF].inited = 1;
if (image_base_statement)
- image_base_statement->exp =
- exp_assop ('=', "__image_base__", exp_intop (pep.ImageBase));
+ image_base_statement->exp = exp_assop ('=', "__image_base__",
+ exp_intop (pep.ImageBase));
}
if (pep_def_file->stack_reserve != -1
@@ -1332,7 +1335,7 @@ gld_${EMULATION_NAME}_finish (void)
if (link_info.shared
|| (!link_info.relocatable && pep_def_file->num_exports != 0))
{
- pep_dll_fill_sections (output_bfd, &link_info);
+ pep_dll_fill_sections (link_info.output_bfd, &link_info);
if (pep_implib_filename)
pep_dll_generate_implib (pep_def_file, pep_implib_filename);
}
@@ -1343,7 +1346,7 @@ gld_${EMULATION_NAME}_finish (void)
/* I don't know where .idata gets set as code, but it shouldn't be. */
{
- asection *asec = bfd_get_section_by_name (output_bfd, ".idata");
+ asection *asec = bfd_get_section_by_name (link_info.output_bfd, ".idata");
if (asec)
{
@@ -1481,10 +1484,11 @@ gld_${EMULATION_NAME}_place_orphan (asection *s)
/* Choose a unique name for the section. This will be needed if the
same section name appears in the input file with different
loadable or allocatable characteristics. */
- if (bfd_get_section_by_name (output_bfd, secname) != NULL)
+ if (bfd_get_section_by_name (link_info.output_bfd, secname) != NULL)
{
static int count = 1;
- secname = bfd_get_unique_section_name (output_bfd, secname, &count);
+ secname = bfd_get_unique_section_name (link_info.output_bfd,
+ secname, &count);
if (secname == NULL)
einfo ("%F%P: place_orphan failed: %E\n");
}
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index 20af68c..79266a1 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
+# Copyright 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -52,7 +52,7 @@ static int old_got = 0;
static void
ppc_after_open (void)
{
- if (is_ppc_elf32_vec (link_info.hash->creator))
+ if (is_ppc_elf32_vec (link_info.output_bfd->xvec))
{
int new_plt;
int keep_new;
@@ -63,8 +63,8 @@ ppc_after_open (void)
lang_output_section_statement_type *got_os[2];
emit_stub_syms |= link_info.emitrelocations;
- new_plt = ppc_elf_select_plt_layout (output_bfd, &link_info, plt_style,
- emit_stub_syms);
+ new_plt = ppc_elf_select_plt_layout (link_info.output_bfd, &link_info,
+ plt_style, emit_stub_syms);
if (new_plt < 0)
einfo ("%X%P: select_plt_layout problem %E\n");
@@ -109,11 +109,11 @@ ppc_after_open (void)
static void
ppc_before_allocation (void)
{
- if (is_ppc_elf32_vec (link_info.hash->creator))
+ if (is_ppc_elf32_vec (link_info.output_bfd->xvec))
{
- if (ppc_elf_tls_setup (output_bfd, &link_info) && !notlsopt)
+ if (ppc_elf_tls_setup (link_info.output_bfd, &link_info) && !notlsopt)
{
- if (!ppc_elf_tls_optimize (output_bfd, &link_info))
+ if (!ppc_elf_tls_optimize (link_info.output_bfd, &link_info))
{
einfo ("%X%P: TLS problem %E\n");
return;
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index b23ae43..f6af695 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -75,8 +75,8 @@ ppc_create_output_section_statements (void)
extern const bfd_target bfd_elf64_powerpc_vec;
extern const bfd_target bfd_elf64_powerpcle_vec;
- if (link_info.hash->creator != &bfd_elf64_powerpc_vec
- && link_info.hash->creator != &bfd_elf64_powerpcle_vec)
+ if (link_info.output_bfd->xvec != &bfd_elf64_powerpc_vec
+ && link_info.output_bfd->xvec != &bfd_elf64_powerpcle_vec)
return;
link_info.wrap_char = '.';
@@ -84,11 +84,11 @@ ppc_create_output_section_statements (void)
stub_file = lang_add_input_file ("linker stubs",
lang_input_file_is_fake_enum,
NULL);
- stub_file->the_bfd = bfd_create ("linker stubs", output_bfd);
+ stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd);
if (stub_file->the_bfd == NULL
|| !bfd_set_arch_mach (stub_file->the_bfd,
- bfd_get_arch (output_bfd),
- bfd_get_mach (output_bfd)))
+ bfd_get_arch (link_info.output_bfd),
+ bfd_get_mach (link_info.output_bfd)))
{
einfo ("%F%P: can not create BFD %E\n");
return;
@@ -105,10 +105,12 @@ ppc_before_allocation (void)
if (stub_file != NULL)
{
if (!no_opd_opt
- && !ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd))
+ && !ppc64_elf_edit_opd (link_info.output_bfd, &link_info,
+ non_overlapping_opd))
einfo ("%X%P: can not edit %s %E\n", "opd");
- if (ppc64_elf_tls_setup (output_bfd, &link_info) && !no_tls_opt)
+ if (ppc64_elf_tls_setup (link_info.output_bfd, &link_info)
+ && !no_tls_opt)
{
/* Size the sections. This is premature, but we want to know the
TLS segment layout so that certain optimizations can be done. */
@@ -116,7 +118,7 @@ ppc_before_allocation (void)
expld.dataseg.phase = exp_dataseg_none;
one_lang_size_sections_pass (NULL, TRUE);
- if (!ppc64_elf_tls_optimize (output_bfd, &link_info))
+ if (!ppc64_elf_tls_optimize (link_info.output_bfd, &link_info))
einfo ("%X%P: TLS problem %E\n");
/* We must not cache anything from the preliminary sizing. */
@@ -125,7 +127,7 @@ ppc_before_allocation (void)
if (!no_toc_opt
&& !link_info.relocatable
- && !ppc64_elf_edit_toc (output_bfd, &link_info))
+ && !ppc64_elf_edit_toc (link_info.output_bfd, &link_info))
einfo ("%X%P: can not edit %s %E\n", "toc");
}
@@ -271,7 +273,8 @@ static void
gld${EMULATION_NAME}_after_allocation (void)
{
if (!link_info.relocatable)
- _bfd_set_gp_value (output_bfd, ppc64_elf_toc (output_bfd));
+ _bfd_set_gp_value (link_info.output_bfd,
+ ppc64_elf_toc (link_info.output_bfd));
}
@@ -300,7 +303,7 @@ build_section_lists (lang_statement_union_type *statement)
if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
&& (i->flags & SEC_EXCLUDE) == 0
&& i->output_section != NULL
- && i->output_section->owner == output_bfd)
+ && i->output_section->owner == link_info.output_bfd)
{
if (!ppc64_elf_next_input_section (&link_info, i))
einfo ("%X%P: can not size stub section: %E\n");
@@ -323,29 +326,30 @@ gld${EMULATION_NAME}_finish (void)
ie. doesn't affect any code, so we can delay resizing the
sections. It's likely we'll resize everything in the process of
adding stubs. */
- if (bfd_elf_discard_info (output_bfd, &link_info))
+ if (bfd_elf_discard_info (link_info.output_bfd, &link_info))
need_laying_out = 1;
/* If generating a relocatable output file, then we don't have any
stubs. */
if (stub_file != NULL && !link_info.relocatable)
{
- int ret = ppc64_elf_setup_section_lists (output_bfd, &link_info,
+ int ret = ppc64_elf_setup_section_lists (link_info.output_bfd,
+ &link_info,
no_multi_toc);
if (ret < 0)
einfo ("%X%P: can not size stub section: %E\n");
else if (ret > 0)
{
- toc_section = bfd_get_section_by_name (output_bfd, ".got");
+ toc_section = bfd_get_section_by_name (link_info.output_bfd, ".got");
if (toc_section != NULL)
lang_for_each_statement (build_toc_list);
- ppc64_elf_reinit_toc (output_bfd, &link_info);
+ ppc64_elf_reinit_toc (link_info.output_bfd, &link_info);
lang_for_each_statement (build_section_lists);
/* Call into the BFD backend to do the real work. */
- if (!ppc64_elf_size_stubs (output_bfd,
+ if (!ppc64_elf_size_stubs (link_info.output_bfd,
&link_info,
group_size,
&ppc_add_stub_section,
@@ -359,9 +363,9 @@ gld${EMULATION_NAME}_finish (void)
if (link_info.relocatable)
{
- asection *toc = bfd_get_section_by_name (output_bfd, ".toc");
+ asection *toc = bfd_get_section_by_name (link_info.output_bfd, ".toc");
if (toc != NULL
- && bfd_section_size (output_bfd, toc) > 0x10000)
+ && bfd_section_size (link_info.output_bfd, toc) > 0x10000)
einfo ("%X%P: TOC section size exceeds 64k\n");
}
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
index 369ad76..f6cb510 100644
--- a/ld/emultempl/scoreelf.em
+++ b/ld/emultempl/scoreelf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2006, 2007 Free Software Foundation, Inc.
+# Copyright 2006, 2007, 2008 Free Software Foundation, Inc.
# Contributed by:
# Mei Ligang (ligang@sunnorth.com.cn)
# Pei-Lin Tsai (pltsai@sunplus.com)
@@ -40,7 +40,7 @@ gld${EMULATION_NAME}_before_parse ()
static void
score_elf_after_open (void)
{
- if (strstr (bfd_get_target (output_bfd), "score") == NULL)
+ if (strstr (bfd_get_target (link_info.output_bfd), "score") == NULL)
{
/* The score backend needs special fields in the output hash structure.
These will only be created if the output format is an score format,
diff --git a/ld/emultempl/sh64elf.em b/ld/emultempl/sh64elf.em
index 0433cf9..d8cce23 100644
--- a/ld/emultempl/sh64elf.em
+++ b/ld/emultempl/sh64elf.em
@@ -1,5 +1,6 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2000, 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2004, 2007, 2008
+# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -53,7 +54,8 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
/* Call main function; we're just extending it. */
gld${EMULATION_NAME}_before_allocation ();
- cranges = bfd_get_section_by_name (output_bfd, SH64_CRANGES_SECTION_NAME);
+ cranges = bfd_get_section_by_name (link_info.output_bfd,
+ SH64_CRANGES_SECTION_NAME);
if (cranges != NULL)
{
@@ -117,7 +119,7 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
/* For each non-empty input section in each output section, check if it
has the same SH64-specific flags. If some input section differs, we
need a .cranges section. */
- for (osec = output_bfd->sections;
+ for (osec = link_info.output_bfd->sections;
osec != NULL;
osec = osec->next)
{
@@ -125,13 +127,13 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
bfd_vma oflags_isa = 0;
bfd_vma iflags_isa = 0;
- if (bfd_get_flavour (output_bfd) != bfd_target_elf_flavour)
+ if (bfd_get_flavour (link_info.output_bfd) != bfd_target_elf_flavour)
einfo (_("%FError: non-ELF output formats are not supported by this target's linker.\n"));
sh64_sec_data = sh64_elf_section_data (osec)->sh64_info;
/* Omit excluded or garbage-collected sections. */
- if (bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE)
+ if (bfd_get_section_flags (link_info.output_bfd, osec) & SEC_EXCLUDE)
continue;
/* Make sure we have the target section data initialized. */
@@ -201,10 +203,10 @@ sh64_elf_${EMULATION_NAME}_before_allocation (void)
sh64_elf_section_data; no need to set it
specifically here. */
cranges
- = bfd_make_section (output_bfd,
+ = bfd_make_section (link_info.output_bfd,
SH64_CRANGES_SECTION_NAME);
if (cranges == NULL
- || !bfd_set_section_flags (output_bfd,
+ || !bfd_set_section_flags (link_info.output_bfd,
cranges,
SEC_LINKER_CREATED
| SEC_KEEP
@@ -245,8 +247,8 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
asection *osec;
bfd_byte *crangesp;
- asection *cranges
- = bfd_get_section_by_name (output_bfd, SH64_CRANGES_SECTION_NAME);
+ asection *cranges = bfd_get_section_by_name (link_info.output_bfd,
+ SH64_CRANGES_SECTION_NAME);
/* If this ever starts doing something, we will pick it up. */
after_allocation_default ();
@@ -261,7 +263,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
first non-discarded section. For each input section in osec, we
check if it has the same flags. If it does not, we set flags to mark
a mixed section (and exit the loop early). */
- for (osec = output_bfd->sections;
+ for (osec = link_info.output_bfd->sections;
osec != NULL;
osec = osec->next)
{
@@ -269,7 +271,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
bfd_boolean need_check_cranges = FALSE;
/* Omit excluded or garbage-collected sections. */
- if (bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE)
+ if (bfd_get_section_flags (link_info.output_bfd, osec) & SEC_EXCLUDE)
continue;
/* First find an input section so we have flags to compare with; the
@@ -408,7 +410,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
/* Now pass over the sections again, and make reloc orders for the new
.cranges entries. Constants are set as we go. */
- for (osec = output_bfd->sections;
+ for (osec = link_info.output_bfd->sections;
osec != NULL;
osec = osec->next)
{
@@ -419,7 +421,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
/* Omit excluded or garbage-collected sections, and output sections
which were not marked as needing further processing. */
- if ((bfd_get_section_flags (output_bfd, osec) & SEC_EXCLUDE) != 0
+ if ((bfd_get_section_flags (link_info.output_bfd, osec) & SEC_EXCLUDE) != 0
|| (sh64_elf_section_data (osec)->sh64_info->contents_flags
!= SHF_SH5_ISA32_MIXED))
continue;
@@ -477,7 +479,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
== osec->vma + isec->output_offset))
{
last_cr_size += cr_size;
- bfd_put_32 (output_bfd, last_cr_size,
+ bfd_put_32 (link_info.output_bfd, last_cr_size,
crangesp - SH64_CRANGE_SIZE
+ SH64_CRANGE_CR_SIZE_OFFSET);
@@ -494,7 +496,7 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
would leave us free to do some optimizations
later. */
cr_addr_order
- = bfd_new_link_order (output_bfd, cranges);
+ = bfd_new_link_order (link_info.output_bfd, cranges);
if (cr_addr_order == NULL)
{
@@ -518,12 +520,12 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
"partial inplace" REL-like relocation for this,
we put the addend in the contents and specify 0
for the reloc. */
- bfd_put_32 (output_bfd, isec->output_offset,
+ bfd_put_32 (link_info.output_bfd, isec->output_offset,
crangesp + SH64_CRANGE_CR_ADDR_OFFSET);
cr_addr_order->u.reloc.p->addend = 0;
}
else
- bfd_put_32 (output_bfd,
+ bfd_put_32 (link_info.output_bfd,
osec->vma + isec->output_offset,
crangesp + SH64_CRANGE_CR_ADDR_OFFSET);
@@ -531,10 +533,10 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
it, but we would have to have a symbol for the size
of the _input_ section and there's no way to
generate that. */
- bfd_put_32 (output_bfd, cr_size,
+ bfd_put_32 (link_info.output_bfd, cr_size,
crangesp + SH64_CRANGE_CR_SIZE_OFFSET);
- bfd_put_16 (output_bfd, cr_type,
+ bfd_put_16 (link_info.output_bfd, cr_type,
crangesp + SH64_CRANGE_CR_TYPE_OFFSET);
last_cr_type = cr_type;
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index bbaf098..14d1d9e 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -64,7 +64,7 @@ is_spu_target (void)
{
extern const bfd_target bfd_elf32_spu_vec;
- return link_info.hash->creator == &bfd_elf32_spu_vec;
+ return link_info.output_bfd->xvec == &bfd_elf32_spu_vec;
}
/* Create our note section. */
@@ -75,7 +75,7 @@ spu_after_open (void)
if (is_spu_target ()
&& !link_info.relocatable
&& link_info.input_bfds != NULL
- && !spu_elf_create_sections (output_bfd, &link_info,
+ && !spu_elf_create_sections (link_info.output_bfd, &link_info,
stack_analysis, emit_stack_syms))
einfo ("%X%P: can not create note section: %E\n");
@@ -198,11 +198,11 @@ spu_before_allocation (void)
one_lang_size_sections_pass (NULL, TRUE);
/* Find overlays by inspecting section vmas. */
- if (spu_elf_find_overlays (output_bfd, &link_info))
+ if (spu_elf_find_overlays (link_info.output_bfd, &link_info))
{
int ret;
- ret = spu_elf_size_stubs (output_bfd, &link_info,
+ ret = spu_elf_size_stubs (link_info.output_bfd, &link_info,
spu_place_special_section,
non_overlay_stubs);
if (ret == 0)
@@ -225,7 +225,7 @@ gld${EMULATION_NAME}_finish (void)
{
int need_laying_out;
- need_laying_out = bfd_elf_discard_info (output_bfd, &link_info);
+ need_laying_out = bfd_elf_discard_info (link_info.output_bfd, &link_info);
gld${EMULATION_NAME}_map_segments (need_laying_out);
@@ -233,7 +233,8 @@ gld${EMULATION_NAME}_finish (void)
{
asection *s;
- s = spu_elf_check_vma (output_bfd, local_store_lo, local_store_hi);
+ s = spu_elf_check_vma (link_info.output_bfd,
+ local_store_lo, local_store_hi);
if (s != NULL)
einfo ("%X%P: %A exceeds local store range\n", s);
}
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index 00d949f..6367c3c 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -10,7 +10,7 @@ fragment <<EOF
/* SunOS emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
SunOS shared library support by Ian Lance Taylor <ian@cygnus.com>
@@ -378,7 +378,7 @@ gld${EMULATION_NAME}_after_open (void)
include another without requiring special action by the person
doing the link. Note that the needed list can actually grow
while we are stepping through this loop. */
- needed = bfd_sunos_get_needed_list (output_bfd, &link_info);
+ needed = bfd_sunos_get_needed_list (link_info.output_bfd, &link_info);
for (l = needed; l != NULL; l = l->next)
{
struct bfd_link_needed_list *ll;
@@ -405,7 +405,7 @@ gld${EMULATION_NAME}_after_open (void)
{
bfd *abfd;
- abfd = bfd_openr (lname, bfd_get_target (output_bfd));
+ abfd = bfd_openr (lname, bfd_get_target (link_info.output_bfd));
if (abfd != NULL)
{
if (! bfd_check_format (abfd, bfd_object))
@@ -555,7 +555,7 @@ gld${EMULATION_NAME}_try_needed (const char *dir, const char *name)
alc = (char *) xmalloc (strlen (dir) + strlen (file) + 2);
sprintf (alc, "%s/%s", dir, file);
free (file);
- abfd = bfd_openr (alc, bfd_get_target (output_bfd));
+ abfd = bfd_openr (alc, bfd_get_target (link_info.output_bfd));
if (abfd == NULL)
return FALSE;
if (! bfd_check_format (abfd, bfd_object))
@@ -715,7 +715,7 @@ gld${EMULATION_NAME}_before_allocation (void)
FALSE);
if (hdyn == NULL)
einfo ("%P%F: bfd_link_hash_lookup: %E\n");
- if (! bfd_sunos_record_link_assignment (output_bfd, &link_info,
+ if (! bfd_sunos_record_link_assignment (link_info.output_bfd, &link_info,
"__DYNAMIC"))
einfo ("%P%F: failed to record assignment to __DYNAMIC: %E\n");
}
@@ -727,8 +727,8 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Let the backend linker work out the sizes of any sections
required by dynamic linking. */
- if (! bfd_sunos_size_dynamic_sections (output_bfd, &link_info, &sdyn,
- &sneed, &srules))
+ if (! bfd_sunos_size_dynamic_sections (link_info.output_bfd, &link_info,
+ &sdyn, &sneed, &srules))
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
if (sneed != NULL)
@@ -847,7 +847,8 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
if (strcmp (exp->assign.dst, ".") != 0)
{
- if (! bfd_sunos_record_link_assignment (output_bfd, &link_info,
+ if (! bfd_sunos_record_link_assignment (link_info.output_bfd,
+ &link_info,
exp->assign.dst))
einfo ("%P%F: failed to record assignment to %s: %E\n",
exp->assign.dst);
@@ -914,12 +915,13 @@ gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp)
Instead, we use offsets, and rely on the BFD backend to
finish the section up correctly. FIXME: Talk about lack of
referential locality. */
- bfd_put_32 (output_bfd, need_pnames - need_contents, need_pinfo);
+ bfd_put_32 (link_info.output_bfd, need_pnames - need_contents,
+ need_pinfo);
if (! inp->is_archive)
{
- bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 4);
- bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 8);
- bfd_put_16 (output_bfd, (bfd_vma) 0, need_pinfo + 10);
+ bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 4);
+ bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 8);
+ bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 10);
strcpy ((char *) need_pnames, inp->filename);
}
else
@@ -927,22 +929,23 @@ gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp)
char *verstr;
int maj, min;
- bfd_put_32 (output_bfd, (bfd_vma) 0x80000000, need_pinfo + 4);
+ bfd_put_32 (link_info.output_bfd, (bfd_vma) 0x80000000,
+ need_pinfo + 4);
maj = 0;
min = 0;
verstr = strstr (inp->filename, ".so.");
if (verstr != NULL)
sscanf (verstr, ".so.%d.%d", &maj, &min);
- bfd_put_16 (output_bfd, (bfd_vma) maj, need_pinfo + 8);
- bfd_put_16 (output_bfd, (bfd_vma) min, need_pinfo + 10);
+ bfd_put_16 (link_info.output_bfd, (bfd_vma) maj, need_pinfo + 8);
+ bfd_put_16 (link_info.output_bfd, (bfd_vma) min, need_pinfo + 10);
strcpy ((char *) need_pnames, inp->local_sym_name + 2);
}
c = (need_pinfo - need_contents) / NEED_ENTRY_SIZE;
if (c + 1 >= need_entries)
- bfd_put_32 (output_bfd, (bfd_vma) 0, need_pinfo + 12);
+ bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 12);
else
- bfd_put_32 (output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE,
+ bfd_put_32 (link_info.output_bfd, (bfd_vma) (c + 1) * NEED_ENTRY_SIZE,
need_pinfo + 12);
need_pinfo += NEED_ENTRY_SIZE;
diff --git a/ld/emultempl/vanilla.em b/ld/emultempl/vanilla.em
index 8ed2a5a..bd8039a 100644
--- a/ld/emultempl/vanilla.em
+++ b/ld/emultempl/vanilla.em
@@ -2,7 +2,7 @@
# It does some substitutions.
fragment <<EOF
/* A vanilla emulation with no defaults
- Copyright 1991, 1992, 1994, 2000, 2001, 2002, 2003, 2007
+ Copyright 1991, 1992, 1994, 2000, 2001, 2002, 2003, 2007, 2008
Free Software Foundation, Inc.
Written by Steve Chamberlain steve@cygnus.com
@@ -25,6 +25,7 @@ fragment <<EOF
#include "sysdep.h"
#include "bfd.h"
+#include "bfdlink.h"
#include "ld.h"
#include "ldmisc.h"
@@ -44,7 +45,8 @@ vanilla_set_output_arch (void)
{
/* Set the output architecture and machine if possible */
unsigned long machine = 0;
- bfd_set_arch_mach(output_bfd, ldfile_output_architecture, machine);
+ bfd_set_arch_mach (link_info.output_bfd,
+ ldfile_output_architecture, machine);
}
static char *
diff --git a/ld/emultempl/vxworks.em b/ld/emultempl/vxworks.em
index e49391a..ef92e0e 100644
--- a/ld/emultempl/vxworks.em
+++ b/ld/emultempl/vxworks.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007, 2008 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
@@ -41,14 +41,14 @@ vxworks_after_open (void)
if (force_dynamic
&& link_info.input_bfds
- && output_bfd->xvec->flavour == bfd_target_elf_flavour
+ && bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
&& !_bfd_elf_link_create_dynamic_sections (link_info.input_bfds,
&link_info))
einfo ("%X%P: Cannot create dynamic sections %E\n");
if (!force_dynamic
&& !link_info.shared
- && output_bfd->xvec->flavour == bfd_target_elf_flavour
+ && bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
&& elf_hash_table (&link_info)->dynamic_sections_created)
einfo ("%X%P: Dynamic sections created in non-dynamic link\n");
}
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index f09515a..6651a50 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -1,5 +1,5 @@
# This shell script emits a C file. -*- C -*-
-# Copyright 2003, 2004, 2005, 2006, 2007
+# Copyright 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
@@ -434,12 +434,14 @@ elf_xtensa_before_allocation (void)
required to process relocations) for the selected Xtensa
configuration. */
- if (is_big_endian && output_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
+ if (is_big_endian
+ && link_info.output_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
{
einfo (_("%F%P: little endian output does not match "
"Xtensa configuration\n"));
}
- if (!is_big_endian && output_bfd->xvec->byteorder == BFD_ENDIAN_BIG)
+ if (!is_big_endian
+ && link_info.output_bfd->xvec->byteorder == BFD_ENDIAN_BIG)
{
einfo (_("%F%P: big endian output does not match "
"Xtensa configuration\n"));
diff --git a/ld/emultempl/z80.em b/ld/emultempl/z80.em
index 7b17e8f..37ef944 100644
--- a/ld/emultempl/z80.em
+++ b/ld/emultempl/z80.em
@@ -1,7 +1,7 @@
# This shell script emits C code -*- C -*-
# to keep track of the machine type of Z80 object files
# It does some substitutions.
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007, 2008 Free Software Foundation, Inc.
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
@@ -96,7 +96,7 @@ gldz80_after_open (void)
default:
mach_type = 0;
}
- bfd_set_arch_mach (output_bfd, bfd_arch_z80, mach_type);
+ bfd_set_arch_mach (link_info.output_bfd, bfd_arch_z80, mach_type);
}
/* --- \end{z80.em} */
EOF