This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Add output_type to bfd_link_info
- From: H.J.Lu <hjl at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 18 Aug 2015 12:55:07 -0000
- Subject: [binutils-gdb] Add output_type to bfd_link_info
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0e1862bb401f47716446aef143b2bf7a4563f541
commit 0e1862bb401f47716446aef143b2bf7a4563f541
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Aug 18 05:51:03 2015 -0700
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.
Diff:
---
bfd/ChangeLog | 112 +++++++++++++++++++++++++++++
bfd/aoutx.h | 16 ++---
bfd/bout.c | 2 +-
bfd/coff-alpha.c | 16 ++---
bfd/coff-arm.c | 20 +++---
bfd/coff-i386.c | 2 +-
bfd/coff-i960.c | 6 +-
bfd/coff-m68k.c | 2 +-
bfd/coff-mcore.c | 2 +-
bfd/coff-mips.c | 4 +-
bfd/coff-ppc.c | 16 ++---
bfd/coff-rs6000.c | 2 +-
bfd/coff-sh.c | 4 +-
bfd/coff-tic80.c | 2 +-
bfd/coff-x86_64.c | 2 +-
bfd/coff64-rs6000.c | 2 +-
bfd/coffgen.c | 2 +-
bfd/cofflink.c | 44 ++++++------
bfd/ecoff.c | 8 +--
bfd/ecofflink.c | 12 ++--
bfd/elf-bfd.h | 4 +-
bfd/elf-eh-frame.c | 14 ++--
bfd/elf-ifunc.c | 16 ++---
bfd/elf-m10200.c | 4 +-
bfd/elf-m10300.c | 52 +++++++-------
bfd/elf-s390-common.c | 17 +++--
bfd/elf-vxworks.c | 4 +-
bfd/elf.c | 14 ++--
bfd/elf32-arm.c | 125 +++++++++++++++++---------------
bfd/elf32-avr.c | 8 +--
bfd/elf32-bfin.c | 72 ++++++++++---------
bfd/elf32-cr16.c | 24 +++----
bfd/elf32-cr16c.c | 2 +-
bfd/elf32-cris.c | 86 +++++++++++------------
bfd/elf32-crx.c | 4 +-
bfd/elf32-d10v.c | 8 +--
bfd/elf32-dlx.c | 2 +-
bfd/elf32-epiphany.c | 4 +-
bfd/elf32-fr30.c | 4 +-
bfd/elf32-frv.c | 71 ++++++++++---------
bfd/elf32-ft32.c | 2 +-
bfd/elf32-h8300.c | 4 +-
bfd/elf32-hppa.c | 76 ++++++++++----------
bfd/elf32-i370.c | 26 +++----
bfd/elf32-i386.c | 107 ++++++++++++++--------------
bfd/elf32-i860.c | 2 +-
bfd/elf32-ip2k.c | 4 +-
bfd/elf32-iq2000.c | 4 +-
bfd/elf32-lm32.c | 42 +++++------
bfd/elf32-m32c.c | 12 ++--
bfd/elf32-m32r.c | 67 +++++++++---------
bfd/elf32-m68hc11.c | 2 +-
bfd/elf32-m68hc1x.c | 4 +-
bfd/elf32-m68k.c | 48 +++++++------
bfd/elf32-mcore.c | 6 +-
bfd/elf32-mep.c | 2 +-
bfd/elf32-metag.c | 71 ++++++++++---------
bfd/elf32-microblaze.c | 55 ++++++++-------
bfd/elf32-moxie.c | 4 +-
bfd/elf32-msp430.c | 6 +-
bfd/elf32-mt.c | 4 +-
bfd/elf32-nds32.c | 77 ++++++++++----------
bfd/elf32-nios2.c | 80 +++++++++++----------
bfd/elf32-or1k.c | 52 +++++++-------
bfd/elf32-ppc.c | 168 ++++++++++++++++++++++----------------------
bfd/elf32-rl78.c | 10 +--
bfd/elf32-rx.c | 4 +-
bfd/elf32-s390.c | 100 +++++++++++++-------------
bfd/elf32-score.c | 35 ++++-----
bfd/elf32-score7.c | 36 +++++-----
bfd/elf32-sh-symbian.c | 2 +-
bfd/elf32-sh.c | 143 +++++++++++++++++++------------------
bfd/elf32-sh64.c | 8 +--
bfd/elf32-spu.c | 10 +--
bfd/elf32-tic6x.c | 57 ++++++++-------
bfd/elf32-tilepro.c | 86 ++++++++++++-----------
bfd/elf32-v850.c | 6 +-
bfd/elf32-vax.c | 30 ++++----
bfd/elf32-visium.c | 4 +-
bfd/elf32-xc16x.c | 2 +-
bfd/elf32-xstormy16.c | 8 +--
bfd/elf32-xtensa.c | 56 +++++++--------
bfd/elf64-alpha.c | 69 ++++++++++--------
bfd/elf64-hppa.c | 68 +++++++++---------
bfd/elf64-ia64-vms.c | 54 +++++++-------
bfd/elf64-mmix.c | 10 +--
bfd/elf64-ppc.c | 104 +++++++++++++--------------
bfd/elf64-s390.c | 90 ++++++++++++------------
bfd/elf64-sh64.c | 66 ++++++++---------
bfd/elf64-x86-64.c | 99 +++++++++++++-------------
bfd/elflink.c | 122 +++++++++++++++++---------------
bfd/elfnn-aarch64.c | 75 ++++++++++----------
bfd/elfnn-ia64.c | 92 ++++++++++++------------
bfd/elfxx-mips.c | 135 ++++++++++++++++++-----------------
bfd/elfxx-sparc.c | 122 +++++++++++++++++---------------
bfd/elfxx-tilegx.c | 88 ++++++++++++-----------
bfd/i386linux.c | 2 +-
bfd/linker.c | 10 +--
bfd/m68klinux.c | 2 +-
bfd/pdp11.c | 12 ++--
bfd/pe-mips.c | 6 +-
bfd/peXXigen.c | 4 +-
bfd/reloc.c | 2 +-
bfd/reloc16.c | 2 +-
bfd/sparclinux.c | 2 +-
bfd/sunos.c | 42 +++++------
bfd/vms-alpha.c | 2 +-
bfd/xcofflink.c | 8 +--
include/ChangeLog | 11 +++
include/bfdlink.h | 30 +++++---
ld/ChangeLog | 55 +++++++++++++++
ld/emultempl/aarch64elf.em | 4 +-
ld/emultempl/aix.em | 21 +++---
ld/emultempl/alphaelf.em | 8 ++-
ld/emultempl/armcoff.em | 8 +--
ld/emultempl/armelf.em | 6 +-
ld/emultempl/avrelf.em | 4 +-
ld/emultempl/beos.em | 10 +--
ld/emultempl/cr16elf.em | 4 +-
ld/emultempl/elf-generic.em | 2 +-
ld/emultempl/elf32.em | 50 +++++++------
ld/emultempl/genelf.em | 4 +-
ld/emultempl/generic.em | 10 +--
ld/emultempl/gld960.em | 8 +--
ld/emultempl/gld960c.em | 8 +--
ld/emultempl/hppaelf.em | 6 +-
ld/emultempl/irix.em | 2 +-
ld/emultempl/linux.em | 10 +--
ld/emultempl/lnk960.em | 10 +--
ld/emultempl/m68hc1xelf.em | 2 +-
ld/emultempl/m68kcoff.em | 12 ++--
ld/emultempl/m68kelf.em | 4 +-
ld/emultempl/metagelf.em | 4 +-
ld/emultempl/mipself.em | 2 +-
ld/emultempl/mmo.em | 2 +-
ld/emultempl/msp430.em | 12 ++--
ld/emultempl/nds32elf.em | 8 +--
ld/emultempl/needrelax.em | 2 +-
ld/emultempl/nios2elf.em | 8 ++-
ld/emultempl/pe.em | 32 +++++----
ld/emultempl/pep.em | 32 +++++----
ld/emultempl/ppc32elf.em | 3 +-
ld/emultempl/ppc64elf.em | 12 ++--
ld/emultempl/sh64elf.em | 3 +-
ld/emultempl/solaris2.em | 6 +-
ld/emultempl/spuelf.em | 8 +--
ld/emultempl/sunos.em | 23 +++---
ld/emultempl/tic6xdsbt.em | 2 +-
ld/emultempl/ticoff.em | 8 +--
ld/emultempl/v850elf.em | 2 +-
ld/emultempl/vms.em | 2 +-
ld/emultempl/vxworks.em | 2 +-
ld/ldctor.c | 4 +-
ld/ldemul.c | 6 +-
ld/ldfile.c | 2 +-
ld/ldlang.c | 43 ++++++------
ld/ldmain.c | 7 +-
ld/ldwrite.c | 4 +-
ld/lexsup.c | 46 +++++++-----
ld/pe-dll.c | 6 +-
ld/plugin.c | 10 +--
161 files changed, 2279 insertions(+), 1932 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index e0d32ac..a182d2f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,115 @@
+2015-08-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2015-08-18 Alan Modra <amodra@gmail.com>
PR 18667
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index e3bd2dd..f78b910 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -3946,7 +3946,7 @@ aout_link_input_section_std (struct aout_final_link_info *flaginfo,
BFD_ASSERT (input_bfd->xvec->header_byteorder
== output_bfd->xvec->header_byteorder);
- relocatable = flaginfo->info->relocatable;
+ relocatable = bfd_link_relocatable (flaginfo->info);
syms = obj_aout_external_syms (input_bfd);
strings = obj_aout_external_strings (input_bfd);
sym_hashes = obj_aout_sym_hashes (input_bfd);
@@ -4212,7 +4212,7 @@ aout_link_input_section_std (struct aout_final_link_info *flaginfo,
/* Now warn if a global symbol is undefined. We could not
do this earlier, because check_dynamic_reloc might want
to skip this reloc. */
- if (hundef && ! flaginfo->info->shared && ! r_baserel)
+ if (hundef && ! bfd_link_pic (flaginfo->info) && ! r_baserel)
{
const char *name;
@@ -4300,7 +4300,7 @@ aout_link_input_section_ext (struct aout_final_link_info *flaginfo,
BFD_ASSERT (input_bfd->xvec->header_byteorder
== output_bfd->xvec->header_byteorder);
- relocatable = flaginfo->info->relocatable;
+ relocatable = bfd_link_relocatable (flaginfo->info);
syms = obj_aout_external_syms (input_bfd);
strings = obj_aout_external_strings (input_bfd);
sym_hashes = obj_aout_sym_hashes (input_bfd);
@@ -4616,7 +4616,7 @@ aout_link_input_section_ext (struct aout_final_link_info *flaginfo,
do this earlier, because check_dynamic_reloc might want
to skip this reloc. */
if (hundef
- && ! flaginfo->info->shared
+ && ! bfd_link_pic (flaginfo->info)
&& r_type != (unsigned int) RELOC_BASE10
&& r_type != (unsigned int) RELOC_BASE13
&& r_type != (unsigned int) RELOC_BASE22)
@@ -4749,7 +4749,7 @@ aout_link_input_section (struct aout_final_link_info *flaginfo,
/* If we are producing relocatable output, the relocs were
modified, and we now write them out. */
- if (flaginfo->info->relocatable && rel_size > 0)
+ if (bfd_link_relocatable (flaginfo->info) && rel_size > 0)
{
if (bfd_seek (flaginfo->output_bfd, *reloff_ptr, SEEK_SET) != 0)
return FALSE;
@@ -5335,7 +5335,7 @@ NAME (aout, final_link) (bfd *abfd,
asection *o;
bfd_boolean have_link_order_relocs;
- if (info->shared)
+ if (bfd_link_pic (info))
abfd->flags |= DYNAMIC;
aout_info.info = info;
@@ -5363,7 +5363,7 @@ NAME (aout, final_link) (bfd *abfd,
{
bfd_size_type sz;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
{
@@ -5407,7 +5407,7 @@ NAME (aout, final_link) (bfd *abfd,
}
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (obj_textsec (abfd) != NULL)
trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
diff --git a/bfd/bout.c b/bfd/bout.c
index 8ca3c78..f356b96 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1139,7 +1139,7 @@ b_out_bfd_relax_section (bfd *abfd,
arelent **reloc_vector = NULL;
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
- if (link_info->relocatable)
+ if (bfd_link_relocatable (link_info))
(*link_info->callbacks->einfo)
(_("%P%F: --relax and -r may not be used together\n"));
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 0fdbded..58d4e1d 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -1226,7 +1226,7 @@ alpha_convert_external_reloc (bfd *output_bfd ATTRIBUTE_UNUSED,
unsigned long r_symndx;
bfd_vma relocation;
- BFD_ASSERT (info->relocatable);
+ BFD_ASSERT (bfd_link_relocatable (info));
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
@@ -1405,7 +1405,7 @@ alpha_relocate_section (bfd *output_bfd,
lita_sec = symndx_to_section[RELOC_SECTION_LITA];
gp = _bfd_get_gp_value (output_bfd);
- if (! info->relocatable && lita_sec != NULL)
+ if (! bfd_link_relocatable (info) && lita_sec != NULL)
{
struct ecoff_section_tdata *lita_sec_data;
@@ -1530,7 +1530,7 @@ alpha_relocate_section (bfd *output_bfd,
not otherwise used for anything. For some reason, the
address of the relocation does not appear to include the
section VMA, unlike the other relocation types. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
ext_rel->r_vaddr);
adjust_addrp = FALSE;
@@ -1683,7 +1683,7 @@ alpha_relocate_section (bfd *output_bfd,
if (h == (struct ecoff_link_hash_entry *) NULL)
abort ();
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
@@ -1726,7 +1726,7 @@ alpha_relocate_section (bfd *output_bfd,
addend += r_vaddr;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* Adjust r_vaddr by the addend. */
H_PUT_64 (input_bfd, addend, ext_rel->r_vaddr);
@@ -1762,7 +1762,7 @@ alpha_relocate_section (bfd *output_bfd,
/* Store a value from the reloc stack into a bitfield. If
we are generating relocatable output, all we do is
adjust the address of the reloc. */
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
bfd_vma mask;
bfd_vma val;
@@ -1828,7 +1828,7 @@ alpha_relocate_section (bfd *output_bfd,
abort ();
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* We are generating relocatable output, and must
convert the existing reloc. */
@@ -1954,7 +1954,7 @@ alpha_relocate_section (bfd *output_bfd,
}
}
- if (info->relocatable && adjust_addrp)
+ if (bfd_link_relocatable (info) && adjust_addrp)
{
/* Change the address of the relocation. */
H_PUT_64 (input_bfd,
diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c
index 74ce017..3007762 100644
--- a/bfd/coff-arm.c
+++ b/bfd/coff-arm.c
@@ -1222,7 +1222,7 @@ coff_arm_relocate_section (bfd *output_bfd,
relocations to be reflected in section's data. */
if (rel->r_type == ARM_26
&& h != NULL
- && info->relocatable
+ && bfd_link_relocatable (info)
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& (h->root.u.def.section->output_section
@@ -1255,7 +1255,7 @@ coff_arm_relocate_section (bfd *output_bfd,
#ifdef ARM_WINCE
/* MS ARM-CE makes the reloc relative to the opcode's pc, not
the next opcode's pc, so is off by one. */
- if (howto->pc_relative && !info->relocatable)
+ if (howto->pc_relative && !bfd_link_relocatable (info))
addend -= 8;
#endif
@@ -1265,7 +1265,7 @@ coff_arm_relocate_section (bfd *output_bfd,
then we should ignore the symbol value. */
if (howto->pc_relative && howto->pcrel_offset)
{
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
/* FIXME - it is not clear which targets need this next test
and which do not. It is known that it is needed for the
@@ -1311,7 +1311,7 @@ coff_arm_relocate_section (bfd *output_bfd,
stub generation to the final linker pass. If we fail to
verify that the name is defined, we'll try to build stubs
for an undefined name... */
- if (! info->relocatable
+ if (! bfd_link_relocatable (info)
&& ( h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak))
{
@@ -1561,7 +1561,7 @@ coff_arm_relocate_section (bfd *output_bfd,
+ sec->output_offset);
}
- else if (! info->relocatable)
+ else if (! bfd_link_relocatable (info))
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
@@ -1582,7 +1582,7 @@ coff_arm_relocate_section (bfd *output_bfd,
rstat = bfd_reloc_ok;
#ifndef ARM_WINCE
/* Only perform this fix during the final link, not a relocatable link. */
- else if (! info->relocatable
+ else if (! bfd_link_relocatable (info)
&& howto->type == ARM_THUMB23)
{
/* This is pretty much a copy of what the default
@@ -1698,7 +1698,7 @@ coff_arm_relocate_section (bfd *output_bfd,
}
#endif
else
- if (info->relocatable && ! howto->partial_inplace)
+ if (bfd_link_relocatable (info) && ! howto->partial_inplace)
rstat = bfd_reloc_ok;
else
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
@@ -1706,7 +1706,7 @@ coff_arm_relocate_section (bfd *output_bfd,
rel->r_vaddr - input_section->vma,
val, addend);
/* Only perform this fix during the final link, not a relocatable link. */
- if (! info->relocatable
+ if (! bfd_link_relocatable (info)
&& (rel->r_type == ARM_32 || rel->r_type == ARM_RVA32))
{
/* Determine if we need to set the bottom bit of a relocated address
@@ -1968,7 +1968,7 @@ bfd_arm_get_bfd_for_interworking (bfd * abfd,
/* If we are only performing a partial link do not bother
getting a bfd to hold the glue. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
globals = coff_arm_hash_table (info);
@@ -2021,7 +2021,7 @@ bfd_arm_process_before_allocation (bfd * abfd,
/* If we are only performing a partial link do not bother
to construct any glue. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
/* Here we have a bfd that is to be included on the link. We have a hook
diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c
index b185b81..a9725c4 100644
--- a/bfd/coff-i386.c
+++ b/bfd/coff-i386.c
@@ -417,7 +417,7 @@ coff_pe_i386_relocate_section (bfd *output_bfd,
struct internal_syment *syms,
asection **sections)
{
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
diff --git a/bfd/coff-i960.c b/bfd/coff-i960.c
index dbd197f..f761028 100644
--- a/bfd/coff-i960.c
+++ b/bfd/coff-i960.c
@@ -322,7 +322,7 @@ coff_i960_start_final_link (bfd *abfd, struct bfd_link_info *info)
asection *o;
bfd_byte *esym;
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
return TRUE;
esym = (bfd_byte *) bfd_malloc (symesz);
@@ -447,7 +447,7 @@ coff_i960_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
+ sec->output_section->vma
+ sec->output_offset);
}
- else if (! info->relocatable)
+ else if (! bfd_link_relocatable (info))
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
@@ -458,7 +458,7 @@ coff_i960_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
done = FALSE;
- if (howto->type == R_OPTCALL && ! info->relocatable && symndx != -1)
+ if (howto->type == R_OPTCALL && ! bfd_link_relocatable (info) && symndx != -1)
{
int class_val;
diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c
index e90aec7..56949cf 100644
--- a/bfd/coff-m68k.c
+++ b/bfd/coff-m68k.c
@@ -446,7 +446,7 @@ bfd_m68k_coff_create_embedded_relocs (bfd *abfd,
bfd_byte *p;
bfd_size_type amt;
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
*errmsg = NULL;
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index 45d4917..53c5d36 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -358,7 +358,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
/* If we are performing a relocatable link, we don't need to do a
thing. The caller will take care of adjusting the reloc
addresses and symbol indices. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
/* Check if we have the same endianness */
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index a490572..5dfbc54 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -960,7 +960,7 @@ mips_relocate_section (bfd *output_bfd,
and the GP value of OUTPUT_BFD (which is in GP). */
addend = ecoff_data (input_bfd)->gp - gp;
}
- else if (! info->relocatable
+ else if (! bfd_link_relocatable (info)
|| h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
@@ -986,7 +986,7 @@ mips_relocate_section (bfd *output_bfd,
}
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* We are generating relocatable output, and must convert
the existing reloc. */
diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c
index 237980d..2f979e9 100644
--- a/bfd/coff-ppc.c
+++ b/bfd/coff-ppc.c
@@ -947,7 +947,7 @@ coff_ppc_relocate_section (bfd *output_bfd,
/* If we are performing a relocatable link, we don't need to do a
thing. The caller will take care of adjusting the reloc
addresses and symbol indices. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
rel = relocs;
@@ -2043,7 +2043,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
|| info->strip == strip_some)
o->lineno_count += sec->lineno_count;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
o->reloc_count += sec->reloc_count;
if (sec->rawsize > max_contents_size)
@@ -2055,7 +2055,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
if (sec->reloc_count > max_reloc_count)
max_reloc_count = sec->reloc_count;
}
- else if (info->relocatable
+ else if (bfd_link_relocatable (info)
&& (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order))
++o->reloc_count;
@@ -2072,7 +2072,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
/* If doing a relocatable link, allocate space for the pointers we
need to keep. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
unsigned int i;
@@ -2123,7 +2123,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
memory until the end of the link. This wastes memory,
but only when doing a relocatable link, which is not the
common case. */
- BFD_ASSERT (info->relocatable);
+ BFD_ASSERT (bfd_link_relocatable (info));
amt = o->reloc_count;
amt *= sizeof (struct internal_reloc);
flaginfo.section_info[o->target_index].relocs =
@@ -2175,7 +2175,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
flaginfo.linenos = (bfd_byte *) bfd_malloc (amt);
flaginfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
flaginfo.external_relocs = (bfd_byte *) bfd_malloc (max_reloc_count * relsz);
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
amt = max_reloc_count * sizeof (struct internal_reloc);
flaginfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
@@ -2187,7 +2187,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
|| (flaginfo.linenos == NULL && max_lineno_count > 0)
|| (flaginfo.contents == NULL && max_contents_size > 0)
|| (flaginfo.external_relocs == NULL && max_reloc_count > 0)
- || (! info->relocatable
+ || (! bfd_link_relocatable (info)
&& flaginfo.internal_relocs == NULL
&& max_reloc_count > 0))
goto error_return;
@@ -2321,7 +2321,7 @@ ppc_bfd_coff_final_link (bfd *abfd, struct bfd_link_info *info)
flaginfo.outsyms = NULL;
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* Now that we have written out all the global symbols, we know
the symbol indices to use for relocs against them, and we can
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 3aa5e63..dd9ecb2 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -3421,7 +3421,7 @@ xcoff_ppc_relocate_section (bfd *output_bfd,
}
else
{
- BFD_ASSERT (info->relocatable
+ BFD_ASSERT (bfd_link_relocatable (info)
|| (info->static_link
&& (h->flags & XCOFF_WAS_UNDEFINED) != 0)
|| (h->flags & XCOFF_DEF_DYNAMIC) != 0
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index e52fffa..044fc04 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -713,7 +713,7 @@ sh_relax_section (bfd *abfd,
*again = FALSE;
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
return TRUE;
@@ -2836,7 +2836,7 @@ sh_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
+ sec->output_section->vma
+ sec->output_offset);
}
- else if (! info->relocatable)
+ else if (! bfd_link_relocatable (info))
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c
index 10d50f0..ea27034 100644
--- a/bfd/coff-tic80.c
+++ b/bfd/coff-tic80.c
@@ -562,7 +562,7 @@ coff_tic80_relocate_section (bfd *output_bfd,
+ sec->output_offset);
}
- else if (! info->relocatable)
+ else if (! bfd_link_relocatable (info))
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c
index fb5971d..4e6420a 100644
--- a/bfd/coff-x86_64.c
+++ b/bfd/coff-x86_64.c
@@ -538,7 +538,7 @@ coff_pe_amd64_relocate_section (bfd *output_bfd,
struct internal_syment *syms,
asection **sections)
{
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,input_section, contents,relocs, syms, sections);
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index ba98469..a9da59c 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -1277,7 +1277,7 @@ xcoff64_ppc_relocate_section (bfd *output_bfd,
}
else
{
- BFD_ASSERT (info->relocatable
+ BFD_ASSERT (bfd_link_relocatable (info)
|| (h->flags & XCOFF_DEF_DYNAMIC) != 0
|| (h->flags & XCOFF_IMPORT) != 0);
}
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 44bdc6e..9257f73 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2486,7 +2486,7 @@ coff_sizeof_headers (bfd *abfd, struct bfd_link_info *info)
{
size_t size;
- if (!info->relocatable)
+ if (!bfd_link_relocatable (info))
size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd);
else
size = bfd_coff_filhsz (abfd);
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index c1541d1..8d98fec 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -507,7 +507,7 @@ coff_link_add_symbols (bfd *abfd,
/* If this is a non-traditional, non-relocatable link, try to
optimize the handling of any .stab/.stabstr sections. */
- if (! info->relocatable
+ if (! bfd_link_relocatable (info)
&& ! info->traditional_format
&& bfd_get_flavour (info->output_bfd) == bfd_get_flavour (abfd)
&& (info->strip != strip_all && info->strip != strip_debugger))
@@ -652,7 +652,7 @@ _bfd_coff_final_link (bfd *abfd,
|| info->strip == strip_some)
o->lineno_count += sec->lineno_count;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
o->reloc_count += sec->reloc_count;
if (sec->rawsize > max_contents_size)
@@ -664,7 +664,7 @@ _bfd_coff_final_link (bfd *abfd,
if (sec->reloc_count > max_reloc_count)
max_reloc_count = sec->reloc_count;
}
- else if (info->relocatable
+ else if (bfd_link_relocatable (info)
&& (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order))
++o->reloc_count;
@@ -699,7 +699,7 @@ _bfd_coff_final_link (bfd *abfd,
/* If doing a relocatable link, allocate space for the pointers we
need to keep. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
unsigned int i;
@@ -747,7 +747,7 @@ _bfd_coff_final_link (bfd *abfd,
memory until the end of the link. This wastes memory,
but only when doing a relocatable link, which is not the
common case. */
- BFD_ASSERT (info->relocatable);
+ BFD_ASSERT (bfd_link_relocatable (info));
amt = o->reloc_count;
amt *= sizeof (struct internal_reloc);
flaginfo.section_info[o->target_index].relocs =
@@ -799,7 +799,7 @@ _bfd_coff_final_link (bfd *abfd,
flaginfo.contents = (bfd_byte *) bfd_malloc (max_contents_size);
amt = max_reloc_count * relsz;
flaginfo.external_relocs = (bfd_byte *) bfd_malloc (amt);
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
amt = max_reloc_count * sizeof (struct internal_reloc);
flaginfo.internal_relocs = (struct internal_reloc *) bfd_malloc (amt);
@@ -811,7 +811,7 @@ _bfd_coff_final_link (bfd *abfd,
|| (flaginfo.linenos == NULL && max_lineno_count > 0)
|| (flaginfo.contents == NULL && max_contents_size > 0)
|| (flaginfo.external_relocs == NULL && max_reloc_count > 0)
- || (! info->relocatable
+ || (! bfd_link_relocatable (info)
&& flaginfo.internal_relocs == NULL
&& max_reloc_count > 0))
goto error_return;
@@ -891,7 +891,7 @@ _bfd_coff_final_link (bfd *abfd,
== NULL))
|| (((flaginfo.info->discard == discard_sec_merge
&& (bfd_get_section (sym)->flags & SEC_MERGE)
- && ! flaginfo.info->relocatable)
+ && ! bfd_link_relocatable (flaginfo.info))
|| flaginfo.info->discard == discard_l)
&& bfd_is_local_label_name (sub, bfd_asymbol_name(sym))))
continue;
@@ -1031,7 +1031,7 @@ _bfd_coff_final_link (bfd *abfd,
flaginfo.outsyms = NULL;
}
- if (info->relocatable && max_output_reloc_count > 0)
+ if (bfd_link_relocatable (info) && max_output_reloc_count > 0)
{
/* Now that we have written out all the global symbols, we know
the symbol indices to use for relocs against them, and we can
@@ -1350,8 +1350,8 @@ mark_relocs (struct coff_final_link_info *flaginfo, bfd *input_bfd)
internal_relocs = _bfd_coff_read_internal_relocs
(input_bfd, a, FALSE,
flaginfo->external_relocs,
- flaginfo->info->relocatable,
- (flaginfo->info->relocatable
+ bfd_link_relocatable (flaginfo->info),
+ (bfd_link_relocatable (flaginfo->info)
? (flaginfo->section_info[ a->output_section->target_index ].relocs + a->output_section->reloc_count)
: flaginfo->internal_relocs)
);
@@ -1436,7 +1436,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
symbols that are going to be involved in the relocations. */
if (( flaginfo->info->strip != strip_none
|| flaginfo->info->discard != discard_none)
- && flaginfo->info->relocatable)
+ && bfd_link_relocatable (flaginfo->info))
{
/* Mark the symbol array as 'not-used'. */
memset (indexp, 0, obj_raw_syment_count (input_bfd) * sizeof * indexp);
@@ -1483,7 +1483,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
relocation. */
if ((flaginfo->info->strip != strip_none
|| flaginfo->info->discard != discard_none)
- && flaginfo->info->relocatable)
+ && bfd_link_relocatable (flaginfo->info))
dont_skip_symbol = *indexp;
else
dont_skip_symbol = FALSE;
@@ -2360,8 +2360,8 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
target_index = o->output_section->target_index;
internal_relocs = (_bfd_coff_read_internal_relocs
(input_bfd, o, FALSE, flaginfo->external_relocs,
- flaginfo->info->relocatable,
- (flaginfo->info->relocatable
+ bfd_link_relocatable (flaginfo->info),
+ (bfd_link_relocatable (flaginfo->info)
? (flaginfo->section_info[target_index].relocs
+ o->output_section->reloc_count)
: flaginfo->internal_relocs)));
@@ -2408,7 +2408,7 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *flaginfo, bfd *input_bfd)
flaginfo->sec_ptrs))
return FALSE;
- if (flaginfo->info->relocatable)
+ if (bfd_link_relocatable (flaginfo->info))
{
bfd_vma offset;
struct internal_reloc *irelend;
@@ -2636,8 +2636,8 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
/* When a weak symbol is not overridden by a strong one,
turn it into an external symbol when not building a
shared or relocatable object. */
- if (! flaginfo->info->shared
- && ! flaginfo->info->relocatable
+ if (! bfd_link_pic (flaginfo->info)
+ && ! bfd_link_relocatable (flaginfo->info)
&& IS_WEAK_EXTERNAL (flaginfo->output_bfd, isym))
isym.n_sclass = C_EXT;
@@ -2690,7 +2690,7 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
not matter. FIXME: Why not? */
if (sec->reloc_count > 0xffff
&& (! obj_pe (output_bfd)
- || flaginfo->info->relocatable))
+ || bfd_link_relocatable (flaginfo->info)))
(*_bfd_error_handler)
(_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
bfd_get_filename (output_bfd),
@@ -2699,7 +2699,7 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
if (sec->lineno_count > 0xffff
&& (! obj_pe (output_bfd)
- || flaginfo->info->relocatable))
+ || bfd_link_relocatable (flaginfo->info)))
(*_bfd_error_handler)
(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
bfd_get_filename (output_bfd),
@@ -2959,7 +2959,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
then we should ignore the symbol value. */
if (howto->pc_relative && howto->pcrel_offset)
{
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
if (sym != NULL && sym->n_scnum != 0)
addend += sym->n_value;
@@ -3031,7 +3031,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd,
val = 0;
}
- else if (! info->relocatable)
+ else if (! bfd_link_relocatable (info))
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index a4aef63..ee30659 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -3896,7 +3896,7 @@ ecoff_indirect_link_order (bfd *output_bfd,
modified, and we write them out now. We use the reloc_count
field of output_section to keep track of the number of relocs we
have output so far. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
file_ptr pos = (output_section->rel_filepos
+ output_section->reloc_count * external_reloc_size);
@@ -4370,7 +4370,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
einfo.info = info;
bfd_hash_traverse (&info->hash->table, ecoff_link_write_external, &einfo);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* We need to make a pass over the link_orders to count up the
number of relocations we will need to output, so that we know
@@ -4400,7 +4400,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
bfd_ecoff_debug_free (handle, abfd, debug, &backend->debug_swap, info);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* Now reset the reloc_count field of the sections in the output
BFD to 0, so that we can use them to keep track of how many
@@ -4420,7 +4420,7 @@ _bfd_ecoff_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
ecoff_data (abfd)->gp = (h->u.def.value
+ h->u.def.section->output_section->vma
+ h->u.def.section->output_offset);
- else if (info->relocatable)
+ else if (bfd_link_relocatable (info))
{
bfd_vma lo;
diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c
index 4f0b463..f81361a 100644
--- a/bfd/ecofflink.c
+++ b/bfd/ecofflink.c
@@ -496,7 +496,7 @@ bfd_ecoff_debug_init (bfd *output_bfd ATTRIBUTE_UNUSED,
ainfo->largest_file_shuffle = 0;
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
if (!bfd_hash_table_init (&ainfo->str_hash.table, string_hash_newfunc,
sizeof (struct string_hash_entry)))
@@ -529,7 +529,7 @@ bfd_ecoff_debug_free (void * handle,
bfd_hash_table_free (&ainfo->fdr_hash.table);
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
bfd_hash_table_free (&ainfo->str_hash.table);
objalloc_free (ainfo->memory);
@@ -818,7 +818,7 @@ bfd_ecoff_debug_accumulate (void * handle,
of space required by debugging information. We don't do
this when performing a relocatable link because it would
prevent us from easily merging different FDR's. */
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
bfd_boolean ffilename;
const char *name;
@@ -895,7 +895,7 @@ bfd_ecoff_debug_accumulate (void * handle,
fdr.iauxBase = output_symhdr->iauxMax;
output_symhdr->iauxMax += fdr.caux;
}
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
/* When are are hashing strings, we lie about the number of
@@ -1041,7 +1041,7 @@ ecoff_add_string (struct accumulate *ainfo,
symhdr = &debug->symbolic_header;
len = strlen (string);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (!add_memory_shuffle (ainfo, &ainfo->ss, &ainfo->ss_end,
(bfd_byte *) string, len + 1))
@@ -1598,7 +1598,7 @@ bfd_ecoff_write_accumulated_debug (void * handle,
/* The string table is written out from the hash table if this is a
final link. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
BFD_ASSERT (ainfo->ss_hash == (struct string_hash_entry *) NULL);
if (! ecoff_write_shuffle (abfd, swap, ainfo->ss, space))
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index d8d11b7..f5a1f45 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2555,7 +2555,7 @@ extern asection _bfd_elf_large_com_section;
else if (info->unresolved_syms_in_objects == RM_IGNORE \
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) \
ignored = TRUE; \
- else if (!info->relocatable) \
+ else if (!bfd_link_relocatable (info)) \
{ \
bfd_boolean err; \
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR \
@@ -2590,7 +2590,7 @@ extern asection _bfd_elf_large_com_section;
_bfd_clear_contents (howto, input_bfd, input_section, \
contents + rel[index].r_offset); \
\
- if (info->relocatable \
+ if (bfd_link_relocatable (info) \
&& (input_section->flags & SEC_DEBUGGING)) \
{ \
/* Only remove relocations in debug sections since other \
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 22068ab..7d65dae 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -833,8 +833,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
/* For shared libraries, try to get rid of as many RELATIVE relocs
as possible. */
- if (info->shared
- && !info->relocatable
+ if (bfd_link_pic (info)
&& (get_elf_backend_data (abfd)
->elf_backend_can_make_relative_eh_frame
(abfd, info, sec)))
@@ -871,7 +870,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
buf += initial_insn_length;
ENSURE_NO_RELOCS (buf);
- if (!info->relocatable)
+ if (!bfd_link_relocatable (info))
{
/* Keep info for merging cies. */
this_inf->u.cie.u.full_cie = cie;
@@ -1018,7 +1017,7 @@ _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
elf_section_data (sec)->sec_info = sec_info;
sec->sec_info_type = SEC_INFO_TYPE_EH_FRAME;
- if (!info->relocatable)
+ if (!bfd_link_relocatable (info))
{
/* Keep info for merging cies. */
sec_info->cies = local_cies;
@@ -1264,8 +1263,7 @@ find_merged_cie (bfd *abfd, struct bfd_link_info *info, asection *sec,
}
if (per_binds_local
- && info->shared
- && !info->relocatable
+ && bfd_link_pic (info)
&& (cie->per_encoding & 0x70) == DW_EH_PE_absptr
&& (get_elf_backend_data (abfd)
->elf_backend_can_make_relative_eh_frame (abfd, info, sec)))
@@ -1365,7 +1363,7 @@ _bfd_elf_discard_section_eh_frame
}
if (keep)
{
- if (info->shared
+ if (bfd_link_pic (info)
&& (((ent->fde_encoding & 0x70) == DW_EH_PE_absptr
&& ent->make_relative == 0)
|| (ent->fde_encoding & 0x70) == DW_EH_PE_aligned))
@@ -1907,7 +1905,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd,
value = ((ent->new_offset + sec->output_offset + 4)
- (cie->new_offset + cie->u.cie.u.sec->output_offset));
bfd_put_32 (abfd, value, buf);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
buf += 4;
width = get_DW_EH_PE_width (ent->fde_encoding, ptr_size);
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index f54c90b..baca25e 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -53,7 +53,7 @@ _bfd_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
if (bed->plt_readonly)
pltflags |= SEC_READONLY;
- if (info->shared)
+ if (bfd_link_pic (info))
{
/* We need to create .rel[a].ifunc for shared objects. */
const char *rel_sec = (bed->rela_plts_and_copies_p
@@ -125,7 +125,7 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
But in non-shared executable, the address of its .plt slot may
be used. Pointer equality may not work correctly. PIE should
be used if pointer equality is required here. */
- if (!info->shared
+ if (!bfd_link_pic (info)
&& (h->dynindx != -1
|| info->export_dynamic)
&& h->pointer_equality_needed)
@@ -145,7 +145,7 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
/* When building shared library, we need to handle the case where it is
marked with regular reference, but not non-GOT reference since the
non-GOT reference bit may not be set here. */
- if (info->shared && !h->non_got_ref && h->ref_regular)
+ if (bfd_link_pic (info) && !h->non_got_ref && h->ref_regular)
for (p = *head; p != NULL; p = p->next)
if (p->count)
{
@@ -220,7 +220,7 @@ keep:
/* We need dynamic relocation for STT_GNU_IFUNC symbol only when
there is a non-GOT reference in a shared object. */
- if (!info->shared
+ if (!bfd_link_pic (info)
|| !h->non_got_ref)
*head = NULL;
@@ -252,12 +252,12 @@ keep:
objects at run-time.
We only need to relocate .got entry in shared object. */
if (h->got.refcount <= 0
- || (info->shared
+ || (bfd_link_pic (info)
&& (h->dynindx == -1
|| h->forced_local))
- || (!info->shared
+ || (!bfd_link_pic (info)
&& !h->pointer_equality_needed)
- || (info->executable && info->shared)
+ || bfd_link_pie (info)
|| htab->sgot == NULL)
{
/* Use .got.plt. */
@@ -267,7 +267,7 @@ keep:
{
h->got.offset = htab->sgot->size;
htab->sgot->size += got_entry_size;
- if (info->shared)
+ if (bfd_link_pic (info))
htab->srelgot->size += sizeof_reloc;
}
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 45bfed7..2ee4496 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -383,7 +383,7 @@ mn10200_elf_relocate_section (bfd *output_bfd,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
r = mn10200_elf_final_link_relocate (howto, input_bfd, output_bfd,
@@ -572,7 +572,7 @@ mn10200_elf_relax_section (bfd *abfd,
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
|| (sec->flags & SEC_CODE) == 0)
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index a6a22b3..ee8d6ca 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -830,7 +830,7 @@ elf_mn10300_tls_transition (struct bfd_link_info * info,
&& elf_mn10300_hash_entry (h)->tls_type == GOT_TLS_IE)
return R_MN10300_TLS_GOTIE;
- if (info->shared)
+ if (bfd_link_pic (info))
return r_type;
if (! (sec->flags & SEC_CODE))
@@ -1061,7 +1061,7 @@ mn10300_elf_check_relocs (bfd *abfd,
srelgot = NULL;
sreloc = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -1153,7 +1153,7 @@ mn10300_elf_check_relocs (bfd *abfd,
case R_MN10300_TLS_IE:
case R_MN10300_TLS_GOTIE:
- if (info->shared)
+ if (bfd_link_pic (info))
info->flags |= DF_STATIC_TLS;
/* Fall through */
@@ -1179,7 +1179,7 @@ mn10300_elf_check_relocs (bfd *abfd,
}
if (srelgot == NULL
- && (h != NULL || info->shared))
+ && (h != NULL || bfd_link_pic (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
@@ -1268,7 +1268,7 @@ mn10300_elf_check_relocs (bfd *abfd,
local_got_offsets[r_symndx] = sgot->size;
- if (info->shared)
+ if (bfd_link_pic (info))
{
/* If we are generating a shared object, we need to
output a R_MN10300_RELATIVE reloc so that the dynamic
@@ -1332,7 +1332,7 @@ mn10300_elf_check_relocs (bfd *abfd,
need_shared_relocs:
/* If we are creating a shared library, then we
need to copy the reloc into the shared library. */
- if (info->shared
+ if (bfd_link_pic (info)
&& (sec->flags & SEC_ALLOC) != 0
/* Do not generate a dynamic reloc for a
reloc associated with a SYM_DIFF operation. */
@@ -1465,7 +1465,7 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
case R_MN10300_GOTOFF32:
case R_MN10300_GOTOFF24:
case R_MN10300_GOTOFF16:
- if (info->shared
+ if (bfd_link_pic (info)
&& (input_section->flags & SEC_ALLOC) != 0
&& h != NULL
&& ! SYMBOL_REFERENCES_LOCAL (info, h))
@@ -1474,7 +1474,7 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
/* Issue 2052223:
Taking the address of a protected function in a shared library
is illegal. Issue an error message here. */
- if (info->shared
+ if (bfd_link_pic (info)
&& (input_section->flags & SEC_ALLOC) != 0
&& h != NULL
&& ELF_ST_VISIBILITY (h->other) == STV_PROTECTED
@@ -1532,7 +1532,7 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
return bfd_reloc_ok;
case R_MN10300_32:
- if (info->shared
+ if (bfd_link_pic (info)
/* Do not generate relocs when an R_MN10300_32 has been used
with an R_MN10300_SYM_DIFF to compute a difference of two
symbols. */
@@ -1890,7 +1890,7 @@ mn10300_elf_final_link_relocate (reloc_howto_type *howto,
{
bfd_put_32 (output_bfd, value, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection * srelgot;
Elf_Internal_Rela outrel;
@@ -2091,7 +2091,7 @@ mn10300_elf_relocate_section (bfd *output_bfd,
/* _32 relocs in executables force _COPY relocs,
such that the address of the symbol ends up
being local. */
- && !info->executable
+ && !bfd_link_executable (info)
&& !SYMBOL_REFERENCES_LOCAL (info, hh)
&& ((input_section->flags & SEC_ALLOC) != 0
/* DWARF will emit R_MN10300_32 relocations
@@ -2105,7 +2105,7 @@ mn10300_elf_relocate_section (bfd *output_bfd,
obscure cases sec->output_section will be NULL. */
relocation = 0;
- else if (!info->relocatable && unresolved_reloc
+ else if (!bfd_link_relocatable (info) && unresolved_reloc
&& _bfd_elf_section_offset (output_bfd, info, input_section,
rel->r_offset) != (bfd_vma) -1)
@@ -2122,7 +2122,7 @@ mn10300_elf_relocate_section (bfd *output_bfd,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
r = mn10300_elf_final_link_relocate (howto, input_bfd, output_bfd,
@@ -2665,7 +2665,7 @@ mn10300_elf_relax_section (bfd *abfd,
asection *section = sec;
bfd_vma align_gap_adjustment;
- if (link_info->relocatable)
+ if (bfd_link_relocatable (link_info))
(*link_info->callbacks->einfo)
(_("%P%F: --relax and -r may not be used together\n"));
@@ -3287,7 +3287,7 @@ mn10300_elf_relax_section (bfd *abfd,
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
|| (sec->flags & SEC_CODE) == 0)
@@ -4776,11 +4776,11 @@ static const bfd_byte elf_mn10300_pic_plt_entry[PIC_PLT_ENTRY_SIZE] =
/* Return size of the first PLT entry. */
#define elf_mn10300_sizeof_plt0(info) \
- (info->shared ? PIC_PLT_ENTRY_SIZE : PLT0_ENTRY_SIZE)
+ (bfd_link_pic (info) ? PIC_PLT_ENTRY_SIZE : PLT0_ENTRY_SIZE)
/* Return size of a PLT entry. */
#define elf_mn10300_sizeof_plt(info) \
- (info->shared ? PIC_PLT_ENTRY_SIZE : PLT_ENTRY_SIZE)
+ (bfd_link_pic (info) ? PIC_PLT_ENTRY_SIZE : PLT_ENTRY_SIZE)
/* Return offset of the PLT0 address in an absolute PLT entry. */
#define elf_mn10300_plt_plt0_offset(info) 16
@@ -4872,7 +4872,7 @@ _bfd_mn10300_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
be needed, we can discard it later. We will never need this
section when generating a shared object, since they do not use
copy relocs. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
{
s = bfd_make_section_anyway_with_flags (abfd,
(bed->default_use_rela_p
@@ -4917,7 +4917,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
if (h->type == STT_FUNC
|| h->needs_plt)
{
- if (! info->shared
+ if (! bfd_link_pic (info)
&& !h->def_dynamic
&& !h->ref_dynamic)
{
@@ -4950,7 +4950,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
location in the .plt. This is required to make function
pointers compare as equal between the normal executable and
the shared library. */
- if (! info->shared
+ if (! bfd_link_pic (info)
&& !h->def_regular)
{
h->root.u.def.section = s;
@@ -4995,7 +4995,7 @@ _bfd_mn10300_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
only references to the symbol are via the global offset table.
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
- if (info->shared)
+ if (bfd_link_pic (info))
return TRUE;
/* If there are no references to this symbol that do not use the
@@ -5052,7 +5052,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
+ if (bfd_link_executable (info))
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -5174,7 +5174,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
but we must add the entries now so that we get the correct
size for the .dynamic section. The DT_DEBUG entry is filled
in by the dynamic linker and used by the debugger. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
{
if (!_bfd_elf_add_dynamic_entry (info, DT_DEBUG, 0))
return FALSE;
@@ -5254,7 +5254,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd,
got_offset = (plt_index + 3) * 4;
/* Fill in the entry in the procedure linkage table. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
{
memcpy (splt->contents + h->plt.offset, elf_mn10300_plt_entry,
elf_mn10300_sizeof_plt (info));
@@ -5357,7 +5357,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (bfd * output_bfd,
the symbol was forced to be local because of a version file.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
- if (info->shared
+ if (bfd_link_pic (info)
&& (info->symbolic || h->dynindx == -1)
&& h->def_regular)
{
@@ -5497,7 +5497,7 @@ _bfd_mn10300_elf_finish_dynamic_sections (bfd * output_bfd,
splt = htab->root.splt;
if (splt && splt->size > 0)
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
memcpy (splt->contents, elf_mn10300_pic_plt_entry,
elf_mn10300_sizeof_plt (info));
diff --git a/bfd/elf-s390-common.c b/bfd/elf-s390-common.c
index 09d4e5c..5c36ec8 100644
--- a/bfd/elf-s390-common.c
+++ b/bfd/elf-s390-common.c
@@ -45,7 +45,7 @@ s390_elf_create_ifunc_sections (bfd *abfd, struct bfd_link_info *info)
flags = bed->dynamic_sec_flags;
- if (info->shared)
+ if (bfd_link_pic (info))
{
s = bfd_make_section_with_flags (abfd, ".rela.ifunc",
flags | SEC_READONLY);
@@ -105,7 +105,7 @@ s390_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
where it is marked with regular reference, but not non-GOT
reference. It may happen if we didn't see STT_GNU_IFUNC
symbol at the time when checking relocations. */
- if (info->shared
+ if (bfd_link_pic (info)
&& !h->non_got_ref
&& h->ref_regular)
for (p = *head; p != NULL; p = p->next)
@@ -151,7 +151,10 @@ keep:
point to the IPLT slot. That way the referencing shared lib will
always get the PLT slot address when resolving the respective
R_390_GLOB_DAT/R_390_64 relocs on that symbol. */
- if (info->executable && !info->shared && h->def_regular && h->ref_dynamic)
+ if (bfd_link_executable (info)
+ && !bfd_link_pic (info)
+ && h->def_regular
+ && h->ref_dynamic)
{
h->root.u.def.section = htab->iplt;
h->root.u.def.value = h->plt.offset;
@@ -161,7 +164,7 @@ keep:
/* We need dynamic relocation for STT_GNU_IFUNC symbol only when
there is a non-GOT reference in a shared object. */
- if (!info->shared || !h->non_got_ref)
+ if (!bfd_link_pic (info) || !h->non_got_ref)
*head = NULL;
/* Finally, allocate space. */
@@ -182,9 +185,9 @@ keep:
avoided if the values in the GOT slots could differ for pointer
equality reasons. */
if (h->got.refcount <= 0
- || (info->shared
+ || (bfd_link_pic (info)
&& (h->dynindx == -1 || h->forced_local))
- || (info->executable && info->shared)
+ || (bfd_link_executable (info) && bfd_link_pic (info))
|| htab->sgot == NULL)
{
/* Use .got.iplt. */
@@ -194,7 +197,7 @@ keep:
{
h->got.offset = htab->sgot->size;
htab->sgot->size += GOT_ENTRY_SIZE;
- if (info->shared)
+ if (bfd_link_pic (info))
htab->srelgot->size += RELA_ENTRY_SIZE;
}
diff --git a/bfd/elf-vxworks.c b/bfd/elf-vxworks.c
index acc25c0..56fdec0 100644
--- a/bfd/elf-vxworks.c
+++ b/bfd/elf-vxworks.c
@@ -64,7 +64,7 @@ elf_vxworks_add_symbol_hook (bfd *abfd,
give the symbol weak binding to get the desired samantics.
This transformation will be undone in
elf_i386_vxworks_link_output_symbol_hook. */
- if ((info->shared || abfd->flags & DYNAMIC)
+ if ((bfd_link_pic (info) || abfd->flags & DYNAMIC)
&& elf_vxworks_gott_symbol_p (abfd, *namep))
{
sym->st_info = ELF_ST_INFO (STB_WEAK, ELF_ST_TYPE (sym->st_info));
@@ -89,7 +89,7 @@ elf_vxworks_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info,
htab = elf_hash_table (info);
bed = get_elf_backend_data (dynobj);
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
s = bfd_make_section_anyway_with_flags (dynobj,
bed->default_use_rela_p
diff --git a/bfd/elf.c b/bfd/elf.c
index 5be48d9..f20679e 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3081,7 +3081,8 @@ elf_fake_sections (bfd *abfd, asection *asect, void *fsarg)
if (arg->link_info
/* Do the normal setup if we wouldn't create any sections here. */
&& esd->rel.count + esd->rela.count > 0
- && (arg->link_info->relocatable || arg->link_info->emitrelocations))
+ && (bfd_link_relocatable (arg->link_info)
+ || arg->link_info->emitrelocations))
{
if (esd->rel.count && esd->rel.hdr == NULL
&& !_bfd_elf_init_reloc_shdr (abfd, &esd->rel, name, FALSE,
@@ -3298,7 +3299,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
_bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd));
/* SHT_GROUP sections are in relocatable files only. */
- if (link_info == NULL || link_info->relocatable)
+ if (link_info == NULL || bfd_link_relocatable (link_info))
{
/* Put SHT_GROUP sections first. */
for (sec = abfd->sections; sec != NULL; sec = sec->next)
@@ -5555,9 +5556,7 @@ assign_file_positions_except_relocs (bfd *abfd,
}
/* Set e_type in ELF header to ET_EXEC for -pie -Ttext-segment=. */
- if (link_info != NULL
- && link_info->executable
- && link_info->shared)
+ if (link_info != NULL && bfd_link_pie (link_info))
{
unsigned int num_segments = elf_elfheader (abfd)->e_phnum;
Elf_Internal_Phdr *segment = elf_tdata (abfd)->phdr;
@@ -6894,7 +6893,8 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
{
Elf_Internal_Shdr *ihdr, *ohdr;
- bfd_boolean final_link = link_info != NULL && !link_info->relocatable;
+ bfd_boolean final_link = (link_info != NULL
+ && !bfd_link_relocatable (link_info));
if (ibfd->xvec->flavour != bfd_target_elf_flavour
|| obfd->xvec->flavour != bfd_target_elf_flavour)
@@ -8187,7 +8187,7 @@ _bfd_elf_sizeof_headers (bfd *abfd, struct bfd_link_info *info)
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
int ret = bed->s->sizeof_ehdr;
- if (!info->relocatable)
+ if (!bfd_link_relocatable (info))
{
bfd_size_type phdr_size = elf_program_header_size (abfd);
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index d313de4..bd4b576 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3409,7 +3409,7 @@ elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
return FALSE;
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
- if (!info->shared)
+ if (!bfd_link_pic (info))
htab->srelbss = bfd_get_linker_section (dynobj,
RELOC_SECTION (htab, ".bss"));
@@ -3418,7 +3418,7 @@ elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
return FALSE;
- if (info->shared)
+ if (bfd_link_pic (info))
{
htab->plt_header_size = 0;
htab->plt_entry_size
@@ -3452,7 +3452,7 @@ elf32_arm_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
if (!htab->root.splt
|| !htab->root.srelplt
|| !htab->sdynbss
- || (!info->shared && !htab->srelbss))
+ || (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
@@ -3746,7 +3746,7 @@ arm_type_of_stub (struct bfd_link_info *info,
/* Thumb to thumb. */
if (!thumb_only)
{
- stub_type = (info->shared | globals->pic_veneer)
+ stub_type = (bfd_link_pic (info) | globals->pic_veneer)
/* PIC stubs. */
? ((globals->use_blx
&& (r_type == R_ARM_THM_CALL))
@@ -3768,7 +3768,7 @@ arm_type_of_stub (struct bfd_link_info *info,
}
else
{
- stub_type = (info->shared | globals->pic_veneer)
+ stub_type = (bfd_link_pic (info) | globals->pic_veneer)
/* PIC stub. */
? arm_stub_long_branch_thumb_only_pic
/* non-PIC stub. */
@@ -3789,7 +3789,7 @@ arm_type_of_stub (struct bfd_link_info *info,
}
stub_type =
- (info->shared | globals->pic_veneer)
+ (bfd_link_pic (info) | globals->pic_veneer)
/* PIC stubs. */
? (r_type == R_ARM_THM_TLS_CALL
/* TLS PIC stubs. */
@@ -3843,7 +3843,7 @@ arm_type_of_stub (struct bfd_link_info *info,
|| (r_type == R_ARM_JUMP24)
|| (r_type == R_ARM_PLT32))
{
- stub_type = (info->shared | globals->pic_veneer)
+ stub_type = (bfd_link_pic (info) | globals->pic_veneer)
/* PIC stubs. */
? ((globals->use_blx)
/* V5T and above. */
@@ -3866,7 +3866,7 @@ arm_type_of_stub (struct bfd_link_info *info,
|| (branch_offset < ARM_MAX_BWD_BRANCH_OFFSET))
{
stub_type =
- (info->shared | globals->pic_veneer)
+ (bfd_link_pic (info) | globals->pic_veneer)
/* PIC stubs. */
? (r_type == R_ARM_TLS_CALL
/* TLS PIC Stub. */
@@ -4097,7 +4097,8 @@ elf32_arm_tls_transition (struct bfd_link_info *info, int r_type,
{
int is_local = (h == NULL);
- if (info->shared || (h && h->root.type == bfd_link_hash_undefweak))
+ if (bfd_link_pic (info)
+ || (h && h->root.type == bfd_link_hash_undefweak))
return r_type;
/* We do not support relaxations for Old TLS models. */
@@ -5838,7 +5839,8 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info,
free (tmp_name);
- if (link_info->shared || globals->root.is_relocatable_executable
+ if (bfd_link_pic (link_info)
+ || globals->root.is_relocatable_executable
|| globals->pic_veneer)
size = ARM2THUMB_PIC_GLUE_SIZE;
else if (globals->use_blx)
@@ -6110,7 +6112,7 @@ bfd_elf32_arm_add_glue_sections_to_bfd (bfd *abfd,
{
/* If we are only performing a partial
link do not bother adding the glue. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
return arm_make_glue_section (abfd, ARM2THUMB_GLUE_SECTION_NAME)
@@ -6130,7 +6132,7 @@ bfd_elf32_arm_get_bfd_for_interworking (bfd *abfd, struct bfd_link_info *info)
/* If we are only performing a partial link
do not bother getting a bfd to hold the glue. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
/* Make sure we don't attach the glue sections to a dynamic object. */
@@ -6182,7 +6184,7 @@ bfd_elf32_arm_process_before_allocation (bfd *abfd,
/* If we are only performing a partial link do not bother
to construct any glue. */
- if (link_info->relocatable)
+ if (bfd_link_relocatable (link_info))
return TRUE;
/* Here we have a bfd that is to be included on the link. We have a
@@ -6746,7 +6748,7 @@ bfd_elf32_arm_vfp11_erratum_scan (bfd *abfd, struct bfd_link_info *link_info)
/* If we are only performing a partial link do not bother
to construct any glue. */
- if (link_info->relocatable)
+ if (bfd_link_relocatable (link_info))
return TRUE;
/* Skip if this bfd does not correspond to an ELF image. */
@@ -6932,7 +6934,7 @@ bfd_elf32_arm_vfp11_fix_veneer_locations (bfd *abfd,
struct elf32_arm_link_hash_table *globals;
char *tmp_name;
- if (link_info->relocatable)
+ if (bfd_link_relocatable (link_info))
return;
/* Skip if this bfd does not correspond to an ELF image. */
@@ -7220,7 +7222,8 @@ elf32_arm_create_thumb_stub (struct bfd_link_info * info,
--my_offset;
myh->root.u.def.value = my_offset;
- if (info->shared || globals->root.is_relocatable_executable
+ if (bfd_link_pic (info)
+ || globals->root.is_relocatable_executable
|| globals->pic_veneer)
{
/* For relocatable objects we can't use absolute addresses,
@@ -7671,7 +7674,7 @@ elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
+ root_plt->offset);
ptr = splt->contents + root_plt->offset;
- if (htab->vxworks_p && info->shared)
+ if (htab->vxworks_p && bfd_link_pic (info))
{
unsigned int i;
bfd_vma val;
@@ -8383,7 +8386,8 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
/* When generating a shared object or relocatable executable, these
relocations are copied into the output file to be resolved at
run time. */
- if ((info->shared || globals->root.is_relocatable_executable)
+ if ((bfd_link_pic (info)
+ || globals->root.is_relocatable_executable)
&& (input_section->flags & SEC_ALLOC)
&& !(globals->vxworks_p
&& strcmp (input_section->output_section->name,
@@ -8409,7 +8413,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
char *v = _("shared object");
- if (info->executable)
+ if (bfd_link_executable (info))
v = _("PIE executable");
(*_bfd_error_handler)
@@ -8448,7 +8452,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
memset (&outrel, 0, sizeof outrel);
else if (h != NULL
&& h->dynindx != -1
- && (!info->shared
+ && (!bfd_link_pic (info)
|| !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
@@ -9398,7 +9402,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
if (dynreloc_st_type == STT_GNU_IFUNC)
outrel.r_info = ELF32_R_INFO (0, R_ARM_IRELATIVE);
- else if (info->shared &&
+ else if (bfd_link_pic (info) &&
(ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
@@ -9447,7 +9451,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
if (globals->use_rel)
bfd_put_32 (output_bfd, dynreloc_value, sgot->contents + off);
- if (info->shared || dynreloc_st_type == STT_GNU_IFUNC)
+ if (bfd_link_pic (info) || dynreloc_st_type == STT_GNU_IFUNC)
{
Elf_Internal_Rela outrel;
@@ -9496,7 +9500,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
/* If we don't know the module number, create a relocation
for it. */
- if (info->shared)
+ if (bfd_link_pic (info))
{
Elf_Internal_Rela outrel;
@@ -9546,8 +9550,10 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
{
bfd_boolean dyn;
dyn = globals->root.dynamic_sections_created;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- && (!info->shared
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
+ bfd_link_pic (info),
+ h)
+ && (!bfd_link_pic (info)
|| !SYMBOL_REFERENCES_LOCAL (info, h)))
{
*unresolved_reloc_p = FALSE;
@@ -9584,7 +9590,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
now, and emit any relocations. If both an IE GOT and a
GD GOT are necessary, we emit the GD first. */
- if ((info->shared || indx != 0)
+ if ((bfd_link_pic (info) || indx != 0)
&& (h == NULL
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
@@ -9600,7 +9606,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
/* We should have relaxed, unless this is an undefined
weak symbol. */
BFD_ASSERT ((h && (h->root.type == bfd_link_hash_undefweak))
- || info->shared);
+ || bfd_link_pic (info));
BFD_ASSERT (globals->sgotplt_jump_table_size + offplt + 8
<= globals->root.sgotplt->size);
@@ -9875,7 +9881,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
}
case R_ARM_TLS_LE32:
- if (info->shared && !info->pie)
+ if (bfd_link_pic (info) && !bfd_link_pie (info))
{
(*_bfd_error_handler)
(_("%B(%A+0x%lx): R_ARM_TLS_LE32 relocation not permitted in shared object"),
@@ -10596,7 +10602,7 @@ elf32_arm_relocate_section (bfd * output_bfd,
relocation = (sec->output_section->vma
+ sec->output_offset
+ sym->st_value);
- if (!info->relocatable
+ if (!bfd_link_relocatable (info)
&& (sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
@@ -10703,7 +10709,7 @@ elf32_arm_relocate_section (bfd * output_bfd,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
@@ -12448,7 +12454,7 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
const Elf_Internal_Rela *rel, *relend;
struct elf32_arm_link_hash_table * globals;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
globals = elf32_arm_hash_table (info);
@@ -12546,7 +12552,7 @@ elf32_arm_gc_sweep_hook (bfd * abfd,
case R_ARM_THM_MOVW_PREL_NC:
case R_ARM_THM_MOVT_PREL:
/* Should the interworking branches be here also? */
- if ((info->shared || globals->root.is_relocatable_executable)
+ if ((bfd_link_pic (info) || globals->root.is_relocatable_executable)
&& (sec->flags & SEC_ALLOC) != 0)
{
if (h == NULL
@@ -12644,7 +12650,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
bfd_boolean may_need_local_target_p;
unsigned long nsyms;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
BFD_ASSERT (is_arm_elf (abfd));
@@ -12761,7 +12767,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
default: tls_type = GOT_NORMAL; break;
}
- if (!info->executable && (tls_type & GOT_TLS_IE))
+ if (!bfd_link_executable (info) && (tls_type & GOT_TLS_IE))
info->flags |= DF_STATIC_TLS;
if (h != NULL)
@@ -12846,7 +12852,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_ARM_MOVT_ABS:
case R_ARM_THM_MOVW_ABS_NC:
case R_ARM_THM_MOVT_ABS:
- if (info->shared)
+ if (bfd_link_pic (info))
{
(*_bfd_error_handler)
(_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"),
@@ -12859,7 +12865,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* Fall through. */
case R_ARM_ABS32:
case R_ARM_ABS32_NOI:
- if (h != NULL && info->executable)
+ if (h != NULL && bfd_link_executable (info))
{
h->pointer_equality_needed = 1;
}
@@ -12872,7 +12878,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_ARM_THM_MOVT_PREL:
/* Should the interworking branches be listed here? */
- if ((info->shared || htab->root.is_relocatable_executable)
+ if ((bfd_link_pic (info) || htab->root.is_relocatable_executable)
&& (sec->flags & SEC_ALLOC) != 0)
{
if (h == NULL
@@ -13315,7 +13321,7 @@ elf32_arm_adjust_dynamic_symbol (struct bfd_link_info * info,
be handled correctly by relocate_section. Relocatable executables
can reference data in shared objects directly, so we don't need to
do anything here. */
- if (info->shared || globals->root.is_relocatable_executable)
+ if (bfd_link_pic (info) || globals->root.is_relocatable_executable)
return TRUE;
/* We must allocate the symbol in our .dynbss section, which will
@@ -13397,7 +13403,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
h->got.refcount = 0;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| eh->is_iplt
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
@@ -13408,7 +13414,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
location in the .plt. This is required to make function
pointers compare as equal between the normal executable and
the shared library. */
- if (! info->shared
+ if (! bfd_link_pic (info)
&& !h->def_regular)
{
h->root.u.def.section = htab->root.splt;
@@ -13423,7 +13429,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
/* VxWorks executables have a second set of relocations for
each PLT entry. They go in a separate relocation section,
which is processed by the kernel loader. */
- if (htab->vxworks_p && !info->shared)
+ if (htab->vxworks_p && !bfd_link_pic (info))
{
/* There is a relocation for the initial PLT entry:
an R_ARM_32 relocation for _GLOBAL_OFFSET_TABLE_. */
@@ -13510,13 +13516,15 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
dyn = htab->root.dynamic_sections_created;
indx = 0;
- if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- && (!info->shared
+ if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
+ bfd_link_pic (info),
+ h)
+ && (!bfd_link_pic (info)
|| !SYMBOL_REFERENCES_LOCAL (info, h)))
indx = h->dynindx;
if (tls_type != GOT_NORMAL
- && (info->shared || indx != 0)
+ && (bfd_link_pic (info) || indx != 0)
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
{
@@ -13550,8 +13558,9 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
they all resolve dynamically instead. Reserve room for the
GOT entry's R_ARM_IRELATIVE relocation. */
elf32_arm_allocate_irelocs (info, htab->root.srelgot, 1);
- else if (info->shared && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ else if (bfd_link_pic (info)
+ && (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
/* Reserve room for the GOT entry's R_ARM_RELATIVE relocation. */
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
}
@@ -13601,7 +13610,7 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf)
space for pc-relative relocs that have become local due to symbol
visibility changes. */
- if (info->shared || htab->root.is_relocatable_executable)
+ if (bfd_link_pic (info) || htab->root.is_relocatable_executable)
{
/* Relocs that use pc_count are PC-relative forms, which will appear
on something like ".long foo - ." or "movw REG, foo - .". We want
@@ -13777,7 +13786,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
+ if (bfd_link_executable (info))
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -13929,13 +13938,13 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
&& (local_iplt == NULL
|| local_iplt->arm.noncall_refcount == 0))
elf32_arm_allocate_irelocs (info, srel, 1);
- else if (info->shared || output_bfd->flags & DYNAMIC)
+ else if (bfd_link_pic (info) || output_bfd->flags & DYNAMIC)
{
- if ((info->shared && !(*local_tls_type & GOT_TLS_GDESC))
+ if ((bfd_link_pic (info) && !(*local_tls_type & GOT_TLS_GDESC))
|| *local_tls_type & GOT_TLS_GD)
elf32_arm_allocate_dynrelocs (info, srel, 1);
- if (info->shared && *local_tls_type & GOT_TLS_GDESC)
+ if (bfd_link_pic (info) && *local_tls_type & GOT_TLS_GDESC)
{
elf32_arm_allocate_dynrelocs (info,
htab->root.srelplt, 1);
@@ -13954,7 +13963,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
for R_ARM_TLS_LDM32 relocations. */
htab->tls_ldm_got.offset = htab->root.sgot->size;
htab->root.sgot->size += 8;
- if (info->shared)
+ if (bfd_link_pic (info))
elf32_arm_allocate_dynrelocs (info, htab->root.srelgot, 1);
}
else
@@ -14090,7 +14099,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (info->executable)
+ if (bfd_link_executable (info))
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
@@ -14158,7 +14167,7 @@ elf32_arm_always_size_sections (bfd *output_bfd,
{
asection *tls_sec;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
tls_sec = elf_hash_table (info)->tls_sec;
@@ -14649,7 +14658,9 @@ elf32_arm_finish_dynamic_sections (bfd * output_bfd, struct bfd_link_info * info
#endif
}
- if (htab->vxworks_p && !info->shared && htab->root.splt->size > 0)
+ if (htab->vxworks_p
+ && !bfd_link_pic (info)
+ && htab->root.splt->size > 0)
{
/* Correct the .rel(a).plt.unloaded relocations. They will have
incorrect symbol indexes. */
@@ -15168,7 +15179,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
osi.sec_shndx = _bfd_elf_section_from_bfd_section
(output_bfd, osi.sec->output_section);
- if (info->shared || htab->root.is_relocatable_executable
+ if (bfd_link_pic (info) || htab->root.is_relocatable_executable
|| htab->pic_veneer)
size = ARM2THUMB_PIC_GLUE_SIZE;
else if (htab->use_blx)
@@ -15246,7 +15257,7 @@ elf32_arm_output_arch_local_syms (bfd *output_bfd,
if (htab->vxworks_p)
{
/* VxWorks shared libraries have no PLT header. */
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
if (!elf32_arm_output_map_sym (&osi, ARM_MAP_ARM, 0))
return FALSE;
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index bd57ab7..86b9f84 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -1474,7 +1474,7 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
r = avr_final_link_relocate (howto, input_bfd, input_section,
@@ -2375,7 +2375,7 @@ elf32_avr_relax_section (bfd *abfd,
|| !strcmp (sec->name,".jumptables"))
shrinkable = FALSE;
- if (link_info->relocatable)
+ if (bfd_link_relocatable (link_info))
(*link_info->callbacks->einfo)
(_("%P%F: --relax and -r may not be used together\n"));
@@ -2413,7 +2413,7 @@ elf32_avr_relax_section (bfd *abfd,
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
|| (sec->flags & SEC_CODE) == 0)
@@ -3641,7 +3641,7 @@ elf32_avr_size_stubs (bfd *output_bfd,
}
else if (hh->root.type == bfd_link_hash_undefweak)
{
- if (! info->shared)
+ if (! bfd_link_pic (info))
continue;
}
else if (hh->root.type == bfd_link_hash_undefined)
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 80d20ca..49ef360 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -1165,7 +1165,7 @@ bfin_check_relocs (bfd * abfd,
asection *sgot;
asection *srelgot;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
@@ -1232,7 +1232,7 @@ bfin_check_relocs (bfd * abfd,
BFD_ASSERT (sgot != NULL);
}
- if (srelgot == NULL && (h != NULL || info->shared))
+ if (srelgot == NULL && (h != NULL || bfd_link_pic (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
@@ -1285,7 +1285,7 @@ bfin_check_relocs (bfd * abfd,
if (local_got_refcounts[r_symndx] == 0)
{
sgot->size += 4;
- if (info->shared)
+ if (bfd_link_pic (info))
{
/* If we are generating a shared object, we need to
output a R_68K_RELATIVE reloc so that the dynamic
@@ -1455,7 +1455,7 @@ bfin_relocate_section (bfd * output_bfd,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
address = rel->r_offset;
@@ -1502,8 +1502,10 @@ bfin_relocate_section (bfd * output_bfd,
BFD_ASSERT (off != (bfd_vma) - 1);
dyn = elf_hash_table (info)->dynamic_sections_created;
- if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
- || (info->shared
+ if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
+ bfd_link_pic (info),
+ h)
+ || (bfd_link_pic (info)
&& (info->symbolic
|| h->dynindx == -1
|| h->forced_local)
@@ -1548,7 +1550,7 @@ bfin_relocate_section (bfd * output_bfd,
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
@@ -1719,7 +1721,7 @@ bfin_gc_sweep_hook (bfd * abfd,
{
/* We don't need the .got entry any more. */
sgot->size -= 4;
- if (info->shared)
+ if (bfd_link_pic (info))
srelgot->size -= sizeof (Elf32_External_Rela);
}
}
@@ -2213,7 +2215,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
/* If we're linking an executable at a fixed address, we can
omit the dynamic relocation as long as the symbol is local to
this module. */
- if (info->executable && !info->pie
+ if (bfd_link_executable (info) && !bfd_link_pic (info)
&& (entry->symndx != -1
|| BFINFDPIC_SYM_LOCAL (info, entry->d.h)))
{
@@ -2268,7 +2270,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
if (entry->symndx == -1
&& ! BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h)
&& BFINFDPIC_SYM_LOCAL (info, entry->d.h)
- && !(info->executable && !info->pie))
+ && !(bfd_link_executable (info) && !bfd_link_pic (info)))
{
reloc = R_BFIN_FUNCDESC;
idx = elf_section_data (entry->d.h->root.u.def.section
@@ -2304,7 +2306,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
dynamic symbol entry for the got section, so idx will be
zero, which means we can and should compute the address
of the private descriptor ourselves. */
- if (info->executable && !info->pie
+ if (bfd_link_executable (info) && !bfd_link_pic (info)
&& (entry->symndx != -1
|| BFINFDPIC_FUNCDESC_LOCAL (info, entry->d.h)))
{
@@ -2367,7 +2369,7 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
/* If we're linking an executable at a fixed address, we can
omit the dynamic relocation as long as the symbol is local to
this module. */
- if (info->executable && !info->pie
+ if (bfd_link_executable (info) && !bfd_link_pic (info)
&& (entry->symndx != -1 || BFINFDPIC_SYM_LOCAL (info, entry->d.h)))
{
if (sec)
@@ -2415,7 +2417,10 @@ _bfinfdpic_emit_got_relocs_plt_entries (struct bfinfdpic_relocs_info *entry,
/* If we've omitted the dynamic relocation, just emit the fixed
addresses of the symbol and of the local GOT base offset. */
- if (info->executable && !info->pie && sec && sec->output_section)
+ if (bfd_link_executable (info)
+ && !bfd_link_pic (info)
+ && sec
+ && sec->output_section)
{
lowword = ad;
highword = bfinfdpic_got_section (info)->output_section->vma
@@ -2595,7 +2600,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
Elf_Internal_Rela *relend;
unsigned isec_segment, got_segment, plt_segment,
check_segment[2];
- int silence_segment_error = !(info->shared || info->pie);
+ int silence_segment_error = !bfd_link_pic (info);
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
@@ -2675,7 +2680,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
if (h != NULL
@@ -2829,7 +2834,8 @@ bfinfdpic_relocate_section (bfd * output_bfd,
section+offset. */
if (h && ! BFINFDPIC_FUNCDESC_LOCAL (info, h)
&& BFINFDPIC_SYM_LOCAL (info, h)
- && !(info->executable && !info->pie))
+ && !(bfd_link_executable (info)
+ && !bfd_link_pic (info)))
{
dynindx = elf_section_data (h->root.u.def.section
->output_section)->dynindx;
@@ -2866,7 +2872,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
dynamic symbol entry for the got section, so idx will
be zero, which means we can and should compute the
address of the private descriptor ourselves. */
- if (info->executable && !info->pie
+ if (bfd_link_executable (info) && !bfd_link_pic (info)
&& (!h || BFINFDPIC_FUNCDESC_LOCAL (info, h)))
{
bfd_vma offset;
@@ -2989,7 +2995,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
can omit the dynamic relocation as long as the symbol
is defined in the current link unit (which is implied
by its output section not being NULL). */
- if (info->executable && !info->pie
+ if (bfd_link_executable (info) && !bfd_link_pic (info)
&& (!h || BFINFDPIC_SYM_LOCAL (info, h)))
{
if (osec)
@@ -3069,7 +3075,7 @@ bfinfdpic_relocate_section (bfd * output_bfd,
/* If we've omitted the dynamic relocation, just emit
the fixed addresses of the symbol and of the local
GOT base offset. */
- if (info->executable && !info->pie
+ if (bfd_link_executable (info) && !bfd_link_pic (info)
&& (!h || BFINFDPIC_SYM_LOCAL (info, h)))
bfd_put_32 (output_bfd,
bfinfdpic_got_section (info)->output_section->vma
@@ -3127,11 +3133,11 @@ bfinfdpic_relocate_section (bfd * output_bfd,
&& picrel->d.h->root.type == bfd_link_hash_undefined))
info->callbacks->warning
(info,
- (info->shared || info->pie)
+ bfd_link_pic (info)
? _("relocations between different segments are not supported")
: _("warning: relocation references a different segment"),
name, input_bfd, input_section, rel->r_offset);
- if (!silence_segment_error && (info->shared || info->pie))
+ if (!silence_segment_error && bfd_link_pic (info))
return FALSE;
elf_elfheader (output_bfd)->e_flags |= EF_BFIN_PIC;
}
@@ -3497,7 +3503,7 @@ _bfin_create_got_section (bfd *abfd, struct bfd_link_info *info)
h->def_regular = 1;
h->type = STT_OBJECT;
- if (! info->executable
+ if (! bfd_link_executable (info)
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
return FALSE;
}
@@ -3566,7 +3572,7 @@ elf32_bfinfdpic_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
be needed, we can discard it later. We will never need this
section when generating a shared object, since they do not use
copy relocs. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
{
s = bfd_make_section_anyway_with_flags (abfd,
".rela.bss",
@@ -3649,7 +3655,7 @@ _bfinfdpic_count_relocs_fixups (struct bfinfdpic_relocs_info *entry,
{
bfd_vma relocs = 0, fixups = 0;
- if (!dinfo->info->executable || dinfo->info->pie)
+ if (!bfd_link_executable (dinfo->info) || bfd_link_pie (dinfo->info))
relocs = entry->relocs32 + entry->relocsfd + entry->relocsfdv;
else
{
@@ -4251,7 +4257,7 @@ elf32_bfinfdpic_size_dynamic_sections (bfd *output_bfd,
if (htab->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
+ if (bfd_link_executable (info))
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -4318,7 +4324,7 @@ static bfd_boolean
elf32_bfinfdpic_always_size_sections (bfd *output_bfd,
struct bfd_link_info *info)
{
- if (!info->relocatable
+ if (!bfd_link_relocatable (info)
&& !bfd_elf_stack_segment_size (output_bfd, info,
"__stacksize", DEFAULT_STACK_SIZE))
return FALSE;
@@ -4735,7 +4741,7 @@ bfinfdpic_check_relocs (bfd *abfd, struct bfd_link_info *info,
bfd *dynobj;
struct bfinfdpic_relocs_info *picrel;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -5145,7 +5151,7 @@ bfin_finish_dynamic_symbol (bfd * output_bfd,
the symbol was forced to be local because of a version file.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
- if (info->shared
+ if (bfd_link_pic (info)
&& (info->symbolic
|| h->dynindx == -1 || h->forced_local) && h->def_regular)
{
@@ -5232,7 +5238,7 @@ bfin_adjust_dynamic_symbol (struct bfd_link_info *info,
only references to the symbol are via the global offset table.
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
- if (info->shared)
+ if (bfd_link_pic (info))
return TRUE;
/* We must allocate the symbol in our .dynbss section, which will
@@ -5362,7 +5368,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
+ if (bfd_link_executable (info))
{
s = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (s != NULL);
@@ -5388,7 +5394,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
against symbols that have become local due to visibility changes.
We allocated space for them in the check_relocs routine, but we
will not fill them in in the relocate_section routine. */
- if (info->shared)
+ if (bfd_link_pic (info))
elf_link_hash_traverse (elf_hash_table (info),
bfin_discard_copies, info);
@@ -5467,7 +5473,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
#define add_dynamic_entry(TAG, VAL) \
_bfd_elf_add_dynamic_entry (info, TAG, VAL)
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
if (!add_dynamic_entry (DT_DEBUG, 0))
return FALSE;
@@ -5515,7 +5521,7 @@ bfd_bfin_elf32_create_embedded_relocs (bfd *abfd,
bfd_byte *p;
bfd_size_type amt;
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
*errmsg = NULL;
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 047d720..5d8ffbc 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -705,7 +705,7 @@ cr16_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
srelgot = NULL;
bfd_boolean result = FALSE;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -767,7 +767,7 @@ cr16_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
}
if (srelgot == NULL
- && (h != NULL || info->executable))
+ && (h != NULL || bfd_link_executable (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
@@ -828,7 +828,7 @@ cr16_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
local_got_offsets[r_symndx] = sgot->size;
- if (info->executable)
+ if (bfd_link_executable (info))
/* If we are generating a shared object, we need to
output a R_CR16_RELATIVE reloc so that the dynamic
linker can adjust this GOT entry. */
@@ -1443,7 +1443,7 @@ elf32_cr16_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
r = cr16_elf_final_link_relocate (howto, input_bfd, output_bfd,
@@ -1776,7 +1776,7 @@ elf32_cr16_relax_section (bfd *abfd, asection *sec,
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0
|| (sec->flags & SEC_CODE) == 0)
@@ -2309,7 +2309,7 @@ _bfd_cr16_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
be needed, we can discard it later. We will never need this
section when generating a shared object, since they do not use
copy relocs. */
- if (! info->executable)
+ if (! bfd_link_executable (info))
{
s = bfd_make_section_anyway_with_flags (abfd,
(bed->default_use_rela_p
@@ -2353,7 +2353,7 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
if (h->type == STT_FUNC
|| h->needs_plt)
{
- if (! info->executable
+ if (! bfd_link_executable (info)
&& !h->def_dynamic
&& !h->ref_dynamic)
{
@@ -2408,7 +2408,7 @@ _bfd_cr16_elf_adjust_dynamic_symbol (struct bfd_link_info * info,
only references to the symbol are via the global offset table.
For such cases we need not do anything here; the relocations will
be handled correctly by relocate_section. */
- if (info->executable)
+ if (bfd_link_executable (info))
return TRUE;
/* If there are no references to this symbol that do not use the
@@ -2464,7 +2464,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
if (elf_hash_table (info)->dynamic_sections_created)
{
/* Set the contents of the .interp section to the interpreter. */
- if (info->executable)
+ if (bfd_link_executable (info))
{
#if 0
s = bfd_get_linker_section (dynobj, ".interp");
@@ -2581,7 +2581,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
but we must add the entries now so that we get the correct
size for the .dynamic section. The DT_DEBUG entry is filled
in by the dynamic linker and used by the debugger. */
- if (! info->executable)
+ if (! bfd_link_executable (info))
{
if (!_bfd_elf_add_dynamic_entry (info, DT_DEBUG, 0))
return FALSE;
@@ -2649,7 +2649,7 @@ _bfd_cr16_elf_finish_dynamic_symbol (bfd * output_bfd,
the symbol was forced to be local because of a version file.
The entry in the global offset table will already have been
initialized in the relocate_section function. */
- if (info->executable
+ if (bfd_link_executable (info)
&& (info->symbolic || h->dynindx == -1)
&& h->def_regular)
{
@@ -2819,7 +2819,7 @@ bfd_cr16_elf32_create_embedded_relocs (bfd *abfd,
bfd_byte *p;
bfd_size_type amt;
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
*errmsg = NULL;
diff --git a/bfd/elf32-cr16c.c b/bfd/elf32-cr16c.c
index 6547ec1..00adb69 100644
--- a/bfd/elf32-cr16c.c
+++ b/bfd/elf32-cr16c.c
@@ -730,7 +730,7 @@ elf32_cr16c_relocate_section (bfd *output_bfd,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* This is a relocatable link. We don't have to change
anything, unless the reloc is against a section symbol,
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 439ce11..3031173 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -1092,7 +1092,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
time. FIXME: Not sure this example covers the
h->elf_link_hash_flags test, though it's there in
other targets. */
- if (info->shared
+ if (bfd_link_pic (info)
&& ((!SYMBOLIC_BIND (info, h) && h->dynindx != -1)
|| !h->def_regular)
&& (input_section->flags & SEC_ALLOC) != 0
@@ -1103,7 +1103,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|| r_type == R_CRIS_16_PCREL
|| r_type == R_CRIS_32_PCREL))
relocation = 0;
- else if (!info->relocatable && unresolved_reloc
+ else if (!bfd_link_relocatable (info) && unresolved_reloc
&& (_bfd_elf[...]
[diff truncated at 100000 bytes]