aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-08-18 05:51:03 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-08-18 05:51:19 -0700
commit0e1862bb401f47716446aef143b2bf7a4563f541 (patch)
tree8410cdece79e8df2f1394b53d1e992736323baac /ld
parentb2a33439909493f5bf93ada871bd588f365d61f4 (diff)
downloadgdb-0e1862bb401f47716446aef143b2bf7a4563f541.zip
gdb-0e1862bb401f47716446aef143b2bf7a4563f541.tar.gz
gdb-0e1862bb401f47716446aef143b2bf7a4563f541.tar.bz2
Add output_type to bfd_link_info
The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog55
-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
-rw-r--r--ld/ldctor.c4
-rw-r--r--ld/ldemul.c6
-rw-r--r--ld/ldfile.c2
-rw-r--r--ld/ldlang.c43
-rw-r--r--ld/ldmain.c7
-rw-r--r--ld/ldwrite.c4
-rw-r--r--ld/lexsup.c46
-rw-r--r--ld/pe-dll.c6
-rw-r--r--ld/plugin.c10
51 files changed, 320 insertions, 229 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 62ad6f3..67821df 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,58 @@
+2015-08-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld/ldctor.c: Replace shared, executable, relocatable and pie
+ fields with bfd_link_executable, bfd_link_dll,
+ bfd_link_relocatable, bfd_link_pic and bfd_link_pie.
+ * ld/ldemul.c: Likewise.
+ * ld/ldfile.c: Likewise.
+ * ld/ldlang.c: Likewise.
+ * ld/ldmain.c: Likewise.
+ * ld/ldwrite.c: Likewise.
+ * ld/lexsup.c: Likewise.
+ * ld/pe-dll.c: Likewise.
+ * ld/plugin.c: Likewise.
+ * ld/emultempl/aarch64elf.em: Likewise.
+ * ld/emultempl/aix.em: Likewise.
+ * ld/emultempl/alphaelf.em: Likewise.
+ * ld/emultempl/armcoff.em: Likewise.
+ * ld/emultempl/armelf.em: Likewise.
+ * ld/emultempl/avrelf.em: Likewise.
+ * ld/emultempl/beos.em: Likewise.
+ * ld/emultempl/cr16elf.em: Likewise.
+ * ld/emultempl/elf-generic.em: Likewise.
+ * ld/emultempl/elf32.em: Likewise.
+ * ld/emultempl/genelf.em: Likewise.
+ * ld/emultempl/generic.em: Likewise.
+ * ld/emultempl/gld960.em: Likewise.
+ * ld/emultempl/gld960c.em: Likewise.
+ * ld/emultempl/hppaelf.em: Likewise.
+ * ld/emultempl/irix.em: Likewise.
+ * ld/emultempl/linux.em: Likewise.
+ * ld/emultempl/lnk960.em: Likewise.
+ * ld/emultempl/m68hc1xelf.em: Likewise.
+ * ld/emultempl/m68kcoff.em: Likewise.
+ * ld/emultempl/m68kelf.em: Likewise.
+ * ld/emultempl/metagelf.em: Likewise.
+ * ld/emultempl/mipself.em: Likewise.
+ * ld/emultempl/mmo.em: Likewise.
+ * ld/emultempl/msp430.em: Likewise.
+ * ld/emultempl/nds32elf.em: Likewise.
+ * ld/emultempl/needrelax.em: Likewise.
+ * ld/emultempl/nios2elf.em: Likewise.
+ * ld/emultempl/pe.em: Likewise.
+ * ld/emultempl/pep.em: Likewise.
+ * ld/emultempl/ppc32elf.em: Likewise.
+ * ld/emultempl/ppc64elf.em: Likewise.
+ * ld/emultempl/sh64elf.em: Likewise.
+ * ld/emultempl/solaris2.em: Likewise.
+ * ld/emultempl/spuelf.em: Likewise.
+ * ld/emultempl/sunos.em: Likewise.
+ * ld/emultempl/tic6xdsbt.em: Likewise.
+ * ld/emultempl/ticoff.em: Likewise.
+ * ld/emultempl/v850elf.em: Likewise.
+ * ld/emultempl/vms.em: Likewise.
+ * ld/emultempl/vxworks.em: Likewise.
+
2015-08-18 Alan Modra <amodra@gmail.com>
* ldexp.c (exp_fold_tree_1): Clear linker_def on symbol assignment.
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");
diff --git a/ld/ldctor.c b/ld/ldctor.c
index 9f28b85..dc31240 100644
--- a/ld/ldctor.c
+++ b/ld/ldctor.c
@@ -274,7 +274,7 @@ ldctor_build_sets (void)
howto = bfd_reloc_type_lookup (link_info.output_bfd, p->reloc);
if (howto == NULL)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
einfo (_("%P%X: %s does not support reloc %s for set %s\n"),
bfd_get_target (link_info.output_bfd),
@@ -362,7 +362,7 @@ ldctor_build_sets (void)
if (! bfd_is_abs_section (e->section))
e->section->flags |= SEC_KEEP;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
lang_add_reloc (p->reloc, howto, e->section, e->name,
exp_intop (e->value));
else
diff --git a/ld/ldemul.c b/ld/ldemul.c
index 4898892..596418e 100644
--- a/ld/ldemul.c
+++ b/ld/ldemul.c
@@ -209,7 +209,7 @@ void
after_parse_default (void)
{
if (entry_symbol.name != NULL
- && (link_info.executable || entry_from_cmdline))
+ && (bfd_link_executable (&link_info) || entry_from_cmdline))
{
bfd_boolean is_vma = FALSE;
@@ -239,14 +239,14 @@ after_allocation_default (void)
void
before_allocation_default (void)
{
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
strip_excluded_output_sections ();
}
void
finish_default (void)
{
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
_bfd_fix_excluded_sec_syms (link_info.output_bfd, &link_info);
}
diff --git a/ld/ldfile.c b/ld/ldfile.c
index d4f7cb4..96f9ecc 100644
--- a/ld/ldfile.c
+++ b/ld/ldfile.c
@@ -357,7 +357,7 @@ ldfile_open_file_search (const char *arch,
{
char *string;
- if (entry->flags.dynamic && ! link_info.relocatable)
+ if (entry->flags.dynamic && !bfd_link_relocatable (&link_info))
{
if (ldemul_open_dynamic_archive (arch, search, entry))
return TRUE;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 0d6419d..6ee3f84 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -201,7 +201,7 @@ unique_section_p (const asection *sec,
struct unique_sections *unam;
const char *secnam;
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
&& sec->owner != NULL
&& bfd_is_group_section (sec->owner, sec))
return !(os != NULL
@@ -1817,7 +1817,8 @@ lang_insert_orphan (asection *s,
push_stat_ptr (&add);
}
- if (link_info.relocatable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
+ if (bfd_link_relocatable (&link_info)
+ || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop (0);
os_tail = ((lang_output_section_statement_type **)
@@ -2347,7 +2348,7 @@ lang_add_section (lang_statement_list_type *ptr,
format targets, .text$foo sections go into .text and it's odd
to see .text with SEC_LINK_ONCE set. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
flags &= ~(SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_RELOC);
switch (output->sectype)
@@ -3172,7 +3173,8 @@ ldlang_open_output (lang_statement_union_type *statement)
ASSERT (link_info.output_bfd == NULL);
open_output (statement->output_statement.name);
ldemul_set_output_arch ();
- if (config.magic_demand_paged && !link_info.relocatable)
+ if (config.magic_demand_paged
+ && !bfd_link_relocatable (&link_info))
link_info.output_bfd->flags |= D_PAGED;
else
link_info.output_bfd->flags &= ~D_PAGED;
@@ -4846,7 +4848,7 @@ lang_size_sections_1
here, in lang_insert_orphan, or in the default linker scripts.
This is covering for coff backend linker bugs. See PR6945. */
if (os->addr_tree == NULL
- && link_info.relocatable
+ && bfd_link_relocatable (&link_info)
&& (bfd_get_flavour (link_info.output_bfd)
== bfd_target_coff_flavour))
os->addr_tree = exp_intop (0);
@@ -4925,7 +4927,7 @@ lang_size_sections_1
defined, issue an error message. */
if (!os->ignored
&& !IGNORE_SECTION (os->bfd_section)
- && ! link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& check_regions
&& strcmp (os->region->name_list.name,
DEFAULT_MEMORY_REGION) == 0
@@ -5105,13 +5107,13 @@ lang_size_sections_1
&& dot >= (r->last_os->output_section_statement
.bfd_section->vma)))
&& os->lma_region == NULL
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
r->last_os = s;
/* .tbss sections effectively have zero size. */
if ((os->bfd_section->flags & SEC_HAS_CONTENTS) != 0
|| (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
dotdelta = TO_ADDR (os->bfd_section->size);
else
dotdelta = 0;
@@ -5546,7 +5548,7 @@ lang_do_assignments_1 (lang_statement_union_type *s,
/* .tbss sections effectively have zero size. */
if ((os->bfd_section->flags & SEC_HAS_CONTENTS) != 0
|| (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
dot += TO_ADDR (os->bfd_section->size);
if (os->update_dot_tree != NULL)
@@ -5770,7 +5772,7 @@ lang_set_startof (void)
{
asection *s;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
@@ -5810,15 +5812,15 @@ lang_end (void)
struct bfd_link_hash_entry *h;
bfd_boolean warn;
- if ((link_info.relocatable && !link_info.gc_sections)
- || (link_info.shared && !link_info.executable))
+ if ((bfd_link_relocatable (&link_info) && !link_info.gc_sections)
+ || bfd_link_dll (&link_info))
warn = entry_from_cmdline;
else
warn = TRUE;
/* Force the user to specify a root when generating a relocatable with
--gc-sections. */
- if (link_info.gc_sections && link_info.relocatable
+ if (link_info.gc_sections && bfd_link_relocatable (&link_info)
&& !(entry_from_cmdline || undef_from_cmdline))
einfo (_("%P%F: gc-sections requires either an entry or "
"an undefined symbol\n"));
@@ -5928,7 +5930,8 @@ lang_check (void)
input format may not have equivalent representations in
the output format (and besides BFD does not translate
relocs for other link purposes than a final link). */
- if ((link_info.relocatable || link_info.emitrelocations)
+ if ((bfd_link_relocatable (&link_info)
+ || link_info.emitrelocations)
&& (compatible == NULL
|| (bfd_get_flavour (input_bfd)
!= bfd_get_flavour (link_info.output_bfd)))
@@ -5984,7 +5987,7 @@ lang_common (void)
{
if (command_line.inhibit_common_definition)
return;
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
&& ! command_line.force_common_definition)
return;
@@ -6126,7 +6129,7 @@ lang_place_orphans (void)
/* This is a lonely common section which must have
come from an archive. We attach to the section
with the wildcard. */
- if (! link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
|| command_line.force_common_definition)
{
if (default_common_section == NULL)
@@ -6153,7 +6156,7 @@ lang_place_orphans (void)
constraint,
TRUE);
if (os->addr_tree == NULL
- && (link_info.relocatable
+ && (bfd_link_relocatable (&link_info)
|| (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0))
os->addr_tree = exp_intop (0);
lang_add_section (&os->children, s, NULL, os);
@@ -6434,7 +6437,7 @@ lang_gc_sections (void)
/* SEC_EXCLUDE is ignored when doing a relocatable link, except in
the special case of debug info. (See bfd/stabs.c)
Twiddle the flag here, to simplify later linker code. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
@@ -6800,7 +6803,7 @@ lang_process (void)
/* Find any sections not attached explicitly and handle them. */
lang_place_orphans ();
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
asection *found;
@@ -6831,7 +6834,7 @@ lang_process (void)
lang_record_phdrs ();
/* Check relro sections. */
- if (link_info.relro && ! link_info.relocatable)
+ if (link_info.relro && !bfd_link_relocatable (&link_info))
lang_find_relro_sections ();
/* Size up the sections. */
diff --git a/ld/ldmain.c b/ld/ldmain.c
index 0492034..577928d 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -420,7 +420,7 @@ main (int argc, char **argv)
/* Print error messages for any missing symbols, for any warning
symbols, and possibly multiple definitions. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
link_info.output_bfd->flags &= ~EXEC_P;
else
link_info.output_bfd->flags |= EXEC_P;
@@ -473,7 +473,8 @@ main (int argc, char **argv)
/* If the --force-exe-suffix is enabled, and we're making an
executable file and it doesn't end in .exe, copy it to one
which does. */
- if (! link_info.relocatable && command_line.force_exe_suffix)
+ if (!bfd_link_relocatable (&link_info)
+ && command_line.force_exe_suffix)
{
int len = strlen (output_filename);
@@ -1122,7 +1123,7 @@ constructor_callback (struct bfd_link_info *info,
/* Ensure that BFD_RELOC_CTOR exists now, so that we can give a
useful error message. */
if (bfd_reloc_type_lookup (info->output_bfd, BFD_RELOC_CTOR) == NULL
- && (info->relocatable
+ && (bfd_link_relocatable (info)
|| bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
einfo (_("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"));
diff --git a/ld/ldwrite.c b/ld/ldwrite.c
index f57b88d..c833bbb 100644
--- a/ld/ldwrite.c
+++ b/ld/ldwrite.c
@@ -488,13 +488,13 @@ split_sections (bfd *abfd, struct bfd_link_info *info)
|| info->strip == strip_some)
thislines = sec->lineno_count;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
thisrelocs = sec->reloc_count;
thissize = sec->size;
}
- else if (info->relocatable
+ else if (bfd_link_relocatable (info)
&& (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order))
thisrelocs++;
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 2854134..777d6e2 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1010,7 +1010,11 @@ parse_args (unsigned argc, char **argv)
and will seg-fault the next time around. */
einfo(_("%P%F: unrecognised option: %s\n"), argv[optind]);
- link_info.relocatable = TRUE;
+ if (bfd_link_pic (&link_info))
+ einfo (_("%P%F: -r and %s may not be used together\n"),
+ bfd_link_dll (&link_info) ? "-shared" : "-pie");
+
+ link_info.type = type_relocatable;
config.build_constructors = FALSE;
config.magic_demand_paged = FALSE;
config.text_read_only = FALSE;
@@ -1113,7 +1117,11 @@ parse_args (unsigned argc, char **argv)
case OPTION_SHARED:
if (config.has_shared)
{
- link_info.shared = TRUE;
+ if (bfd_link_relocatable (&link_info))
+ einfo (_("%P%F: -r and -shared may not be used together\n"));
+
+ link_info.type = type_dll;
+ link_info.pic = TRUE;
/* When creating a shared library, the default
behaviour is to ignore any unresolved references. */
if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
@@ -1127,8 +1135,11 @@ parse_args (unsigned argc, char **argv)
case OPTION_PIE:
if (config.has_shared)
{
- link_info.shared = TRUE;
- link_info.pie = TRUE;
+ if (bfd_link_relocatable (&link_info))
+ einfo (_("%P%F: -r and -pie may not be used together\n"));
+
+ link_info.type = type_executable;
+ link_info.pic = TRUE;
}
else
einfo (_("%P%F: -pie not supported\n"));
@@ -1241,7 +1252,11 @@ parse_args (unsigned argc, char **argv)
link_info.task_link = TRUE;
/* Fall through - do an implied -r option. */
case OPTION_UR:
- link_info.relocatable = TRUE;
+ if (bfd_link_pic (&link_info))
+ einfo (_("%P%F: -r and %s may not be used together\n"),
+ bfd_link_dll (&link_info) ? "-shared" : "-pie");
+
+ link_info.type = type_relocatable;
config.build_constructors = TRUE;
config.magic_demand_paged = FALSE;
config.text_read_only = FALSE;
@@ -1531,13 +1546,9 @@ parse_args (unsigned argc, char **argv)
/* FIXME: Should we allow emulations a chance to set this ? */
link_info.unresolved_syms_in_shared_libs = how_to_report_unresolved_symbols;
- if (link_info.relocatable)
- {
- if (command_line.check_section_addresses < 0)
- command_line.check_section_addresses = 0;
- if (link_info.shared)
- einfo (_("%P%F: -r and -shared may not be used together\n"));
- }
+ if (bfd_link_relocatable (&link_info)
+ && command_line.check_section_addresses < 0)
+ command_line.check_section_addresses = 0;
/* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
--dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
@@ -1550,7 +1561,7 @@ parse_args (unsigned argc, char **argv)
break;
case symbolic:
/* -Bsymbolic is for shared library only. */
- if (link_info.shared)
+ if (bfd_link_dll (&link_info))
{
link_info.symbolic = TRUE;
/* Should we free the unused memory? */
@@ -1560,7 +1571,7 @@ parse_args (unsigned argc, char **argv)
break;
case symbolic_functions:
/* -Bsymbolic-functions is for shared library only. */
- if (link_info.shared)
+ if (bfd_link_dll (&link_info))
command_line.dynamic_list = dynamic_list_data;
break;
}
@@ -1576,7 +1587,7 @@ parse_args (unsigned argc, char **argv)
break;
}
- if (! link_info.shared)
+ if (!bfd_link_dll (&link_info))
{
if (command_line.filter_shlib)
einfo (_("%P%F: -F may not be used without -shared\n"));
@@ -1584,13 +1595,10 @@ parse_args (unsigned argc, char **argv)
einfo (_("%P%F: -f may not be used without -shared\n"));
}
- if ((! link_info.shared && ! link_info.relocatable) || link_info.pie)
- link_info.executable = TRUE;
-
/* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
don't see how else this can be handled, since in this case we
must preserve all externally visible symbols. */
- if (link_info.relocatable && link_info.strip == strip_all)
+ if (bfd_link_relocatable (&link_info) && link_info.strip == strip_all)
{
link_info.strip = strip_debugger;
if (link_info.discard == discard_sec_merge)
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index e3e1f1f..fdadeaf 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -693,7 +693,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
/* If we are building an executable and there is nothing
to export, we do not build an export table at all. */
- if (info->executable && pe_def_file->num_exports == 0
+ if (bfd_link_executable (info) && pe_def_file->num_exports == 0
&& (!pe_dll_export_everything || pe_dll_exclude_all_symbols))
return;
@@ -3369,7 +3369,7 @@ pe_dll_build_sections (bfd *abfd, struct bfd_link_info *info)
pe_output_file_set_long_section_names (abfd);
process_def_file_and_drectve (abfd, info);
- if (pe_def_file->num_exports == 0 && !info->shared)
+ if (pe_def_file->num_exports == 0 && !bfd_link_pic (info))
return;
generate_edata (abfd, info);
@@ -3411,7 +3411,7 @@ pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
fill_edata (abfd, info);
- if (info->shared && !info->pie)
+ if (bfd_link_dll (info))
pe_data (abfd)->dll = 1;
edata_s->contents = edata_d;
diff --git a/ld/plugin.c b/ld/plugin.c
index 81bf143..5f7bbd8 100644
--- a/ld/plugin.c
+++ b/ld/plugin.c
@@ -611,9 +611,9 @@ is_visible_from_outside (struct ld_plugin_symbol *lsym,
{
struct bfd_sym_chain *sym;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return TRUE;
- if (link_info.export_dynamic || !link_info.executable)
+ if (link_info.export_dynamic || bfd_link_dll (&link_info))
{
/* Check if symbol is hidden by version script. */
if (bfd_hide_sym_by_version (link_info.version_info,
@@ -872,10 +872,10 @@ set_tv_header (struct ld_plugin_tv *tv)
TVU(val) = major * 100 + minor;
break;
case LDPT_LINKER_OUTPUT:
- TVU(val) = (link_info.relocatable
+ TVU(val) = (bfd_link_relocatable (&link_info)
? LDPO_REL
- : (link_info.executable
- ? (link_info.pie ? LDPO_PIE : LDPO_EXEC)
+ : (bfd_link_executable (&link_info)
+ ? (bfd_link_pic (&link_info) ? LDPO_PIE : LDPO_EXEC)
: LDPO_DYN));
break;
case LDPT_OUTPUT_NAME: