aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/aarch64elf.em4
-rw-r--r--ld/emultempl/aix.em21
-rw-r--r--ld/emultempl/alphaelf.em8
-rw-r--r--ld/emultempl/armcoff.em8
-rw-r--r--ld/emultempl/armelf.em6
-rw-r--r--ld/emultempl/avrelf.em4
-rw-r--r--ld/emultempl/beos.em10
-rw-r--r--ld/emultempl/cr16elf.em4
-rw-r--r--ld/emultempl/elf-generic.em2
-rw-r--r--ld/emultempl/elf32.em50
-rw-r--r--ld/emultempl/genelf.em4
-rw-r--r--ld/emultempl/generic.em10
-rw-r--r--ld/emultempl/gld960.em8
-rw-r--r--ld/emultempl/gld960c.em8
-rw-r--r--ld/emultempl/hppaelf.em6
-rw-r--r--ld/emultempl/irix.em2
-rw-r--r--ld/emultempl/linux.em10
-rw-r--r--ld/emultempl/lnk960.em10
-rw-r--r--ld/emultempl/m68hc1xelf.em2
-rw-r--r--ld/emultempl/m68kcoff.em12
-rw-r--r--ld/emultempl/m68kelf.em4
-rw-r--r--ld/emultempl/metagelf.em4
-rw-r--r--ld/emultempl/mipself.em2
-rw-r--r--ld/emultempl/mmo.em2
-rw-r--r--ld/emultempl/msp430.em12
-rw-r--r--ld/emultempl/nds32elf.em8
-rw-r--r--ld/emultempl/needrelax.em2
-rw-r--r--ld/emultempl/nios2elf.em8
-rw-r--r--ld/emultempl/pe.em32
-rw-r--r--ld/emultempl/pep.em32
-rw-r--r--ld/emultempl/ppc32elf.em3
-rw-r--r--ld/emultempl/ppc64elf.em12
-rw-r--r--ld/emultempl/sh64elf.em3
-rw-r--r--ld/emultempl/solaris2.em6
-rw-r--r--ld/emultempl/spuelf.em8
-rw-r--r--ld/emultempl/sunos.em23
-rw-r--r--ld/emultempl/tic6xdsbt.em2
-rw-r--r--ld/emultempl/ticoff.em8
-rw-r--r--ld/emultempl/v850elf.em2
-rw-r--r--ld/emultempl/vms.em2
-rw-r--r--ld/emultempl/vxworks.em2
41 files changed, 195 insertions, 171 deletions
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index 313263a..b75a24b 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -238,7 +238,7 @@ gld${EMULATION_NAME}_after_allocation (void)
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf${ELFSIZE}_aarch64_setup_section_lists (link_info.output_bfd,
&link_info);
@@ -273,7 +273,7 @@ gld${EMULATION_NAME}_after_allocation (void)
static void
gld${EMULATION_NAME}_finish (void)
{
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Now build the linker stubs. */
if (stub_file->the_bfd->sections != NULL)
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 463cf17..d4147f3 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -532,7 +532,8 @@ gld${EMULATION_NAME}_handle_option (int optc)
case OPTION_MODTYPE:
if (*optarg == 'S')
{
- link_info.shared = TRUE;
+ link_info.type = type_dll;
+ link_info.pic = TRUE;
++optarg;
}
if (*optarg == '\0' || optarg[1] == '\0')
@@ -680,7 +681,7 @@ gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry)
static void
gld${EMULATION_NAME}_after_open (void)
{
- bfd_boolean r;
+ enum output_type t;
struct set_info *p;
after_open_default ();
@@ -690,11 +691,11 @@ gld${EMULATION_NAME}_after_open (void)
entries for all references to symbols, even in a final
executable. Of course, we only want to do this if we are
producing an XCOFF output file. */
- r = link_info.relocatable;
+ t = link_info.type;
if (strstr (bfd_get_target (link_info.output_bfd), "xcoff") != NULL)
- link_info.relocatable = TRUE;
+ link_info.type = type_relocatable;
ldctor_build_sets ();
- link_info.relocatable = r;
+ link_info.type = t;
/* For each set, record the size, so that the XCOFF backend can
output the correct csect length. */
@@ -953,7 +954,7 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Executables and shared objects must always have .text, .data
and .bss output sections, so that the header can refer to them.
The kernel refuses to load objects that have missing sections. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
for (i = 0; i < ARRAY_SIZE (must_keep_sections); i++)
{
asection *sec;
@@ -1410,11 +1411,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -1431,9 +1432,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/alphaelf.em b/ld/emultempl/alphaelf.em
index 06ea6c1..1301c6f 100644
--- a/ld/emultempl/alphaelf.em
+++ b/ld/emultempl/alphaelf.em
@@ -73,7 +73,9 @@ static void
alpha_after_parse (void)
{
link_info.relax_pass = 2;
- if (limit_32bit && !link_info.shared && !link_info.relocatable)
+ if (limit_32bit
+ && !bfd_link_pic (&link_info)
+ && !bfd_link_relocatable (&link_info))
lang_section_start (".interp",
exp_binop ('+',
exp_intop (ALPHA_TEXT_START_32BIT),
@@ -90,7 +92,9 @@ alpha_before_allocation (void)
gld${EMULATION_NAME}_before_allocation ();
/* Add -relax if -O, not -r, and not explicitly disabled. */
- if (link_info.optimize && !link_info.relocatable && ! RELAXATION_DISABLED_BY_USER)
+ if (link_info.optimize
+ && !bfd_link_relocatable (&link_info)
+ && ! RELAXATION_DISABLED_BY_USER)
ENABLE_RELAXATION;
}
diff --git a/ld/emultempl/armcoff.em b/ld/emultempl/armcoff.em
index 9003f7b..e93f075 100644
--- a/ld/emultempl/armcoff.em
+++ b/ld/emultempl/armcoff.em
@@ -215,11 +215,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -236,9 +236,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index f1da1bc..408d605 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -273,7 +273,7 @@ gld${EMULATION_NAME}_after_allocation (void)
{
int ret;
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Build a sorted list of input text sections, then use that to process
the unwind table index. */
@@ -338,7 +338,7 @@ gld${EMULATION_NAME}_after_allocation (void)
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf32_arm_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
@@ -383,7 +383,7 @@ gld${EMULATION_NAME}_finish (void)
}
}
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Now build the linker stubs. */
if (stub_file->the_bfd->sections != NULL)
diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
index f7a3acb..18bd51d 100644
--- a/ld/emultempl/avrelf.em
+++ b/ld/emultempl/avrelf.em
@@ -81,7 +81,7 @@ avr_elf_${EMULATION_NAME}_before_allocation (void)
/* If generating a relocatable output file, then
we don't have to generate the trampolines. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
avr_no_stubs = TRUE;
if (avr_no_stubs)
@@ -182,7 +182,7 @@ avr_finish (void)
bfd *abfd;
bfd_boolean avr_link_relax;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
avr_link_relax = TRUE;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index 3511a55..488c0dd 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -329,7 +329,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
if (!init[IMAGEBASEOFF].inited)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
init[IMAGEBASEOFF].value = 0;
else if (init[DLLOFF].value)
init[IMAGEBASEOFF].value = BEOS_DLL_IMAGE_BASE;
@@ -338,7 +338,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
}
/* Don't do any symbol assignments if this is a relocatable link. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Glue the assignments into the abs section */
@@ -674,7 +674,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
If they're marked as COMDAT sections, we don't want .text\$foo to
end up in .text and then have .text disappear because it's marked
link-once-discard. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return NULL;
/* Everything from the '\$' on gets deleted so don't allow '\$' as the
@@ -734,11 +734,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em
index 9c07b35..276dce4 100644
--- a/ld/emultempl/cr16elf.em
+++ b/ld/emultempl/cr16elf.em
@@ -39,7 +39,7 @@ cr16_elf_after_open (void)
gld${EMULATION_NAME}_after_open ();
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && !bfd_link_relocatable (&link_info))
{
bfd *abfd;
@@ -132,7 +132,7 @@ cr16elf_before_allocation (void)
gld${EMULATION_NAME}_before_allocation ();
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && (!bfd_link_relocatable (&link_info)))
{
bfd *abfd;
diff --git a/ld/emultempl/elf-generic.em b/ld/emultempl/elf-generic.em
index 99d6671..4eceec1 100644
--- a/ld/emultempl/elf-generic.em
+++ b/ld/emultempl/elf-generic.em
@@ -35,7 +35,7 @@ gld${EMULATION_NAME}_map_segments (bfd_boolean need_layout)
need_layout = FALSE;
if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
{
bfd_size_type phdr_size;
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 8a41347..7fe9089 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1029,7 +1029,7 @@ gld${EMULATION_NAME}_after_open (void)
}
}
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
if (link_info.execstack == ! link_info.noexecstack)
/* PR ld/16744: If "-z [no]execstack" has been specified on the
@@ -1456,7 +1456,7 @@ gld${EMULATION_NAME}_before_allocation (void)
/* Make __ehdr_start hidden if it has been referenced, to
prevent the symbol from being dynamic. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
struct elf_link_hash_entry *h
= elf_link_hash_lookup (elf_hash_table (&link_info), "__ehdr_start",
@@ -1827,7 +1827,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
int iself = s->owner->xvec->flavour == bfd_target_elf_flavour;
unsigned int sh_type = iself ? elf_section_type (s) : SHT_NULL;
- if (! link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& link_info.combreloc
&& (s->flags & SEC_ALLOC))
{
@@ -1909,8 +1909,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
/* If this is a final link, then always put .gnu.warning.SYMBOL
sections into the .text section to get them out of the way. */
- if (link_info.executable
- && ! link_info.relocatable
+ if (bfd_link_executable (&link_info)
&& CONST_STRNEQ (s->name, ".gnu.warning.")
&& hold[orphan_text].os != NULL)
{
@@ -2009,11 +2008,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -2023,26 +2022,28 @@ sed $sc ldscripts/${EMULATION_NAME}.xn >> e${EMULATION_NAME}.c
fi
if test -n "$GENERATE_PIE_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
-echo ' ; else if (link_info.pie && link_info.combreloc' >> e${EMULATION_NAME}.c
-echo ' && link_info.relro' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.pie && link_info.combreloc) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c
fi
-echo ' ; else if (link_info.pie) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_pie (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xd >> e${EMULATION_NAME}.c
fi
if test -n "$GENERATE_SHLIB_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
-echo ' ; else if (link_info.shared && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_dll (&link_info) && link_info.combreloc' >> e${EMULATION_NAME}.c
echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.shared && link_info.combreloc) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_dll (&link_info) && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c
fi
-echo ' ; else if (link_info.shared) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_dll (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c
fi
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
@@ -2063,9 +2064,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
@@ -2080,30 +2081,33 @@ fi
if test -n "$GENERATE_PIE_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
fragment <<EOF
- else if (link_info.pie && link_info.combreloc
- && link_info.relro && (link_info.flags & DF_BIND_NOW))
+ else if (bfd_link_pie (&link_info)
+ && link_info.combreloc
+ && link_info.relro
+ && (link_info.flags & DF_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xdw";
- else if (link_info.pie && link_info.combreloc)
+ else if (bfd_link_pie (&link_info)
+ && link_info.combreloc)
return "ldscripts/${EMULATION_NAME}.xdc";
EOF
fi
fragment <<EOF
- else if (link_info.pie)
+ else if (bfd_link_pie (&link_info))
return "ldscripts/${EMULATION_NAME}.xd";
EOF
fi
if test -n "$GENERATE_SHLIB_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
fragment <<EOF
- else if (link_info.shared && link_info.combreloc
+ else if (bfd_link_dll (&link_info) && link_info.combreloc
&& link_info.relro && (link_info.flags & DF_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xsw";
- else if (link_info.shared && link_info.combreloc)
+ else if (bfd_link_dll (&link_info) && link_info.combreloc)
return "ldscripts/${EMULATION_NAME}.xsc";
EOF
fi
fragment <<EOF
- else if (link_info.shared)
+ else if (bfd_link_dll (&link_info))
return "ldscripts/${EMULATION_NAME}.xs";
EOF
fi
diff --git a/ld/emultempl/genelf.em b/ld/emultempl/genelf.em
index cc046fe..7dc5e72 100644
--- a/ld/emultempl/genelf.em
+++ b/ld/emultempl/genelf.em
@@ -37,7 +37,7 @@ gld${EMULATION_NAME}_after_open (void)
after_open_default ();
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
for (ibfd = link_info.input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
if ((syms = bfd_get_outsymbols (ibfd)) != NULL
&& bfd_get_flavour (ibfd) == bfd_target_elf_flavour)
@@ -52,7 +52,7 @@ gld${EMULATION_NAME}_after_open (void)
static void
gld${EMULATION_NAME}_before_allocation (void)
{
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
&& !_bfd_elf_size_group_sections (&link_info))
einfo ("%X%P: can not size group sections: %E\n");
before_allocation_default ();
diff --git a/ld/emultempl/generic.em b/ld/emultempl/generic.em
index b08da3c..6fff1cc 100644
--- a/ld/emultempl/generic.em
+++ b/ld/emultempl/generic.em
@@ -62,7 +62,7 @@ EOF
case ${target} in
msp430-*-* )
fragment <<EOF
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
TARGET_ENABLE_RELAXATION;
EOF
;;
@@ -91,11 +91,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -112,9 +112,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/gld960.em b/ld/emultempl/gld960.em
index 03a9a3b..e44cd51 100644
--- a/ld/emultempl/gld960.em
+++ b/ld/emultempl/gld960.em
@@ -84,11 +84,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -105,9 +105,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/gld960c.em b/ld/emultempl/gld960c.em
index 2edf3df..8dee329 100644
--- a/ld/emultempl/gld960c.em
+++ b/ld/emultempl/gld960c.em
@@ -97,11 +97,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -118,9 +118,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 9b49a4a..26ccc0f 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -50,7 +50,7 @@ static bfd_signed_vma group_size = 1;
static void
hppaelf_after_parse (void)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
lang_add_unique (".text");
/* Enable this once we split millicode stuff from libgcc:
@@ -259,7 +259,7 @@ gld${EMULATION_NAME}_after_allocation (void)
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf32_hppa_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
@@ -290,7 +290,7 @@ gld${EMULATION_NAME}_after_allocation (void)
if (need_laying_out != -1)
gld${EMULATION_NAME}_map_segments (need_laying_out);
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Set the global data pointer. */
if (! elf32_hppa_set_gp (link_info.output_bfd, &link_info))
diff --git a/ld/emultempl/irix.em b/ld/emultempl/irix.em
index 2969f9b..963dadb 100644
--- a/ld/emultempl/irix.em
+++ b/ld/emultempl/irix.em
@@ -32,7 +32,7 @@ fragment <<EOF
static void
irix_after_open (void)
{
- if (link_info.shared && command_line.soname == 0)
+ if (bfd_link_dll (&link_info) && command_line.soname == 0)
command_line.soname
= (char *) lbasename (bfd_get_filename (link_info.output_bfd));
diff --git a/ld/emultempl/linux.em b/ld/emultempl/linux.em
index 9c320a3..afbbb9e 100644
--- a/ld/emultempl/linux.em
+++ b/ld/emultempl/linux.em
@@ -114,7 +114,7 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
static void
gld${EMULATION_NAME}_before_allocation (void)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Let the backend work out the sizes of any sections required by
@@ -141,11 +141,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -162,9 +162,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/lnk960.em b/ld/emultempl/lnk960.em
index 6d52801..d8391b3 100644
--- a/ld/emultempl/lnk960.em
+++ b/ld/emultempl/lnk960.em
@@ -190,7 +190,7 @@ symbol_at_end_of (const char *secname, const char *name)
static void
lnk960_after_allocation (void)
{
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
symbol_at_end_of (".text", "_etext");
symbol_at_end_of (".data", "_edata");
@@ -278,11 +278,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -299,9 +299,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em
index 7044838..ff347ba 100644
--- a/ld/emultempl/m68hc1xelf.em
+++ b/ld/emultempl/m68hc1xelf.em
@@ -68,7 +68,7 @@ m68hc11_elf_${EMULATION_NAME}_before_allocation (void)
/* If generating a relocatable output file, then we don't
have to generate the trampolines. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
ret = elf32_m68hc11_setup_section_lists (link_info.output_bfd, &link_info);
diff --git a/ld/emultempl/m68kcoff.em b/ld/emultempl/m68kcoff.em
index e29ce9e..d547ad9 100644
--- a/ld/emultempl/m68kcoff.em
+++ b/ld/emultempl/m68kcoff.em
@@ -64,7 +64,7 @@ gld${EMULATION_NAME}_after_open (void)
after_open_default ();
if (! command_line.embedded_relocs
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
return;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
@@ -130,7 +130,7 @@ gld${EMULATION_NAME}_after_allocation (void)
bfd *abfd;
if (! command_line.embedded_relocs
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
return;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
@@ -175,11 +175,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -196,9 +196,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em
index 6dab1c1..b71052d 100644
--- a/ld/emultempl/m68kelf.em
+++ b/ld/emultempl/m68kelf.em
@@ -67,7 +67,7 @@ m68k_elf_after_open (void)
#ifdef SUPPORT_EMBEDDED_RELOCS
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && (!bfd_link_relocatable (&link_info)))
{
bfd *abfd;
@@ -147,7 +147,7 @@ m68k_elf_after_allocation (void)
#ifdef SUPPORT_EMBEDDED_RELOCS
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && (!bfd_link_relocatable (&link_info)))
{
bfd *abfd;
diff --git a/ld/emultempl/metagelf.em b/ld/emultempl/metagelf.em
index c9dadd1..37af8aa 100644
--- a/ld/emultempl/metagelf.em
+++ b/ld/emultempl/metagelf.em
@@ -236,7 +236,7 @@ gld${EMULATION_NAME}_after_allocation (void)
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf_metag_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
@@ -266,7 +266,7 @@ gld${EMULATION_NAME}_after_allocation (void)
if (need_laying_out != -1)
gld${EMULATION_NAME}_map_segments (need_laying_out);
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Now build the linker stubs. */
if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em
index 611c0bd..0eb0813 100644
--- a/ld/emultempl/mipself.em
+++ b/ld/emultempl/mipself.em
@@ -216,7 +216,7 @@ mips_before_allocation (void)
flagword flags;
flags = elf_elfheader (link_info.output_bfd)->e_flags;
- if (!link_info.shared
+ if (!bfd_link_pic (&link_info)
&& !link_info.nocopyreloc
&& (flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) == EF_MIPS_CPIC)
_bfd_mips_elf_use_plts_and_copy_relocs (&link_info);
diff --git a/ld/emultempl/mmo.em b/ld/emultempl/mmo.em
index 405b2f0..47f77d8 100644
--- a/ld/emultempl/mmo.em
+++ b/ld/emultempl/mmo.em
@@ -91,7 +91,7 @@ mmo_place_orphan (asection *s,
/* We have nothing to say for anything other than a final link or
for sections that are excluded. */
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
|| (s->flags & SEC_EXCLUDE) != 0)
return NULL;
diff --git a/ld/emultempl/msp430.em b/ld/emultempl/msp430.em
index 0eff3f0..7533aa5 100644
--- a/ld/emultempl/msp430.em
+++ b/ld/emultempl/msp430.em
@@ -60,7 +60,7 @@ gld${EMULATION_NAME}_before_parse (void)
/* The MSP430 port *needs* linker relaxtion in order to cope with large
functions where conditional branches do not fit into a +/- 1024 byte range. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
TARGET_ENABLE_RELAXATION;
}
@@ -85,11 +85,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -106,9 +106,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
@@ -178,7 +178,7 @@ gld${EMULATION_NAME}_place_orphan (asection * s,
if ((s->flags & SEC_ALLOC) == 0)
return NULL;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return NULL;
/* If constraints are involved let the linker handle the placement normally. */
diff --git a/ld/emultempl/nds32elf.em b/ld/emultempl/nds32elf.em
index 8a2be29..e74652a 100644
--- a/ld/emultempl/nds32elf.em
+++ b/ld/emultempl/nds32elf.em
@@ -70,7 +70,7 @@ nds32_elf_create_output_section_statements (void)
static void
nds32_elf_after_parse (void)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
DISABLE_RELAXATION;
if (!RELAXATION_ENABLED)
@@ -88,7 +88,7 @@ nds32_elf_after_parse (void)
else
update_ex9_table = 0;
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
{
target_optimize = target_optimize & (!NDS32_RELAX_JUMP_IFC_ON);
target_optimize = target_optimize & (!NDS32_RELAX_EX9_ON);
@@ -157,14 +157,14 @@ nds32_elf_after_open (void)
/* Check object files if the target is dynamic linked executable
or shared object. */
if (elf_hash_table (&link_info)->dynamic_sections_created
- || link_info.shared || link_info.pie)
+ || bfd_link_pic (&link_info))
{
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
{
if (!(elf_elfheader (abfd)->e_flags & E_NDS32_HAS_PIC))
{
/* Non-PIC object file is used. */
- if (link_info.shared || link_info.pie)
+ if (bfd_link_pic (&link_info))
{
/* For PIE or shared object, all input must be PIC. */
einfo (_("%B: must use -fpic to compile this file "
diff --git a/ld/emultempl/needrelax.em b/ld/emultempl/needrelax.em
index fc57fa3..a2acf19 100644
--- a/ld/emultempl/needrelax.em
+++ b/ld/emultempl/needrelax.em
@@ -33,7 +33,7 @@ need_relax_${EMULATION_NAME}_before_allocation (void)
gld${EMULATION_NAME}_before_allocation ();
/* Force -relax on if not doing a relocatable link. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
ENABLE_RELAXATION;
}
EOF
diff --git a/ld/emultempl/nios2elf.em b/ld/emultempl/nios2elf.em
index 90c8c62..42ea0df 100644
--- a/ld/emultempl/nios2elf.em
+++ b/ld/emultempl/nios2elf.em
@@ -50,7 +50,7 @@ nios2elf_create_output_section_statements (void)
/* If --no-relax was not explicitly specified by the user, enable
relaxation. If it's not enabled (either explicitly or by default),
we're done, as we won't need to create any stubs. */
- if (!link_info.relocatable && RELAXATION_DISABLED_BY_DEFAULT)
+ if (!bfd_link_relocatable (&link_info) && RELAXATION_DISABLED_BY_DEFAULT)
ENABLE_RELAXATION;
if (!RELAXATION_ENABLED)
return;
@@ -253,7 +253,9 @@ gld${EMULATION_NAME}_after_allocation (void)
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable && RELAXATION_ENABLED)
+ if (stub_file != NULL
+ && !bfd_link_relocatable (&link_info)
+ && RELAXATION_ENABLED)
{
ret = nios2_elf32_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
@@ -282,7 +284,7 @@ gld${EMULATION_NAME}_after_allocation (void)
if (need_laying_out != -1)
gld${EMULATION_NAME}_map_segments (need_laying_out);
- if (!link_info.relocatable && RELAXATION_ENABLED)
+ if (!bfd_link_relocatable (&link_info) && RELAXATION_ENABLED)
{
/* Now build the linker stubs. */
if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 0a5dcbf..e817b47 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -553,7 +553,7 @@ set_entry_point (void)
/* Entry point name for arbitrary subsystem numbers. */
static const char default_entry[] = "mainCRTStartup";
- if (link_info.shared || dll)
+ if (bfd_link_pic (&link_info) || dll)
{
#if defined (TARGET_IS_i386pe)
entry = "DllMainCRTStartup@12";
@@ -960,9 +960,9 @@ gld_${EMULATION_NAME}_set_symbols (void)
if (!init[IMAGEBASEOFF].inited)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
init[IMAGEBASEOFF].value = 0;
- else if (init[DLLOFF].value || (link_info.shared && !link_info.pie))
+ else if (init[DLLOFF].value || bfd_link_dll (&link_info))
{
#ifdef DLL_SUPPORT
init[IMAGEBASEOFF].value = (pe_enable_auto_image_base
@@ -978,7 +978,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
}
/* Don't do any symbol assignments if this is a relocatable link. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Glue the assignments into the abs section. */
@@ -1494,7 +1494,7 @@ gld_${EMULATION_NAME}_after_open (void)
find it, so enable it in that case. */
if (pe_use_coff_long_section_names < 0 && link_info.strip == strip_none)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
pe_use_coff_long_section_names = 1;
else
{
@@ -1533,10 +1533,10 @@ gld_${EMULATION_NAME}_after_open (void)
|| defined (TARGET_IS_armpe) \
|| defined (TARGET_IS_arm_epoc_pe) \
|| defined (TARGET_IS_arm_wince_pe)
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
pe_dll_build_sections (link_info.output_bfd, &link_info);
#else
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
pe_dll_build_sections (link_info.output_bfd, &link_info);
else
pe_exe_build_sections (link_info.output_bfd, &link_info);
@@ -1956,7 +1956,10 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
/* def_file_print (stdout, pe_def_file); */
if (pe_def_file->is_dll == 1)
- link_info.shared = 1;
+ {
+ link_info.type = type_dll;
+ link_info.pic = 1;
+ }
if (pe_def_file->base_address != (bfd_vma)(-1))
{
@@ -2065,9 +2068,10 @@ gld_${EMULATION_NAME}_finish (void)
finish_default ();
#ifdef DLL_SUPPORT
- if (link_info.shared
+ if (bfd_link_pic (&link_info)
#if !defined(TARGET_IS_shpe)
- || (!link_info.relocatable && pe_def_file->num_exports != 0)
+ || (!bfd_link_relocatable (&link_info)
+ && pe_def_file->num_exports != 0)
#endif
)
{
@@ -2126,7 +2130,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
lang_statement_union_type **pl;
/* Look through the script to see where to place this section. */
- if (!link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& (dollar = strchr (secname, '\$')) != NULL)
{
size_t len = dollar - secname;
@@ -2260,7 +2264,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
os = lang_insert_orphan (s, secname, constraint, after, place, address,
&add_child);
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
os->section_alignment = s->alignment_power;
os->bfd_section->alignment_power = s->alignment_power;
@@ -2416,11 +2420,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index bf36276..8b30b1c 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -515,7 +515,7 @@ set_entry_point (void)
/* Entry point name for arbitrary subsystem numbers. */
static const char default_entry[] = "mainCRTStartup";
- if (link_info.shared || dll)
+ if (bfd_link_pic (&link_info) || dll)
{
entry = "DllMainCRTStartup";
}
@@ -903,9 +903,9 @@ gld_${EMULATION_NAME}_set_symbols (void)
if (!init[IMAGEBASEOFF].inited)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
init[IMAGEBASEOFF].value = 0;
- else if (init[DLLOFF].value || (link_info.shared && !link_info.pie))
+ else if (init[DLLOFF].value || bfd_link_dll (&link_info))
{
#ifdef DLL_SUPPORT
init[IMAGEBASEOFF].value = (pep_enable_auto_image_base
@@ -921,7 +921,7 @@ gld_${EMULATION_NAME}_set_symbols (void)
}
/* Don't do any symbol assignments if this is a relocatable link. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Glue the assignments into the abs section. */
@@ -1459,7 +1459,7 @@ gld_${EMULATION_NAME}_after_open (void)
find it, so enable it in that case. */
if (pep_use_coff_long_section_names < 0 && link_info.strip == strip_none)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
pep_use_coff_long_section_names = 1;
else
{
@@ -1495,9 +1495,9 @@ gld_${EMULATION_NAME}_after_open (void)
pep_fixup_stdcalls ();
#ifndef TARGET_IS_i386pep
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
#else
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
#endif
pep_dll_build_sections (link_info.output_bfd, &link_info);
@@ -1789,7 +1789,10 @@ gld_${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIB
/* def_file_print (stdout, pep_def_file); */
if (pep_def_file->is_dll == 1)
- link_info.shared = 1;
+ {
+ link_info.type = type_dll;
+ link_info.pic = 1;
+ }
if (pep_def_file->base_address != (bfd_vma)(-1))
{
@@ -1846,8 +1849,9 @@ gld_${EMULATION_NAME}_finish (void)
finish_default ();
#ifdef DLL_SUPPORT
- if (link_info.shared
- || (!link_info.relocatable && pep_def_file->num_exports != 0))
+ if (bfd_link_pic (&link_info)
+ || (!bfd_link_relocatable (&link_info)
+ && pep_def_file->num_exports != 0))
{
pep_dll_fill_sections (link_info.output_bfd, &link_info);
if (pep_implib_filename)
@@ -1897,7 +1901,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
lang_statement_union_type **pl;
/* Look through the script to see where to place this section. */
- if (!link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& (dollar = strchr (secname, '\$')) != NULL)
{
size_t len = dollar - secname;
@@ -2031,7 +2035,7 @@ gld_${EMULATION_NAME}_place_orphan (asection *s,
address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
os = lang_insert_orphan (s, secname, constraint, after, place, address,
&add_child);
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
os->section_alignment = s->alignment_power;
os->bfd_section->alignment_power = s->alignment_power;
@@ -2187,11 +2191,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index 41ff746..bbf3ce0 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -47,7 +47,8 @@ static void
ppc_after_open_output (void)
{
if (params.emit_stub_syms < 0)
- params.emit_stub_syms = link_info.emitrelocations || link_info.shared;
+ params.emit_stub_syms = (link_info.emitrelocations
+ || bfd_link_pic (&link_info));
if (pagesize == 0)
pagesize = config.commonpagesize;
params.pagesize_p2 = bfd_log2 (pagesize);
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index 2d26a95..41942f9 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -95,7 +95,7 @@ ppc_create_output_section_statements (void)
ldlang_add_file (stub_file);
params.stub_bfd = stub_file->the_bfd;
if (params.save_restore_funcs < 0)
- params.save_restore_funcs = !link_info.relocatable;
+ params.save_restore_funcs = !bfd_link_relocatable (&link_info);
if (!ppc64_elf_init_stub_bfd (&link_info, &params))
einfo ("%F%P: can not init BFD: %E\n");
}
@@ -295,7 +295,7 @@ ppc_before_allocation (void)
}
if (!no_toc_opt
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
{
prelim_size_sections ();
@@ -445,7 +445,7 @@ ppc_layout_sections_again (void)
add even more stubs. */
gld${EMULATION_NAME}_map_segments (TRUE);
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
need_laying_out = -1;
@@ -498,7 +498,7 @@ gld${EMULATION_NAME}_after_allocation (void)
/* If generating a relocatable output file, then we don't have any
stubs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = ppc64_elf_setup_section_lists (&link_info);
if (ret < 0)
@@ -554,7 +554,7 @@ gld${EMULATION_NAME}_after_allocation (void)
innocuous except for confusing ELF_SECTION_IN_SEGMENT. */
gld${EMULATION_NAME}_map_segments (need_laying_out > 0);
- if (need_laying_out != -1 && !link_info.relocatable)
+ if (need_laying_out != -1 && !bfd_link_relocatable (&link_info))
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
}
@@ -577,7 +577,7 @@ gld${EMULATION_NAME}_finish (void)
if (params.emit_stub_syms < 0)
params.emit_stub_syms = 1;
if (stub_file != NULL
- && !link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& !ppc64_elf_build_stubs (&link_info, config.stats ? &msg : NULL))
einfo ("%X%P: can not build stubs: %E\n");
diff --git a/ld/emultempl/sh64elf.em b/ld/emultempl/sh64elf.em
index 794115a..29be05b 100644
--- a/ld/emultempl/sh64elf.em
+++ b/ld/emultempl/sh64elf.em
@@ -485,7 +485,8 @@ sh64_elf_${EMULATION_NAME}_after_allocation (void)
/* If we emit relocatable contents, we need a
relocation for the start address. */
- if (link_info.relocatable || link_info.emitrelocations)
+ if (bfd_link_relocatable (&link_info)
+ || link_info.emitrelocations)
{
/* FIXME: We could perhaps use lang_add_reloc and
friends here, but I'm not really sure that
diff --git a/ld/emultempl/solaris2.em b/ld/emultempl/solaris2.em
index e0edce2..dfb173d 100644
--- a/ld/emultempl/solaris2.em
+++ b/ld/emultempl/solaris2.em
@@ -53,7 +53,7 @@ elf_solaris2_before_allocation (void)
const char **sym;
/* Do this for both executables and shared objects. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
for (sym = global_syms; *sym != NULL; sym++)
{
@@ -75,7 +75,7 @@ elf_solaris2_before_allocation (void)
}
/* Only do this if emitting a shared object and versioning is in place. */
- if (link_info.shared
+ if (bfd_link_dll (&link_info)
&& (link_info.version_info != NULL
|| link_info.create_default_symver))
{
@@ -127,7 +127,7 @@ elf_solaris2_after_allocation (void)
const char **sym;
/* Do this for both executables and shared objects. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
for (sym = local_syms; *sym != NULL; sym++)
{
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index cc9ef2c..88278ae 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -107,10 +107,10 @@ spu_after_open (void)
params.emit_stub_syms |= link_info.emitrelocations;
spu_elf_setup (&link_info, &params);
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
lang_add_unique (".text.ia.*");
- if (!link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& link_info.input_bfds != NULL
&& !spu_elf_create_sections (&link_info))
einfo ("%X%P: can not create note section: %E\n");
@@ -264,7 +264,7 @@ static void
spu_before_allocation (void)
{
if (is_spu_target ()
- && !link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& !no_overlays)
{
int ret;
@@ -318,7 +318,7 @@ spu_before_allocation (void)
}
if (is_spu_target ()
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
spu_elf_size_sections (link_info.output_bfd, &link_info);
gld${EMULATION_NAME}_before_allocation ();
diff --git a/ld/emultempl/sunos.em b/ld/emultempl/sunos.em
index 952d731..c026e35 100644
--- a/ld/emultempl/sunos.em
+++ b/ld/emultempl/sunos.em
@@ -368,7 +368,7 @@ gld${EMULATION_NAME}_after_open (void)
after_open_default ();
/* We only need to worry about this when doing a final link. */
- if (link_info.relocatable || link_info.shared)
+ if (bfd_link_relocatable (&link_info) || bfd_link_pic (&link_info))
return;
/* Get the list of files which appear in ld_need entries in dynamic
@@ -669,7 +669,9 @@ gld${EMULATION_NAME}_before_allocation (void)
/* The SunOS native linker creates a shared library whenever there
are any undefined symbols in a link, unless -e is used. This is
pretty weird, but we are compatible. */
- if (! link_info.shared && ! link_info.relocatable && ! entry_from_cmdline)
+ if (! bfd_link_pic (&link_info)
+ && !bfd_link_relocatable (&link_info)
+ && ! entry_from_cmdline)
{
struct bfd_link_hash_entry *h;
@@ -686,14 +688,15 @@ gld${EMULATION_NAME}_before_allocation (void)
lang_for_each_statement (gld${EMULATION_NAME}_find_assignment);
if (! found_assign)
{
- link_info.shared = TRUE;
+ link_info.type = type_dll;
+ link_info.pic = TRUE;
break;
}
}
}
}
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
{
lang_output_section_statement_type *os;
@@ -710,7 +713,7 @@ gld${EMULATION_NAME}_before_allocation (void)
one. We need to create the symbol before calling
size_dynamic_sections, although we can't set the value until
afterward. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
hdyn = bfd_link_hash_lookup (link_info.hash, "__DYNAMIC", TRUE, FALSE,
FALSE);
@@ -803,7 +806,7 @@ gld${EMULATION_NAME}_before_allocation (void)
/* We must assign a value to __DYNAMIC. It should be zero if we are
not doing a dynamic link, or the start of the .dynamic section if
we are doing one. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
hdyn->type = bfd_link_hash_defined;
hdyn->u.def.value = 0;
@@ -969,11 +972,11 @@ fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
@@ -990,9 +993,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/tic6xdsbt.em b/ld/emultempl/tic6xdsbt.em
index 347e6d5..2e3d3f2 100644
--- a/ld/emultempl/tic6xdsbt.em
+++ b/ld/emultempl/tic6xdsbt.em
@@ -97,7 +97,7 @@ gld${EMULATION_NAME}_after_allocation (void)
int layout_changed = 0;
int ret;
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Build a sorted list of input text sections, then use that to process
the unwind table index. */
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 386e401..e570c9d 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -118,9 +118,9 @@ $s/$/n"/
fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
else if (!config.text_read_only)
return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
@@ -138,9 +138,9 @@ fragment <<EOF
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
diff --git a/ld/emultempl/v850elf.em b/ld/emultempl/v850elf.em
index 6f9f0d2..0175487 100644
--- a/ld/emultempl/v850elf.em
+++ b/ld/emultempl/v850elf.em
@@ -41,7 +41,7 @@ static void
v850_after_open (void)
{
if (is_v850_target ()
- && ! link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& link_info.input_bfds != NULL
&& ! v850_elf_create_sections (& link_info))
einfo ("%X%P: can not create note section: %E\n");
diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em
index 982bfce..cc2c31a 100644
--- a/ld/emultempl/vms.em
+++ b/ld/emultempl/vms.em
@@ -101,7 +101,7 @@ vms_place_orphan (asection *s,
/* We have nothing to say for anything other than a final link or an excluded
section. */
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
|| (s->flags & (SEC_EXCLUDE | SEC_LOAD)) != SEC_LOAD)
return NULL;
diff --git a/ld/emultempl/vxworks.em b/ld/emultempl/vxworks.em
index c371433..22bbda7 100644
--- a/ld/emultempl/vxworks.em
+++ b/ld/emultempl/vxworks.em
@@ -47,7 +47,7 @@ vxworks_after_open (void)
einfo ("%X%P: Cannot create dynamic sections %E\n");
if (!force_dynamic
- && !link_info.shared
+ && !bfd_link_pic (&link_info)
&& 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");