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.
This commit is contained in:
parent
b2a3343990
commit
0e1862bb40
112
bfd/ChangeLog
112
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
|
||||
|
16
bfd/aoutx.h
16
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)
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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. */
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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 \
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
14
bfd/elf.c
14
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);
|
||||
|
||||
|
125
bfd/elf32-arm.c
125
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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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_section_offset (output_bfd, info,
|
||||
input_section,
|
||||
rel->r_offset)
|
||||
@ -1125,7 +1125,7 @@ cris_elf_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;
|
||||
|
||||
switch (r_type)
|
||||
@ -1165,7 +1165,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
these call-specific relocs don't address non-functions. */
|
||||
if (h != NULL
|
||||
&& (h->got.offset == (bfd_vma) -1
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& !(h->def_regular
|
||||
|| (!h->def_dynamic
|
||||
&& h->root.type == bfd_link_hash_undefweak)))))
|
||||
@ -1207,20 +1207,20 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
BFD_ASSERT (off != (bfd_vma) -1);
|
||||
|
||||
if (!elf_hash_table (info)->dynamic_sections_created
|
||||
|| (! info->shared
|
||||
|| (! bfd_link_pic (info)
|
||||
&& (h->def_regular
|
||||
|| h->type == STT_FUNC
|
||||
|| h->needs_plt))
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& (SYMBOLIC_BIND (info, h) || h->dynindx == -1)
|
||||
&& h->def_regular))
|
||||
{
|
||||
/* This wasn't checked above for ! info->shared, but
|
||||
/* This wasn't checked above for ! bfd_link_pic (info), but
|
||||
must hold there if we get here; the symbol must
|
||||
be defined in the regular program or be undefweak
|
||||
or be a function or otherwise need a PLT. */
|
||||
BFD_ASSERT (!elf_hash_table (info)->dynamic_sections_created
|
||||
|| info->shared
|
||||
|| bfd_link_pic (info)
|
||||
|| h->def_regular
|
||||
|| h->type == STT_FUNC
|
||||
|| h->needs_plt
|
||||
@ -1266,7 +1266,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_byte *loc;
|
||||
@ -1327,7 +1327,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
defined in an ordinary (non-DSO) object or is undefined weak. */
|
||||
if (h != NULL
|
||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
&& !(!info->shared
|
||||
&& !(!bfd_link_pic (info)
|
||||
&& (h->def_regular
|
||||
|| (!h->def_dynamic
|
||||
&& h->root.type == bfd_link_hash_undefweak))))
|
||||
@ -1426,7 +1426,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
case R_CRIS_8:
|
||||
case R_CRIS_16:
|
||||
case R_CRIS_32:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& r_symndx != STN_UNDEF
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& ((r_type != R_CRIS_8_PCREL
|
||||
@ -1557,7 +1557,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (h != NULL
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| (!h->def_regular
|
||||
&& h->root.type != bfd_link_hash_undefined)))
|
||||
{
|
||||
@ -1592,7 +1592,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
asection *sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
|
||||
BFD_ASSERT (sgotplt != NULL);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_byte *loc;
|
||||
@ -1631,7 +1631,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
break;
|
||||
|
||||
case R_CRIS_32_GD:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
|
||||
@ -1662,7 +1662,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
&& (h == NULL || h->def_regular || ELF_COMMON_DEF_P (h)))
|
||||
{
|
||||
/* Known contents of the GOT. */
|
||||
@ -1783,7 +1783,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
break;
|
||||
|
||||
case R_CRIS_32_IE:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
|
||||
@ -1814,7 +1814,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
&& (h == NULL || h->def_regular || ELF_COMMON_DEF_P (h)))
|
||||
{
|
||||
/* Known contents of the GOT. */
|
||||
@ -1920,7 +1920,7 @@ cris_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
case R_CRIS_32_TPREL:
|
||||
/* This relocation must only be performed against symbols
|
||||
defined in an ordinary (non-DSO) object. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
|
||||
@ -2139,7 +2139,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
|
||||
got_base = sgotplt->output_section->vma + sgotplt->output_offset;
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
memcpy (splt->contents + h->plt.offset, plt_entry,
|
||||
plt_entry_size);
|
||||
@ -2215,7 +2215,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
|
||||
references to the function symbol are redirected to the PLT. */
|
||||
if (h->got.offset != (bfd_vma) -1
|
||||
&& (elf_cris_hash_entry (h)->reg_got_refcount > 0)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| (h->dynindx != -1
|
||||
&& h->plt.offset == (bfd_vma) -1
|
||||
&& !h->def_regular
|
||||
@ -2244,7 +2244,7 @@ elf_cris_finish_dynamic_symbol (bfd *output_bfd,
|
||||
initialized in the relocate_section function. */
|
||||
where = sgot->contents + (h->got.offset &~ (bfd_vma) 1);
|
||||
if (! elf_hash_table (info)->dynamic_sections_created
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& (SYMBOLIC_BIND (info, h) || h->dynindx == -1)
|
||||
&& h->def_regular))
|
||||
{
|
||||
@ -2380,7 +2380,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
|
||||
{
|
||||
if (bfd_get_mach (output_bfd) == bfd_mach_cris_v32)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
memcpy (splt->contents, elf_cris_pic_plt0_entry_v32,
|
||||
PLT_ENTRY_SIZE_V32);
|
||||
else
|
||||
@ -2398,7 +2398,7 @@ elf_cris_finish_dynamic_sections (bfd *output_bfd,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
memcpy (splt->contents, elf_cris_pic_plt0_entry,
|
||||
PLT_ENTRY_SIZE);
|
||||
else
|
||||
@ -2481,7 +2481,7 @@ cris_elf_gc_sweep_hook (bfd *abfd,
|
||||
asection *sgot;
|
||||
asection *srelgot;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -2592,7 +2592,7 @@ cris_elf_gc_sweep_hook (bfd *abfd,
|
||||
{
|
||||
/* We don't need the .got entry any more. */
|
||||
sgot->size -= got_element_size;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srelgot->size -= sizeof (Elf32_External_Rela);
|
||||
}
|
||||
}
|
||||
@ -2886,7 +2886,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
result as one built without -fpic, specifically considering weak
|
||||
symbols.
|
||||
FIXME: m68k and i386 differ here, for unclear reasons. */
|
||||
if (! info->shared
|
||||
if (! bfd_link_pic (info)
|
||||
&& !h->def_dynamic)
|
||||
{
|
||||
/* This case can occur if we saw a PLT reloc in an input file,
|
||||
@ -2908,7 +2908,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
like R_CRIS_JUMP_SLOT after symbol evaluation) we could get rid
|
||||
of the PLT. We can't for the executable, because the GOT
|
||||
entries will point to the PLT there (and be constant). */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& !elf_cris_try_fold_plt_to_got ((struct elf_cris_link_hash_entry*)
|
||||
h, info))
|
||||
return FALSE;
|
||||
@ -2939,7 +2939,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
/* If this symbol is not defined in a regular file, and we are
|
||||
not generating a shared library, then set the symbol to this
|
||||
location in the .plt. */
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
&& !h->def_regular)
|
||||
{
|
||||
h->root.u.def.section = s;
|
||||
@ -2952,7 +2952,7 @@ elf_cris_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
executable, because then the reloc associated with the PLT
|
||||
would get a non-PLT reloc pointing to the PLT. FIXME: Move
|
||||
this to elf_cris_try_fold_plt_to_got. */
|
||||
if (info->shared && h->got.refcount > 0)
|
||||
if (bfd_link_pic (info) && h->got.refcount > 0)
|
||||
{
|
||||
h->got.refcount += h->plt.refcount;
|
||||
|
||||
@ -3023,7 +3023,7 @@ elf_cris_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
|
||||
@ -3143,7 +3143,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
asection *srelgot;
|
||||
asection *sreloc;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf_cris_hash_table (info);
|
||||
@ -3286,7 +3286,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
of the first entry is constant there. For a shared
|
||||
library, we need .got.rela for the R_CRIS_DTPMOD
|
||||
relocation at index 3. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
break;
|
||||
/* Fall through. */
|
||||
|
||||
@ -3310,7 +3310,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
case R_CRIS_16_GOT:
|
||||
case R_CRIS_32_GOT:
|
||||
if (srelgot == NULL
|
||||
&& (h != NULL || info->shared))
|
||||
&& (h != NULL || bfd_link_pic (info)))
|
||||
{
|
||||
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
|
||||
if (srelgot == NULL)
|
||||
@ -3339,7 +3339,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
case R_CRIS_32_TPREL:
|
||||
case R_CRIS_16_TPREL:
|
||||
case R_CRIS_32_GD:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B, section %A:\n relocation %s not valid"
|
||||
@ -3381,7 +3381,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
/* Those relocs also require that a DSO is of type
|
||||
Initial Exec. Like other targets, we don't reset this
|
||||
flag even if the relocs are GC:ed away. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
break;
|
||||
|
||||
@ -3484,7 +3484,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
if (local_got_refcounts[r_symndx_lgot] == 0)
|
||||
{
|
||||
sgot->size += got_element_size;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* If we are generating a shared object, we need
|
||||
to output a R_CRIS_RELATIVE reloc so that the
|
||||
@ -3550,7 +3550,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
can't help tables of (global) function pointers, for
|
||||
example, though they must be emitted in a (writable) data
|
||||
section to avoid having impure text sections. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (sec->flags & SEC_READONLY) != 0)
|
||||
{
|
||||
@ -3594,7 +3594,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
render the symbol local. */
|
||||
|
||||
/* No need to do anything if we're not creating a shared object. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
break;
|
||||
|
||||
/* We may need to create a reloc section in the dynobj and made room
|
||||
@ -3643,7 +3643,7 @@ cris_elf_check_relocs (bfd *abfd,
|
||||
render the symbol local. */
|
||||
|
||||
/* No need to do anything if we're not creating a shared object. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
break;
|
||||
|
||||
/* We don't need to handle relocs into sections not going into
|
||||
@ -3764,7 +3764,7 @@ elf_cris_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);
|
||||
@ -3795,7 +3795,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
for relocs that have become for local symbols due to symbol
|
||||
visibility changes. For programs, we discard space for relocs for
|
||||
symbols not referenced by any dynamic object. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
elf_cris_link_hash_traverse (htab,
|
||||
elf_cris_discard_excess_dso_dynamics,
|
||||
info);
|
||||
@ -3837,7 +3837,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
if (strcmp (name, ".rela.got") == 0
|
||||
&& htab->dtpmod_refcount != 0
|
||||
&& info->shared)
|
||||
&& bfd_link_pic (info))
|
||||
s->size += sizeof (Elf32_External_Rela);
|
||||
|
||||
if (s->size != 0)
|
||||
@ -3897,7 +3897,7 @@ elf_cris_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;
|
||||
|
@ -882,7 +882,7 @@ elf32_crx_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 = crx_elf_final_link_relocate (howto, input_bfd, output_bfd,
|
||||
@ -979,7 +979,7 @@ elf32_crx_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)
|
||||
|
@ -269,7 +269,7 @@ elf32_d10v_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -439,7 +439,7 @@ elf32_d10v_relocate_section (bfd *output_bfd,
|
||||
+ sym->st_value);
|
||||
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION
|
||||
&& ((sec->flags & SEC_MERGE) != 0
|
||||
|| (info->relocatable
|
||||
|| (bfd_link_relocatable (info)
|
||||
&& sec->output_offset != 0)))
|
||||
{
|
||||
bfd_vma addend;
|
||||
@ -447,7 +447,7 @@ elf32_d10v_relocate_section (bfd *output_bfd,
|
||||
|
||||
addend = extract_rel_addend (input_bfd, where, howto);
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
addend += sec->output_offset;
|
||||
else
|
||||
{
|
||||
@ -474,7 +474,7 @@ elf32_d10v_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)
|
||||
|
@ -429,7 +429,7 @@ elf32_dlx_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
@ -212,7 +212,7 @@ epiphany_elf_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)
|
||||
@ -533,7 +533,7 @@ epiphany_elf_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;
|
||||
|
||||
/* Finally, the sole EPIPHANY-specific part. */
|
||||
|
@ -563,7 +563,7 @@ fr30_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 = fr30_final_link_relocate (howto, input_bfd, input_section,
|
||||
@ -652,7 +652,7 @@ fr30_elf_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
@ -1384,7 +1384,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_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
|
||||
|| FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
|
||||
{
|
||||
@ -1439,7 +1439,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
|
||||
if (entry->symndx == -1
|
||||
&& ! FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h)
|
||||
&& FRVFDPIC_SYM_LOCAL (info, entry->d.h)
|
||||
&& !(info->executable && !info->pie))
|
||||
&& !(bfd_link_executable (info) && !bfd_link_pic (info)))
|
||||
{
|
||||
reloc = R_FRV_FUNCDESC;
|
||||
idx = elf_section_data (entry->d.h->root.u.def.section
|
||||
@ -1482,7 +1482,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_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
|
||||
|| FRVFDPIC_FUNCDESC_LOCAL (info, entry->d.h)))
|
||||
{
|
||||
@ -1545,7 +1545,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_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 || FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
|
||||
{
|
||||
if (sec)
|
||||
@ -1593,7 +1593,10 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_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 = frvfdpic_got_section (info)->output_section->vma
|
||||
@ -1768,14 +1771,14 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
|
||||
|
||||
/* *ABS*+addend is special for TLS relocations, use only the
|
||||
addend. */
|
||||
if (info->executable
|
||||
if (bfd_link_executable (info)
|
||||
&& idx == 0
|
||||
&& (bfd_is_abs_section (sec)
|
||||
|| bfd_is_und_section (sec)))
|
||||
;
|
||||
/* If we're linking an executable, we can entirely omit the
|
||||
dynamic relocation if the symbol is local to this module. */
|
||||
else if (info->executable
|
||||
else if (bfd_link_executable (info)
|
||||
&& (entry->symndx != -1
|
||||
|| FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
|
||||
{
|
||||
@ -1841,10 +1844,10 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
|
||||
/* If we didn't set up a TLS offset entry, but we're linking an
|
||||
executable and the symbol binds locally, we can use the
|
||||
module offset in the TLS descriptor in relaxations. */
|
||||
if (info->executable && ! entry->tlsoff_entry)
|
||||
if (bfd_link_executable (info) && ! entry->tlsoff_entry)
|
||||
entry->tlsoff_entry = entry->tlsdesc_entry + 4;
|
||||
|
||||
if (info->executable && !info->pie
|
||||
if (bfd_link_executable (info) && !bfd_link_pic (info)
|
||||
&& ((idx == 0
|
||||
&& (bfd_is_abs_section (sec)
|
||||
|| bfd_is_und_section (sec)))
|
||||
@ -1943,7 +1946,7 @@ _frvfdpic_emit_got_relocs_plt_entries (struct frvfdpic_relocs_info *entry,
|
||||
bfd_byte *plt_code = frvfdpic_plt_section (info)->contents
|
||||
+ entry->tlsplt_entry;
|
||||
|
||||
if (info->executable
|
||||
if (bfd_link_executable (info)
|
||||
&& (entry->symndx != -1
|
||||
|| FRVFDPIC_SYM_LOCAL (info, entry->d.h)))
|
||||
{
|
||||
@ -2666,7 +2669,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
Elf_Internal_Rela *relend;
|
||||
unsigned isec_segment, got_segment, plt_segment, gprel_segment, tls_segment,
|
||||
check_segment[2];
|
||||
int silence_segment_error = !(info->shared || info->pie);
|
||||
int silence_segment_error = !bfd_link_pic (info);
|
||||
unsigned long insn;
|
||||
|
||||
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
|
||||
@ -2754,7 +2757,7 @@ elf32_frv_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;
|
||||
|
||||
if (r_type != R_FRV_TLSMOFF
|
||||
@ -2880,10 +2883,10 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
|
||||
#define LOCAL_EXEC_P(info, picrel) \
|
||||
((info)->executable \
|
||||
(bfd_link_executable (info) \
|
||||
&& (picrel->symndx != -1 || FRVFDPIC_SYM_LOCAL ((info), (picrel)->d.h)))
|
||||
#define INITIAL_EXEC_P(info, picrel) \
|
||||
(((info)->executable || (info)->flags & DF_STATIC_TLS) \
|
||||
((bfd_link_executable (info)|| (info)->flags & DF_STATIC_TLS) \
|
||||
&& (picrel)->tlsoff_entry)
|
||||
|
||||
#define IN_RANGE_FOR_OFST12_P(value) \
|
||||
@ -3520,7 +3523,8 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
section+offset. */
|
||||
if (h && ! FRVFDPIC_FUNCDESC_LOCAL (info, h)
|
||||
&& FRVFDPIC_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;
|
||||
@ -3558,7 +3562,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
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 || FRVFDPIC_FUNCDESC_LOCAL (info, h)))
|
||||
{
|
||||
addend += frvfdpic_got_section (info)->output_section->vma;
|
||||
@ -3680,7 +3684,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
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 || FRVFDPIC_SYM_LOCAL (info, h)))
|
||||
{
|
||||
if (osec)
|
||||
@ -3769,7 +3773,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
/* 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 || FRVFDPIC_SYM_LOCAL (info, h)))
|
||||
bfd_put_32 (output_bfd,
|
||||
frvfdpic_got_section (info)->output_section->vma
|
||||
@ -3912,7 +3916,7 @@ elf32_frv_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
(_("%H: reloc against `%s' references a different segment\n"),
|
||||
input_bfd, input_section, rel->r_offset, name);
|
||||
}
|
||||
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_FRV_PIC;
|
||||
}
|
||||
@ -4106,7 +4110,7 @@ elf32_frv_add_symbol_hook (bfd *abfd,
|
||||
bfd_vma *valp)
|
||||
{
|
||||
if (sym->st_shndx == SHN_COMMON
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& (int)sym->st_size <= (int)bfd_get_gp_size (abfd))
|
||||
{
|
||||
/* Common symbols less than or equal to -G nn bytes are
|
||||
@ -4371,7 +4375,7 @@ elf32_frvfdpic_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
|
||||
@ -4508,7 +4512,7 @@ _frvfdpic_count_relocs_fixups (struct frvfdpic_relocs_info *entry,
|
||||
{
|
||||
bfd_vma relocs = 0, fixups = 0, tlsrets = 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
|
||||
+ entry->relocstlsd;
|
||||
@ -4520,7 +4524,7 @@ _frvfdpic_count_relocs_fixups (struct frvfdpic_relocs_info *entry,
|
||||
emit dynamic relocations even for local symbols, because we
|
||||
don't know the module id the library is going to get at
|
||||
run-time, nor its TLS base offset. */
|
||||
if (!dinfo->info->executable
|
||||
if (!bfd_link_executable (dinfo->info)
|
||||
|| (entry->symndx == -1
|
||||
&& ! FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h)))
|
||||
relocs += entry->relocstlsoff;
|
||||
@ -4579,7 +4583,7 @@ _frvfdpic_relax_tls_entries (struct frvfdpic_relocs_info *entry,
|
||||
{
|
||||
bfd_boolean changed = ! relaxing;
|
||||
|
||||
BFD_ASSERT (dinfo->info->executable
|
||||
BFD_ASSERT (bfd_link_executable (dinfo->info)
|
||||
|| (dinfo->info->flags & DF_STATIC_TLS));
|
||||
|
||||
if (entry->tlsdesc12 || entry->tlsdesclos || entry->tlsdeschilo)
|
||||
@ -4598,7 +4602,7 @@ _frvfdpic_relax_tls_entries (struct frvfdpic_relocs_info *entry,
|
||||
to GOTTLSOFF, we must keep the GOT entry in range. We know
|
||||
it has to fit because we'll be trading the 4 words of hte TLS
|
||||
descriptor for a single word in the same range. */
|
||||
if (! dinfo->info->executable
|
||||
if (! bfd_link_executable (dinfo->info)
|
||||
|| (entry->symndx == -1
|
||||
&& ! FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h)))
|
||||
{
|
||||
@ -4622,7 +4626,7 @@ _frvfdpic_relax_tls_entries (struct frvfdpic_relocs_info *entry,
|
||||
do better than this. */
|
||||
if ((entry->tlsplt
|
||||
|| entry->tlsoff12 || entry->tlsofflos || entry->tlsoffhilo)
|
||||
&& dinfo->info->executable && relaxing
|
||||
&& bfd_link_executable (dinfo->info) && relaxing
|
||||
&& ((entry->symndx == -1
|
||||
&& FRVFDPIC_SYM_LOCAL (dinfo->info, entry->d.h)
|
||||
/* The above may hold for an undefweak TLS symbol, so make
|
||||
@ -4695,7 +4699,8 @@ _frvfdpic_count_got_plt_entries (void **entryp, void *dinfo_)
|
||||
|
||||
_frvfdpic_count_nontls_entries (entry, dinfo);
|
||||
|
||||
if (dinfo->info->executable || (dinfo->info->flags & DF_STATIC_TLS))
|
||||
if (bfd_link_executable (dinfo->info)
|
||||
|| (dinfo->info->flags & DF_STATIC_TLS))
|
||||
_frvfdpic_relax_tls_entries (entry, dinfo, FALSE);
|
||||
else
|
||||
{
|
||||
@ -5088,7 +5093,7 @@ _frvfdpic_assign_plt_entries (void **entryp, void *info_)
|
||||
entry->tlsplt_entry
|
||||
= frvfdpic_plt_section (dinfo->g.info)->size;
|
||||
|
||||
if (dinfo->g.info->executable
|
||||
if (bfd_link_executable (dinfo->g.info)
|
||||
&& (entry->symndx != -1
|
||||
|| FRVFDPIC_SYM_LOCAL (dinfo->g.info, entry->d.h)))
|
||||
{
|
||||
@ -5439,7 +5444,7 @@ elf32_frvfdpic_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);
|
||||
@ -5498,7 +5503,7 @@ static bfd_boolean
|
||||
elf32_frvfdpic_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;
|
||||
@ -5640,7 +5645,7 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
|
||||
{
|
||||
struct _frvfdpic_dynamic_got_plt_info gpinfo;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
(*info->callbacks->einfo)
|
||||
(_("%P%F: --relax and -r may not be used together\n"));
|
||||
|
||||
@ -5653,7 +5658,7 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
|
||||
|
||||
/* We can only relax when linking the main executable or a library
|
||||
that can't be dlopened. */
|
||||
if (! info->executable && ! (info->flags & DF_STATIC_TLS))
|
||||
if (! bfd_link_executable (info) && ! (info->flags & DF_STATIC_TLS))
|
||||
return TRUE;
|
||||
|
||||
/* If there isn't a TLS section for this binary, we can't do
|
||||
@ -6028,7 +6033,7 @@ elf32_frv_check_relocs (bfd *abfd,
|
||||
bfd *dynobj;
|
||||
struct frvfdpic_relocs_info *picrel;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
@ -306,7 +306,7 @@ ft32_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 = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
|
@ -480,7 +480,7 @@ elf32_h8_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 = elf32_h8_final_link_relocate (r_type, input_bfd, output_bfd,
|
||||
@ -707,7 +707,7 @@ elf32_h8_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)
|
||||
|
@ -609,7 +609,7 @@ hppa_type_of_stub (asection *input_sec,
|
||||
&& hh->eh.plt.offset != (bfd_vma) -1
|
||||
&& hh->eh.dynindx != -1
|
||||
&& !hh->plabel
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| !hh->eh.def_regular
|
||||
|| hh->eh.root.type == bfd_link_hash_defweak))
|
||||
{
|
||||
@ -1137,7 +1137,7 @@ elf32_hppa_check_relocs (bfd *abfd,
|
||||
asection *sreloc;
|
||||
int tls_type = GOT_UNKNOWN, old_tls_type = GOT_UNKNOWN;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = hppa_link_hash_table (info);
|
||||
@ -1266,7 +1266,7 @@ elf32_hppa_check_relocs (bfd *abfd,
|
||||
case R_PARISC_DPREL14F: /* Used for gp rel data load/store. */
|
||||
case R_PARISC_DPREL14R:
|
||||
case R_PARISC_DPREL21L:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: relocation %s can not be used when making a shared object; recompile with -fPIC"),
|
||||
@ -1312,7 +1312,7 @@ elf32_hppa_check_relocs (bfd *abfd,
|
||||
|
||||
case R_PARISC_TLS_IE21L:
|
||||
case R_PARISC_TLS_IE14R:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
need_entry = NEED_GOT;
|
||||
break;
|
||||
@ -1432,7 +1432,7 @@ elf32_hppa_check_relocs (bfd *abfd,
|
||||
/* Flag this symbol as having a non-got, non-plt reference
|
||||
so that we generate copy relocs if it turns out to be
|
||||
dynamic. */
|
||||
if (hh != NULL && !info->shared)
|
||||
if (hh != NULL && !bfd_link_pic (info))
|
||||
hh->eh.non_got_ref = 1;
|
||||
|
||||
/* If we are creating a shared library then we need to copy
|
||||
@ -1463,7 +1463,7 @@ elf32_hppa_check_relocs (bfd *abfd,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (IS_ABSOLUTE_RELOC (r_type)
|
||||
|| (hh != NULL
|
||||
@ -1471,7 +1471,7 @@ elf32_hppa_check_relocs (bfd *abfd,
|
||||
|| hh->eh.root.type == bfd_link_hash_defweak
|
||||
|| !hh->eh.def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& hh != NULL
|
||||
&& (hh->eh.root.type == bfd_link_hash_defweak
|
||||
@ -1589,7 +1589,7 @@ elf32_hppa_gc_sweep_hook (bfd *abfd,
|
||||
const Elf_Internal_Rela *rela, *relend;
|
||||
struct elf32_hppa_link_hash_table *htab;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = hppa_link_hash_table (info);
|
||||
@ -1819,7 +1819,7 @@ elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
|| (eh->def_regular
|
||||
&& eh->root.type != bfd_link_hash_defweak
|
||||
&& ! hppa_elf_hash_entry (eh)->plabel
|
||||
&& (!info->shared || SYMBOLIC_BIND (info, eh))))
|
||||
&& (!bfd_link_pic (info) || SYMBOLIC_BIND (info, eh))))
|
||||
{
|
||||
/* The .plt entry is not needed when:
|
||||
a) Garbage collection has removed all references to the
|
||||
@ -1860,7 +1860,7 @@ elf32_hppa_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
|
||||
@ -1951,7 +1951,7 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, eh))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), eh))
|
||||
{
|
||||
/* Allocate these later. From this point on, h->plabel
|
||||
means that the plt entry is only used by a plabel.
|
||||
@ -2042,7 +2042,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
|
||||
else if ((hh->tls_type & GOT_TLS_GD) == GOT_TLS_GD)
|
||||
sec->size += GOT_ENTRY_SIZE;
|
||||
if (htab->etab.dynamic_sections_created
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| (eh->dynindx != -1
|
||||
&& !eh->forced_local)))
|
||||
{
|
||||
@ -2064,7 +2064,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
|
||||
defined in a regular object. For the normal shared case, discard
|
||||
space for relocs that have become local due to symbol visibility
|
||||
changes. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
#if RELATIVE_DYNRELOCS
|
||||
if (SYMBOL_CALLS_LOCAL (info, eh))
|
||||
@ -2215,7 +2215,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->etab.dynamic_sections_created)
|
||||
{
|
||||
/* Set the contents of the .interp section to the interpreter. */
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
sec = bfd_get_linker_section (dynobj, ".interp");
|
||||
if (sec == NULL)
|
||||
@ -2293,7 +2293,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
sec->size += 2 * GOT_ENTRY_SIZE;
|
||||
else if ((*local_tls_type & GOT_TLS_GD) == GOT_TLS_GD)
|
||||
sec->size += GOT_ENTRY_SIZE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
if ((*local_tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
|
||||
@ -2326,7 +2326,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
*local_plt = sec->size;
|
||||
sec->size += PLT_ENTRY_SIZE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2446,7 +2446,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
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 (!add_dynamic_entry (DT_DEBUG, 0))
|
||||
return FALSE;
|
||||
@ -2722,7 +2722,7 @@ get_local_syms (bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info)
|
||||
|
||||
all_local_syms[bfd_indx] = local_syms;
|
||||
|
||||
if (info->shared && htab->multi_subspace)
|
||||
if (bfd_link_pic (info) && htab->multi_subspace)
|
||||
{
|
||||
struct elf_link_hash_entry **eh_syms;
|
||||
struct elf_link_hash_entry **eh_symend;
|
||||
@ -2994,7 +2994,7 @@ elf32_hppa_size_stubs
|
||||
}
|
||||
else if (hh->eh.root.type == bfd_link_hash_undefweak)
|
||||
{
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
continue;
|
||||
}
|
||||
else if (hh->eh.root.type == bfd_link_hash_undefined)
|
||||
@ -3046,7 +3046,7 @@ elf32_hppa_size_stubs
|
||||
hsh->target_value = sym_value;
|
||||
hsh->target_section = sym_sec;
|
||||
hsh->stub_type = stub_type;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (stub_type == hppa_stub_import)
|
||||
hsh->stub_type = hppa_stub_import_shared;
|
||||
@ -3251,7 +3251,7 @@ elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
|
||||
/* If we're producing a final executable, sort the contents of the
|
||||
unwind section. */
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
return elf_hppa_sort_unwind (abfd);
|
||||
@ -3329,7 +3329,7 @@ final_link_relocate (asection *input_section,
|
||||
|
||||
/* If we are not building a shared library, convert DLTIND relocs to
|
||||
DPREL relocs. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
switch (r_type)
|
||||
{
|
||||
@ -3366,7 +3366,7 @@ final_link_relocate (asection *input_section,
|
||||
&& hh->eh.plt.offset != (bfd_vma) -1
|
||||
&& hh->eh.dynindx != -1
|
||||
&& !hh->plabel
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| !hh->eh.def_regular
|
||||
|| hh->eh.root.type == bfd_link_hash_defweak)))
|
||||
{
|
||||
@ -3707,7 +3707,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
unresolved_reloc, warned_undef,
|
||||
ignored);
|
||||
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& relocation == 0
|
||||
&& eh->root.type != bfd_link_hash_defined
|
||||
&& eh->root.type != bfd_link_hash_defweak
|
||||
@ -3733,7 +3733,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
elf_hppa_howto_table + r_type, 0,
|
||||
contents);
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
/* Do any required modifications to the relocation value, and
|
||||
@ -3757,7 +3757,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
|
||||
off = hh->eh.got.offset;
|
||||
dyn = htab->etab.dynamic_sections_created;
|
||||
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared,
|
||||
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
&hh->eh))
|
||||
{
|
||||
/* If we aren't going to call finish_dynamic_symbol,
|
||||
@ -3797,7 +3798,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (do_got)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Output a dynamic relocation for this GOT entry.
|
||||
In this case it is relative to the base of the
|
||||
@ -3849,7 +3850,8 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
if (hh != NULL)
|
||||
{
|
||||
off = hh->eh.plt.offset;
|
||||
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared,
|
||||
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (1,
|
||||
bfd_link_pic (info),
|
||||
&hh->eh))
|
||||
{
|
||||
/* In a non-shared link, adjust_dynamic_symbols
|
||||
@ -3888,7 +3890,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (do_plt)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Output a dynamic IPLT relocation for this
|
||||
PLT entry. */
|
||||
@ -3962,13 +3964,13 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
which is why we can't use just that test here.
|
||||
Conversely, DEF_DYNAMIC can't be used in check_relocs as
|
||||
there all files have not been loaded. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (hh == NULL
|
||||
|| ELF_ST_VISIBILITY (hh->eh.other) == STV_DEFAULT
|
||||
|| hh->eh.root.type != bfd_link_hash_undefweak)
|
||||
&& (IS_ABSOLUTE_RELOC (r_type)
|
||||
|| !SYMBOL_CALLS_LOCAL (info, &hh->eh)))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& hh != NULL
|
||||
&& hh->eh.dynindx != -1
|
||||
&& !hh->eh.non_got_ref
|
||||
@ -4004,7 +4006,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
&& hh->eh.dynindx != -1
|
||||
&& (plabel
|
||||
|| !IS_ABSOLUTE_RELOC (r_type)
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, &hh->eh)
|
||||
|| !hh->eh.def_regular))
|
||||
{
|
||||
@ -4111,8 +4113,10 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
bfd_boolean dyn;
|
||||
dyn = htab->etab.dynamic_sections_created;
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, &hh->eh)
|
||||
&& (!info->shared
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
&hh->eh)
|
||||
&& (!bfd_link_pic (info)
|
||||
|| !SYMBOL_REFERENCES_LOCAL (info, &hh->eh)))
|
||||
{
|
||||
indx = hh->eh.dynindx;
|
||||
@ -4142,7 +4146,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
|
||||
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)
|
||||
&& (hh == NULL
|
||||
|| ELF_ST_VISIBILITY (hh->eh.other) == STV_DEFAULT
|
||||
|| hh->eh.root.type != bfd_link_hash_undefweak))
|
||||
@ -4388,7 +4392,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
|
||||
we just want to emit a RELATIVE reloc. 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)
|
||||
&& (SYMBOLIC_BIND (info, eh) || eh->dynindx == -1)
|
||||
&& eh->def_regular)
|
||||
{
|
||||
|
@ -433,7 +433,7 @@ i370_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
if (s == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
s = bfd_make_section_anyway_with_flags (abfd, ".rela.sbss",
|
||||
flags | SEC_READONLY);
|
||||
@ -503,7 +503,7 @@ i370_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;
|
||||
|
||||
/* We must allocate the symbol in our .dynbss section, which will
|
||||
@ -594,7 +594,7 @@ i370_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);
|
||||
@ -713,7 +713,7 @@ i370_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
#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;
|
||||
@ -755,7 +755,7 @@ i370_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
locations in linker-created sections that do not have
|
||||
externally-visible names. Instead, we should work out precisely
|
||||
which sections relocations are targeted at. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
int c;
|
||||
|
||||
@ -804,7 +804,7 @@ i370_elf_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
asection *sreloc;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -839,7 +839,7 @@ i370_elf_check_relocs (bfd *abfd,
|
||||
h->root.non_ir_ref = 1;
|
||||
}
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr,
|
||||
@ -948,7 +948,7 @@ i370_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
|
||||
}
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *sdynsym;
|
||||
asection *s;
|
||||
@ -1049,7 +1049,7 @@ i370_elf_relocate_section (bfd *output_bfd,
|
||||
_bfd_error_handler ("i370_elf_relocate_section called for %B section %A, %ld relocations%s",
|
||||
input_bfd, input_section,
|
||||
(long) input_section->reloc_count,
|
||||
(info->relocatable) ? " (relocatable)" : "");
|
||||
(bfd_link_relocatable (info)) ? " (relocatable)" : "");
|
||||
#endif
|
||||
|
||||
if (!i370_elf_howto_table[ R_I370_ADDR31 ])
|
||||
@ -1113,7 +1113,7 @@ i370_elf_relocate_section (bfd *output_bfd,
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
sec = h->root.u.def.section;
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& ((! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular)
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
@ -1135,7 +1135,7 @@ i370_elf_relocate_section (bfd *output_bfd,
|
||||
else if (info->unresolved_syms_in_objects == RM_IGNORE
|
||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
|
||||
;
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
@ -1153,7 +1153,7 @@ i370_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;
|
||||
|
||||
switch ((int) r_type)
|
||||
@ -1184,7 +1184,7 @@ i370_elf_relocate_section (bfd *output_bfd,
|
||||
object. */
|
||||
case (int) R_I370_ADDR31:
|
||||
case (int) R_I370_ADDR16:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& r_symndx != STN_UNDEF)
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
|
107
bfd/elf32-i386.c
107
bfd/elf32-i386.c
@ -1029,7 +1029,7 @@ elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||
if (!htab->sdynbss)
|
||||
abort ();
|
||||
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
/* Always allow copy relocs for building executables. */
|
||||
asection *s = bfd_get_linker_section (dynobj, ".rel.bss");
|
||||
@ -1354,7 +1354,7 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
case R_386_TLS_IE_32:
|
||||
case R_386_TLS_IE:
|
||||
case R_386_TLS_GOTIE:
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
if (h == NULL)
|
||||
to_type = R_386_TLS_LE_32;
|
||||
@ -1370,7 +1370,7 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
{
|
||||
unsigned int new_to_type = to_type;
|
||||
|
||||
if (info->executable
|
||||
if (bfd_link_executable (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx == -1
|
||||
&& (tls_type & GOT_TLS_IE))
|
||||
@ -1396,7 +1396,7 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_386_TLS_LDM:
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
to_type = R_386_TLS_LE_32;
|
||||
break;
|
||||
|
||||
@ -1474,7 +1474,7 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
asection *sreloc;
|
||||
bfd_boolean use_plt_got;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_i386_elf (abfd));
|
||||
@ -1618,7 +1618,7 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
case R_386_TLS_IE_32:
|
||||
case R_386_TLS_IE:
|
||||
case R_386_TLS_GOTIE:
|
||||
if (!info->executable)
|
||||
if (!bfd_link_executable (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
@ -1738,14 +1738,14 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
|
||||
case R_386_TLS_LE_32:
|
||||
case R_386_TLS_LE:
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
break;
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
case R_386_32:
|
||||
case R_386_PC32:
|
||||
if (h != NULL && info->executable)
|
||||
if (h != NULL && bfd_link_executable (info))
|
||||
{
|
||||
/* If this reloc is in a read-only section, we might
|
||||
need a copy reloc. We can't check reliably at this
|
||||
@ -1785,7 +1785,7 @@ do_size:
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (r_type != R_386_PC32
|
||||
|| (h != NULL
|
||||
@ -1793,7 +1793,7 @@ do_size:
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -1963,7 +1963,7 @@ elf_i386_gc_sweep_hook (bfd *abfd,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf_i386_hash_table (info);
|
||||
@ -2066,7 +2066,7 @@ elf_i386_gc_sweep_hook (bfd *abfd,
|
||||
case R_386_32:
|
||||
case R_386_PC32:
|
||||
case R_386_SIZE32:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (h == NULL || h->type != STT_GNU_IFUNC))
|
||||
break;
|
||||
/* Fall through */
|
||||
@ -2206,7 +2206,7 @@ elf_i386_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
|
||||
@ -2349,7 +2349,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
{
|
||||
asection *s = htab->elf.splt;
|
||||
@ -2371,7 +2371,7 @@ elf_i386_allocate_dynrelocs (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)
|
||||
{
|
||||
if (use_plt_got)
|
||||
@ -2406,7 +2406,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
}
|
||||
|
||||
if (get_elf_i386_backend_data (info->output_bfd)->is_vxworks
|
||||
&& !info->shared)
|
||||
&& !bfd_link_pic (info))
|
||||
{
|
||||
/* VxWorks has a second set of relocations for each PLT entry
|
||||
in executables. They go in a separate relocation section,
|
||||
@ -2443,7 +2443,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
/* If R_386_TLS_{IE_32,IE,GOTIE} symbol is now local to the binary,
|
||||
make it a R_386_TLS_LE_32 requiring no TLS entry. */
|
||||
if (h->got.refcount > 0
|
||||
&& info->executable
|
||||
&& bfd_link_executable (info)
|
||||
&& h->dynindx == -1
|
||||
&& (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE))
|
||||
h->got.offset = (bfd_vma) -1;
|
||||
@ -2495,7 +2495,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
else if (! GOT_TLS_GDESC_P (tls_type)
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
htab->elf.srelgot->size += sizeof (Elf32_External_Rel);
|
||||
if (GOT_TLS_GDESC_P (tls_type))
|
||||
@ -2513,7 +2513,7 @@ elf_i386_allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* The only reloc that uses pc_count is R_386_PC32, which will
|
||||
appear on a call or on something like ".long foo - .". We
|
||||
@ -2655,7 +2655,7 @@ elf_i386_readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
info->flags |= DF_TEXTREL;
|
||||
|
||||
if ((info->warn_shared_textrel && info->shared)
|
||||
if ((info->warn_shared_textrel && bfd_link_pic (info))
|
||||
|| info->error_textrel)
|
||||
info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"),
|
||||
p->sec->owner, h->root.root.string,
|
||||
@ -2834,7 +2834,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
if (htab->elf.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");
|
||||
if (s == NULL)
|
||||
@ -2894,7 +2894,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
&& (info->flags & DF_TEXTREL) == 0)
|
||||
{
|
||||
info->flags |= DF_TEXTREL;
|
||||
if ((info->warn_shared_textrel && info->shared)
|
||||
if ((info->warn_shared_textrel && bfd_link_pic (info))
|
||||
|| info->error_textrel)
|
||||
info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'\n"),
|
||||
p->sec->owner, p->sec);
|
||||
@ -2936,7 +2936,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
|| *local_tls_type == GOT_TLS_IE_BOTH)
|
||||
s->size += 4;
|
||||
}
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| GOT_TLS_GD_ANY_P (*local_tls_type)
|
||||
|| (*local_tls_type & GOT_TLS_IE))
|
||||
{
|
||||
@ -3115,7 +3115,7 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
#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;
|
||||
@ -3263,7 +3263,7 @@ elf_i386_set_tls_module_base (struct bfd_link_info *info)
|
||||
struct elf_i386_link_hash_table *htab;
|
||||
struct bfd_link_hash_entry *base;
|
||||
|
||||
if (!info->executable)
|
||||
if (!bfd_link_executable (info))
|
||||
return;
|
||||
|
||||
htab = elf_i386_hash_table (info);
|
||||
@ -3343,7 +3343,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
/* We have to handle relocations in vxworks .tls_vars sections
|
||||
specially, because the dynamic loader is 'weird'. */
|
||||
is_vxworks_tls = (get_elf_i386_backend_data (output_bfd)->is_vxworks
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& !strcmp (input_section->output_section->name,
|
||||
".tls_vars"));
|
||||
|
||||
@ -3406,7 +3406,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION
|
||||
&& ((sec->flags & SEC_MERGE) != 0
|
||||
|| (info->relocatable
|
||||
|| (bfd_link_relocatable (info)
|
||||
&& sec->output_offset != 0)))
|
||||
{
|
||||
bfd_vma addend;
|
||||
@ -3442,7 +3442,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
addend += sec->output_offset;
|
||||
else
|
||||
{
|
||||
@ -3473,7 +3473,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!info->relocatable
|
||||
else if (!bfd_link_relocatable (info)
|
||||
&& ELF32_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
|
||||
{
|
||||
/* Relocate against local STT_GNU_IFUNC symbol. */
|
||||
@ -3503,7 +3503,7 @@ elf_i386_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;
|
||||
|
||||
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle
|
||||
@ -3562,7 +3562,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
case R_386_32:
|
||||
/* Generate dynamic relcoation 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)
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@ -3584,7 +3584,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (h->dynindx == -1
|
||||
|| h->forced_local
|
||||
|| info->executable)
|
||||
|| bfd_link_executable (info))
|
||||
{
|
||||
/* This symbol is resolved locally. */
|
||||
outrel.r_info = ELF32_R_INFO (0, R_386_IRELATIVE);
|
||||
@ -3701,8 +3701,10 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
|
||||
off = h->got.offset;
|
||||
dyn = htab->elf.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))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -3748,7 +3750,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
bfd_put_32 (output_bfd, relocation,
|
||||
htab->elf.sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -3785,7 +3787,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
symbol for shared library since it may not be local when
|
||||
used as function address or with copy relocation. We also
|
||||
need to make sure that a symbol is referenced locally. */
|
||||
if (!info->executable && h)
|
||||
if (!bfd_link_executable (info) && h)
|
||||
{
|
||||
if (!h->def_regular)
|
||||
{
|
||||
@ -3892,14 +3894,14 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
|| is_vxworks_tls)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& ((r_type != R_386_PC32 && r_type != R_386_SIZE32)
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -3934,7 +3936,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
else if (h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& (r_type == R_386_PC32
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
|
||||
@ -3965,7 +3967,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_386_TLS_IE:
|
||||
if (!info->executable)
|
||||
if (!bfd_link_executable (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@ -4506,7 +4508,8 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_386_TLS_LDO_32:
|
||||
if (!info->executable || (input_section->flags & SEC_CODE) == 0)
|
||||
if (!bfd_link_executable (info)
|
||||
|| (input_section->flags & SEC_CODE) == 0)
|
||||
relocation -= elf_i386_dtpoff_base (info);
|
||||
else
|
||||
/* When converting LDO to LE, we must negate. */
|
||||
@ -4515,7 +4518,7 @@ elf_i386_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_386_TLS_LE_32:
|
||||
case R_386_TLS_LE:
|
||||
if (!info->executable)
|
||||
if (!bfd_link_executable (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@ -4666,7 +4669,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
|
||||
it up. */
|
||||
|
||||
if ((h->dynindx == -1
|
||||
&& !((h->forced_local || info->executable)
|
||||
&& !((h->forced_local || bfd_link_executable (info))
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
|| plt == NULL
|
||||
@ -4697,7 +4700,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
|
||||
}
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
memcpy (plt->contents + h->plt.offset, abed->plt->plt_entry,
|
||||
abed->plt->plt_entry_size);
|
||||
@ -4719,7 +4722,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
|
||||
s = ((h->plt.offset - abed->plt->plt_entry_size)
|
||||
/ abed->plt->plt_entry_size);
|
||||
/* K: Number of relocations for PLTResolve. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
k = PLTRESOLVE_RELOCS_SHLIB;
|
||||
else
|
||||
k = PLTRESOLVE_RELOCS;
|
||||
@ -4767,7 +4770,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
|
||||
+ gotplt->output_offset
|
||||
+ got_offset);
|
||||
if (h->dynindx == -1
|
||||
|| ((info->executable
|
||||
|| ((bfd_link_executable (info)
|
||||
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
@ -4826,7 +4829,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
|
||||
abort ();
|
||||
|
||||
/* Fill in the entry in the GOT procedure linkage table. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
got_plt_entry = elf_i386_got_plt_entry;
|
||||
got_offset += got->output_section->vma + got->output_offset;
|
||||
@ -4888,7 +4891,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
|
||||
if (h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Generate R_386_GLOB_DAT. */
|
||||
goto do_glob_dat;
|
||||
@ -4911,7 +4914,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (info->shared
|
||||
else if (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
BFD_ASSERT((h->got.offset & 1) != 0);
|
||||
@ -5077,7 +5080,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
|
||||
/* Fill in the first entry in the procedure linkage table. */
|
||||
if (htab->elf.splt && htab->elf.splt->size > 0)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
memcpy (htab->elf.splt->contents, abed->plt->pic_plt0_entry,
|
||||
abed->plt->plt0_entry_size);
|
||||
@ -5135,14 +5138,14 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
|
||||
->this_hdr.sh_entsize = 4;
|
||||
|
||||
/* Correct the .rel.plt.unloaded relocations. */
|
||||
if (abed->is_vxworks && !info->shared)
|
||||
if (abed->is_vxworks && !bfd_link_pic (info))
|
||||
{
|
||||
int num_plts = (htab->elf.splt->size
|
||||
/ abed->plt->plt_entry_size) - 1;
|
||||
unsigned char *p;
|
||||
|
||||
p = htab->srelplt2->contents;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
p += PLTRESOLVE_RELOCS_SHLIB * sizeof (Elf32_External_Rel);
|
||||
else
|
||||
p += PLTRESOLVE_RELOCS * sizeof (Elf32_External_Rel);
|
||||
|
@ -1131,7 +1131,7 @@ elf32_i860_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;
|
||||
|
||||
switch (r_type)
|
||||
|
@ -1096,7 +1096,7 @@ ip2k_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)
|
||||
@ -1444,7 +1444,7 @@ ip2k_elf_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;
|
||||
|
||||
/* Finally, the sole IP2K-specific part. */
|
||||
|
@ -461,7 +461,7 @@ iq2000_elf_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
bfd_boolean changed = FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -645,7 +645,7 @@ iq2000_elf_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;
|
||||
|
||||
switch (r_type)
|
||||
|
@ -892,7 +892,7 @@ lm32_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))
|
||||
{
|
||||
/* This is a relocatable link. We don't have to change
|
||||
anything, unless the reloc is against a section symbol,
|
||||
@ -945,8 +945,10 @@ lm32_elf_relocate_section (bfd *output_bfd,
|
||||
BFD_ASSERT (off != (bfd_vma) -1);
|
||||
|
||||
dyn = htab->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)
|
||||
&& (info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->forced_local)
|
||||
@ -1019,7 +1021,7 @@ lm32_elf_relocate_section (bfd *output_bfd,
|
||||
+ off);
|
||||
}
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srelgot;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -1277,7 +1279,7 @@ lm32_elf_check_relocs (bfd *abfd,
|
||||
struct elf_lm32_link_hash_table *htab;
|
||||
bfd *dynobj;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -1495,7 +1497,7 @@ lm32_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = htab->splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD0, splt->contents);
|
||||
bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD1, splt->contents + 4);
|
||||
@ -1635,7 +1637,7 @@ lm32_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))
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
@ -1692,7 +1694,7 @@ lm32_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->forced_local)
|
||||
@ -1794,7 +1796,7 @@ lm32_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
|
||||
&& h->root.type != bfd_link_hash_undefweak
|
||||
@ -1833,7 +1835,7 @@ lm32_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
|
||||
@ -1932,7 +1934,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->splt;
|
||||
|
||||
@ -1948,7 +1950,7 @@ allocate_dynrelocs (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 = s;
|
||||
@ -1996,7 +1998,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
h->got.offset = s->size;
|
||||
s->size += 4;
|
||||
dyn = htab->root.dynamic_sections_created;
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2011,7 +2013,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (h->def_regular
|
||||
&& (h->forced_local
|
||||
@ -2139,7 +2141,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
if (htab->root.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);
|
||||
@ -2203,7 +2205,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
{
|
||||
*local_got = s->size;
|
||||
s->size += 4;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2282,7 +2284,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
#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;
|
||||
@ -2508,7 +2510,7 @@ lm32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
h->type = STT_OBJECT;
|
||||
htab->root.hplt = h;
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
}
|
||||
@ -2550,7 +2552,7 @@ lm32_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
|
||||
@ -2616,7 +2618,7 @@ lm32_elf_copy_indirect_symbol (struct bfd_link_info *info,
|
||||
static bfd_boolean
|
||||
lm32_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
{
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (!bfd_elf_stack_segment_size (output_bfd, info,
|
||||
"__stacksize", DEFAULT_STACK_SIZE))
|
||||
|
@ -477,7 +477,7 @@ m32c_elf_relocate_section
|
||||
}
|
||||
else if (h->root.type == bfd_link_hash_undefweak)
|
||||
;
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
@ -490,7 +490,7 @@ m32c_elf_relocate_section
|
||||
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,
|
||||
@ -671,7 +671,7 @@ m32c_elf_check_relocs
|
||||
asection *splt;
|
||||
bfd *dynobj;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -793,7 +793,7 @@ m32c_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
bfd *dynobj;
|
||||
asection *splt;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -1165,7 +1165,7 @@ m32c_elf_relax_plt_section (asection *splt,
|
||||
/* Assume nothing changes. */
|
||||
*again = FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
/* Quick check for an empty plt. */
|
||||
@ -1467,7 +1467,7 @@ m32c_elf_relax_section
|
||||
/* 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)
|
||||
|
@ -1369,7 +1369,7 @@ m32r_elf_add_symbol_hook (bfd *abfd,
|
||||
asection **secp,
|
||||
bfd_vma *valp)
|
||||
{
|
||||
if (! info->relocatable
|
||||
if (! bfd_link_relocatable (info)
|
||||
&& (*namep)[0] == '_' && (*namep)[1] == 'S'
|
||||
&& strcmp (*namep, "_SDA_BASE_") == 0
|
||||
&& is_elf_hash_table (info->hash))
|
||||
@ -1679,7 +1679,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
h->type = STT_OBJECT;
|
||||
htab->root.hplt = h;
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
}
|
||||
@ -1721,7 +1721,7 @@ m32r_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
|
||||
@ -1821,7 +1821,7 @@ m32r_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
|
||||
&& h->root.type != bfd_link_hash_undefweak
|
||||
@ -1860,7 +1860,7 @@ m32r_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
|
||||
@ -1959,7 +1959,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->splt;
|
||||
|
||||
@ -1975,7 +1975,7 @@ allocate_dynrelocs (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 = s;
|
||||
@ -2023,7 +2023,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
h->got.offset = s->size;
|
||||
s->size += 4;
|
||||
dyn = htab->root.dynamic_sections_created;
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2038,7 +2038,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (h->def_regular
|
||||
&& (h->forced_local
|
||||
@ -2170,7 +2170,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->root.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);
|
||||
@ -2234,7 +2234,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
*local_got = s->size;
|
||||
s->size += 4;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2313,7 +2313,7 @@ m32r_elf_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;
|
||||
@ -2524,11 +2524,12 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|| r_type == R_M32R_GOT16_HI_SLO
|
||||
|| r_type == R_M32R_GOT16_LO)
|
||||
&& WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
info->shared, h)
|
||||
&& (! info->shared
|
||||
bfd_link_pic (info),
|
||||
h)
|
||||
&& (! bfd_link_pic (info)
|
||||
|| (! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular))
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& ((! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular)
|
||||
&& (((r_type == R_M32R_16_RELA
|
||||
@ -2558,7 +2559,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
relocation = (h->root.u.def.value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
else if (!info->relocatable
|
||||
else if (!bfd_link_relocatable (info)
|
||||
&& (_bfd_elf_section_offset (output_bfd, info,
|
||||
input_section,
|
||||
rel->r_offset)
|
||||
@ -2578,7 +2579,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
else if (info->unresolved_syms_in_objects == RM_IGNORE
|
||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
|
||||
;
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
@ -2593,7 +2594,7 @@ m32r_elf_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 && !use_rel)
|
||||
if (bfd_link_relocatable (info) && !use_rel)
|
||||
{
|
||||
/* This is a relocatable link. We don't have to change
|
||||
anything, unless the reloc is against a section symbol,
|
||||
@ -2604,7 +2605,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (info->relocatable && use_rel)
|
||||
if (bfd_link_relocatable (info) && use_rel)
|
||||
{
|
||||
/* This is a relocatable link. We don't have to change
|
||||
anything, unless the reloc is against a section symbol,
|
||||
@ -2733,8 +2734,10 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
BFD_ASSERT (off != (bfd_vma) -1);
|
||||
|
||||
dyn = htab->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)
|
||||
&& (info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->forced_local)
|
||||
@ -2783,7 +2786,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srelgot;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -2854,7 +2857,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
case R_M32R_26_PCREL_RELA:
|
||||
case R_M32R_HI16_ULO_RELA:
|
||||
case R_M32R_LO16_RELA:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& r_symndx != STN_UNDEF
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (( r_type != R_M32R_10_PCREL_RELA
|
||||
@ -3153,7 +3156,7 @@ m32r_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))
|
||||
{
|
||||
bfd_put_32 (output_bfd,
|
||||
(PLT_ENTRY_WORD0b
|
||||
@ -3245,7 +3248,7 @@ m32r_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->forced_local)
|
||||
@ -3391,7 +3394,7 @@ m32r_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = htab->splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD0, splt->contents);
|
||||
bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD1, splt->contents + 4);
|
||||
@ -3604,7 +3607,7 @@ m32r_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
elf_section_data (sec)->local_dynrel = NULL;
|
||||
@ -3671,7 +3674,7 @@ m32r_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
struct elf_m32r_dyn_relocs **pp;
|
||||
struct elf_m32r_dyn_relocs *p;
|
||||
|
||||
if (!info->shared && h->plt.refcount > 0)
|
||||
if (!bfd_link_pic (info) && h->plt.refcount > 0)
|
||||
h->plt.refcount -= 1;
|
||||
|
||||
eh = (struct elf_m32r_link_hash_entry *) h;
|
||||
@ -3726,7 +3729,7 @@ m32r_elf_check_relocs (bfd *abfd,
|
||||
bfd *dynobj;
|
||||
asection *sreloc;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
sreloc = NULL;
|
||||
@ -3852,7 +3855,7 @@ m32r_elf_check_relocs (bfd *abfd,
|
||||
case R_M32R_18_PCREL_RELA:
|
||||
case R_M32R_26_PCREL_RELA:
|
||||
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
h->non_got_ref = 1;
|
||||
h->plt.refcount += 1;
|
||||
@ -3877,7 +3880,7 @@ m32r_elf_check_relocs (bfd *abfd,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (( r_type != R_M32R_26_PCREL_RELA
|
||||
&& r_type != R_M32R_18_PCREL_RELA
|
||||
@ -3887,7 +3890,7 @@ m32r_elf_check_relocs (bfd *abfd,
|
||||
&& (! info->symbolic
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
|
@ -696,7 +696,7 @@ m68hc11_elf_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)
|
||||
|
@ -853,7 +853,7 @@ elf32_m68hc11_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
const Elf_Internal_Rela * rel;
|
||||
const Elf_Internal_Rela * rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
|
||||
@ -998,7 +998,7 @@ elf32_m68hc11_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))
|
||||
{
|
||||
/* This is a relocatable link. We don't have to change
|
||||
anything, unless the reloc is against a section symbol,
|
||||
|
@ -2232,7 +2232,7 @@ elf_m68k_partition_multi_got_2 (struct elf_m68k_partition_multi_got_arg *arg)
|
||||
|
||||
arg->n_slots += arg->current_got->n_slots[R_32];
|
||||
|
||||
if (!arg->info->shared)
|
||||
if (!bfd_link_pic (arg->info))
|
||||
/* If we are generating a shared object, we need to
|
||||
output a R_68K_RELATIVE reloc so that the dynamic
|
||||
linker can adjust this GOT entry. Overwise we
|
||||
@ -2554,7 +2554,7 @@ elf_m68k_check_relocs (bfd *abfd,
|
||||
asection *sreloc;
|
||||
struct elf_m68k_got *got;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -2620,7 +2620,7 @@ elf_m68k_check_relocs (bfd *abfd,
|
||||
case R_68K_TLS_DTPREL32:
|
||||
|
||||
if (ELF32_R_TYPE (rel->r_info) == R_68K_TLS_TPREL32
|
||||
&& info->shared)
|
||||
&& bfd_link_pic (info))
|
||||
/* Do the special chorus for libraries with static TLS. */
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
|
||||
@ -2641,7 +2641,7 @@ elf_m68k_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)
|
||||
@ -2755,7 +2755,7 @@ elf_m68k_check_relocs (bfd *abfd,
|
||||
will be set later (it is never cleared). We account for that
|
||||
possibility below by storing information in the
|
||||
pcrel_relocs_copied field of the hash table entry. */
|
||||
if (!(info->shared
|
||||
if (!(bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
@ -2786,14 +2786,14 @@ elf_m68k_check_relocs (bfd *abfd,
|
||||
turns out to be a function defined by a dynamic object. */
|
||||
h->plt.refcount++;
|
||||
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
/* This symbol needs a non-GOT reference. */
|
||||
h->non_got_ref = 1;
|
||||
}
|
||||
|
||||
/* If we are creating a shared library, we need to copy the
|
||||
reloc into the shared library. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* When creating a shared object, we must copy these
|
||||
reloc types into the output file. We create a reloc
|
||||
@ -2938,7 +2938,7 @@ elf_m68k_gc_sweep_hook (bfd *abfd,
|
||||
bfd *dynobj;
|
||||
struct elf_m68k_got *got;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -3153,7 +3153,7 @@ elf_m68k_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;
|
||||
@ -3202,7 +3202,7 @@ elf_m68k_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
|
||||
@ -3257,7 +3257,7 @@ elf_m68k_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);
|
||||
@ -3283,7 +3283,7 @@ elf_m68k_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),
|
||||
elf_m68k_discard_copies,
|
||||
info);
|
||||
@ -3366,7 +3366,7 @@ elf_m68k_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;
|
||||
@ -3680,7 +3680,7 @@ elf_m68k_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;
|
||||
|
||||
switch (r_type)
|
||||
@ -3810,8 +3810,10 @@ elf_m68k_relocate_section (bfd *output_bfd,
|
||||
bfd_boolean dyn;
|
||||
|
||||
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)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -3841,7 +3843,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
|
||||
else
|
||||
unresolved_reloc = FALSE;
|
||||
}
|
||||
else if (info->shared) /* && h == NULL */
|
||||
else if (bfd_link_pic (info)) /* && h == NULL */
|
||||
/* Process local symbol during dynamic link. */
|
||||
{
|
||||
if (srela == NULL)
|
||||
@ -3860,7 +3862,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
|
||||
|
||||
*off_ptr |= 1;
|
||||
}
|
||||
else /* h == NULL && !info->shared */
|
||||
else /* h == NULL && !bfd_link_pic (info) */
|
||||
{
|
||||
elf_m68k_init_got_entry_static (info,
|
||||
output_bfd,
|
||||
@ -3914,7 +3916,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
|
||||
case R_68K_TLS_LE32:
|
||||
case R_68K_TLS_LE16:
|
||||
case R_68K_TLS_LE8:
|
||||
if (info->shared && !info->pie)
|
||||
if (bfd_link_pic (info) && !bfd_link_pie (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B(%A+0x%lx): R_68K_TLS_LE32 relocation not permitted "
|
||||
@ -3987,7 +3989,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
|
||||
case R_68K_PC8:
|
||||
case R_68K_PC16:
|
||||
case R_68K_PC32:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& r_symndx != STN_UNDEF
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (h == NULL
|
||||
@ -4026,7 +4028,7 @@ elf_m68k_relocate_section (bfd *output_bfd,
|
||||
&& (r_type == R_68K_PC8
|
||||
|| r_type == R_68K_PC16
|
||||
|| r_type == R_68K_PC32
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
{
|
||||
@ -4335,7 +4337,7 @@ elf_m68k_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 already have been
|
||||
initialized in the relocate_section function. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
bfd_vma relocation;
|
||||
@ -4591,7 +4593,7 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
|
||||
bfd_byte *p;
|
||||
bfd_size_type amt;
|
||||
|
||||
BFD_ASSERT (! info->relocatable);
|
||||
BFD_ASSERT (! bfd_link_relocatable (info));
|
||||
|
||||
*errmsg = NULL;
|
||||
|
||||
|
@ -409,7 +409,7 @@ mcore_elf_relocate_section (bfd * output_bfd,
|
||||
input_bfd,
|
||||
input_section,
|
||||
(long) input_section->reloc_count,
|
||||
(info->relocatable) ? " (relocatable)" : "");
|
||||
(bfd_link_relocatable (info)) ? " (relocatable)" : "");
|
||||
#endif
|
||||
|
||||
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */
|
||||
@ -478,7 +478,7 @@ mcore_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;
|
||||
|
||||
switch (r_type)
|
||||
@ -598,7 +598,7 @@ mcore_elf_check_relocs (bfd * abfd,
|
||||
const Elf_Internal_Rela * rel;
|
||||
const Elf_Internal_Rela * rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = & elf_tdata (abfd)->symtab_hdr;
|
||||
|
@ -491,7 +491,7 @@ mep_elf_relocate_section
|
||||
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 (r_type == R_RELC)
|
||||
|
@ -1418,7 +1418,7 @@ metag_final_link_relocate (reloc_howto_type *howto,
|
||||
_bfd_clear_contents (howto, input_bfd, input_section, \
|
||||
contents + rel->r_offset); \
|
||||
\
|
||||
if (info->relocatable \
|
||||
if (bfd_link_relocatable (info) \
|
||||
&& (input_section->flags & SEC_DEBUGGING)) \
|
||||
{ \
|
||||
/* Only remove relocations in debug sections since other \
|
||||
@ -1559,7 +1559,7 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
METAG_RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
|
||||
rel, relend, howto, contents);
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
switch (r_type)
|
||||
@ -1569,12 +1569,12 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
if ((input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& r_symndx != STN_UNDEF
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (r_type != R_METAG_RELBRANCH
|
||||
|| !SYMBOL_CALLS_LOCAL (info, &hh->eh)))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& hh != NULL
|
||||
&& hh->eh.dynindx != -1
|
||||
&& !hh->eh.non_got_ref
|
||||
@ -1709,7 +1709,8 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
|
||||
off = hh->eh.got.offset;
|
||||
dyn = htab->etab.dynamic_sections_created;
|
||||
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared,
|
||||
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
&hh->eh))
|
||||
{
|
||||
/* If we aren't going to call finish_dynamic_symbol,
|
||||
@ -1749,7 +1750,7 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (do_got)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Output a dynamic relocation for this GOT entry.
|
||||
In this case it is relative to the base of the
|
||||
@ -1796,8 +1797,10 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
bfd_boolean dyn;
|
||||
dyn = htab->etab.dynamic_sections_created;
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, &hh->eh)
|
||||
&& (!info->shared
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
&hh->eh)
|
||||
&& (!bfd_link_pic (info)
|
||||
|| !SYMBOL_REFERENCES_LOCAL (info, &hh->eh)))
|
||||
{
|
||||
indx = hh->eh.dynindx;
|
||||
@ -1831,7 +1834,7 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
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)
|
||||
&& (hh == NULL
|
||||
|| ELF_ST_VISIBILITY (hh->eh.other) == STV_DEFAULT
|
||||
|| hh->eh.root.type != bfd_link_hash_undefweak))
|
||||
@ -1923,7 +1926,7 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
case R_METAG_TLS_IENONPIC_LO16:
|
||||
case R_METAG_TLS_LE_HI16:
|
||||
case R_METAG_TLS_LE_LO16:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B(%A+0x%lx): R_METAG_TLS_LE/IENONPIC relocation not permitted in shared object"),
|
||||
@ -1936,7 +1939,7 @@ elf_metag_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
case R_METAG_TLS_LDO_HI16:
|
||||
case R_METAG_TLS_LDO_LO16:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
relocation = tpoff (info, relocation);
|
||||
else
|
||||
relocation -= dtpoff_base (info);
|
||||
@ -2071,7 +2074,7 @@ elf_metag_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
eh->type = STT_OBJECT;
|
||||
eh->other = STV_HIDDEN;
|
||||
|
||||
if (! info->executable
|
||||
if (! bfd_link_executable (info)
|
||||
&& ! bfd_elf_link_record_dynamic_symbol (info, eh))
|
||||
return FALSE;
|
||||
|
||||
@ -2108,7 +2111,7 @@ elf_metag_check_relocs (bfd *abfd,
|
||||
bfd *dynobj;
|
||||
int tls_type = GOT_UNKNOWN, old_tls_type = GOT_UNKNOWN;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = metag_link_hash_table (info);
|
||||
@ -2163,7 +2166,7 @@ elf_metag_check_relocs (bfd *abfd,
|
||||
case R_METAG_TLS_GD:
|
||||
case R_METAG_TLS_LDM:
|
||||
case R_METAG_TLS_IE:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through. */
|
||||
|
||||
@ -2277,7 +2280,7 @@ elf_metag_check_relocs (bfd *abfd,
|
||||
cannot be used in shared libs. Don't error out for
|
||||
sections we don't care about, such as debug sections or
|
||||
non-constant sections. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (sec->flags & SEC_READONLY) != 0)
|
||||
{
|
||||
@ -2298,7 +2301,7 @@ elf_metag_check_relocs (bfd *abfd,
|
||||
case R_METAG_ADDR32:
|
||||
case R_METAG_RELBRANCH:
|
||||
case R_METAG_GETSETOFF:
|
||||
if (hh != NULL && !info->shared)
|
||||
if (hh != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
hh->eh.non_got_ref = 1;
|
||||
hh->eh.plt.refcount += 1;
|
||||
@ -2323,14 +2326,14 @@ elf_metag_check_relocs (bfd *abfd,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (r_type != R_METAG_RELBRANCH
|
||||
|| (hh != NULL
|
||||
&& (! info->symbolic
|
||||
|| hh->eh.root.type == bfd_link_hash_defweak
|
||||
|| !hh->eh.def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& hh != NULL
|
||||
&& (hh->eh.root.type == bfd_link_hash_defweak
|
||||
@ -2537,7 +2540,7 @@ elf_metag_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
|
||||
@ -2626,7 +2629,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, eh))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), eh))
|
||||
{
|
||||
asection *s = htab->splt;
|
||||
|
||||
@ -2642,7 +2645,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, 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)
|
||||
&& !eh->def_regular)
|
||||
{
|
||||
eh->root.u.def.section = s;
|
||||
@ -2701,7 +2704,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
else if (tls_type == GOT_TLS_GD)
|
||||
htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, eh))
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
eh))
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2716,7 +2721,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *eh, void *inf)
|
||||
defined in a regular object. For the normal shared case, discard
|
||||
space for relocs that have become local due to symbol visibility
|
||||
changes. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, eh))
|
||||
{
|
||||
@ -2843,7 +2848,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->etab.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");
|
||||
if (s == NULL)
|
||||
@ -2913,7 +2918,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
/* R_METAG_TLS_GD relocs need 2 consecutive GOT entries. */
|
||||
if (*local_tls_type == GOT_TLS_GD)
|
||||
s->size += 4;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -3022,7 +3027,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (!add_dynamic_entry (DT_PLTGOT, 0))
|
||||
return FALSE;
|
||||
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
if (!add_dynamic_entry (DT_DEBUG, 0))
|
||||
return FALSE;
|
||||
@ -3114,7 +3119,7 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd,
|
||||
BFD_ASSERT (plt_index < (1 << 16));
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
bfd_put_32 (output_bfd,
|
||||
(plt_entry[0]
|
||||
@ -3198,7 +3203,7 @@ elf_metag_finish_dynamic_symbol (bfd *output_bfd,
|
||||
we just want to emit a RELATIVE reloc. 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 || eh->dynindx == -1)
|
||||
&& eh->def_regular)
|
||||
{
|
||||
@ -3377,7 +3382,7 @@ elf_metag_finish_dynamic_sections (bfd *output_bfd,
|
||||
/* addr = .got + 4 */
|
||||
addr = htab->sgot->output_section->vma +
|
||||
htab->sgot->output_offset + 4;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
addr -= splt->output_section->vma + splt->output_offset;
|
||||
bfd_put_32 (output_bfd,
|
||||
@ -3463,7 +3468,7 @@ elf_metag_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
bfd_signed_vma *local_plt_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
elf_section_data (sec)->local_dynrel = NULL;
|
||||
@ -3546,7 +3551,7 @@ elf_metag_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
struct elf_metag_dyn_reloc_entry **hdh_pp;
|
||||
struct elf_metag_dyn_reloc_entry *hdh_p;
|
||||
|
||||
if (!info->shared && eh->plt.refcount > 0)
|
||||
if (!bfd_link_pic (info) && eh->plt.refcount > 0)
|
||||
eh->plt.refcount -= 1;
|
||||
|
||||
hh = (struct elf_metag_link_hash_entry *) eh;
|
||||
@ -3604,7 +3609,7 @@ metag_type_of_stub (asection *input_sec,
|
||||
|
||||
if (branch_offset + max_branch_offset >= 2*max_branch_offset)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return metag_stub_long_branch_shared;
|
||||
else
|
||||
return metag_stub_long_branch;
|
||||
@ -4145,7 +4150,7 @@ elf_metag_size_stubs(bfd *output_bfd, bfd *stub_bfd,
|
||||
}
|
||||
else if (hh->eh.root.type == bfd_link_hash_undefweak)
|
||||
{
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
continue;
|
||||
}
|
||||
else if (hh->eh.root.type == bfd_link_hash_undefined)
|
||||
|
@ -966,7 +966,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
||||
howto = microblaze_elf_howto_table[r_type];
|
||||
r_symndx = ELF32_R_SYM (rel->r_info);
|
||||
|
||||
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,
|
||||
@ -1245,13 +1245,16 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
||||
bfd_boolean dyn =
|
||||
elf_hash_table (info)->dynamic_sections_created;
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|
||||
&& (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h)
|
||||
&& (!bfd_link_pic (info)
|
||||
|| !SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||
indx = h->dynindx;
|
||||
}
|
||||
|
||||
/* Need to generate relocs ? */
|
||||
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))
|
||||
@ -1272,7 +1275,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
||||
/* Process module-id */
|
||||
if (IS_TLS_LD(tls_type))
|
||||
{
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
bfd_put_32 (output_bfd, 1, htab->sgot->contents + off);
|
||||
}
|
||||
@ -1337,7 +1340,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
/* Relocs for dyn symbols generated by
|
||||
finish_dynamic_symbols */
|
||||
if (info->shared && h == NULL)
|
||||
if (bfd_link_pic (info) && h == NULL)
|
||||
{
|
||||
*offp |= 1;
|
||||
microblaze_elf_output_dynamic_relocation (output_bfd,
|
||||
@ -1427,7 +1430,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
}
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
@ -1436,7 +1439,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
||||
&& h->dynindx != -1
|
||||
&& (!info->symbolic
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -1688,7 +1691,7 @@ microblaze_elf_relax_section (bfd *abfd,
|
||||
*again = FALSE;
|
||||
|
||||
/* Only do this for a text 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)
|
||||
@ -2330,7 +2333,7 @@ microblaze_elf_check_relocs (bfd * abfd,
|
||||
struct elf32_mb_link_hash_table *htab;
|
||||
asection *sreloc = NULL;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf32_mb_hash_table (info);
|
||||
@ -2423,7 +2426,7 @@ microblaze_elf_check_relocs (bfd * abfd,
|
||||
case R_MICROBLAZE_64_PCREL:
|
||||
case R_MICROBLAZE_32:
|
||||
{
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
/* we may need a copy reloc. */
|
||||
h->non_got_ref = 1;
|
||||
@ -2457,14 +2460,14 @@ microblaze_elf_check_relocs (bfd * abfd,
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (r_type != R_MICROBLAZE_64_PCREL
|
||||
|| (h != NULL
|
||||
&& (! info->symbolic
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -2563,11 +2566,11 @@ microblaze_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||
htab->splt = bfd_get_linker_section (dynobj, ".plt");
|
||||
htab->srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
|
||||
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
|
||||
|
||||
if (!htab->splt || !htab->srelplt || !htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -2688,7 +2691,7 @@ microblaze_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
|
||||
@ -2795,7 +2798,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->splt;
|
||||
|
||||
@ -2810,7 +2813,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
|
||||
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;
|
||||
@ -2900,7 +2903,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
|
||||
space for pc-relative relocs that have become local due to symbol
|
||||
visibility changes. */
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (h->def_regular
|
||||
&& (h->forced_local
|
||||
@ -3055,7 +3058,7 @@ microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
*local_got = s->size;
|
||||
s->size += need;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += need * (sizeof (Elf32_External_Rela) / 4);
|
||||
}
|
||||
}
|
||||
@ -3072,7 +3075,7 @@ microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
htab->tlsld_got.offset = htab->sgot->size;
|
||||
htab->sgot->size += 8;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -3155,7 +3158,7 @@ microblaze_elf_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;
|
||||
@ -3227,13 +3230,13 @@ microblaze_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
got_addr = got_offset;
|
||||
|
||||
/* For non-PIC objects we need absolute address of the GOT entry. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
got_addr += htab->sgotplt->output_section->vma + sgotplt->output_offset;
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
bfd_put_32 (output_bfd, PLT_ENTRY_WORD_0 + ((got_addr >> 16) & 0xffff),
|
||||
splt->contents + h->plt.offset);
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
bfd_put_32 (output_bfd, PLT_ENTRY_WORD_1 + (got_addr & 0xffff),
|
||||
splt->contents + h->plt.offset + 4);
|
||||
else
|
||||
@ -3292,7 +3295,7 @@ microblaze_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)
|
||||
{
|
||||
@ -3459,7 +3462,7 @@ microblaze_elf_add_symbol_hook (bfd *abfd,
|
||||
bfd_vma *valp)
|
||||
{
|
||||
if (sym->st_shndx == SHN_COMMON
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& sym->st_size <= elf_gp_size (abfd))
|
||||
{
|
||||
/* Common symbols less than or equal to -G nn bytes are automatically
|
||||
|
@ -257,7 +257,7 @@ moxie_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 = moxie_final_link_relocate (howto, input_bfd, input_section,
|
||||
@ -338,7 +338,7 @@ moxie_elf_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
@ -672,7 +672,7 @@ elf32_msp430_check_relocs (bfd * abfd, struct bfd_link_info * info,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -1328,7 +1328,7 @@ elf32_msp430_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 = msp430_final_link_relocate (howto, input_bfd, input_section,
|
||||
@ -1846,7 +1846,7 @@ msp430_elf_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)
|
||||
return TRUE;
|
||||
|
@ -362,7 +362,7 @@ mt_elf_relocate_section
|
||||
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
|
||||
rel, 1, relend, howto, 0, contents);
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
/* Finally, the sole MT-specific part. */
|
||||
@ -436,7 +436,7 @@ mt_elf_check_relocs
|
||||
const Elf_Internal_Rela * rel;
|
||||
const Elf_Internal_Rela * rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
@ -3472,7 +3472,7 @@ nds32_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
h->def_regular = 1;
|
||||
h->type = STT_OBJECT;
|
||||
|
||||
if (info->shared && !bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
if (bfd_link_pic (info) && !bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -3537,7 +3537,7 @@ nds32_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 (abfd, (bed->default_use_rela_p
|
||||
? ".rela.bss" : ".rel.bss"));
|
||||
@ -3632,7 +3632,7 @@ nds32_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
when we know the address of the .got section. */
|
||||
if (h->type == STT_FUNC || h->needs_plt)
|
||||
{
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
&& !h->def_dynamic
|
||||
&& !h->ref_dynamic
|
||||
&& h->root.type != bfd_link_hash_undefweak
|
||||
@ -3671,7 +3671,7 @@ nds32_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
|
||||
@ -3790,7 +3790,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->splt;
|
||||
|
||||
@ -3806,7 +3806,7 @@ allocate_dynrelocs (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 && !h->def_regular)
|
||||
if (!bfd_link_pic (info) && !h->def_regular)
|
||||
{
|
||||
h->root.u.def.section = s;
|
||||
h->root.u.def.value = h->plt.offset;
|
||||
@ -3859,7 +3859,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
s->size += 4;
|
||||
|
||||
dyn = htab->root.dynamic_sections_created;
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -3874,7 +3874,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (h->def_regular && (h->forced_local || info->symbolic))
|
||||
{
|
||||
@ -3980,7 +3980,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->root.dynamic_sections_created)
|
||||
{
|
||||
/* Set the contents of the .interp section to the interpreter. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
s = bfd_get_section_by_name (dynobj, ".interp");
|
||||
BFD_ASSERT (s != NULL);
|
||||
@ -4043,7 +4043,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
*local_got = s->size;
|
||||
s->size += 4;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -4127,7 +4127,7 @@ nds32_elf_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;
|
||||
@ -4505,7 +4505,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
table = nds32_elf_hash_table (info);
|
||||
eliminate_gc_relocs = table->eliminate_gc_relocs;
|
||||
/* By this time, we can adjust the value of _SDA_BASE_. */
|
||||
if ((!info->relocatable))
|
||||
if ((!bfd_link_relocatable (info)))
|
||||
{
|
||||
is_SDA_BASE_set = 1;
|
||||
r = nds32_elf_final_sda_base (output_bfd, info, &gp, TRUE);
|
||||
@ -4597,7 +4597,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
if (((r_type >= R_NDS32_DWARF2_OP1_RELA
|
||||
&& r_type <= R_NDS32_DWARF2_LEB_RELA)
|
||||
|| r_type >= R_NDS32_RELAX_ENTRY) && !info->relocatable)
|
||||
|| r_type >= R_NDS32_RELAX_ENTRY) && !bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
howto = bfd_elf32_bfd_reloc_type_table_lookup (r_type);
|
||||
@ -4645,7 +4645,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
}
|
||||
|
||||
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,
|
||||
@ -4805,8 +4805,10 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
off = h->got.offset;
|
||||
BFD_ASSERT (off != (bfd_vma) - 1);
|
||||
dyn = htab->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)
|
||||
&& (info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->forced_local) && h->def_regular))
|
||||
@ -4853,7 +4855,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srelgot;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -4899,7 +4901,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
case R_NDS32_LO12S1_RELA:
|
||||
case R_NDS32_LO12S0_RELA:
|
||||
case R_NDS32_LO12S0_ORI_RELA:
|
||||
if (info->shared && r_symndx != 0
|
||||
if (bfd_link_pic (info) && r_symndx != 0
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (eliminate_gc_relocs == 0
|
||||
|| (sec && (sec->flags & SEC_EXCLUDE) == 0))
|
||||
@ -5000,7 +5002,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
break;
|
||||
|
||||
case R_NDS32_25_ABS_RELA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: warning: cannot deal R_NDS32_25_ABS_RELA in shared "
|
||||
@ -5060,11 +5062,12 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
dyn = htab->root.dynamic_sections_created;
|
||||
if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL
|
||||
(dyn, info->shared, h) || (info->shared
|
||||
&& (info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->forced_local)
|
||||
&& h->def_regular))
|
||||
(dyn, bfd_link_pic (info), h)
|
||||
|| (bfd_link_pic (info)
|
||||
&& (info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->forced_local)
|
||||
&& h->def_regular))
|
||||
{
|
||||
/* This is actually a static link, or it is a
|
||||
-Bsymbolic link and the symbol is defined
|
||||
@ -5106,7 +5109,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srelgot;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -5242,8 +5245,8 @@ handle_sda:
|
||||
BFD_ASSERT (off != (bfd_vma) - 1);
|
||||
dyn = htab->root.dynamic_sections_created;
|
||||
tls_type = ((struct elf_nds32_link_hash_entry *) h)->tls_type;
|
||||
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;
|
||||
}
|
||||
@ -5271,7 +5274,7 @@ handle_sda:
|
||||
{
|
||||
bfd_boolean need_relocs = FALSE;
|
||||
srelgot = htab->srelgot;
|
||||
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))
|
||||
@ -5505,7 +5508,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
got_offset = (plt_index + 3) * 4;
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
unsigned long insn;
|
||||
|
||||
@ -5609,7 +5612,7 @@ nds32_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
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)
|
||||
{
|
||||
@ -5748,7 +5751,7 @@ nds32_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
splt = htab->splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
unsigned long insn;
|
||||
long offset;
|
||||
@ -6299,7 +6302,7 @@ nds32_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
struct elf_nds32_dyn_relocs **pp;
|
||||
struct elf_nds32_dyn_relocs *p;
|
||||
|
||||
if (!info->shared && h->plt.refcount > 0)
|
||||
if (!bfd_link_pic (info) && h->plt.refcount > 0)
|
||||
h->plt.refcount -= 1;
|
||||
|
||||
eh = (struct elf_nds32_link_hash_entry *) h;
|
||||
@ -6352,7 +6355,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd *dynobj;
|
||||
asection *sreloc = NULL;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -6537,7 +6540,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_NDS32_17_PCREL_RELA:
|
||||
case R_NDS32_25_PCREL_RELA:
|
||||
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
h->non_got_ref = 1;
|
||||
h->plt.refcount += 1;
|
||||
@ -6559,7 +6562,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
If on the other hand, we are creating an executable, we may need
|
||||
to keep relocations for symbols satisfied by a dynamic library
|
||||
if we manage to avoid copy relocs for the symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& ((r_type != R_NDS32_25_PCREL_RELA
|
||||
&& r_type != R_NDS32_15_PCREL_RELA
|
||||
@ -6570,7 +6573,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
&& (!info->symbolic
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -11967,7 +11970,7 @@ nds32_elf_relax_section (bfd *abfd, asection *sec,
|
||||
* non-code section or
|
||||
* empty content or
|
||||
* no reloc entry. */
|
||||
if (link_info->relocatable
|
||||
if (bfd_link_relocatable (link_info)
|
||||
|| (sec->flags & SEC_RELOC) == 0
|
||||
|| (sec->flags & SEC_EXCLUDE) == 1
|
||||
|| (sec->flags & SEC_CODE) == 0
|
||||
|
@ -2779,7 +2779,7 @@ nios2_elf32_size_stubs (bfd *output_bfd, bfd *stub_bfd,
|
||||
}
|
||||
else if (hh->root.root.type == bfd_link_hash_undefweak)
|
||||
{
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
continue;
|
||||
}
|
||||
else if (hh->root.root.type == bfd_link_hash_undefined)
|
||||
@ -3759,7 +3759,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
rel, 1, relend, howto, 0, contents);
|
||||
|
||||
/* Nothing more to do unless this is a final link. */
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
if (sec && sec->output_section)
|
||||
@ -3986,8 +3986,10 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
off = h->got.offset;
|
||||
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)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -4031,7 +4033,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
bfd_put_32 (output_bfd, relocation,
|
||||
sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srelgot;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -4055,7 +4057,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
}
|
||||
|
||||
if (use_plt && info->shared)
|
||||
if (use_plt && bfd_link_pic (info))
|
||||
{
|
||||
off = ((h->plt.offset - 24) / 12 + 3) * 4;
|
||||
relocation = (htab->root.sgotplt->output_offset + off
|
||||
@ -4156,7 +4158,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
/* 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;
|
||||
bfd_byte *loc;
|
||||
@ -4203,8 +4205,10 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
bfd_boolean dyn;
|
||||
dyn = htab->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 = FALSE;
|
||||
@ -4239,7 +4243,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
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))
|
||||
@ -4348,7 +4352,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
|
||||
break;
|
||||
case R_NIOS2_TLS_LE16:
|
||||
if (info->shared && !info->pie)
|
||||
if (bfd_link_pic (info) && !bfd_link_pie (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B(%A+0x%lx): R_NIOS2_TLS_LE16 relocation not "
|
||||
@ -4366,7 +4370,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_NIOS2_BFD_RELOC_32:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
@ -4397,7 +4401,7 @@ nios2_elf32_relocate_section (bfd *output_bfd,
|
||||
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))
|
||||
{
|
||||
@ -4594,7 +4598,7 @@ nios2_elf32_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
|
||||
if (!htab->sdynbss)
|
||||
return FALSE;
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
|
||||
if (!htab->srelbss)
|
||||
@ -4699,7 +4703,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
asection *sreloc = NULL;
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -4786,7 +4790,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
}
|
||||
|
||||
if (srelgot == NULL
|
||||
&& (h != NULL || info->shared))
|
||||
&& (h != NULL || bfd_link_pic (info)))
|
||||
{
|
||||
srelgot = htab->root.srelgot;
|
||||
BFD_ASSERT (srelgot != NULL);
|
||||
@ -4892,7 +4896,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
sections have not yet been mapped to output sections.
|
||||
Tentatively set the flag for now, and correct in
|
||||
adjust_dynamic_symbol. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
h->non_got_ref = 1;
|
||||
|
||||
/* Make sure a plt entry is created for this symbol if it
|
||||
@ -4905,7 +4909,7 @@ nios2_elf32_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* If we are creating a shared library, we need to copy the
|
||||
reloc into the shared library. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (r_type == R_NIOS2_BFD_RELOC_32
|
||||
|| (h != NULL && ! h->needs_plt
|
||||
@ -5012,7 +5016,7 @@ nios2_elf32_gc_sweep_hook (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
bfd *dynobj;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
elf_section_data (sec)->local_dynrel = NULL;
|
||||
@ -5138,7 +5142,7 @@ nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
|
||||
BFD_ASSERT (splt != NULL && sgotplt != NULL && srela != NULL);
|
||||
|
||||
/* Emit the PLT entry. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
nios2_elf32_install_data (splt, nios2_so_plt_entry, h->plt.offset,
|
||||
3);
|
||||
@ -5228,7 +5232,7 @@ nios2_elf32_finish_dynamic_symbol (bfd *output_bfd,
|
||||
The entry in the global offset table will already have been
|
||||
initialized in the relocate_section function. */
|
||||
|
||||
if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
rela.r_info = ELF32_R_INFO (0, R_NIOS2_RELATIVE);
|
||||
rela.r_addend = bfd_get_signed_32 (output_bfd,
|
||||
@ -5377,7 +5381,7 @@ nios2_elf32_finish_dynamic_sections (bfd *output_bfd,
|
||||
{
|
||||
bfd_vma got_address = (sgotplt->output_section->vma
|
||||
+ sgotplt->output_offset);
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_vma corrected = got_address - (splt->output_section->vma
|
||||
+ splt->output_offset + 4);
|
||||
@ -5506,7 +5510,7 @@ nios2_elf32_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 (h->size == 0)
|
||||
@ -5623,14 +5627,14 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
|
||||
&& !bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->root.splt;
|
||||
|
||||
/* Allocate room for the header. */
|
||||
if (s->size == 0)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
s->size = 24;
|
||||
else
|
||||
s->size = 28;
|
||||
@ -5643,7 +5647,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR 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 = s;
|
||||
@ -5711,13 +5715,13 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR 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))
|
||||
{
|
||||
@ -5733,7 +5737,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
|
||||
else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& !use_plt
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
htab->root.srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
@ -5749,7 +5753,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, PTR inf)
|
||||
space for pc-relative relocs that have become local due to symbol
|
||||
visibility changes. */
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (h->def_regular
|
||||
&& (h->forced_local || SYMBOLIC_BIND (info, h)))
|
||||
@ -5845,7 +5849,7 @@ nios2_elf32_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);
|
||||
@ -5926,7 +5930,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (*local_tls_type == GOT_NORMAL)
|
||||
s->size += 4;
|
||||
|
||||
if (info->shared || *local_tls_type == GOT_TLS_GD)
|
||||
if (bfd_link_pic (info) || *local_tls_type == GOT_TLS_GD)
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -5940,7 +5944,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
for R_NIOS2_TLS_LDM16 relocations. */
|
||||
htab->tls_ldm_got.offset = htab->root.sgot->size;
|
||||
htab->root.sgot->size += 8;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
htab->root.srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -5983,7 +5987,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
plt = s->size != 0;
|
||||
|
||||
/* Correct for the number of res_N branches. */
|
||||
if (plt && !info->shared)
|
||||
if (plt && !bfd_link_pic (info))
|
||||
{
|
||||
htab->res_n_size = (s->size-28) / 3;
|
||||
s->size += htab->res_n_size;
|
||||
@ -6050,7 +6054,7 @@ nios2_elf32_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 && !add_dynamic_entry (DT_DEBUG, 0))
|
||||
if (!bfd_link_pic (info) && !add_dynamic_entry (DT_DEBUG, 0))
|
||||
return FALSE;
|
||||
|
||||
if (got && !add_dynamic_entry (DT_PLTGOT, 0))
|
||||
@ -6068,7 +6072,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf32_External_Rela))))
|
||||
return FALSE;
|
||||
|
||||
if (!info->shared && !add_dynamic_entry (DT_NIOS2_GP, 0))
|
||||
if (!bfd_link_pic (info) && !add_dynamic_entry (DT_NIOS2_GP, 0))
|
||||
return FALSE;
|
||||
|
||||
if ((info->flags & DF_TEXTREL) != 0
|
||||
@ -6166,7 +6170,7 @@ nios2_elf_add_symbol_hook (bfd *abfd,
|
||||
bfd *dynobj;
|
||||
|
||||
if (sym->st_shndx == SHN_COMMON
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& sym->st_size <= elf_gp_size (abfd)
|
||||
&& is_nios2_elf_target (info->output_bfd->xvec))
|
||||
{
|
||||
|
@ -879,7 +879,7 @@ or1k_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;
|
||||
|
||||
switch (howto->type)
|
||||
@ -909,8 +909,10 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
BFD_ASSERT (off != (bfd_vma) -1);
|
||||
|
||||
dyn = htab->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)))
|
||||
{
|
||||
/* This is actually a static link, or it is a
|
||||
@ -959,7 +961,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
/* Write entry in GOT. */
|
||||
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srelgot;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -1012,13 +1014,13 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
|| (input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (howto->type != R_OR1K_INSN_REL_26
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -1138,7 +1140,7 @@ or1k_elf_relocate_section (bfd *output_bfd,
|
||||
/* Dynamic entries will require relocations. if we do not need
|
||||
them we will just use the default R_OR1K_NONE and
|
||||
not set anything. */
|
||||
dynamic = info->shared
|
||||
dynamic = bfd_link_pic (info)
|
||||
|| (sec && (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak || !h->def_regular));
|
||||
@ -1419,7 +1421,7 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
bfd *dynobj;
|
||||
asection *sreloc = NULL;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -1574,7 +1576,7 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
case R_OR1K_32:
|
||||
/* R_OR1K_16? */
|
||||
{
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a copy reloc. */
|
||||
h->non_got_ref = 1;
|
||||
@ -1607,14 +1609,14 @@ or1k_elf_check_relocs (bfd *abfd,
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (ELF32_R_TYPE (rel->r_info) != R_OR1K_INSN_REL_26
|
||||
|| (h != NULL
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -1810,7 +1812,7 @@ or1k_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = htab->splt;
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_put_32 (output_bfd, PLT0_PIC_ENTRY_WORD0,
|
||||
splt->contents);
|
||||
@ -1911,7 +1913,7 @@ or1k_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
got_addr = got_offset;
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
got_addr += htab->sgotplt->output_section->vma
|
||||
+ htab->sgotplt->output_offset;
|
||||
@ -1989,7 +1991,7 @@ or1k_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 && SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
rela.r_info = ELF32_R_INFO (0, R_OR1K_RELATIVE);
|
||||
rela.r_addend = (h->root.u.def.value
|
||||
@ -2089,7 +2091,7 @@ or1k_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
|
||||
&& h->root.type != bfd_link_hash_undefweak
|
||||
@ -2128,7 +2130,7 @@ or1k_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
|
||||
@ -2227,7 +2229,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->splt;
|
||||
|
||||
@ -2243,7 +2245,7 @@ allocate_dynrelocs (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 = s;
|
||||
@ -2299,7 +2301,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
else
|
||||
s->size += 4;
|
||||
dyn = htab->root.dynamic_sections_created;
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
|
||||
{
|
||||
if (tls_type == TLS_GD)
|
||||
htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
|
||||
@ -2319,7 +2321,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
@ -2445,7 +2447,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->root.dynamic_sections_created)
|
||||
{
|
||||
/* Set the contents of the .interp section to the interpreter. */
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
s = bfd_get_section_by_name (dynobj, ".interp");
|
||||
BFD_ASSERT (s != NULL);
|
||||
@ -2516,7 +2518,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
s->size += 8;
|
||||
else
|
||||
s->size += 4;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (local_tls_type != NULL && *local_tls_type == TLS_GD)
|
||||
srel->size += 2 * sizeof (Elf32_External_Rela);
|
||||
@ -2605,7 +2607,7 @@ or1k_elf_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;
|
||||
@ -2666,11 +2668,11 @@ or1k_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||
htab->splt = bfd_get_section_by_name (dynobj, ".plt");
|
||||
htab->srelplt = bfd_get_section_by_name (dynobj, ".rela.plt");
|
||||
htab->sdynbss = bfd_get_section_by_name (dynobj, ".dynbss");
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srelbss = bfd_get_section_by_name (dynobj, ".rela.bss");
|
||||
|
||||
if (!htab->splt || !htab->srelplt || !htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
|
168
bfd/elf32-ppc.c
168
bfd/elf32-ppc.c
@ -3080,7 +3080,7 @@ must_be_dyn_reloc (struct bfd_link_info *info,
|
||||
case R_PPC_TPREL16_LO:
|
||||
case R_PPC_TPREL16_HI:
|
||||
case R_PPC_TPREL16_HA:
|
||||
return !info->executable;
|
||||
return !bfd_link_executable (info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3465,7 +3465,7 @@ ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
if (s == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
htab->relbss = bfd_get_linker_section (abfd, ".rela.bss");
|
||||
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_HAS_CONTENTS
|
||||
@ -3622,7 +3622,7 @@ ppc_elf_add_symbol_hook (bfd *abfd,
|
||||
bfd_vma *valp)
|
||||
{
|
||||
if (sym->st_shndx == SHN_COMMON
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& is_ppc_elf (info->output_bfd)
|
||||
&& sym->st_size <= elf_gp_size (abfd))
|
||||
{
|
||||
@ -3876,7 +3876,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
asection *got2, *sreloc;
|
||||
struct elf_link_hash_entry *tga;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
/* Don't do anything special with non-loaded, non-alloced sections.
|
||||
@ -3973,14 +3973,14 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
/* STT_GNU_IFUNC symbols must have a PLT entry;
|
||||
In a non-pie executable even when there are
|
||||
no plt calls. */
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
|| is_branch_reloc (r_type))
|
||||
{
|
||||
bfd_vma addend = 0;
|
||||
if (r_type == R_PPC_PLTREL24)
|
||||
{
|
||||
ppc_elf_tdata (abfd)->makes_plt_call = 1;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
addend = rel->r_addend;
|
||||
}
|
||||
if (!update_plt_info (abfd, ifunc, got2, addend))
|
||||
@ -4031,7 +4031,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
case R_PPC_GOT_TPREL16_LO:
|
||||
case R_PPC_GOT_TPREL16_HI:
|
||||
case R_PPC_GOT_TPREL16_HA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
tls_type = TLS_TLS | TLS_TPREL;
|
||||
goto dogottls;
|
||||
@ -4070,7 +4070,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
|
||||
/* We may also need a plt entry if the symbol turns out to be
|
||||
an ifunc. */
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
if (!update_plt_info (abfd, &h->plt.plist, NULL, 0))
|
||||
return FALSE;
|
||||
@ -4079,7 +4079,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
|
||||
/* Indirect .sdata relocation. */
|
||||
case R_PPC_EMB_SDAI16:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bad_shared_reloc (abfd, r_type);
|
||||
return FALSE;
|
||||
@ -4097,7 +4097,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
|
||||
/* Indirect .sdata2 relocation. */
|
||||
case R_PPC_EMB_SDA2I16:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bad_shared_reloc (abfd, r_type);
|
||||
return FALSE;
|
||||
@ -4142,7 +4142,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_PPC_EMB_SDA2REL:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bad_shared_reloc (abfd, r_type);
|
||||
return FALSE;
|
||||
@ -4159,7 +4159,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
case R_PPC_VLE_SDA21:
|
||||
case R_PPC_EMB_SDA21:
|
||||
case R_PPC_EMB_RELSDA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bad_shared_reloc (abfd, r_type);
|
||||
return FALSE;
|
||||
@ -4176,7 +4176,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
case R_PPC_EMB_NADDR16_LO:
|
||||
case R_PPC_EMB_NADDR16_HI:
|
||||
case R_PPC_EMB_NADDR16_HA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bad_shared_reloc (abfd, r_type);
|
||||
return FALSE;
|
||||
@ -4220,7 +4220,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
if (r_type == R_PPC_PLTREL24)
|
||||
{
|
||||
ppc_elf_tdata (abfd)->makes_plt_call = 1;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
addend = rel->r_addend;
|
||||
}
|
||||
h->needs_plt = 1;
|
||||
@ -4286,7 +4286,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
}
|
||||
if (h != NULL && h->type == STT_GNU_IFUNC)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
info->callbacks->einfo (_("%P: %H: @local call to ifunc %s\n"),
|
||||
abfd, sec, rel->r_offset,
|
||||
@ -4322,7 +4322,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
case R_PPC_TPREL16_LO:
|
||||
case R_PPC_TPREL16_HI:
|
||||
case R_PPC_TPREL16_HA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
goto dodyn;
|
||||
|
||||
@ -4335,7 +4335,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
if (h == NULL
|
||||
&& got2 != NULL
|
||||
&& (sec->flags & SEC_CODE) != 0
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& htab->plt_type == PLT_UNSET)
|
||||
{
|
||||
/* Old -fPIC gcc code has .long LCTOC1-LCFx just before
|
||||
@ -4370,7 +4370,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
case R_PPC_ADDR16_HA:
|
||||
case R_PPC_UADDR32:
|
||||
case R_PPC_UADDR16:
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a plt entry if the symbol turns out to be
|
||||
a function defined in a dynamic object. */
|
||||
@ -4408,7 +4408,7 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
case R_PPC_ADDR14:
|
||||
case R_PPC_ADDR14_BRTAKEN:
|
||||
case R_PPC_ADDR14_BRNTAKEN:
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a plt entry if the symbol turns out to be
|
||||
a function defined in a dynamic object. */
|
||||
@ -4440,14 +4440,14 @@ ppc_elf_check_relocs (bfd *abfd,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (must_be_dyn_reloc (info, r_type)
|
||||
|| (h != NULL
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular)))
|
||||
@ -4818,7 +4818,7 @@ ppc_elf_select_plt_layout (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
if (htab->params->plt_style == PLT_OLD)
|
||||
htab->plt_type = PLT_OLD;
|
||||
else if (info->shared
|
||||
else if (bfd_link_pic (info)
|
||||
&& htab->elf.dynamic_sections_created
|
||||
&& (h = elf_link_hash_lookup (&htab->elf, "_mcount",
|
||||
FALSE, FALSE, TRUE)) != NULL
|
||||
@ -4934,7 +4934,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
asection *got2;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
if ((sec->flags & SEC_ALLOC) == 0)
|
||||
@ -4980,7 +4980,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
|
||||
if (!htab->is_vxworks
|
||||
&& h == NULL
|
||||
&& local_got_refcounts != NULL
|
||||
&& (!info->shared
|
||||
&& (!bfd_link_pic (info)
|
||||
|| is_branch_reloc (r_type)))
|
||||
{
|
||||
struct plt_entry **local_plt = (struct plt_entry **)
|
||||
@ -4993,7 +4993,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
|
||||
bfd_vma addend = 0;
|
||||
struct plt_entry *ent;
|
||||
|
||||
if (r_type == R_PPC_PLTREL24 && info->shared)
|
||||
if (r_type == R_PPC_PLTREL24 && bfd_link_pic (info))
|
||||
addend = rel->r_addend;
|
||||
ent = find_plt_ent (ifunc, got2, addend);
|
||||
if (ent->plt.refcount > 0)
|
||||
@ -5028,7 +5028,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
|
||||
{
|
||||
if (h->got.refcount > 0)
|
||||
h->got.refcount--;
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
struct plt_entry *ent;
|
||||
|
||||
@ -5064,7 +5064,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
|
||||
case R_PPC_ADDR14_BRNTAKEN:
|
||||
case R_PPC_UADDR32:
|
||||
case R_PPC_UADDR16:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
break;
|
||||
|
||||
case R_PPC_PLT32:
|
||||
@ -5078,7 +5078,7 @@ ppc_elf_gc_sweep_hook (bfd *abfd,
|
||||
bfd_vma addend = 0;
|
||||
struct plt_entry *ent;
|
||||
|
||||
if (r_type == R_PPC_PLTREL24 && info->shared)
|
||||
if (r_type == R_PPC_PLTREL24 && bfd_link_pic (info))
|
||||
addend = rel->r_addend;
|
||||
ent = find_plt_ent (&h->plt.plist, got2, addend);
|
||||
if (ent != NULL && ent->plt.refcount > 0)
|
||||
@ -5204,7 +5204,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
|
||||
struct ppc_elf_link_hash_table *htab;
|
||||
int pass;
|
||||
|
||||
if (info->relocatable || !info->executable)
|
||||
if (bfd_link_relocatable (info) || !bfd_link_executable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = ppc_elf_hash_table (info);
|
||||
@ -5377,7 +5377,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED,
|
||||
struct plt_entry *ent;
|
||||
bfd_vma addend = 0;
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& ELF32_R_TYPE (rel[1].r_info) == R_PPC_PLTREL24)
|
||||
addend = rel[1].r_addend;
|
||||
ent = find_plt_ent (&htab->tls_get_addr->plt.plist,
|
||||
@ -5589,7 +5589,7 @@ ppc_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))
|
||||
{
|
||||
h->protected_def = 0;
|
||||
return TRUE;
|
||||
@ -5698,7 +5698,7 @@ add_stub_sym (struct plt_entry *ent,
|
||||
const char *stub;
|
||||
struct ppc_elf_link_hash_table *htab = ppc_elf_hash_table (info);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
stub = ".plt_pic32.";
|
||||
else
|
||||
stub = ".plt_call32.";
|
||||
@ -5807,7 +5807,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
}
|
||||
|
||||
dyn = htab->elf.dynamic_sections_created;
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| h->type == STT_GNU_IFUNC
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
|
||||
{
|
||||
@ -5825,7 +5825,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
ent->plt.offset = plt_offset;
|
||||
|
||||
s = htab->glink;
|
||||
if (!doneone || info->shared)
|
||||
if (!doneone || bfd_link_pic (info))
|
||||
{
|
||||
glink_offset = s->size;
|
||||
s->size += GLINK_ENTRY_SIZE;
|
||||
@ -5834,7 +5834,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
s->size += TLS_GET_ADDR_GLINK_SIZE - GLINK_ENTRY_SIZE;
|
||||
}
|
||||
if (!doneone
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h->def_dynamic
|
||||
&& !h->def_regular)
|
||||
{
|
||||
@ -5873,7 +5873,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
relocations, and 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_dynamic
|
||||
&& !h->def_regular)
|
||||
{
|
||||
@ -5907,7 +5907,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
if (htab->plt_type == PLT_VXWORKS)
|
||||
{
|
||||
/* Allocate space for the unloaded relocations. */
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
&& htab->elf.dynamic_sections_created)
|
||||
{
|
||||
if (ent->plt.offset
|
||||
@ -5999,7 +5999,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
{
|
||||
eh->elf.got.offset = allocate_got (htab, need);
|
||||
dyn = htab->elf.dynamic_sections_created;
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, &eh->elf))
|
||||
&& (ELF_ST_VISIBILITY (eh->elf.other) == STV_DEFAULT
|
||||
|| eh->elf.root.type != bfd_link_hash_undefweak))
|
||||
@ -6030,7 +6030,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
space for relocs that have become local due to symbol visibility
|
||||
changes. */
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Relocs that use pc_count are those that appear on a call insn,
|
||||
or certain REL relocs (see must_be_dyn_reloc) that can be
|
||||
@ -6191,7 +6191,7 @@ ppc_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 (htab->elf.dynobj, ".interp");
|
||||
BFD_ASSERT (s != NULL);
|
||||
@ -6291,7 +6291,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
else
|
||||
{
|
||||
*local_got = allocate_got (htab, need);
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srel = htab->relgot;
|
||||
if ((*lgot_masks & PLT_IFUNC) != 0)
|
||||
@ -6326,7 +6326,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
ent->plt.offset = plt_offset;
|
||||
|
||||
s = htab->glink;
|
||||
if (!doneone || info->shared)
|
||||
if (!doneone || bfd_link_pic (info))
|
||||
{
|
||||
glink_offset = s->size;
|
||||
s->size += GLINK_ENTRY_SIZE;
|
||||
@ -6350,7 +6350,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
if (htab->tlsld_got.refcount > 0)
|
||||
{
|
||||
htab->tlsld_got.offset = allocate_got (htab, 8);
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
htab->relgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -6374,7 +6374,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
|
||||
htab->elf.hgot->root.u.def.value = g_o_t;
|
||||
}
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
struct elf_link_hash_entry *sda = htab->sdata[0].sym;
|
||||
|
||||
@ -6450,7 +6450,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
{
|
||||
s = htab->glink_eh_frame;
|
||||
s->size = sizeof (glink_eh_frame_cie) + 20;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
s->size += 4;
|
||||
if (htab->glink->size - GLINK_PLTRESOLVE + 8 >= 256)
|
||||
@ -6547,7 +6547,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
#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;
|
||||
@ -6626,7 +6626,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
/* Augmentation. */
|
||||
p += 1;
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& htab->elf.dynamic_sections_created)
|
||||
{
|
||||
bfd_vma adv = (htab->glink->size - GLINK_PLTRESOLVE + 8) >> 2;
|
||||
@ -6794,7 +6794,7 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
/* We cannot represent the required PIC relocs in the output, so don't
|
||||
do anything. The linker doesn't support mixing -shared and -r
|
||||
anyway. */
|
||||
if (link_info->relocatable && link_info->shared)
|
||||
if (bfd_link_relocatable (link_info) && bfd_link_pic (link_info))
|
||||
return TRUE;
|
||||
|
||||
htab = ppc_elf_hash_table (link_info);
|
||||
@ -6938,7 +6938,7 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
|| h->root.type == bfd_link_hash_undefweak)
|
||||
{
|
||||
tsec = bfd_und_section_ptr;
|
||||
toff = link_info->relocatable ? indx : 0;
|
||||
toff = bfd_link_relocatable (link_info) ? indx : 0;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@ -6946,8 +6946,8 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
/* If this branch is to __tls_get_addr then we may later
|
||||
optimise away the call. We won't be needing a long-
|
||||
branch stub in that case. */
|
||||
if (link_info->executable
|
||||
&& !link_info->relocatable
|
||||
if (bfd_link_executable (link_info)
|
||||
&& !bfd_link_relocatable (link_info)
|
||||
&& h == htab->tls_get_addr
|
||||
&& irel != internal_relocs)
|
||||
{
|
||||
@ -7038,7 +7038,7 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
bfd_vma addend = 0;
|
||||
struct plt_entry *ent;
|
||||
|
||||
if (r_type == R_PPC_PLTREL24 && link_info->shared)
|
||||
if (r_type == R_PPC_PLTREL24 && bfd_link_pic (link_info))
|
||||
addend = irel->r_addend;
|
||||
ent = find_plt_ent (plist, got2, addend);
|
||||
if (ent != NULL)
|
||||
@ -7104,7 +7104,7 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
toff += irel->r_addend;
|
||||
|
||||
/* Attempted -shared link of non-pic code loses. */
|
||||
if ((!link_info->relocatable
|
||||
if ((!bfd_link_relocatable (link_info)
|
||||
&& tsec == bfd_und_section_ptr)
|
||||
|| tsec->output_section == NULL
|
||||
|| (tsec->owner != NULL
|
||||
@ -7115,7 +7115,7 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
|
||||
/* If the branch is in range, no need to do anything. */
|
||||
if (tsec != bfd_und_section_ptr
|
||||
&& (!link_info->relocatable
|
||||
&& (!bfd_link_relocatable (link_info)
|
||||
/* A relocatable link may have sections moved during
|
||||
final link, so do not presume they remain in range. */
|
||||
|| tsec->output_section == isec->output_section))
|
||||
@ -7145,7 +7145,7 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
one. We'll report an error later. */
|
||||
continue;
|
||||
|
||||
if (link_info->shared)
|
||||
if (bfd_link_pic (link_info))
|
||||
{
|
||||
size = 4 * ARRAY_SIZE (shared_stub_entry);
|
||||
insn_offset = 12;
|
||||
@ -7240,7 +7240,7 @@ ppc_elf_relax_section (bfd *abfd,
|
||||
workaround_change = FALSE;
|
||||
newsize = trampoff;
|
||||
if (htab->params->ppc476_workaround
|
||||
&& (!link_info->relocatable
|
||||
&& (!bfd_link_relocatable (link_info)
|
||||
|| isec->output_section->alignment_power >= htab->params->pagesize_p2))
|
||||
{
|
||||
bfd_vma addr, end_addr;
|
||||
@ -7448,7 +7448,7 @@ write_glink_stub (struct plt_entry *ent, asection *plt_sec, unsigned char *p,
|
||||
+ plt_sec->output_section->vma
|
||||
+ plt_sec->output_offset);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_vma got = 0;
|
||||
|
||||
@ -7666,7 +7666,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
"%ld relocations%s",
|
||||
input_bfd, input_section,
|
||||
(long) input_section->reloc_count,
|
||||
(info->relocatable) ? " (relocatable)" : "");
|
||||
(bfd_link_relocatable (info)) ? " (relocatable)" : "");
|
||||
#endif
|
||||
|
||||
got2 = bfd_get_section_by_name (input_bfd, ".got2");
|
||||
@ -7681,7 +7681,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
sym_hashes = elf_sym_hashes (input_bfd);
|
||||
/* We have to handle relocations in vxworks .tls_vars sections
|
||||
specially, because the dynamic loader is 'weird'. */
|
||||
is_vxworks_tls = (htab->is_vxworks && info->shared
|
||||
is_vxworks_tls = (htab->is_vxworks && bfd_link_pic (info)
|
||||
&& !strcmp (input_section->output_section->name,
|
||||
".tls_vars"));
|
||||
if (input_section->sec_info_type == SEC_INFO_TYPE_TARGET)
|
||||
@ -7747,7 +7747,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
rel, 1, relend, howto, 0, contents);
|
||||
}
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
{
|
||||
if (got2 != NULL
|
||||
&& r_type == R_PPC_PLTREL24
|
||||
@ -8173,11 +8173,11 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
ent = NULL;
|
||||
if (ifunc != NULL
|
||||
&& (!info->shared
|
||||
&& (!bfd_link_pic (info)
|
||||
|| is_branch_reloc (r_type)))
|
||||
{
|
||||
addend = 0;
|
||||
if (r_type == R_PPC_PLTREL24 && info->shared)
|
||||
if (r_type == R_PPC_PLTREL24 && bfd_link_pic (info))
|
||||
addend = rel->r_addend;
|
||||
ent = find_plt_ent (ifunc, got2, addend);
|
||||
}
|
||||
@ -8305,8 +8305,8 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
bfd_boolean dyn;
|
||||
dyn = htab->elf.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)))
|
||||
/* This is actually a static link, or it is a
|
||||
-Bsymbolic link and the symbol is defined
|
||||
@ -8374,7 +8374,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
|
||||
/* Generate relocs for the dynamic linker. */
|
||||
if ((info->shared || indx != 0)
|
||||
if ((bfd_link_pic (info) || indx != 0)
|
||||
&& (offp == &htab->tlsld_got.offset
|
||||
|| h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
@ -8623,7 +8623,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
case R_PPC_ADDR14:
|
||||
case R_PPC_ADDR14_BRTAKEN:
|
||||
case R_PPC_ADDR14_BRNTAKEN:
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
break;
|
||||
/* fall through */
|
||||
|
||||
@ -8632,7 +8632,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
|| is_vxworks_tls)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& !(h != NULL
|
||||
&& ((h->root.type == bfd_link_hash_undefined
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
|
||||
@ -8642,7 +8642,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
&& (must_be_dyn_reloc (info, r_type)
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -8793,7 +8793,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (r_type == R_PPC_RELAX_PLTREL24)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
got2_addend = addend;
|
||||
addend = 0;
|
||||
}
|
||||
@ -8816,7 +8816,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
size_t insn_offset = rel->r_offset;
|
||||
unsigned int insn;
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
relocation -= (input_section->output_section->vma
|
||||
+ input_section->output_offset
|
||||
@ -8835,7 +8835,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
|
||||
relocation += addend;
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
relocation = 0;
|
||||
|
||||
/* First insn is HA, second is LO. */
|
||||
@ -8921,7 +8921,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
if (h != NULL && ifunc == NULL)
|
||||
{
|
||||
struct plt_entry *ent = find_plt_ent (&h->plt.plist, got2,
|
||||
info->shared ? addend : 0);
|
||||
bfd_link_pic (info) ? addend : 0);
|
||||
if (ent == NULL
|
||||
|| htab->plt == NULL)
|
||||
{
|
||||
@ -9471,7 +9471,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (htab->params->ppc476_workaround
|
||||
&& input_section->sec_info_type == SEC_INFO_TYPE_TARGET
|
||||
&& (!info->relocatable
|
||||
&& (!bfd_link_relocatable (info)
|
||||
|| (input_section->output_section->alignment_power
|
||||
>= htab->params->pagesize_p2)))
|
||||
{
|
||||
@ -9683,9 +9683,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
|
||||
bfd_vma delta = ((insn & 0xfffc) ^ 0x8000) - 0x8000;
|
||||
|
||||
delta += offset - patch_off;
|
||||
if (info->relocatable && rel != NULL)
|
||||
if (bfd_link_relocatable (info) && rel != NULL)
|
||||
delta = 0;
|
||||
if (!info->relocatable && rel != NULL)
|
||||
if (!bfd_link_relocatable (info) && rel != NULL)
|
||||
{
|
||||
enum elf_ppc_reloc_type r_type;
|
||||
|
||||
@ -9811,11 +9811,11 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
got_offset = (reloc_index + 3) * 4;
|
||||
|
||||
/* Use the right PLT. */
|
||||
plt_entry = info->shared ? ppc_elf_vxworks_pic_plt_entry
|
||||
plt_entry = bfd_link_pic (info) ? ppc_elf_vxworks_pic_plt_entry
|
||||
: ppc_elf_vxworks_plt_entry;
|
||||
|
||||
/* Fill in the .plt on VxWorks. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_put_32 (output_bfd,
|
||||
plt_entry[0] | PPC_HA (got_offset),
|
||||
@ -9873,7 +9873,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
+ ent->plt.offset + 16),
|
||||
htab->sgotplt->contents + got_offset);
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
/* Fill in a couple of entries in .rela.plt.unloaded. */
|
||||
loc = htab->srelplt2->contents
|
||||
@ -9995,7 +9995,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
}
|
||||
}
|
||||
else if (h->type == STT_GNU_IFUNC
|
||||
&& !info->shared)
|
||||
&& !bfd_link_pic (info))
|
||||
{
|
||||
/* Set the value of ifunc symbols in a non-pie
|
||||
executable to the glink entry. This is to avoid
|
||||
@ -10047,7 +10047,7 @@ ppc_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
write_glink_stub (ent, splt, p, info);
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
/* We only need one non-PIC glink stub. */
|
||||
break;
|
||||
}
|
||||
@ -10242,11 +10242,11 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
/* Use the right PLT. */
|
||||
const bfd_vma *plt_entry = (info->shared
|
||||
const bfd_vma *plt_entry = (bfd_link_pic (info)
|
||||
? ppc_elf_vxworks_pic_plt0_entry
|
||||
: ppc_elf_vxworks_plt0_entry);
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
bfd_vma got_value = SYM_VAL (htab->elf.hgot);
|
||||
|
||||
@ -10267,7 +10267,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
bfd_put_32 (output_bfd, plt_entry[6], splt->contents + 24);
|
||||
bfd_put_32 (output_bfd, plt_entry[7], splt->contents + 28);
|
||||
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela rela;
|
||||
bfd_byte *loc;
|
||||
@ -10484,7 +10484,7 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
}
|
||||
|
||||
/* Last comes the PLTresolve stub. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
bfd_vma bcl;
|
||||
|
||||
|
@ -758,7 +758,7 @@ rl78_elf_relocate_section
|
||||
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,
|
||||
@ -1310,7 +1310,7 @@ rl78_elf_check_relocs
|
||||
asection *splt;
|
||||
bfd *dynobj;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -1442,7 +1442,7 @@ rl78_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
bfd *dynobj;
|
||||
asection *splt;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -1529,7 +1529,7 @@ rl78_elf_relax_plt_section (bfd *dynobj,
|
||||
/* Assume nothing changes. */
|
||||
*again = FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
/* We only relax the .plt section at the moment. */
|
||||
@ -2088,7 +2088,7 @@ rl78_elf_relax_section
|
||||
/* 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)
|
||||
|
@ -632,7 +632,7 @@ rx_elf_relocate_section
|
||||
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,
|
||||
@ -2003,7 +2003,7 @@ elf32_rx_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)
|
||||
|
100
bfd/elf32-s390.c
100
bfd/elf32-s390.c
@ -856,11 +856,11 @@ elf_s390_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||
htab->elf.splt = bfd_get_linker_section (dynobj, ".plt");
|
||||
htab->elf.srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
|
||||
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
|
||||
|
||||
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -937,7 +937,7 @@ elf_s390_tls_transition (struct bfd_link_info *info,
|
||||
int r_type,
|
||||
int is_local)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return r_type;
|
||||
|
||||
switch (r_type)
|
||||
@ -978,7 +978,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
int tls_type, old_tls_type;
|
||||
Elf_Internal_Sym *isym;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_s390_elf (abfd));
|
||||
@ -1177,7 +1177,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
case R_390_TLS_GOTIE20:
|
||||
case R_390_TLS_GOTIE32:
|
||||
case R_390_TLS_IEENT:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through. */
|
||||
|
||||
@ -1253,10 +1253,10 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
/* For static linking and executables this reloc will be
|
||||
calculated at linktime otherwise a TLS_TPOFF runtime
|
||||
reloc will be generated. */
|
||||
if (r_type == R_390_TLS_LE32 && info->pie)
|
||||
if (r_type == R_390_TLS_LE32 && bfd_link_pie (info))
|
||||
break;
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
break;
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through. */
|
||||
@ -1280,7 +1280,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
adjust_dynamic_symbol. */
|
||||
h->non_got_ref = 1;
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a .plt entry if the function this reloc
|
||||
refers to is in a shared lib. */
|
||||
@ -1309,7 +1309,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& ((ELF32_R_TYPE (rel->r_info) != R_390_PC16
|
||||
&& ELF32_R_TYPE (rel->r_info) != R_390_PC12DBL
|
||||
@ -1322,7 +1322,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -1459,7 +1459,7 @@ elf_s390_gc_sweep_hook (bfd *abfd,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf_s390_hash_table (info);
|
||||
@ -1565,7 +1565,7 @@ elf_s390_gc_sweep_hook (bfd *abfd,
|
||||
case R_390_PC24DBL:
|
||||
case R_390_PC32DBL:
|
||||
case R_390_PC32:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
break;
|
||||
/* Fall through. */
|
||||
|
||||
@ -1702,7 +1702,7 @@ elf_s390_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
|
||||
@ -1799,7 +1799,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
{
|
||||
asection *s = htab->elf.splt;
|
||||
@ -1816,7 +1816,7 @@ allocate_dynrelocs (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 = s;
|
||||
@ -1852,7 +1852,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
to R_390_TLS_LE32 requiring no TLS entry. For GOTIE12 and IEENT
|
||||
we can save the dynamic TLS relocation. */
|
||||
if (h->got.refcount > 0
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
|
||||
{
|
||||
@ -1898,7 +1898,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
htab->elf.srelgot->size += 2 * sizeof (Elf32_External_Rela);
|
||||
else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
htab->elf.srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
@ -1914,7 +1914,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
@ -2039,7 +2039,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->elf.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");
|
||||
if (s == NULL)
|
||||
@ -2107,7 +2107,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
s->size += GOT_ENTRY_SIZE;
|
||||
if (*local_tls_type == GOT_TLS_GD)
|
||||
s->size += GOT_ENTRY_SIZE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srela->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2216,7 +2216,7 @@ elf_s390_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;
|
||||
@ -2432,7 +2432,7 @@ elf_s390_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;
|
||||
|
||||
switch (r_type)
|
||||
@ -2515,8 +2515,10 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
finish_dynamic_symbol. */
|
||||
}
|
||||
}
|
||||
else if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|
||||
|| (info->shared
|
||||
else if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h)
|
||||
|| (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -2544,7 +2546,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
|
||||
if ((h->def_regular
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
/* lrl rx,sym@GOTENT -> larl rx, sym */
|
||||
&& ((r_type == R_390_GOTENT
|
||||
@ -2593,7 +2595,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
bfd_put_32 (output_bfd, relocation,
|
||||
htab->elf.sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srelgot;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -2726,7 +2728,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
&& s390_is_ifunc_symbol_p (h)
|
||||
&& h->def_regular)
|
||||
{
|
||||
if (!info->shared || !h->non_got_ref)
|
||||
if (!bfd_link_pic (info) || !h->non_got_ref)
|
||||
{
|
||||
/* For a non-shared object STT_GNU_IFUNC symbol must
|
||||
go through PLT. */
|
||||
@ -2757,7 +2759,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (h->dynindx == -1
|
||||
|| h->forced_local
|
||||
|| info->executable)
|
||||
|| bfd_link_executable (info))
|
||||
{
|
||||
/* This symbol is resolved locally. */
|
||||
outrel.r_info = ELF32_R_INFO (0, R_390_IRELATIVE);
|
||||
@ -2786,7 +2788,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
if ((input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
@ -2798,7 +2800,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
&& r_type != R_390_PC32)
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -2839,7 +2841,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|| r_type == R_390_PC24DBL
|
||||
|| r_type == R_390_PC32DBL
|
||||
|| r_type == R_390_PC32
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
{
|
||||
@ -2909,7 +2911,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|
||||
/* Relocations for tls literal pool entries. */
|
||||
case R_390_TLS_IE32:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@ -2937,7 +2939,9 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
else if (h != NULL)
|
||||
{
|
||||
tls_type = elf_s390_hash_entry(h)->tls_type;
|
||||
if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
|
||||
if (!bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& tls_type >= GOT_TLS_IE)
|
||||
r_type = R_390_TLS_LE32;
|
||||
}
|
||||
if (r_type == R_390_TLS_GD32 && tls_type >= GOT_TLS_IE)
|
||||
@ -3048,14 +3052,16 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
if (local_got_offsets == NULL)
|
||||
abort();
|
||||
off = local_got_offsets[r_symndx];
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
goto emit_tls_relocs;
|
||||
}
|
||||
else
|
||||
{
|
||||
off = h->got.offset;
|
||||
tls_type = elf_s390_hash_entry(h)->tls_type;
|
||||
if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE)
|
||||
if (bfd_link_pic (info)
|
||||
|| h->dynindx != -1
|
||||
|| tls_type < GOT_TLS_IE)
|
||||
goto emit_tls_relocs;
|
||||
}
|
||||
|
||||
@ -3072,7 +3078,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_390_TLS_LDM32:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
/* The literal pool entry this relocation refers to gets ignored
|
||||
by the optimized code of the local exec model. Do nothing
|
||||
and the value will turn out zero. */
|
||||
@ -3110,7 +3116,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_390_TLS_LE32:
|
||||
if (info->shared && !info->pie)
|
||||
if (bfd_link_pic (info) && !bfd_link_pie (info))
|
||||
{
|
||||
/* Linking a shared library with non-fpic code requires
|
||||
a R_390_TLS_TPOFF relocation. */
|
||||
@ -3147,7 +3153,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
continue;
|
||||
|
||||
case R_390_TLS_LDO32:
|
||||
if (info->shared || (input_section->flags & SEC_DEBUGGING))
|
||||
if (bfd_link_pic (info) || (input_section->flags & SEC_DEBUGGING))
|
||||
relocation -= dtpoff_base (info);
|
||||
else
|
||||
/* When converting LDO to LE, we must negate. */
|
||||
@ -3169,7 +3175,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (r_type == R_390_TLS_LOAD)
|
||||
{
|
||||
if (!info->shared && (h == NULL || h->dynindx == -1))
|
||||
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
/* IE->LE transition. Four valid cases:
|
||||
l %rx,0(0,%ry) -> lr %rx,%ry + bcr 0,0
|
||||
@ -3207,7 +3213,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
(insn & 0xffff0000) != 0xc0e50000 &&
|
||||
(insn & 0xff000000) != 0x0d000000)
|
||||
invalid_tls_insn (input_bfd, input_section, rel);
|
||||
if (!info->shared && (h == NULL || h->dynindx == -1))
|
||||
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
if ((insn & 0xff000000) == 0x0d000000)
|
||||
{
|
||||
@ -3257,7 +3263,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
else if (r_type == R_390_TLS_LDCALL)
|
||||
{
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
unsigned int insn;
|
||||
|
||||
@ -3422,7 +3428,7 @@ elf_s390_finish_ifunc_symbol (bfd *output_bfd,
|
||||
= -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2);
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
memcpy (plt->contents + iplt_offset, elf_s390_plt_entry,
|
||||
PLT_ENTRY_SIZE);
|
||||
@ -3505,7 +3511,7 @@ elf_s390_finish_ifunc_symbol (bfd *output_bfd,
|
||||
|
||||
if (!h
|
||||
|| h->dynindx == -1
|
||||
|| ((info->executable
|
||||
|| ((bfd_link_executable (info)
|
||||
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
|
||||
&& h->def_regular))
|
||||
{
|
||||
@ -3584,7 +3590,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
|
||||
= -(unsigned) (((65536 / PLT_ENTRY_SIZE - 1) * PLT_ENTRY_SIZE) / 2);
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
memcpy (htab->elf.splt->contents + h->plt.offset, elf_s390_plt_entry,
|
||||
PLT_ENTRY_SIZE);
|
||||
@ -3708,7 +3714,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
|
||||
initialized in the relocate_section function. */
|
||||
if (h->def_regular && s390_is_ifunc_symbol_p (h))
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* An explicit GOT slot usage needs GLOB_DAT. If the
|
||||
symbol references local the implicit got.iplt slot
|
||||
@ -3728,7 +3734,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (info->shared
|
||||
else if (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
/* If this is a static link, or it is a -Bsymbolic link and
|
||||
@ -3870,7 +3876,7 @@ elf_s390_finish_dynamic_sections (bfd *output_bfd,
|
||||
if (htab->elf.splt && htab->elf.splt->size > 0)
|
||||
{
|
||||
memset (htab->elf.splt->contents, 0, PLT_FIRST_ENTRY_SIZE);
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
memcpy (htab->elf.splt->contents, elf_s390_plt_pic_first_entry,
|
||||
PLT_FIRST_ENTRY_SIZE);
|
||||
|
@ -1447,7 +1447,7 @@ score_elf_create_got_section (bfd *abfd,
|
||||
h->def_regular = 1;
|
||||
h->type = STT_OBJECT;
|
||||
|
||||
if (info->shared && ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
if (bfd_link_pic (info) && ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
|
||||
amt = sizeof (struct score_got_info);
|
||||
@ -2003,7 +2003,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
|
||||
elf_gp (output_bfd) = (bh->u.def.value
|
||||
+ bh->u.def.section->output_section->vma
|
||||
+ bh->u.def.section->output_offset);
|
||||
else if (info->relocatable)
|
||||
else if (bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_vma lo = -1;
|
||||
|
||||
@ -2067,7 +2067,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
|
||||
g = score_elf_global_got_index (elf_hash_table (info)->dynobj,
|
||||
(struct elf_link_hash_entry *) h);
|
||||
if ((! elf_hash_table (info)->dynamic_sections_created
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& (info->symbolic || h->root.dynindx == -1)
|
||||
&& h->root.def_regular)))
|
||||
{
|
||||
@ -2118,7 +2118,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
|
||||
|
||||
case R_SCORE_ABS32:
|
||||
case R_SCORE_REL32:
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
|| (elf_hash_table (info)->dynamic_sections_created
|
||||
&& h != NULL
|
||||
&& h->root.def_dynamic
|
||||
@ -2413,7 +2413,7 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd,
|
||||
if (elf_hash_table (info)->dynamic_sections_created)
|
||||
{
|
||||
bfd_size_type dynsecsymcount = 0;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection * p;
|
||||
const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
|
||||
@ -2464,7 +2464,7 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd,
|
||||
+ sym->st_value);
|
||||
name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
|
||||
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& (sec->flags & SEC_MERGE)
|
||||
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION)
|
||||
{
|
||||
@ -2661,11 +2661,11 @@ s3_bfd_score_elf_relocate_section (bfd *output_bfd,
|
||||
/* If this is a dynamic link, we should have created a _DYNAMIC_LINK symbol
|
||||
in s3_bfd_score_elf_create_dynamic_sections. Otherwise, we should define
|
||||
the symbol with a value of 0. */
|
||||
BFD_ASSERT (! info->shared);
|
||||
BFD_ASSERT (! bfd_link_pic (info));
|
||||
BFD_ASSERT (bfd_get_section_by_name (output_bfd, ".dynamic") == NULL);
|
||||
relocation = 0;
|
||||
}
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.root.string, input_bfd,
|
||||
@ -2681,7 +2681,7 @@ s3_bfd_score_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))
|
||||
{
|
||||
/* This is a relocatable link. We don't have to change
|
||||
anything, unless the reloc is against a section symbol,
|
||||
@ -2783,7 +2783,7 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
asection *sreloc;
|
||||
const struct elf_backend_data *bed;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -2864,7 +2864,9 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
break;
|
||||
case R_SCORE_ABS32:
|
||||
case R_SCORE_REL32:
|
||||
if (dynobj == NULL && (info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0)
|
||||
if (dynobj == NULL
|
||||
&& (bfd_link_pic (info) || h != NULL)
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
elf_hash_table (info)->dynobj = dynobj = abfd;
|
||||
break;
|
||||
default:
|
||||
@ -2907,7 +2909,8 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
break;
|
||||
case R_SCORE_ABS32:
|
||||
case R_SCORE_REL32:
|
||||
if ((info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0)
|
||||
if ((bfd_link_pic (info) || h != NULL)
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
if (sreloc == NULL)
|
||||
{
|
||||
@ -2916,7 +2919,7 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
return FALSE;
|
||||
}
|
||||
#define SCORE_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* When creating a shared object, we must copy these reloc types into
|
||||
the output file as R_SCORE_REL32 relocs. We make room for this reloc
|
||||
@ -3108,7 +3111,7 @@ s3_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
any R_SCORE_ABS32 or R_SCORE_REL32 relocs against it into the output
|
||||
file. */
|
||||
hscore = (struct score_elf_link_hash_entry *)h;
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& hscore->possibly_dynamic_relocs != 0
|
||||
&& (h->root.type == bfd_link_hash_defweak || !h->def_regular))
|
||||
{
|
||||
@ -3266,7 +3269,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
|
||||
if (elf_hash_table (info)->dynamic_sections_created)
|
||||
{
|
||||
/* Set the contents of the .interp section to the interpreter. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
s = bfd_get_linker_section (dynobj, ".interp");
|
||||
BFD_ASSERT (s != NULL);
|
||||
@ -3451,7 +3454,7 @@ s3_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -1305,7 +1305,8 @@ score_elf_create_got_section (bfd *abfd,
|
||||
h->def_regular = 1;
|
||||
h->type = STT_OBJECT;
|
||||
|
||||
if (info->shared && ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
if (bfd_link_pic (info)
|
||||
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
|
||||
amt = sizeof (struct score_got_info);
|
||||
@ -1852,7 +1853,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
|
||||
elf_gp (output_bfd) = (bh->u.def.value
|
||||
+ bh->u.def.section->output_section->vma
|
||||
+ bh->u.def.section->output_offset);
|
||||
else if (info->relocatable)
|
||||
else if (bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_vma lo = -1;
|
||||
|
||||
@ -1965,7 +1966,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
|
||||
g = score_elf_global_got_index (elf_hash_table (info)->dynobj,
|
||||
(struct elf_link_hash_entry *) h);
|
||||
if ((! elf_hash_table(info)->dynamic_sections_created
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& (info->symbolic || h->root.dynindx == -1)
|
||||
&& h->root.def_regular)))
|
||||
{
|
||||
@ -2017,7 +2018,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
|
||||
|
||||
case R_SCORE_ABS32:
|
||||
case R_SCORE_REL32:
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
|| (elf_hash_table (info)->dynamic_sections_created
|
||||
&& h != NULL
|
||||
&& h->root.def_dynamic
|
||||
@ -2251,7 +2252,7 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd,
|
||||
if (elf_hash_table (info)->dynamic_sections_created)
|
||||
{
|
||||
bfd_size_type dynsecsymcount = 0;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection * p;
|
||||
const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
|
||||
@ -2300,7 +2301,7 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd,
|
||||
relocation = sec->output_section->vma + sec->output_offset;
|
||||
name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, sec);
|
||||
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (ELF_ST_TYPE (sym->st_info) != STT_SECTION
|
||||
|| (sec->flags & SEC_MERGE))
|
||||
@ -2433,11 +2434,11 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd,
|
||||
/* If this is a dynamic link, we should have created a _DYNAMIC_LINK symbol
|
||||
in s7_bfd_score_elf_create_dynamic_sections. Otherwise, we should define
|
||||
the symbol with a value of 0. */
|
||||
BFD_ASSERT (! info->shared);
|
||||
BFD_ASSERT (! bfd_link_pic (info));
|
||||
BFD_ASSERT (bfd_get_section_by_name (output_bfd, ".dynamic") == NULL);
|
||||
relocation = 0;
|
||||
}
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.root.string, input_bfd,
|
||||
@ -2453,7 +2454,7 @@ s7_bfd_score_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))
|
||||
{
|
||||
/* This is a relocatable link. We don't have to change
|
||||
anything, unless the reloc is against a section symbol,
|
||||
@ -2588,7 +2589,7 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
asection *sreloc;
|
||||
const struct elf_backend_data *bed;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -2669,7 +2670,9 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
break;
|
||||
case R_SCORE_ABS32:
|
||||
case R_SCORE_REL32:
|
||||
if (dynobj == NULL && (info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0)
|
||||
if (dynobj == NULL
|
||||
&& (bfd_link_pic (info) || h != NULL)
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
elf_hash_table (info)->dynobj = dynobj = abfd;
|
||||
break;
|
||||
default:
|
||||
@ -2712,7 +2715,8 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
break;
|
||||
case R_SCORE_ABS32:
|
||||
case R_SCORE_REL32:
|
||||
if ((info->shared || h != NULL) && (sec->flags & SEC_ALLOC) != 0)
|
||||
if ((bfd_link_pic (info) || h != NULL)
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
if (sreloc == NULL)
|
||||
{
|
||||
@ -2721,7 +2725,7 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
|
||||
return FALSE;
|
||||
}
|
||||
#define SCORE_READONLY_SECTION (SEC_ALLOC | SEC_LOAD | SEC_READONLY)
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* When creating a shared object, we must copy these reloc types into
|
||||
the output file as R_SCORE_REL32 relocs. We make room for this reloc
|
||||
@ -2914,7 +2918,7 @@ s7_bfd_score_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
any R_SCORE_ABS32 or R_SCORE_REL32 relocs against it into the output
|
||||
file. */
|
||||
hscore = (struct score_elf_link_hash_entry *) h;
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& hscore->possibly_dynamic_relocs != 0
|
||||
&& (h->root.type == bfd_link_hash_defweak || !h->def_regular))
|
||||
{
|
||||
@ -3074,7 +3078,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
|
||||
if (elf_hash_table (info)->dynamic_sections_created)
|
||||
{
|
||||
/* Set the contents of the .interp section to the interpreter. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
s = bfd_get_linker_section (dynobj, ".interp");
|
||||
BFD_ASSERT (s != NULL);
|
||||
@ -3259,7 +3263,7 @@ s7_bfd_score_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
const char *name;
|
||||
|
||||
|
@ -432,7 +432,7 @@ sh_symbian_relocate_section (bfd * output_bfd,
|
||||
asection ** local_sections)
|
||||
{
|
||||
/* When performing a final link we implement the IMPORT AS directives. */
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
Elf_Internal_Rela * rel;
|
||||
Elf_Internal_Rela * relend;
|
||||
|
143
bfd/elf32-sh.c
143
bfd/elf32-sh.c
@ -519,7 +519,7 @@ sh_elf_relax_section (bfd *abfd, asection *sec,
|
||||
|
||||
*again = FALSE;
|
||||
|
||||
if (link_info->relocatable
|
||||
if (bfd_link_relocatable (link_info)
|
||||
|| (sec->flags & SEC_RELOC) == 0
|
||||
|| sec->reloc_count == 0)
|
||||
return TRUE;
|
||||
@ -2733,7 +2733,7 @@ sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
h->type = STT_OBJECT;
|
||||
htab->root.hplt = h;
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
}
|
||||
@ -2776,7 +2776,7 @@ sh_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
|
||||
@ -2871,7 +2871,7 @@ sh_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
|
||||
@ -2978,7 +2978,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
{
|
||||
asection *s = htab->splt;
|
||||
@ -2998,7 +2998,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
the shared library. Skip this for FDPIC, since the
|
||||
function's address will be the address of the canonical
|
||||
function descriptor. */
|
||||
if (!htab->fdpic_p && !info->shared && !h->def_regular)
|
||||
if (!htab->fdpic_p && !bfd_link_pic (info) && !h->def_regular)
|
||||
{
|
||||
h->root.u.def.section = s;
|
||||
h->root.u.def.value = h->plt.offset;
|
||||
@ -3021,7 +3021,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
/* We also need to make an entry in the .rel.plt section. */
|
||||
htab->srelplt->size += sizeof (Elf32_External_Rela);
|
||||
|
||||
if (htab->vxworks_p && !info->shared)
|
||||
if (htab->vxworks_p && !bfd_link_pic (info))
|
||||
{
|
||||
/* VxWorks executables have a second set of relocations
|
||||
for each PLT entry. They go in a separate relocation
|
||||
@ -3075,13 +3075,15 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
if (!dyn)
|
||||
{
|
||||
/* No dynamic relocations required. */
|
||||
if (htab->fdpic_p && !info->shared
|
||||
if (htab->fdpic_p && !bfd_link_pic (info)
|
||||
&& h->root.type != bfd_link_hash_undefweak
|
||||
&& (got_type == GOT_NORMAL || got_type == GOT_FUNCDESC))
|
||||
htab->srofixup->size += 4;
|
||||
}
|
||||
/* No dynamic relocations required when IE->LE conversion happens. */
|
||||
else if (got_type == GOT_TLS_IE && !h->def_dynamic && !info->shared)
|
||||
else if (got_type == GOT_TLS_IE
|
||||
&& !h->def_dynamic
|
||||
&& !bfd_link_pic (info))
|
||||
;
|
||||
/* R_SH_TLS_IE_32 needs one dynamic relocation if dynamic,
|
||||
R_SH_TLS_GD needs one if local symbol and two if global. */
|
||||
@ -3092,17 +3094,19 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
htab->srelgot->size += 2 * sizeof (Elf32_External_Rela);
|
||||
else if (got_type == GOT_FUNCDESC)
|
||||
{
|
||||
if (!info->shared && SYMBOL_FUNCDESC_LOCAL (info, h))
|
||||
if (!bfd_link_pic (info) && SYMBOL_FUNCDESC_LOCAL (info, h))
|
||||
htab->srofixup->size += 4;
|
||||
else
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
else if (htab->fdpic_p && !info->shared && got_type == GOT_NORMAL
|
||||
else if (htab->fdpic_p
|
||||
&& !bfd_link_pic (info)
|
||||
&& got_type == GOT_NORMAL
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak))
|
||||
htab->srofixup->size += 4;
|
||||
@ -3129,7 +3133,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
eh->datalabel_got.offset = s->size;
|
||||
s->size += 4;
|
||||
dyn = htab->root.dynamic_sections_created;
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h))
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -3146,7 +3150,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
|| (htab->root.dynamic_sections_created
|
||||
&& ! SYMBOL_CALLS_LOCAL (info, h))))
|
||||
{
|
||||
if (!info->shared && SYMBOL_FUNCDESC_LOCAL (info, h))
|
||||
if (!bfd_link_pic (info) && SYMBOL_FUNCDESC_LOCAL (info, h))
|
||||
htab->srofixup->size += eh->abs_funcdesc_refcount * 4;
|
||||
else
|
||||
htab->srelgot->size
|
||||
@ -3170,7 +3174,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
/* We will need a relocation or two fixups to initialize the
|
||||
function descriptor, so allocate those too. */
|
||||
if (!info->shared && SYMBOL_CALLS_LOCAL (info, h))
|
||||
if (!bfd_link_pic (info) && SYMBOL_CALLS_LOCAL (info, h))
|
||||
htab->srofixup->size += 8;
|
||||
else
|
||||
htab->srelfuncdesc->size += sizeof (Elf32_External_Rela);
|
||||
@ -3185,7 +3189,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
@ -3273,7 +3277,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
sreloc->size += p->count * sizeof (Elf32_External_Rela);
|
||||
|
||||
/* If we need relocations, we do not need fixups. */
|
||||
if (htab->fdpic_p && !info->shared)
|
||||
if (htab->fdpic_p && !bfd_link_pic (info))
|
||||
htab->srofixup->size -= 4 * (p->count - p->pc_count);
|
||||
}
|
||||
|
||||
@ -3313,9 +3317,10 @@ readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
static bfd_boolean
|
||||
sh_elf_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
{
|
||||
sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd, info->shared);
|
||||
sh_elf_hash_table (info)->plt_info = get_plt_info (output_bfd,
|
||||
bfd_link_pic (info));
|
||||
|
||||
if (sh_elf_hash_table (info)->fdpic_p && !info->relocatable
|
||||
if (sh_elf_hash_table (info)->fdpic_p && !bfd_link_relocatable (info)
|
||||
&& !bfd_elf_stack_segment_size (output_bfd, info,
|
||||
"__stacksize", DEFAULT_STACK_SIZE))
|
||||
return FALSE;
|
||||
@ -3344,7 +3349,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->root.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);
|
||||
@ -3400,7 +3405,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
info->flags |= DF_TEXTREL;
|
||||
|
||||
/* If we need relocations, we do not need fixups. */
|
||||
if (htab->fdpic_p && !info->shared)
|
||||
if (htab->fdpic_p && !bfd_link_pic (info))
|
||||
htab->srofixup->size -= 4 * (p->count - p->pc_count);
|
||||
}
|
||||
}
|
||||
@ -3429,7 +3434,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
s->size += 4;
|
||||
if (*local_got_type == GOT_TLS_GD)
|
||||
s->size += 4;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
else
|
||||
htab->srofixup->size += 4;
|
||||
@ -3470,7 +3475,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
local_funcdesc->offset = htab->sfuncdesc->size;
|
||||
htab->sfuncdesc->size += 8;
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srofixup->size += 8;
|
||||
else
|
||||
htab->srelfuncdesc->size += sizeof (Elf32_External_Rela);
|
||||
@ -3589,7 +3594,7 @@ sh_elf_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;
|
||||
@ -3749,7 +3754,7 @@ sh_elf_initialize_funcdesc (bfd *output_bfd,
|
||||
addr = seg = 0;
|
||||
}
|
||||
|
||||
if (!info->shared && SYMBOL_CALLS_LOCAL (info, h))
|
||||
if (!bfd_link_pic (info) && SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
if (h == NULL || h->root.type != bfd_link_hash_undefweak)
|
||||
{
|
||||
@ -3866,7 +3871,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
/* We have to handle relocations in vxworks .tls_vars sections
|
||||
specially, because the dynamic loader is 'weird'. */
|
||||
is_vxworks_tls = (htab && htab->vxworks_p && info->shared
|
||||
is_vxworks_tls = (htab && htab->vxworks_p && bfd_link_pic (info)
|
||||
&& !strcmp (input_section->output_section->name,
|
||||
".tls_vars"));
|
||||
|
||||
@ -3956,7 +3961,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
if (sec != NULL && discarded_section (sec))
|
||||
/* Handled below. */
|
||||
;
|
||||
else if (info->relocatable)
|
||||
else 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,
|
||||
@ -4071,8 +4076,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|| r_type == R_SH_GOT_MEDLOW16
|
||||
|| r_type == R_SH_GOT_MEDHI16
|
||||
|| r_type == R_SH_GOT_HI16)
|
||||
&& WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|
||||
&& (! info->shared
|
||||
&& WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h)
|
||||
&& (! bfd_link_pic (info)
|
||||
|| (! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular))
|
||||
/* The cases above are those in which relocation is
|
||||
@ -4080,7 +4087,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
below are those in which we must defer relocation
|
||||
to run-time, because we can't resolve absolute
|
||||
addresses when creating a shared library. */
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& ((! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular)
|
||||
&& ((r_type == R_SH_DIR32
|
||||
@ -4113,7 +4120,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
STT_DATALABEL on the way to it. */
|
||||
| ((h->other & STO_SH5_ISA32) != 0
|
||||
&& ! seen_stt_datalabel));
|
||||
else if (!info->relocatable
|
||||
else if (!bfd_link_relocatable (info)
|
||||
&& (_bfd_elf_section_offset (output_bfd, info,
|
||||
input_section,
|
||||
rel->r_offset)
|
||||
@ -4134,7 +4141,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (info->unresolved_syms_in_objects == RM_IGNORE
|
||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
|
||||
;
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (! info->callbacks->undefined_symbol
|
||||
(info, h->root.root.string, input_bfd,
|
||||
@ -4149,7 +4156,7 @@ sh_elf_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;
|
||||
|
||||
/* Check for inter-segment relocations in FDPIC files. Most
|
||||
@ -4294,7 +4301,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
case R_SH_IMM_MEDHI16_PCREL:
|
||||
case R_SH_IMM_HI16_PCREL:
|
||||
#endif
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
@ -4409,7 +4416,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
if (! relocate)
|
||||
continue;
|
||||
}
|
||||
else if (fdpic_p && !info->shared
|
||||
else if (fdpic_p && !bfd_link_pic (info)
|
||||
&& r_type == R_SH_DIR32
|
||||
&& (input_section->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
@ -4461,7 +4468,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
if (h == NULL
|
||||
|| h->forced_local
|
||||
|| ! info->shared
|
||||
|| ! bfd_link_pic (info)
|
||||
|| info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->plt.offset == (bfd_vma) -1
|
||||
@ -4518,8 +4525,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
BFD_ASSERT (off != (bfd_vma) -1);
|
||||
|
||||
dyn = htab->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))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -4556,7 +4565,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
/* If we initialize the GOT entry here with a valid
|
||||
symbol address, also add a fixup. */
|
||||
if (fdpic_p && !info->shared
|
||||
if (fdpic_p && !bfd_link_pic (info)
|
||||
&& sh_elf_hash_entry (h)->got_type == GOT_NORMAL
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak))
|
||||
@ -4602,7 +4611,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
{
|
||||
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_byte *loc;
|
||||
@ -4889,7 +4898,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
relocation = htab->sfuncdesc->output_offset + (offset & ~1);
|
||||
}
|
||||
|
||||
if (!info->shared && SYMBOL_FUNCDESC_LOCAL (info, h))
|
||||
if (!bfd_link_pic (info) && SYMBOL_FUNCDESC_LOCAL (info, h))
|
||||
{
|
||||
bfd_vma offset;
|
||||
|
||||
@ -5092,7 +5101,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (h != NULL)
|
||||
{
|
||||
got_type = sh_elf_hash_entry (h)->got_type;
|
||||
if (! info->shared
|
||||
if (! bfd_link_pic (info)
|
||||
&& (h->dynindx == -1
|
||||
|| h->def_regular))
|
||||
r_type = R_SH_TLS_LE_32;
|
||||
@ -5336,7 +5345,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
case R_SH_TLS_LD_32:
|
||||
BFD_ASSERT (htab);
|
||||
check_segment[0] = check_segment[1] = -1;
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
bfd_vma offset;
|
||||
unsigned short insn;
|
||||
@ -5415,7 +5424,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
case R_SH_TLS_LDO_32:
|
||||
check_segment[0] = check_segment[1] = -1;
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
relocation = tpoff (info, relocation);
|
||||
else
|
||||
relocation -= dtpoff_base (info);
|
||||
@ -5431,7 +5440,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
check_segment[0] = check_segment[1] = -1;
|
||||
|
||||
if (! info->shared || info->pie)
|
||||
if (! bfd_link_pic (info) || bfd_link_pie (info))
|
||||
{
|
||||
relocation = tpoff (info, relocation);
|
||||
addend = rel->r_addend;
|
||||
@ -5474,7 +5483,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
/* We don't want duplicate errors for undefined symbols. */
|
||||
if (!h || h->root.type != bfd_link_hash_undefined)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
info->callbacks->einfo
|
||||
(_("%X%C: relocation to \"%s\" references a different segment\n"),
|
||||
@ -5691,7 +5700,7 @@ sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
union gotref *local_funcdesc;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
elf_section_data (sec)->local_dynrel = NULL;
|
||||
@ -5803,7 +5812,7 @@ sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_SH_FUNCDESC:
|
||||
if (h != NULL)
|
||||
sh_elf_hash_entry (h)->abs_funcdesc_refcount -= 1;
|
||||
else if (sh_elf_hash_table (info)->fdpic_p && !info->shared)
|
||||
else if (sh_elf_hash_table (info)->fdpic_p && !bfd_link_pic (info))
|
||||
sh_elf_hash_table (info)->srofixup->size -= 4;
|
||||
|
||||
/* Fall through. */
|
||||
@ -5817,13 +5826,13 @@ sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
break;
|
||||
|
||||
case R_SH_DIR32:
|
||||
if (sh_elf_hash_table (info)->fdpic_p && !info->shared
|
||||
if (sh_elf_hash_table (info)->fdpic_p && !bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
sh_elf_hash_table (info)->srofixup->size -= 4;
|
||||
/* Fall thru */
|
||||
|
||||
case R_SH_REL32:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
break;
|
||||
/* Fall thru */
|
||||
|
||||
@ -5972,7 +5981,7 @@ static int
|
||||
sh_elf_optimized_tls_reloc (struct bfd_link_info *info, int r_type,
|
||||
int is_local)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return r_type;
|
||||
|
||||
switch (r_type)
|
||||
@ -6008,7 +6017,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
|
||||
sreloc = NULL;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_sh_elf (abfd));
|
||||
@ -6052,7 +6061,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
}
|
||||
|
||||
r_type = sh_elf_optimized_tls_reloc (info, r_type, h == NULL);
|
||||
if (! info->shared
|
||||
if (! bfd_link_pic (info)
|
||||
&& r_type == R_SH_TLS_IE_32
|
||||
&& h != NULL
|
||||
&& h->root.type != bfd_link_hash_undefined
|
||||
@ -6160,7 +6169,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
break;
|
||||
|
||||
case R_SH_TLS_IE_32:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
|
||||
/* FALLTHROUGH */
|
||||
@ -6329,7 +6338,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
|
||||
if (r_type == R_SH_FUNCDESC)
|
||||
{
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srofixup->size += 4;
|
||||
else
|
||||
htab->srelgot->size += sizeof (Elf32_External_Rela);
|
||||
@ -6372,7 +6381,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
|
||||
if (h == NULL
|
||||
|| h->forced_local
|
||||
|| ! info->shared
|
||||
|| ! bfd_link_pic (info)
|
||||
|| info->symbolic
|
||||
|| h->dynindx == -1)
|
||||
goto force_got;
|
||||
@ -6417,7 +6426,7 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
case R_SH_IMM_MEDHI16_PCREL:
|
||||
case R_SH_IMM_HI16_PCREL:
|
||||
#endif
|
||||
if (h != NULL && ! info->shared)
|
||||
if (h != NULL && ! bfd_link_pic (info))
|
||||
{
|
||||
h->non_got_ref = 1;
|
||||
h->plt.refcount += 1;
|
||||
@ -6442,14 +6451,14 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (r_type != R_SH_REL32
|
||||
|| (h != NULL
|
||||
&& (! info->symbolic
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (! info->shared
|
||||
|| (! bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -6526,14 +6535,14 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
/* Allocate the fixup regardless of whether we need a relocation.
|
||||
If we end up generating the relocation, we'll unallocate the
|
||||
fixup. */
|
||||
if (htab->fdpic_p && !info->shared
|
||||
if (htab->fdpic_p && !bfd_link_pic (info)
|
||||
&& r_type == R_SH_DIR32
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
htab->srofixup->size += 4;
|
||||
break;
|
||||
|
||||
case R_SH_TLS_LE_32:
|
||||
if (info->shared && !info->pie)
|
||||
if (bfd_link_pic (info) && !bfd_link_pie (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: TLS local exec code cannot be linked into shared objects"),
|
||||
@ -6745,7 +6754,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
got_offset = (plt_index + 3) * 4;
|
||||
|
||||
#ifdef GOT_BIAS
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
got_offset -= GOT_BIAS;
|
||||
#endif
|
||||
|
||||
@ -6754,7 +6763,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
plt_info->symbol_entry,
|
||||
plt_info->symbol_entry_size);
|
||||
|
||||
if (info->shared || htab->fdpic_p)
|
||||
if (bfd_link_pic (info) || htab->fdpic_p)
|
||||
{
|
||||
if (plt_info->symbol_fields.got20)
|
||||
{
|
||||
@ -6823,7 +6832,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
/* Make got_offset relative to the start of .got.plt. */
|
||||
#ifdef GOT_BIAS
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
got_offset += GOT_BIAS;
|
||||
#endif
|
||||
if (htab->fdpic_p)
|
||||
@ -6864,7 +6873,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
loc = srelplt->contents + plt_index * sizeof (Elf32_External_Rela);
|
||||
bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
|
||||
|
||||
if (htab->vxworks_p && !info->shared)
|
||||
if (htab->vxworks_p && !bfd_link_pic (info))
|
||||
{
|
||||
/* Create the .rela.plt.unloaded relocations for this PLT entry.
|
||||
Begin by pointing LOC to the first such relocation. */
|
||||
@ -6926,7 +6935,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
of a version file, we just want to emit a RELATIVE reloc.
|
||||
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)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
if (htab->fdpic_p)
|
||||
@ -6987,7 +6996,7 @@ sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
|
||||
of a version file, we just want to emit a RELATIVE reloc.
|
||||
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)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
if (htab->fdpic_p)
|
||||
|
@ -397,7 +397,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
right, and tweak the name when it's output. Otherwise, we make
|
||||
an indirect symbol of it. */
|
||||
flagword flags
|
||||
= info->relocatable || info->emitrelocations
|
||||
= bfd_link_relocatable (info) || info->emitrelocations
|
||||
? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT;
|
||||
|
||||
char *dl_name
|
||||
@ -441,9 +441,9 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
free (dl_name);
|
||||
|
||||
if (h->type != STT_DATALABEL
|
||||
|| ((info->relocatable || info->emitrelocations)
|
||||
|| ((bfd_link_relocatable (info) || info->emitrelocations)
|
||||
&& h->root.type != bfd_link_hash_undefined)
|
||||
|| (! info->relocatable && !info->emitrelocations
|
||||
|| (! bfd_link_relocatable (info) && !info->emitrelocations
|
||||
&& h->root.type != bfd_link_hash_indirect))
|
||||
{
|
||||
/* Make sure we don't get confused on invalid input. */
|
||||
@ -487,7 +487,7 @@ sh64_elf_link_output_symbol_hook (struct bfd_link_info *info,
|
||||
{
|
||||
char *name = (char *) cname;
|
||||
|
||||
if (info->relocatable || info->emitrelocations)
|
||||
if (bfd_link_relocatable (info) || info->emitrelocations)
|
||||
{
|
||||
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL)
|
||||
name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0;
|
||||
|
@ -4729,7 +4729,7 @@ spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info)
|
||||
return bfd_elf_final_link (output_bfd, info);
|
||||
}
|
||||
|
||||
/* Called when not normally emitting relocs, ie. !info->relocatable
|
||||
/* Called when not normally emitting relocs, ie. !bfd_link_relocatable (info)
|
||||
and !info->emitrelocations. Returns a count of special relocs
|
||||
that need to be emitted. */
|
||||
|
||||
@ -4902,7 +4902,7 @@ spu_elf_relocate_section (bfd *output_bfd,
|
||||
else if (info->unresolved_syms_in_objects == RM_IGNORE
|
||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
|
||||
;
|
||||
else if (!info->relocatable
|
||||
else if (!bfd_link_relocatable (info)
|
||||
&& !(r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64))
|
||||
{
|
||||
bfd_boolean err;
|
||||
@ -4922,7 +4922,7 @@ spu_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;
|
||||
|
||||
/* Change "a rt,ra,rb" to "ai rt,ra,0". */
|
||||
@ -4990,7 +4990,7 @@ spu_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
}
|
||||
|
||||
if (htab->params->emit_fixups && !info->relocatable
|
||||
if (htab->params->emit_fixups && !bfd_link_relocatable (info)
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& r_type == R_SPU_ADDR32)
|
||||
{
|
||||
@ -5135,7 +5135,7 @@ spu_elf_output_symbol_hook (struct bfd_link_info *info,
|
||||
{
|
||||
struct spu_link_hash_table *htab = spu_hash_table (info);
|
||||
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& htab->stub_sec != NULL
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defined
|
||||
|
@ -1591,7 +1591,7 @@ elf32_tic6x_link_hash_table_create (bfd *abfd)
|
||||
static bfd_boolean
|
||||
elf32_tic6x_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
obj_attribute *out_attr;
|
||||
out_attr = elf_known_obj_attributes_proc (abfd);
|
||||
@ -1661,11 +1661,11 @@ elf32_tic6x_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, ".rela.bss");
|
||||
|
||||
if (!htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -1761,7 +1761,7 @@ elf32_tic6x_finish_dynamic_symbol (bfd * output_bfd,
|
||||
it up. */
|
||||
|
||||
if ((h->dynindx == -1
|
||||
&& !((h->forced_local || info->executable)
|
||||
&& !((h->forced_local || bfd_link_executable (info))
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
|| plt == NULL
|
||||
@ -1848,7 +1848,7 @@ elf32_tic6x_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)
|
||||
&& (SYMBOLIC_BIND (info, h)
|
||||
|| h->dynindx == -1 || h->forced_local) && h->def_regular)
|
||||
{
|
||||
@ -1993,7 +1993,7 @@ elf32_tic6x_gc_sweep_hook (bfd *abfd,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf32_tic6x_hash_table (info);
|
||||
@ -2128,7 +2128,7 @@ elf32_tic6x_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
|
||||
@ -2321,7 +2321,7 @@ elf32_tic6x_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))
|
||||
{
|
||||
if (is_rel
|
||||
&& sym != NULL
|
||||
@ -2403,7 +2403,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_C6000_DSBT_INDEX:
|
||||
relocation = elf32_tic6x_hash_table (info)->params.dsbt_index;
|
||||
if (!info->shared || relocation != 0)
|
||||
if (!bfd_link_pic (info) || relocation != 0)
|
||||
break;
|
||||
|
||||
/* fall through */
|
||||
@ -2416,7 +2416,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
|
||||
/* 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 || elf32_tic6x_using_dsbt (output_bfd))
|
||||
if ((bfd_link_pic (info) || elf32_tic6x_using_dsbt (output_bfd))
|
||||
&& (input_section->flags & SEC_ALLOC)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
@ -2448,7 +2448,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
|
||||
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))
|
||||
{
|
||||
@ -2544,8 +2544,10 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
|
||||
|
||||
off = h->got.offset;
|
||||
dyn = htab->elf.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))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -2570,7 +2572,8 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
|
||||
htab->elf.sgot->contents + off);
|
||||
h->got.offset |= 1;
|
||||
|
||||
if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared,
|
||||
if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h)
|
||||
&& !(ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -2598,7 +2601,7 @@ elf32_tic6x_relocate_section (bfd *output_bfd,
|
||||
bfd_put_32 (output_bfd, relocation,
|
||||
htab->elf.sgot->contents + off);
|
||||
|
||||
if (info->shared || elf32_tic6x_using_dsbt (output_bfd))
|
||||
if (bfd_link_pic (info) || elf32_tic6x_using_dsbt (output_bfd))
|
||||
elf32_tic6x_make_got_dynreloc (output_bfd, htab, sec, off);
|
||||
|
||||
local_got_offsets[r_symndx] |= 1;
|
||||
@ -2778,7 +2781,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
asection *sreloc;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf32_tic6x_hash_table (info);
|
||||
@ -2787,7 +2790,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* Create dynamic sections for relocatable executables so that we can
|
||||
copy relocations. */
|
||||
if ((info->shared || elf32_tic6x_using_dsbt (abfd))
|
||||
if ((bfd_link_pic (info) || elf32_tic6x_using_dsbt (abfd))
|
||||
&& ! htab->elf.dynamic_sections_created)
|
||||
{
|
||||
if (! _bfd_elf_link_create_dynamic_sections (abfd, info))
|
||||
@ -2902,7 +2905,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
store the number of R_C6000_DSBT_INDEX relocs in the
|
||||
pc_count field, and potentially discard the extra space
|
||||
in elf32_tic6x_allocate_dynrelocs. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
break;
|
||||
|
||||
/* fall through */
|
||||
@ -2933,7 +2936,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared || elf32_tic6x_using_dsbt (abfd))
|
||||
if ((bfd_link_pic (info) || elf32_tic6x_using_dsbt (abfd))
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
struct elf_dyn_relocs *p;
|
||||
@ -3006,7 +3009,7 @@ elf32_tic6x_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_C6000_SBR_H16_B:
|
||||
case R_C6000_SBR_H16_H:
|
||||
case R_C6000_SBR_H16_W:
|
||||
if (h != NULL && info->executable)
|
||||
if (h != NULL && bfd_link_executable (info))
|
||||
{
|
||||
/* For B14-relative addresses, we might need a copy
|
||||
reloc. */
|
||||
@ -3130,7 +3133,7 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
{
|
||||
asection *s = htab->elf.splt;
|
||||
@ -3147,7 +3150,7 @@ elf32_tic6x_allocate_dynrelocs (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 && !h->def_regular)
|
||||
if (! bfd_link_pic (info) && !h->def_regular)
|
||||
{
|
||||
h->root.u.def.section = s;
|
||||
h->root.u.def.value = h->plt.offset;
|
||||
@ -3202,7 +3205,7 @@ elf32_tic6x_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
/* Discard relocs on undefined weak syms with non-default
|
||||
visibility. */
|
||||
if (info->shared || elf32_tic6x_using_dsbt (htab->obfd))
|
||||
if (bfd_link_pic (info) || elf32_tic6x_using_dsbt (htab->obfd))
|
||||
{
|
||||
/* We use the pc_count field to hold the number of
|
||||
R_C6000_DSBT_INDEX relocs. */
|
||||
@ -3297,7 +3300,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
if (htab->elf.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");
|
||||
if (s == NULL)
|
||||
@ -3360,7 +3363,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
*local_got = s->size;
|
||||
s->size += 4;
|
||||
|
||||
if (info->shared || elf32_tic6x_using_dsbt (output_bfd))
|
||||
if (bfd_link_pic (info) || elf32_tic6x_using_dsbt (output_bfd))
|
||||
{
|
||||
srel->size += sizeof (Elf32_External_Rela);
|
||||
}
|
||||
@ -3459,7 +3462,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
#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;
|
||||
@ -3511,7 +3514,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
static bfd_boolean
|
||||
elf32_tic6x_always_size_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
{
|
||||
if (elf32_tic6x_using_dsbt (output_bfd) && !info->relocatable
|
||||
if (elf32_tic6x_using_dsbt (output_bfd) && !bfd_link_relocatable (info)
|
||||
&& !bfd_elf_stack_segment_size (output_bfd, info,
|
||||
"__stacksize", DEFAULT_STACK_SIZE))
|
||||
return FALSE;
|
||||
|
@ -1308,11 +1308,11 @@ tilepro_elf_create_dynamic_sections (bfd *dynobj,
|
||||
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, ".rela.bss");
|
||||
|
||||
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -1454,7 +1454,7 @@ static int
|
||||
tilepro_elf_tls_transition (struct bfd_link_info *info, int r_type,
|
||||
int is_local)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return r_type;
|
||||
|
||||
if (is_local)
|
||||
@ -1479,7 +1479,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
asection *sreloc;
|
||||
int num_relocs;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = tilepro_elf_hash_table (info);
|
||||
@ -1538,7 +1538,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEPRO_IMM16_X1_TLS_LE_HI:
|
||||
case R_TILEPRO_IMM16_X0_TLS_LE_HA:
|
||||
case R_TILEPRO_IMM16_X1_TLS_LE_HA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
goto r_tilepro_plt32;
|
||||
break;
|
||||
|
||||
@ -1550,7 +1550,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEPRO_IMM16_X1_TLS_GD_HI:
|
||||
case R_TILEPRO_IMM16_X0_TLS_GD_HA:
|
||||
case R_TILEPRO_IMM16_X1_TLS_GD_HA:
|
||||
BFD_ASSERT (info->shared);
|
||||
BFD_ASSERT (bfd_link_pic (info));
|
||||
tls_type = GOT_TLS_GD;
|
||||
goto have_got_reference;
|
||||
|
||||
@ -1563,7 +1563,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEPRO_IMM16_X0_TLS_IE_HA:
|
||||
case R_TILEPRO_IMM16_X1_TLS_IE_HA:
|
||||
tls_type = GOT_TLS_IE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
goto have_got_reference;
|
||||
|
||||
@ -1648,7 +1648,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
break;
|
||||
|
||||
case R_TILEPRO_TLS_GD_CALL:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* These are basically R_TILEPRO_JOFFLONG_X1_PLT relocs
|
||||
against __tls_get_addr. */
|
||||
@ -1737,7 +1737,7 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
h->non_got_ref = 1;
|
||||
|
||||
r_tilepro_plt32:
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a .plt entry if the function this reloc
|
||||
refers to is in a shared lib. */
|
||||
@ -1765,14 +1765,14 @@ tilepro_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (! tilepro_elf_howto_table[r_type].pc_relative
|
||||
|| (h != NULL
|
||||
&& (! info->symbolic
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -1880,8 +1880,8 @@ tilepro_elf_gc_mark_hook (asection *sec,
|
||||
}
|
||||
|
||||
/* FIXME: The test here, in check_relocs and in relocate_section
|
||||
dealing with TLS optimization, ought to be !info->executable. */
|
||||
if (info->shared)
|
||||
dealing with TLS optimization, ought to be !bfd_link_executable (info). */
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
switch (ELF32_R_TYPE (rel->r_info))
|
||||
{
|
||||
@ -1915,7 +1915,7 @@ tilepro_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_tilepro_elf (abfd) || sec->reloc_count == 0);
|
||||
@ -2048,7 +2048,7 @@ tilepro_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEPRO_SHAMT_X1:
|
||||
case R_TILEPRO_SHAMT_Y0:
|
||||
case R_TILEPRO_SHAMT_Y1:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
break;
|
||||
/* Fall through. */
|
||||
|
||||
@ -2138,7 +2138,7 @@ tilepro_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
|
||||
@ -2222,7 +2222,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->elf.splt;
|
||||
|
||||
@ -2239,7 +2239,7 @@ allocate_dynrelocs (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 = s;
|
||||
@ -2270,7 +2270,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
/* If a TLS_IE symbol is now local to the binary, make it a TLS_LE
|
||||
requiring no TLS entry. */
|
||||
if (h->got.refcount > 0
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& tilepro_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
|
||||
h->got.offset = (bfd_vma) -1;
|
||||
@ -2301,7 +2301,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
global. */
|
||||
if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE)
|
||||
htab->elf.srelgot->size += 2 * TILEPRO_ELF_RELA_BYTES;
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h))
|
||||
htab->elf.srelgot->size += TILEPRO_ELF_RELA_BYTES;
|
||||
}
|
||||
else
|
||||
@ -2317,7 +2319,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
@ -2461,7 +2463,7 @@ tilepro_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);
|
||||
@ -2526,7 +2528,7 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
s->size += TILEPRO_BYTES_PER_WORD;
|
||||
if (*local_tls_type == GOT_TLS_GD)
|
||||
s->size += TILEPRO_BYTES_PER_WORD;
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| *local_tls_type == GOT_TLS_GD
|
||||
|| *local_tls_type == GOT_TLS_IE)
|
||||
srel->size += TILEPRO_ELF_RELA_BYTES;
|
||||
@ -2638,7 +2640,7 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
#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;
|
||||
@ -2915,7 +2917,7 @@ tilepro_elf_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;
|
||||
|
||||
if (h != NULL)
|
||||
@ -2946,8 +2948,8 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (h != NULL)
|
||||
tls_type = tilepro_elf_hash_entry(h)->tls_type;
|
||||
|
||||
is_tls_iele = (! info->shared || tls_type == GOT_TLS_IE);
|
||||
is_tls_le = is_tls_iele && (!info->shared
|
||||
is_tls_iele = (! bfd_link_pic (info) || tls_type == GOT_TLS_IE);
|
||||
is_tls_le = is_tls_iele && (!bfd_link_pic (info)
|
||||
&& (h == NULL || h->dynindx == -1));
|
||||
|
||||
if (r_type == R_TILEPRO_TLS_GD_CALL)
|
||||
@ -3024,7 +3026,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
}
|
||||
break;
|
||||
case R_TILEPRO_TLS_IE_LOAD:
|
||||
if (!info->shared && (h == NULL || h->dynindx == -1))
|
||||
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
/* IE -> LE */
|
||||
tilepro_replace_insn (contents + rel->r_offset,
|
||||
insn_mask_X1_no_dest_no_srca,
|
||||
@ -3063,8 +3065,10 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
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)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||
{
|
||||
/* This is actually a static link, or it is a
|
||||
@ -3105,7 +3109,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
off &= ~1;
|
||||
else
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -3204,13 +3208,13 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
if ((input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (! howto->pc_relative
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -3262,7 +3266,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (h != NULL &&
|
||||
h->dynindx != -1
|
||||
&& (! is_plt
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
{
|
||||
@ -3345,7 +3349,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
case R_TILEPRO_IMM16_X1_TLS_LE_HI:
|
||||
case R_TILEPRO_IMM16_X0_TLS_LE_HA:
|
||||
case R_TILEPRO_IMM16_X1_TLS_LE_HA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_boolean skip;
|
||||
@ -3400,7 +3404,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (h != NULL)
|
||||
{
|
||||
tls_type = tilepro_elf_hash_entry(h)->tls_type;
|
||||
if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
|
||||
if (!bfd_link_pic (info) && h->dynindx == -1 && tls_type == GOT_TLS_IE)
|
||||
r_type = tilepro_tls_translate_to_le (r_type);
|
||||
}
|
||||
if (tls_type == GOT_TLS_IE)
|
||||
@ -3450,8 +3454,10 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
bfd_boolean dyn;
|
||||
dyn = htab->elf.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)))
|
||||
{
|
||||
indx = h->dynindx;
|
||||
@ -3460,7 +3466,7 @@ tilepro_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
/* The GOT entries have not been initialized yet. Do it
|
||||
now, and emit any relocations. */
|
||||
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))
|
||||
@ -3783,7 +3789,7 @@ tilepro_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)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ v850_elf_check_relocs (bfd *abfd,
|
||||
int other = 0;
|
||||
const char *common = NULL;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -2243,7 +2243,7 @@ v850_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;
|
||||
|
||||
/* FIXME: We should use the addend, but the COFF relocations don't. */
|
||||
@ -3433,7 +3433,7 @@ v850_elf_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;
|
||||
|
@ -564,7 +564,7 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
asection *srelgot;
|
||||
asection *sreloc;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -626,7 +626,7 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
}
|
||||
|
||||
if (srelgot == NULL
|
||||
&& (h != NULL || info->shared))
|
||||
&& (h != NULL || bfd_link_pic (info)))
|
||||
{
|
||||
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
|
||||
if (srelgot == NULL)
|
||||
@ -703,7 +703,7 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
will be set later (it is never cleared). We account for that
|
||||
possibility below by storing information in the
|
||||
pcrel_relocs_copied field of the hash table entry. */
|
||||
if (!(info->shared
|
||||
if (!(bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (!info->symbolic
|
||||
@ -745,7 +745,7 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
|
||||
/* If we are creating a shared library, we need to copy the
|
||||
reloc into the shared library. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
/* When creating a shared object, we must copy these
|
||||
@ -860,7 +860,7 @@ elf_vax_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info, asection *sec,
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
bfd *dynobj;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -970,7 +970,7 @@ elf_vax_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;
|
||||
@ -1021,7 +1021,7 @@ elf_vax_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
|
||||
@ -1124,7 +1124,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
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);
|
||||
@ -1137,7 +1137,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
relative relocs against symbols defined in a regular object. 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 && info->symbolic)
|
||||
if (bfd_link_pic (info) && info->symbolic)
|
||||
elf_vax_link_hash_traverse (elf_hash_table (info),
|
||||
elf_vax_discard_copies,
|
||||
NULL);
|
||||
@ -1244,7 +1244,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
#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;
|
||||
@ -1431,10 +1431,10 @@ elf_vax_relocate_section (bfd *output_bfd,
|
||||
&& h->got.offset != (bfd_vma) -1
|
||||
&& !h->forced_local
|
||||
&& elf_hash_table (info)->dynamic_sections_created
|
||||
&& (! info->shared
|
||||
&& (! bfd_link_pic (info)
|
||||
|| (! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular))
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& ((! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular)
|
||||
&& ((input_section->flags & SEC_ALLOC) != 0
|
||||
@ -1458,7 +1458,7 @@ elf_vax_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;
|
||||
|
||||
switch (r_type)
|
||||
@ -1502,7 +1502,7 @@ elf_vax_relocate_section (bfd *output_bfd,
|
||||
reloc refers to is in a shared lib, then we made a PLT
|
||||
entry for this symbol and need to handle the reloc like
|
||||
a PLT reloc. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
goto r_vax_pc32_shared;
|
||||
/* Fall through. */
|
||||
case R_VAX_PLT32:
|
||||
@ -1565,7 +1565,7 @@ elf_vax_relocate_section (bfd *output_bfd,
|
||||
case R_VAX_8:
|
||||
case R_VAX_16:
|
||||
case R_VAX_32:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& r_symndx != STN_UNDEF
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& ((r_type != R_VAX_PC8
|
||||
|
@ -524,7 +524,7 @@ visium_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -649,7 +649,7 @@ visium_elf_relocate_section (bfd *output_bfd,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
switch (r_type)
|
||||
|
@ -392,7 +392,7 @@ elf32_xc16x_relocate_section (bfd *output_bfd,
|
||||
rel, 1, relend, howto, 0, contents);
|
||||
}
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
elf32_xc16x_final_link_relocate (r_type, input_bfd, output_bfd,
|
||||
|
@ -411,7 +411,7 @@ xstormy16_elf_check_relocs (bfd *abfd,
|
||||
asection *splt;
|
||||
bfd *dynobj;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata(abfd)->symtab_hdr;
|
||||
@ -589,7 +589,7 @@ xstormy16_elf_relax_section (bfd *dynobj,
|
||||
/* Assume nothing changes. */
|
||||
*again = FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
/* We only relax the .plt section at the moment. */
|
||||
@ -712,7 +712,7 @@ xstormy16_elf_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
bfd *dynobj;
|
||||
asection *splt;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
@ -829,7 +829,7 @@ xstormy16_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNU
|
||||
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)
|
||||
|
@ -971,7 +971,7 @@ elf_xtensa_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
|
||||
if (info->relocatable || (sec->flags & SEC_ALLOC) == 0)
|
||||
if (bfd_link_relocatable (info) || (sec->flags & SEC_ALLOC) == 0)
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_xtensa_elf (abfd));
|
||||
@ -1021,7 +1021,7 @@ elf_xtensa_check_relocs (bfd *abfd,
|
||||
switch (r_type)
|
||||
{
|
||||
case R_XTENSA_TLSDESC_FN:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
tls_type = GOT_TLS_GD;
|
||||
is_got = TRUE;
|
||||
@ -1032,7 +1032,7 @@ elf_xtensa_check_relocs (bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_XTENSA_TLSDESC_ARG:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
tls_type = GOT_TLS_GD;
|
||||
is_got = TRUE;
|
||||
@ -1046,7 +1046,7 @@ elf_xtensa_check_relocs (bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_XTENSA_TLS_DTPOFF:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
tls_type = GOT_TLS_GD;
|
||||
else
|
||||
tls_type = GOT_TLS_IE;
|
||||
@ -1054,9 +1054,9 @@ elf_xtensa_check_relocs (bfd *abfd,
|
||||
|
||||
case R_XTENSA_TLS_TPOFF:
|
||||
tls_type = GOT_TLS_IE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
if (info->shared || h)
|
||||
if (bfd_link_pic (info) || h)
|
||||
is_got = TRUE;
|
||||
break;
|
||||
|
||||
@ -1201,7 +1201,7 @@ static void
|
||||
elf_xtensa_make_sym_local (struct bfd_link_info *info,
|
||||
struct elf_link_hash_entry *h)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (h->plt.refcount > 0)
|
||||
{
|
||||
@ -1288,7 +1288,7 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
|
||||
if (htab == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
if ((sec->flags & SEC_ALLOC) == 0)
|
||||
@ -1322,7 +1322,7 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
|
||||
switch (r_type)
|
||||
{
|
||||
case R_XTENSA_TLSDESC_FN:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
is_got = TRUE;
|
||||
is_tlsfunc = TRUE;
|
||||
@ -1330,7 +1330,7 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_XTENSA_TLSDESC_ARG:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
is_got = TRUE;
|
||||
else
|
||||
{
|
||||
@ -1340,7 +1340,7 @@ elf_xtensa_gc_sweep_hook (bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_XTENSA_TLS_TPOFF:
|
||||
if (info->shared || h)
|
||||
if (bfd_link_pic (info) || h)
|
||||
is_got = TRUE;
|
||||
break;
|
||||
|
||||
@ -1637,7 +1637,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
&& htab->sgotloc != NULL);
|
||||
|
||||
/* 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");
|
||||
if (s == NULL)
|
||||
@ -1659,7 +1659,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
/* If we are generating a shared object, we also need space in
|
||||
".rela.got" for R_XTENSA_RELATIVE relocs for literals that
|
||||
reference local symbols. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
elf_xtensa_allocate_local_got_size (info);
|
||||
|
||||
/* Allocate space in ".plt" to match the size of ".rela.plt". For
|
||||
@ -1815,7 +1815,7 @@ elf_xtensa_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;
|
||||
@ -2627,7 +2627,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
unresolved_reloc = FALSE;
|
||||
warned = FALSE;
|
||||
|
||||
if (howto->partial_inplace && !info->relocatable)
|
||||
if (howto->partial_inplace && !bfd_link_relocatable (info))
|
||||
{
|
||||
/* Because R_XTENSA_32 was made partial_inplace to fix some
|
||||
problems with DWARF info in partial links, there may be
|
||||
@ -2665,7 +2665,7 @@ elf_xtensa_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))
|
||||
{
|
||||
bfd_vma dest_addr;
|
||||
asection * sym_sec = get_elf_r_symndx_section (input_bfd, r_symndx);
|
||||
@ -2827,7 +2827,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
case R_XTENSA_PLT:
|
||||
if (elf_hash_table (info)->dynamic_sections_created
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (dynamic_symbol || info->shared))
|
||||
&& (dynamic_symbol || bfd_link_pic (info)))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_byte *loc;
|
||||
@ -2915,7 +2915,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_XTENSA_TLS_TPOFF:
|
||||
/* Switch to LE model for local symbols in an executable. */
|
||||
if (! info->shared && ! dynamic_symbol)
|
||||
if (! bfd_link_pic (info) && ! dynamic_symbol)
|
||||
{
|
||||
relocation = tpoff (info, relocation);
|
||||
break;
|
||||
@ -2927,12 +2927,12 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
if (r_type == R_XTENSA_TLSDESC_FN)
|
||||
{
|
||||
if (! info->shared || (tls_type & GOT_TLS_IE) != 0)
|
||||
if (! bfd_link_pic (info) || (tls_type & GOT_TLS_IE) != 0)
|
||||
r_type = R_XTENSA_NONE;
|
||||
}
|
||||
else if (r_type == R_XTENSA_TLSDESC_ARG)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if ((tls_type & GOT_TLS_IE) != 0)
|
||||
r_type = R_XTENSA_TLS_TPOFF;
|
||||
@ -3008,7 +3008,7 @@ elf_xtensa_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_XTENSA_TLS_DTPOFF:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
/* Switch from LD model to LE model. */
|
||||
relocation = tpoff (info, relocation);
|
||||
else
|
||||
@ -3395,7 +3395,7 @@ elf_xtensa_finish_dynamic_sections (bfd *output_bfd,
|
||||
}
|
||||
|
||||
/* Combine adjacent literal table entries. */
|
||||
BFD_ASSERT (! info->relocatable);
|
||||
BFD_ASSERT (! bfd_link_relocatable (info));
|
||||
sxtlit = bfd_get_section_by_name (output_bfd, ".xt.lit");
|
||||
sgotloc = htab->sgotloc;
|
||||
BFD_ASSERT (sgotloc);
|
||||
@ -7348,7 +7348,7 @@ is_resolvable_asm_expansion (bfd *abfd,
|
||||
/* For relocatable sections, we can only simplify when the output
|
||||
section of the target is the same as the output section of the
|
||||
source. */
|
||||
if (link_info->relocatable
|
||||
if (bfd_link_relocatable (link_info)
|
||||
&& (target_sec->output_section != sec->output_section
|
||||
|| is_reloc_sym_weak (abfd, irel)))
|
||||
return FALSE;
|
||||
@ -9004,7 +9004,7 @@ identify_literal_placement (bfd *abfd,
|
||||
sec_size = bfd_get_section_limit (abfd, sec);
|
||||
|
||||
final_static_link =
|
||||
(!link_info->relocatable
|
||||
(!bfd_link_relocatable (link_info)
|
||||
&& !elf_hash_table (link_info)->dynamic_sections_created);
|
||||
|
||||
/* The placement algorithm first checks to see if the literal is
|
||||
@ -9043,7 +9043,7 @@ identify_literal_placement (bfd *abfd,
|
||||
/* For relocatable links, do not try to move literals. To do it
|
||||
correctly might increase the number of relocations in an input
|
||||
section making the default relocatable linking fail. */
|
||||
if (!link_info->relocatable && !literal_placed
|
||||
if (!bfd_link_relocatable (link_info) && !literal_placed
|
||||
&& values->has_last_loc && !(*last_loc_is_prev_p))
|
||||
{
|
||||
asection *target_sec = r_reloc_get_section (&values->last_loc);
|
||||
@ -10119,7 +10119,7 @@ shrink_dynamic_reloc_sections (struct bfd_link_info *info,
|
||||
|
||||
if ((r_type == R_XTENSA_32 || r_type == R_XTENSA_PLT)
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (dynamic_symbol || info->shared))
|
||||
&& (dynamic_symbol || bfd_link_pic (info)))
|
||||
{
|
||||
asection *srel;
|
||||
bfd_boolean is_plt = FALSE;
|
||||
@ -10225,7 +10225,7 @@ move_literal (bfd *abfd,
|
||||
bfd_put_32 (abfd, lit->value, contents + offset);
|
||||
|
||||
/* Currently, we cannot move relocations during a relocatable link. */
|
||||
BFD_ASSERT (!link_info->relocatable);
|
||||
BFD_ASSERT (!bfd_link_relocatable (link_info));
|
||||
fix = reloc_bfd_fix_init (sec, offset, r_type,
|
||||
r_reloc_get_section (r_rel),
|
||||
r_rel->target_offset + r_rel->virtual_offset,
|
||||
@ -10464,7 +10464,7 @@ relax_property_section (bfd *abfd,
|
||||
finish_dynamic_sections() but at that point it's too late to
|
||||
reclaim the space in the output section, so we do this twice. */
|
||||
|
||||
if (internal_relocs && (!link_info->relocatable
|
||||
if (internal_relocs && (!bfd_link_relocatable (link_info)
|
||||
|| xtensa_is_littable_section (sec)))
|
||||
{
|
||||
Elf_Internal_Rela *last_irel = NULL;
|
||||
|
@ -1227,7 +1227,7 @@ elf64_alpha_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
asection **secp, bfd_vma *valp)
|
||||
{
|
||||
if (sym->st_shndx == SHN_COMMON
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& sym->st_size <= elf_gp_size (abfd))
|
||||
{
|
||||
/* Common symbols less than or equal to -G nn bytes are
|
||||
@ -1770,7 +1770,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
bfd_size_type amt;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
/* Don't do anything special with non-loaded, non-alloced sections.
|
||||
@ -1830,7 +1830,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
have yet been processed. Do something with what we know, as
|
||||
this may help reduce memory usage and processing time later. */
|
||||
maybe_dynamic = FALSE;
|
||||
if (h && ((info->shared
|
||||
if (h && ((bfd_link_pic (info)
|
||||
&& (!info->symbolic
|
||||
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|
||||
|| !h->root.def_regular
|
||||
@ -1871,7 +1871,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
case R_ALPHA_REFLONG:
|
||||
case R_ALPHA_REFQUAD:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need = NEED_DYNREL;
|
||||
break;
|
||||
|
||||
@ -1891,12 +1891,12 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_ALPHA_GOTTPREL:
|
||||
need = NEED_GOT | NEED_GOT_ENTRY;
|
||||
gotent_flags = ALPHA_ELF_LINK_HASH_TLS_IE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
break;
|
||||
|
||||
case R_ALPHA_TPREL64:
|
||||
if (info->shared && !info->pie)
|
||||
if (bfd_link_pic (info) && !bfd_link_pie (info))
|
||||
{
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
need = NEED_DYNREL;
|
||||
@ -1988,7 +1988,7 @@ elf64_alpha_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
else
|
||||
rent->count++;
|
||||
}
|
||||
else if (info->shared)
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
/* If this is a shared library, and the section is to be
|
||||
loaded into memory, we need a RELATIVE reloc. */
|
||||
@ -2033,7 +2033,7 @@ elf64_alpha_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
struct alpha_elf_link_hash_entry **sym_hashes;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_symtab_hdr (abfd);
|
||||
@ -2644,7 +2644,7 @@ elf64_alpha_always_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
bfd *i;
|
||||
struct alpha_elf_link_hash_table * htab;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = alpha_elf_hash_table (info);
|
||||
@ -2735,14 +2735,14 @@ elf64_alpha_calc_dynrel_sizes (struct alpha_elf_link_hash_entry *h,
|
||||
|
||||
/* If the symbol is a hidden undefined weak, then we never have any
|
||||
relocations. Avoid the loop which may want to add RELATIVE relocs
|
||||
based on info->shared. */
|
||||
based on bfd_link_pic (info). */
|
||||
if (h->root.root.type == bfd_link_hash_undefweak && !dynamic)
|
||||
return TRUE;
|
||||
|
||||
for (relent = h->reloc_entries; relent; relent = relent->next)
|
||||
{
|
||||
entries = alpha_dynamic_entries_for_reloc (relent->rtype, dynamic,
|
||||
info->shared, info->pie);
|
||||
bfd_link_pic (info), bfd_link_pie (info));
|
||||
if (entries)
|
||||
{
|
||||
relent->srel->size +=
|
||||
@ -2778,7 +2778,7 @@ elf64_alpha_size_rela_got_1 (struct alpha_elf_link_hash_entry *h,
|
||||
|
||||
/* If the symbol is a hidden undefined weak, then we never have any
|
||||
relocations. Avoid the loop which may want to add RELATIVE relocs
|
||||
based on info->shared. */
|
||||
based on bfd_link_pic (info). */
|
||||
if (h->root.root.type == bfd_link_hash_undefweak && !dynamic)
|
||||
return TRUE;
|
||||
|
||||
@ -2786,7 +2786,8 @@ elf64_alpha_size_rela_got_1 (struct alpha_elf_link_hash_entry *h,
|
||||
for (gotent = h->got_entries; gotent ; gotent = gotent->next)
|
||||
if (gotent->use_count > 0)
|
||||
entries += alpha_dynamic_entries_for_reloc (gotent->reloc_type, dynamic,
|
||||
info->shared, info->pie);
|
||||
bfd_link_pic (info),
|
||||
bfd_link_pie (info));
|
||||
|
||||
if (entries > 0)
|
||||
{
|
||||
@ -2836,7 +2837,8 @@ elf64_alpha_size_rela_got_section (struct bfd_link_info *info)
|
||||
gotent ; gotent = gotent->next)
|
||||
if (gotent->use_count > 0)
|
||||
entries += (alpha_dynamic_entries_for_reloc
|
||||
(gotent->reloc_type, 0, info->shared, info->pie));
|
||||
(gotent->reloc_type, 0, bfd_link_pic (info),
|
||||
bfd_link_pie (info)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2875,7 +2877,7 @@ elf64_alpha_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);
|
||||
@ -2961,7 +2963,7 @@ elf64_alpha_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;
|
||||
@ -3069,7 +3071,8 @@ elf64_alpha_relax_got_load (struct alpha_relax_info *info, bfd_vma symval,
|
||||
|
||||
/* Can't use local-exec relocations in shared libraries. */
|
||||
if (r_type == R_ALPHA_GOTTPREL
|
||||
&& (info->link_info->shared && !info->link_info->pie))
|
||||
&& (bfd_link_pic (info->link_info)
|
||||
&& !bfd_link_pie (info->link_info)))
|
||||
return TRUE;
|
||||
|
||||
if (r_type == R_ALPHA_LITERAL)
|
||||
@ -3077,7 +3080,7 @@ elf64_alpha_relax_got_load (struct alpha_relax_info *info, bfd_vma symval,
|
||||
/* Look for nice constant addresses. This includes the not-uncommon
|
||||
special case of 0 for undefweak symbols. */
|
||||
if ((info->h && info->h->root.root.type == bfd_link_hash_undefweak)
|
||||
|| (!info->link_info->shared
|
||||
|| (!bfd_link_pic (info->link_info)
|
||||
&& (symval >= (bfd_vma)-0x8000 || symval < 0x8000)))
|
||||
{
|
||||
disp = 0;
|
||||
@ -3540,12 +3543,12 @@ elf64_alpha_relax_tls_get_addr (struct alpha_relax_info *info, bfd_vma symval,
|
||||
|
||||
/* If the symbol is local, and we've already committed to DF_STATIC_TLS,
|
||||
then we might as well relax to IE. */
|
||||
else if (info->link_info->shared && !dynamic
|
||||
else if (bfd_link_pic (info->link_info) && !dynamic
|
||||
&& (info->link_info->flags & DF_STATIC_TLS))
|
||||
;
|
||||
|
||||
/* Otherwise we must be building an executable to do anything. */
|
||||
else if (info->link_info->shared)
|
||||
else if (bfd_link_pic (info->link_info))
|
||||
return TRUE;
|
||||
|
||||
/* The TLSGD/TLSLDM relocation must be followed by a LITERAL and
|
||||
@ -3646,7 +3649,7 @@ elf64_alpha_relax_tls_get_addr (struct alpha_relax_info *info, bfd_vma symval,
|
||||
|
||||
/* Some compilers warn about a Boolean-looking expression being
|
||||
used in a switch. The explicit cast silences them. */
|
||||
switch ((int) (!dynamic && !info->link_info->shared))
|
||||
switch ((int) (!dynamic && !bfd_link_pic (info->link_info)))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
@ -3789,7 +3792,7 @@ elf64_alpha_relax_section (bfd *abfd, asection *sec,
|
||||
/* There's nothing to change, yet. */
|
||||
*again = FALSE;
|
||||
|
||||
if (link_info->relocatable
|
||||
if (bfd_link_relocatable (link_info)
|
||||
|| ((sec->flags & (SEC_CODE | SEC_RELOC | SEC_ALLOC))
|
||||
!= (SEC_CODE | SEC_RELOC | SEC_ALLOC))
|
||||
|| sec->reloc_count == 0)
|
||||
@ -4206,7 +4209,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
BFD_ASSERT (is_alpha_elf (input_bfd));
|
||||
|
||||
/* Handle relocatable links with a smaller loop. */
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return elf64_alpha_relocate_section_r (output_bfd, info, input_bfd,
|
||||
input_section, contents, relocs,
|
||||
local_syms, local_sections);
|
||||
@ -4431,7 +4434,9 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
/* If the symbol has been forced local, output a
|
||||
RELATIVE reloc, otherwise it will be handled in
|
||||
finish_dynamic_symbol. */
|
||||
if (info->shared && !dynamic_symbol_p && !undef_weak_ref)
|
||||
if (bfd_link_pic (info)
|
||||
&& !dynamic_symbol_p
|
||||
&& !undef_weak_ref)
|
||||
elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
|
||||
gotent->got_offset, 0,
|
||||
R_ALPHA_RELATIVE, value);
|
||||
@ -4581,7 +4586,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (r_type == R_ALPHA_TPREL64)
|
||||
{
|
||||
BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
|
||||
if (!info->shared || info->pie)
|
||||
if (!bfd_link_pic (info) || bfd_link_pie (info))
|
||||
{
|
||||
value -= tp_base;
|
||||
goto default_reloc;
|
||||
@ -4589,7 +4594,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
dynindx = 0;
|
||||
dynaddend = value - dtp_base;
|
||||
}
|
||||
else if (info->shared
|
||||
else if (bfd_link_pic (info)
|
||||
&& r_symndx != STN_UNDEF
|
||||
&& (input_section->flags & SEC_ALLOC)
|
||||
&& !undef_weak_ref
|
||||
@ -4631,7 +4636,8 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
input_bfd, h->root.root.root.string);
|
||||
ret_val = FALSE;
|
||||
}
|
||||
else if ((info->shared || info->pie) && undef_weak_ref)
|
||||
else if ((bfd_link_pic (info) || bfd_link_pie (info))
|
||||
&& undef_weak_ref)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: pc-relative relocation against undefined weak symbol %s"),
|
||||
@ -4664,13 +4670,14 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
gotent->reloc_done = 1;
|
||||
|
||||
/* Note that the module index for the main program is 1. */
|
||||
bfd_put_64 (output_bfd, !info->shared && !dynamic_symbol_p,
|
||||
bfd_put_64 (output_bfd,
|
||||
!bfd_link_pic (info) && !dynamic_symbol_p,
|
||||
sgot->contents + gotent->got_offset);
|
||||
|
||||
/* If the symbol has been forced local, output a
|
||||
DTPMOD64 reloc, otherwise it will be handled in
|
||||
finish_dynamic_symbol. */
|
||||
if (info->shared && !dynamic_symbol_p)
|
||||
if (bfd_link_pic (info) && !dynamic_symbol_p)
|
||||
elf64_alpha_emit_dynrel (output_bfd, info, sgot, srelgot,
|
||||
gotent->got_offset, 0,
|
||||
R_ALPHA_DTPMOD64, 0);
|
||||
@ -4711,7 +4718,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
case R_ALPHA_TPRELHI:
|
||||
case R_ALPHA_TPRELLO:
|
||||
case R_ALPHA_TPREL16:
|
||||
if (info->shared && !info->pie)
|
||||
if (bfd_link_pic (info) && !bfd_link_pie (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: TLS local exec code cannot be linked into shared objects"),
|
||||
@ -4749,7 +4756,7 @@ elf64_alpha_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL);
|
||||
if (r_type == R_ALPHA_GOTDTPREL)
|
||||
value -= dtp_base;
|
||||
else if (!info->shared)
|
||||
else if (!bfd_link_pic (info))
|
||||
value -= tp_base;
|
||||
else
|
||||
{
|
||||
|
@ -503,7 +503,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel;
|
||||
unsigned int sec_symndx;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
/* If this is the first dynamic object found in the link, create
|
||||
@ -522,7 +522,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
/* If necessary, build a new table holding section symbols indices
|
||||
for this BFD. */
|
||||
|
||||
if (info->shared && hppa_info->section_syms_bfd != abfd)
|
||||
if (bfd_link_pic (info) && hppa_info->section_syms_bfd != abfd)
|
||||
{
|
||||
unsigned long i;
|
||||
unsigned int highest_shndx;
|
||||
@ -596,7 +596,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
relocations when building shared libraries. When not building shared
|
||||
libraries this value is never really used, but assign it to zero to
|
||||
prevent out of bounds memory accesses in other routines. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
sec_symndx = _bfd_elf_section_from_bfd_section (abfd, sec);
|
||||
|
||||
@ -655,7 +655,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
have yet been processed. Do something with what we know, as
|
||||
this may help reduce memory usage and processing time later. */
|
||||
maybe_dynamic = FALSE;
|
||||
if (hh && ((info->shared
|
||||
if (hh && ((bfd_link_pic (info)
|
||||
&& (!info->symbolic
|
||||
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|
||||
|| !hh->eh.def_regular
|
||||
@ -730,7 +730,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_PARISC_DIR64:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = (NEED_DYNREL);
|
||||
dynrel_type = R_PARISC_DIR64;
|
||||
break;
|
||||
@ -747,7 +747,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
case R_PARISC_LTOFF_FPTR16F:
|
||||
case R_PARISC_LTOFF_FPTR16WF:
|
||||
case R_PARISC_LTOFF_FPTR16DF:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = (NEED_DLT | NEED_OPD | NEED_PLT);
|
||||
else
|
||||
need_entry = (NEED_DLT | NEED_OPD | NEED_PLT);
|
||||
@ -756,7 +756,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
|
||||
/* This is a simple OPD entry. */
|
||||
case R_PARISC_FPTR64:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = (NEED_OPD | NEED_PLT | NEED_DYNREL);
|
||||
else
|
||||
need_entry = (NEED_OPD | NEED_PLT);
|
||||
@ -882,7 +882,7 @@ elf64_hppa_check_relocs (bfd *abfd,
|
||||
a dynamic R_PARISC_FPTR64 relocation, then make sure the
|
||||
section symbol for this section ends up in the dynamic
|
||||
symbol table. */
|
||||
if (info->shared && dynrel_type == R_PARISC_FPTR64
|
||||
if (bfd_link_pic (info) && dynrel_type == R_PARISC_FPTR64
|
||||
&& ! (bfd_elf_link_record_local_dynamic_symbol
|
||||
(info, abfd, sec_symndx)))
|
||||
return FALSE;
|
||||
@ -966,7 +966,7 @@ allocate_global_data_dlt (struct elf_link_hash_entry *eh, void *data)
|
||||
|
||||
if (hh->want_dlt)
|
||||
{
|
||||
if (x->info->shared)
|
||||
if (bfd_link_pic (x->info))
|
||||
{
|
||||
/* Possibly add the symbol to the local dynamic symbol
|
||||
table since we might need to create a dynamic relocation
|
||||
@ -1062,7 +1062,7 @@ allocate_global_data_opd (struct elf_link_hash_entry *eh, void *data)
|
||||
/* If we are creating a shared library, took the address of a local
|
||||
function or might export this function from this object file, then
|
||||
we have to create an opd descriptor. */
|
||||
else if (x->info->shared
|
||||
else if (bfd_link_pic (x->info)
|
||||
|| hh == NULL
|
||||
|| (hh->eh.dynindx == -1 && hh->eh.type != STT_PARISC_MILLI)
|
||||
|| (hh->eh.root.type == bfd_link_hash_defined
|
||||
@ -1072,7 +1072,7 @@ allocate_global_data_opd (struct elf_link_hash_entry *eh, void *data)
|
||||
create a runtime relocation for the symbol to properly
|
||||
initialize the .opd entry. Make sure the symbol gets
|
||||
added to the dynamic symbol table. */
|
||||
if (x->info->shared
|
||||
if (bfd_link_pic (x->info)
|
||||
&& (hh == NULL || (hh->eh.dynindx == -1)))
|
||||
{
|
||||
bfd *owner;
|
||||
@ -1089,7 +1089,7 @@ allocate_global_data_opd (struct elf_link_hash_entry *eh, void *data)
|
||||
in dynamic relocs. But name munging does make the result
|
||||
much easier to debug. ie, the EPLT reloc will reference
|
||||
a symbol like .foobar, instead of .text + offset. */
|
||||
if (x->info->shared && eh)
|
||||
if (bfd_link_pic (x->info) && eh)
|
||||
{
|
||||
char *new_name;
|
||||
struct elf_link_hash_entry *nh;
|
||||
@ -1407,7 +1407,7 @@ allocate_dynrel_entries (struct elf_link_hash_entry *eh, void *data)
|
||||
return FALSE;
|
||||
|
||||
dynamic_symbol = elf64_hppa_dynamic_symbol_p (eh, x->info);
|
||||
shared = x->info->shared;
|
||||
shared = bfd_link_pic (x->info);
|
||||
|
||||
/* We may need to allocate relocations for a non-dynamic symbol
|
||||
when creating a shared library. */
|
||||
@ -1558,7 +1558,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
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))
|
||||
{
|
||||
sec = bfd_get_linker_section (dynobj, ".interp");
|
||||
BFD_ASSERT (sec != NULL);
|
||||
@ -1637,7 +1637,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
{
|
||||
*local_dlt = sec->size;
|
||||
sec->size += DLT_ENTRY_SIZE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
srel->size += sizeof (Elf64_External_Rela);
|
||||
}
|
||||
@ -1664,7 +1664,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
{
|
||||
*local_plt = sec->size;
|
||||
sec->size += PLT_ENTRY_SIZE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf64_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -1690,7 +1690,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
{
|
||||
*local_opd = sec->size;
|
||||
sec->size += OPD_ENTRY_SIZE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srel->size += sizeof (Elf64_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -1855,7 +1855,7 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
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 (!add_dynamic_entry (DT_DEBUG, 0)
|
||||
|| !add_dynamic_entry (DT_HP_DLD_HOOK, 0)
|
||||
@ -1997,7 +1997,7 @@ elf64_hppa_finish_dynamic_symbol (bfd *output_bfd,
|
||||
if we are creating a shared library and the symbol is
|
||||
still undefined, we create a dynamic relocation to fill
|
||||
in the correct value. */
|
||||
if (info->shared && eh->root.type == bfd_link_hash_undefined)
|
||||
if (bfd_link_pic (info) && eh->root.type == bfd_link_hash_undefined)
|
||||
value = 0;
|
||||
else
|
||||
value = (eh->root.u.def.value + eh->root.u.def.section->vma);
|
||||
@ -2152,7 +2152,7 @@ elf64_hppa_finalize_opd (struct elf_link_hash_entry *eh, void *data)
|
||||
/* If we are generating a shared library, we must generate EPLT relocations
|
||||
for each entry in the .opd, even for static functions (they may have
|
||||
had their address taken). */
|
||||
if (info->shared && hh->want_opd)
|
||||
if (bfd_link_pic (info) && hh->want_opd)
|
||||
{
|
||||
Elf_Internal_Rela rel;
|
||||
bfd_byte *loc;
|
||||
@ -2251,7 +2251,7 @@ elf64_hppa_finalize_dlt (struct elf_link_hash_entry *eh, void *data)
|
||||
address, so there is no need to create a relocation. Just install
|
||||
the proper value into the DLT, note this shortcut can not be
|
||||
skipped when building a shared library. */
|
||||
if (! info->shared && hh && hh->want_dlt)
|
||||
if (! bfd_link_pic (info) && hh && hh->want_dlt)
|
||||
{
|
||||
bfd_vma value;
|
||||
|
||||
@ -2289,7 +2289,7 @@ elf64_hppa_finalize_dlt (struct elf_link_hash_entry *eh, void *data)
|
||||
/* Create a relocation for the DLT entry associated with this symbol.
|
||||
When building a shared library the symbol does not have to be dynamic. */
|
||||
if (hh->want_dlt
|
||||
&& (elf64_hppa_dynamic_symbol_p (eh, info) || info->shared))
|
||||
&& (elf64_hppa_dynamic_symbol_p (eh, info) || bfd_link_pic (info)))
|
||||
{
|
||||
Elf_Internal_Rela rel;
|
||||
bfd_byte *loc;
|
||||
@ -2337,7 +2337,7 @@ elf64_hppa_finalize_dynreloc (struct elf_link_hash_entry *eh,
|
||||
|
||||
dynamic_symbol = elf64_hppa_dynamic_symbol_p (eh, info);
|
||||
|
||||
if (!dynamic_symbol && !info->shared)
|
||||
if (!dynamic_symbol && !bfd_link_pic (info))
|
||||
return TRUE;
|
||||
|
||||
if (hh->reloc_entries)
|
||||
@ -2366,7 +2366,8 @@ elf64_hppa_finalize_dynreloc (struct elf_link_hash_entry *eh,
|
||||
|
||||
/* Allocate one iff we are building a shared library, the relocation
|
||||
isn't a R_PARISC_FPTR64, or we don't want an opd entry. */
|
||||
if (!info->shared && rent->type == R_PARISC_FPTR64 && hh->want_opd)
|
||||
if (!bfd_link_pic (info)
|
||||
&& rent->type == R_PARISC_FPTR64 && hh->want_opd)
|
||||
continue;
|
||||
|
||||
/* Create a dynamic relocation for this entry.
|
||||
@ -2396,7 +2397,8 @@ elf64_hppa_finalize_dynreloc (struct elf_link_hash_entry *eh,
|
||||
We use a section symbol recorded by check_relocs as the
|
||||
base symbol for the relocation. The addend is the difference
|
||||
between the section symbol and the address of the .opd entry. */
|
||||
if (info->shared && rent->type == R_PARISC_FPTR64 && hh->want_opd)
|
||||
if (bfd_link_pic (info)
|
||||
&& rent->type == R_PARISC_FPTR64 && hh->want_opd)
|
||||
{
|
||||
bfd_vma value, value2;
|
||||
|
||||
@ -2843,7 +2845,7 @@ elf_hppa_unmark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
|
||||
|
||||
Ultimately we should have better controls over the generic ELF BFD
|
||||
linker code. */
|
||||
if (! info->relocatable
|
||||
if (! bfd_link_relocatable (info)
|
||||
&& info->unresolved_syms_in_shared_libs != RM_IGNORE
|
||||
&& h->root.type == bfd_link_hash_undefined
|
||||
&& h->ref_dynamic
|
||||
@ -2874,7 +2876,7 @@ elf_hppa_remark_useless_dynamic_symbols (struct elf_link_hash_entry *h,
|
||||
|
||||
Ultimately we should have better controls over the generic ELF BFD
|
||||
linker code. */
|
||||
if (! info->relocatable
|
||||
if (! bfd_link_relocatable (info)
|
||||
&& info->unresolved_syms_in_shared_libs != RM_IGNORE
|
||||
&& h->root.type == bfd_link_hash_undefined
|
||||
&& !h->ref_dynamic
|
||||
@ -2949,7 +2951,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
if (hppa_info == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (! info->relocatable)
|
||||
if (! bfd_link_relocatable (info))
|
||||
{
|
||||
struct elf_link_hash_entry *gp;
|
||||
bfd_vma gp_val;
|
||||
@ -3035,7 +3037,7 @@ elf_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
|
||||
/* If we're producing a final executable, sort the contents of the
|
||||
unwind section. */
|
||||
if (retval && !info->relocatable)
|
||||
if (retval && !bfd_link_relocatable (info))
|
||||
retval = elf_hppa_sort_unwind (abfd);
|
||||
|
||||
return retval;
|
||||
@ -3893,10 +3895,10 @@ elf64_hppa_relocate_section (bfd *output_bfd,
|
||||
else if (info->unresolved_syms_in_objects == RM_IGNORE
|
||||
&& ELF_ST_VISIBILITY (eh->other) == STV_DEFAULT)
|
||||
;
|
||||
else if (!info->relocatable
|
||||
else if (!bfd_link_relocatable (info)
|
||||
&& elf_hppa_is_dynamic_loader_symbol (eh->root.root.string))
|
||||
continue;
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_boolean err;
|
||||
err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR
|
||||
@ -3909,7 +3911,7 @@ elf64_hppa_relocate_section (bfd *output_bfd,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& relocation == 0
|
||||
&& eh->root.type != bfd_link_hash_defined
|
||||
&& eh->root.type != bfd_link_hash_defweak
|
||||
@ -3931,7 +3933,7 @@ elf64_hppa_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 = elf_hppa_final_link_relocate (rel, input_bfd, output_bfd,
|
||||
|
@ -348,7 +348,7 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
|
||||
one pass. */
|
||||
*again = 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"));
|
||||
|
||||
@ -858,7 +858,7 @@ elf64_ia64_add_symbol_hook (bfd *abfd,
|
||||
bfd_vma *valp)
|
||||
{
|
||||
if (sym->st_shndx == SHN_COMMON
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& sym->st_size <= elf_gp_size (abfd))
|
||||
{
|
||||
/* Common symbols less than or equal to -G nn bytes are
|
||||
@ -1757,7 +1757,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
|
||||
| SEC_LOAD
|
||||
| SEC_HAS_CONTENTS
|
||||
| SEC_IN_MEMORY
|
||||
| (info->pie ? 0
|
||||
| (bfd_link_pie (info) ? 0
|
||||
: SEC_READONLY)
|
||||
| SEC_LINKER_CREATED));
|
||||
if (!fptr
|
||||
@ -1769,7 +1769,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
ia64_info->fptr_sec = fptr;
|
||||
|
||||
if (info->pie)
|
||||
if (bfd_link_pie (info))
|
||||
{
|
||||
asection *fptr_rel;
|
||||
fptr_rel = bfd_make_section_anyway_with_flags (dynobj, ".rela.opd",
|
||||
@ -1922,7 +1922,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
unsigned long r_symndx;
|
||||
bfd_boolean maybe_dynamic;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -1955,7 +1955,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
locally or externally defined, as not all of the input files
|
||||
have yet been processed. Do something with what we know, as
|
||||
this may help reduce memory usage and processing time later. */
|
||||
maybe_dynamic = (h && ((!info->executable
|
||||
maybe_dynamic = (h && ((!bfd_link_executable (info)
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|
||||
|| !h->def_regular
|
||||
@ -1996,7 +1996,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_FPTR32LSB:
|
||||
case R_IA64_FPTR64MSB:
|
||||
case R_IA64_FPTR64LSB:
|
||||
if (info->shared || h)
|
||||
if (bfd_link_pic (info) || h)
|
||||
need_entry = NEED_FPTR | NEED_DYNREL;
|
||||
else
|
||||
need_entry = NEED_FPTR;
|
||||
@ -2047,7 +2047,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_DIR64MSB:
|
||||
case R_IA64_DIR64LSB:
|
||||
/* Shared objects will always need at least a REL relocation. */
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
break;
|
||||
|
||||
@ -2107,7 +2107,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
locally or externally defined, as not all of the input files
|
||||
have yet been processed. Do something with what we know, as
|
||||
this may help reduce memory usage and processing time later. */
|
||||
maybe_dynamic = (h && ((!info->executable
|
||||
maybe_dynamic = (h && ((!bfd_link_executable (info)
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|
||||
|| !h->def_regular
|
||||
@ -2144,7 +2144,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_FPTR32LSB:
|
||||
case R_IA64_FPTR64MSB:
|
||||
case R_IA64_FPTR64LSB:
|
||||
if (info->shared || h)
|
||||
if (bfd_link_pic (info) || h)
|
||||
need_entry = NEED_FPTR | NEED_DYNREL;
|
||||
else
|
||||
need_entry = NEED_FPTR;
|
||||
@ -2190,7 +2190,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_DIR64MSB:
|
||||
case R_IA64_DIR64LSB:
|
||||
/* Shared objects will always need at least a REL relocation. */
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
dynrel_type = R_IA64_DIR64LSB;
|
||||
break;
|
||||
@ -2460,7 +2460,7 @@ allocate_dynrel_entries (struct elf64_ia64_dyn_sym_info *dyn_i,
|
||||
/* Note that this can't be used in relation to FPTR relocs below. */
|
||||
dynamic_symbol = elf64_ia64_dynamic_symbol_p (dyn_i->h);
|
||||
|
||||
shared = x->info->shared;
|
||||
shared = bfd_link_pic (x->info);
|
||||
resolved_zero = (dyn_i->h
|
||||
&& ELF_ST_VISIBILITY (dyn_i->h->other)
|
||||
&& dyn_i->h->root.type == bfd_link_hash_undefweak);
|
||||
@ -2519,7 +2519,7 @@ allocate_dynrel_entries (struct elf64_ia64_dyn_sym_info *dyn_i,
|
||||
will be true only if we're actually allocating one statically
|
||||
in the main executable. Position independent executables
|
||||
need a relative reloc. */
|
||||
if (dyn_i->want_fptr && !x->info->pie)
|
||||
if (dyn_i->want_fptr && !bfd_link_pie (x->info))
|
||||
continue;
|
||||
break;
|
||||
case R_IA64_PCREL32LSB:
|
||||
@ -2999,13 +2999,13 @@ set_got_entry (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd_put_64 (abfd, value, got_sec->contents + got_offset);
|
||||
|
||||
/* Install a dynamic relocation if needed. */
|
||||
if (((info->shared
|
||||
if (((bfd_link_pic (info)
|
||||
&& (!dyn_i->h
|
||||
|| ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
|
||||
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
|
||||
|| elf64_ia64_dynamic_symbol_p (dyn_i->h))
|
||||
&& (!dyn_i->want_ltoff_fptr
|
||||
|| !info->pie
|
||||
|| !bfd_link_pie (info)
|
||||
|| !dyn_i->h
|
||||
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
|
||||
{
|
||||
@ -3109,7 +3109,7 @@ set_pltoff_entry (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* Install dynamic relocations if needed. */
|
||||
if (!is_plt
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& (!dyn_i->h
|
||||
|| ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
|
||||
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
|
||||
@ -3309,7 +3309,7 @@ elf64_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
return FALSE;
|
||||
|
||||
/* Make sure we've got ourselves a nice fat __gp value. */
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_vma gp_val;
|
||||
struct elf_link_hash_entry *gp;
|
||||
@ -3335,7 +3335,7 @@ elf64_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
of the .IA_64.unwind section. Force this section to be relocated
|
||||
into memory rather than written immediately to the output file. */
|
||||
unwind_output_sec = NULL;
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind);
|
||||
if (s)
|
||||
@ -3392,7 +3392,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
|
||||
return FALSE;
|
||||
|
||||
/* Infect various flags from the input section to the output section. */
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_vma flags;
|
||||
|
||||
@ -3448,7 +3448,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
|
||||
sym_sec = local_sections[r_symndx];
|
||||
msec = sym_sec;
|
||||
value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& (sym_sec->flags & SEC_MERGE) != 0
|
||||
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
|
||||
&& sym_sec->sec_info_type == SEC_INFO_TYPE_MERGE)
|
||||
@ -3516,7 +3516,7 @@ elf64_ia64_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;
|
||||
|
||||
hit_addr = contents + rel->r_offset;
|
||||
@ -3537,7 +3537,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
|
||||
case R_IA64_DIR64MSB:
|
||||
case R_IA64_DIR64LSB:
|
||||
/* Install a dynamic relocation for this reloc. */
|
||||
if ((dynamic_symbol_p || info->shared)
|
||||
if ((dynamic_symbol_p || bfd_link_pic (info))
|
||||
&& r_symndx != 0
|
||||
&& (input_section->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
@ -3657,7 +3657,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
|
||||
if (!undef_weak_ref)
|
||||
value = set_fptr_entry (output_bfd, info, dyn_i, value);
|
||||
}
|
||||
if (!dyn_i->want_fptr || info->pie)
|
||||
if (!dyn_i->want_fptr || bfd_link_pie (info))
|
||||
{
|
||||
/* Otherwise, we expect the dynamic linker to create
|
||||
the entry. */
|
||||
@ -3838,7 +3838,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
|
||||
case R_IA64_IPLTMSB:
|
||||
case R_IA64_IPLTLSB:
|
||||
/* Install a dynamic relocation for this reloc. */
|
||||
if ((dynamic_symbol_p || info->shared)
|
||||
if ((dynamic_symbol_p || bfd_link_pic (info))
|
||||
&& (input_section->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
/* VMS: FIXFD ?? */
|
||||
@ -4740,11 +4740,11 @@ elf64_vms_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||
/* You can't use -r against a dynamic object. Also, there's no
|
||||
hope of using a dynamic object which does not exactly match
|
||||
the format of the output file. */
|
||||
if (info->relocatable
|
||||
if (bfd_link_relocatable (info)
|
||||
|| !is_elf_hash_table (htab)
|
||||
|| info->output_bfd->xvec != abfd->xvec)
|
||||
{
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
else
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
@ -4759,7 +4759,7 @@ elf64_vms_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||
so we attach them to this BFD, provided it is the right
|
||||
format. FIXME: If there are no input BFD's of the same
|
||||
format as the output, we can't make a shared library. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& is_elf_hash_table (htab)
|
||||
&& info->output_bfd->xvec == abfd->xvec
|
||||
&& !htab->dynamic_sections_created)
|
||||
|
@ -1429,7 +1429,7 @@ mmix_elf_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))
|
||||
{
|
||||
/* This is a relocatable link. For most relocs we don't have to
|
||||
change anything, unless the reloc is against a section
|
||||
@ -1870,7 +1870,7 @@ mmix_elf_check_common_relocs (bfd *abfd,
|
||||
DSO-related stuff if that member is non-NULL. */
|
||||
case R_MMIX_BASE_PLUS_OFFSET:
|
||||
/* We don't do anything with this reloc for a relocatable link. */
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
break;
|
||||
|
||||
if (bpo_greg_owner == NULL)
|
||||
@ -1994,7 +1994,7 @@ mmix_elf_check_relocs (bfd *abfd,
|
||||
if (!mmix_elf_check_common_relocs (abfd, info, sec, relocs))
|
||||
return FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
rel_end = relocs + sec->reloc_count;
|
||||
@ -2303,7 +2303,7 @@ mmix_set_relaxable_size (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
|
||||
/* For use in relocatable link, we start with a max stubs size. See
|
||||
mmix_elf_relax_section. */
|
||||
if (info->relocatable && sec->output_section)
|
||||
if (bfd_link_relocatable (info) && sec->output_section)
|
||||
mmix_elf_section_data (sec->output_section)->pjs.stubs_size_sum
|
||||
+= (mmix_elf_section_data (sec)->pjs.n_pushj_relocs
|
||||
* MAX_PUSHJ_STUB_SIZE);
|
||||
@ -2624,7 +2624,7 @@ mmix_elf_relax_section (bfd *abfd,
|
||||
/* We process relocs in a distinctly different way when this is a
|
||||
relocatable link (for one, we don't look at symbols), so we avoid
|
||||
mixing its code with that for the "normal" relaxation. */
|
||||
if (link_info->relocatable)
|
||||
if (bfd_link_relocatable (link_info))
|
||||
{
|
||||
/* The only transformation in a relocatable link is to generate
|
||||
a full stub at the location of the stub calculated for the
|
||||
|
104
bfd/elf64-ppc.c
104
bfd/elf64-ppc.c
@ -3716,7 +3716,7 @@ must_be_dyn_reloc (struct bfd_link_info *info,
|
||||
case R_PPC64_TPREL16_HIGHEST:
|
||||
case R_PPC64_TPREL16_HIGHESTA:
|
||||
case R_PPC64_TPREL64:
|
||||
return !info->executable;
|
||||
return !bfd_link_executable (info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4315,7 +4315,7 @@ create_linkage_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||
|| ! bfd_set_section_alignment (dynobj, htab->brlt, 3))
|
||||
return FALSE;
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
return TRUE;
|
||||
|
||||
flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY
|
||||
@ -4349,7 +4349,7 @@ ppc64_elf_init_stub_bfd (struct bfd_link_info *info,
|
||||
htab->elf.dynobj = params->stub_bfd;
|
||||
htab->params = params;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
return create_linkage_sections (htab->elf.dynobj, info);
|
||||
@ -4555,11 +4555,11 @@ ppc64_elf_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
|
||||
return FALSE;
|
||||
|
||||
htab->dynbss = bfd_get_linker_section (dynobj, ".dynbss");
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->relbss = bfd_get_linker_section (dynobj, ".rela.bss");
|
||||
|
||||
if (!htab->elf.sgot || !htab->elf.splt || !htab->elf.srelplt || !htab->dynbss
|
||||
|| (!info->shared && !htab->relbss))
|
||||
|| (!bfd_link_pic (info) && !htab->relbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -4834,7 +4834,7 @@ ppc64_elf_add_symbol_hook (bfd *ibfd,
|
||||
|
||||
/* If the symbol is a function defined in .opd, and the function
|
||||
code is in a discarded group, let it appear to be undefined. */
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& (*sec)->reloc_count != 0
|
||||
&& opd_entry_value (*sec, *value, &code_sec, NULL,
|
||||
FALSE) != (bfd_vma) -1
|
||||
@ -4949,7 +4949,7 @@ add_symbol_adjust (struct ppc_link_hash_entry *eh, struct bfd_link_info *info)
|
||||
fdh = lookup_fdh (eh, htab);
|
||||
if (fdh == NULL)
|
||||
{
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& (eh->elf.root.type == bfd_link_hash_undefined
|
||||
|| eh->elf.root.type == bfd_link_hash_undefweak)
|
||||
&& eh->elf.ref_regular)
|
||||
@ -5226,7 +5226,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
asection **opd_sym_map;
|
||||
struct elf_link_hash_entry *tga, *dottga;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
/* Don't do anything special with non-loaded, non-alloced sections.
|
||||
@ -5355,7 +5355,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_PPC64_GOT_TPREL16_LO_DS:
|
||||
case R_PPC64_GOT_TPREL16_HI:
|
||||
case R_PPC64_GOT_TPREL16_HA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
tls_type = TLS_TLS | TLS_TPREL;
|
||||
goto dogottls;
|
||||
@ -5428,7 +5428,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* We may also need a plt entry if the symbol turns out to be
|
||||
an ifunc. */
|
||||
if (h != NULL && !info->shared && abiversion (abfd) != 1)
|
||||
if (h != NULL && !bfd_link_pic (info) && abiversion (abfd) != 1)
|
||||
{
|
||||
if (!update_plt_info (abfd, &h->plt.plist, rel->r_addend))
|
||||
return FALSE;
|
||||
@ -5495,7 +5495,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* Not supported as a dynamic relocation. */
|
||||
case R_PPC64_ADDR64_LOCAL:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
|
||||
ppc_howto_init ();
|
||||
@ -5585,7 +5585,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
case R_PPC64_TPREL64:
|
||||
tls_type = TLS_EXPLICIT | TLS_TLS | TLS_TPREL;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
goto dotlstoc;
|
||||
|
||||
@ -5661,7 +5661,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_PPC64_TPREL16_HIGHERA:
|
||||
case R_PPC64_TPREL16_HIGHEST:
|
||||
case R_PPC64_TPREL16_HIGHESTA:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
goto dodyn;
|
||||
@ -5711,7 +5711,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_PPC64_ADDR16_HIGHESTA:
|
||||
case R_PPC64_ADDR16_LO:
|
||||
case R_PPC64_ADDR16_LO_DS:
|
||||
if (h != NULL && !info->shared && abiversion (abfd) != 1
|
||||
if (h != NULL && !bfd_link_pic (info) && abiversion (abfd) != 1
|
||||
&& rel->r_addend == 0)
|
||||
{
|
||||
/* We may need a .plt entry if this reloc refers to a
|
||||
@ -5734,7 +5734,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_PPC64_UADDR32:
|
||||
case R_PPC64_UADDR64:
|
||||
case R_PPC64_TOC:
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
/* We may need a copy reloc. */
|
||||
h->non_got_ref = 1;
|
||||
|
||||
@ -5764,18 +5764,18 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
dodyn:
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (must_be_dyn_reloc (info, r_type)
|
||||
|| (h != NULL
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& ifunc != NULL))
|
||||
{
|
||||
/* We must copy these reloc types into the output file.
|
||||
@ -6256,7 +6256,7 @@ ppc64_elf_gc_mark_dynamic_ref (struct elf_link_hash_entry *h, void *inf)
|
||||
|| ((eh->elf.def_regular || ELF_COMMON_DEF_P (&eh->elf))
|
||||
&& ELF_ST_VISIBILITY (eh->elf.other) != STV_INTERNAL
|
||||
&& ELF_ST_VISIBILITY (eh->elf.other) != STV_HIDDEN
|
||||
&& (!info->executable
|
||||
&& (!bfd_link_executable (info)
|
||||
|| info->export_dynamic
|
||||
|| (eh->elf.dynamic
|
||||
&& d != NULL
|
||||
@ -6386,7 +6386,7 @@ ppc64_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
struct got_entry **local_got_ents;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
if ((sec->flags & SEC_ALLOC) == 0)
|
||||
@ -6836,7 +6836,7 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
fdh = lookup_fdh (fh, htab);
|
||||
if (fdh == NULL
|
||||
&& !info->executable
|
||||
&& !bfd_link_executable (info)
|
||||
&& (fh->elf.root.type == bfd_link_hash_undefined
|
||||
|| fh->elf.root.type == bfd_link_hash_undefweak))
|
||||
{
|
||||
@ -6869,7 +6869,7 @@ func_desc_adjust (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
if (fdh != NULL
|
||||
&& !fdh->elf.forced_local
|
||||
&& (!info->executable
|
||||
&& (!bfd_link_executable (info)
|
||||
|| fdh->elf.def_dynamic
|
||||
|| fdh->elf.ref_dynamic
|
||||
|| (fdh->elf.root.type == bfd_link_hash_undefweak
|
||||
@ -6939,7 +6939,7 @@ ppc64_elf_func_desc_adjust (bfd *obfd ATTRIBUTE_UNUSED,
|
||||
if (htab == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& htab->elf.hgot != NULL)
|
||||
{
|
||||
_bfd_elf_link_hash_hide_symbol (info, htab->elf.hgot, TRUE);
|
||||
@ -7089,7 +7089,7 @@ ppc64_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
|
||||
@ -7508,7 +7508,7 @@ dec_dynrel_count (bfd_vma r_info,
|
||||
case R_PPC64_TPREL16_HIGHERA:
|
||||
case R_PPC64_TPREL16_HIGHEST:
|
||||
case R_PPC64_TPREL16_HIGHESTA:
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
return TRUE;
|
||||
|
||||
case R_PPC64_TPREL64:
|
||||
@ -7552,14 +7552,14 @@ dec_dynrel_count (bfd_vma r_info,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (must_be_dyn_reloc (info, r_type)
|
||||
|| (h != NULL
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular)))
|
||||
@ -7906,7 +7906,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info)
|
||||
}
|
||||
opd->adjust[OPD_NDX (rel->r_offset)] = -1;
|
||||
|
||||
if (NO_OPD_RELOCS || info->relocatable)
|
||||
if (NO_OPD_RELOCS || bfd_link_relocatable (info))
|
||||
rel = next_rel;
|
||||
else
|
||||
while (1)
|
||||
@ -8006,7 +8006,7 @@ ppc64_elf_edit_opd (struct bfd_link_info *info)
|
||||
|
||||
/* If we are doing a final link and the last .opd entry is just 16 byte
|
||||
long, add a 8 byte padding after it. */
|
||||
if (need_pad != NULL && !info->relocatable)
|
||||
if (need_pad != NULL && !bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_byte *p;
|
||||
|
||||
@ -8184,7 +8184,7 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info)
|
||||
unsigned char *toc_ref;
|
||||
int pass;
|
||||
|
||||
if (info->relocatable || !info->executable)
|
||||
if (bfd_link_relocatable (info) || !bfd_link_executable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = ppc_hash_table (info);
|
||||
@ -9378,7 +9378,7 @@ allocate_got (struct elf_link_hash_entry *h,
|
||||
htab->elf.irelplt->size += rentsize;
|
||||
htab->got_reli_size += rentsize;
|
||||
}
|
||||
else if ((info->shared
|
||||
else if ((bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak))
|
||||
@ -9431,7 +9431,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
if ((htab->elf.dynamic_sections_created
|
||||
&& h->dynindx != -1
|
||||
&& WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
&& WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
|| h->type == STT_GNU_IFUNC)
|
||||
{
|
||||
struct plt_entry *pent;
|
||||
@ -9574,7 +9574,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
space for relocs that have become local due to symbol visibility
|
||||
changes. */
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Relocs that use pc_count are those that appear on a call insn,
|
||||
or certain REL relocs (see must_be_dyn_reloc) that can be
|
||||
@ -9748,7 +9748,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
if (htab->elf.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");
|
||||
if (s == NULL)
|
||||
@ -9840,7 +9840,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
htab->elf.irelplt->size += rel_size;
|
||||
htab->got_reli_size += rel_size;
|
||||
}
|
||||
else if (info->shared)
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srel = ppc64_elf_tdata (ibfd)->relgot;
|
||||
srel->size += rel_size;
|
||||
@ -9878,7 +9878,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
if (htab->glink != NULL)
|
||||
htab->glink->rawsize = htab->glink->size;
|
||||
|
||||
if (!htab->opd_abi && !info->shared)
|
||||
if (!htab->opd_abi && !bfd_link_pic (info))
|
||||
elf_link_hash_traverse (&htab->elf, size_global_entry_stubs, info);
|
||||
|
||||
first_tlsld = NULL;
|
||||
@ -9905,7 +9905,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
ent->got.offset = s->size;
|
||||
ent->owner = ibfd;
|
||||
s->size += 16;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srel = ppc64_elf_tdata (ibfd)->relgot;
|
||||
srel->size += sizeof (Elf64_External_Rela);
|
||||
@ -10035,7 +10035,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
#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;
|
||||
@ -11456,7 +11456,7 @@ ppc64_elf_layout_multitoc (struct bfd_link_info *info)
|
||||
htab->elf.irelplt->size += rel_size;
|
||||
htab->got_reli_size += rel_size;
|
||||
}
|
||||
else if (info->shared)
|
||||
else if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srel = ppc64_elf_tdata (ibfd)->relgot;
|
||||
srel->size += rel_size;
|
||||
@ -11481,7 +11481,7 @@ ppc64_elf_layout_multitoc (struct bfd_link_info *info)
|
||||
asection *s = ppc64_elf_tdata (ibfd)->got;
|
||||
ent->got.offset = s->size;
|
||||
s->size += 16;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *srel = ppc64_elf_tdata (ibfd)->relgot;
|
||||
srel->size += sizeof (Elf64_External_Rela);
|
||||
@ -12005,7 +12005,7 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
|
||||
if (htab == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (htab->params->plt_thread_safe == -1 && !info->executable)
|
||||
if (htab->params->plt_thread_safe == -1 && !bfd_link_executable (info))
|
||||
htab->params->plt_thread_safe = 1;
|
||||
if (!htab->opd_abi)
|
||||
htab->params->plt_thread_safe = 0;
|
||||
@ -13229,7 +13229,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
||||
ppc64_elf_howto_table[r_type], 0,
|
||||
contents);
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
continue;
|
||||
|
||||
if (h != NULL && &h->elf == htab->elf.hgot)
|
||||
@ -13709,7 +13709,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
||||
. lis 2,.TOC.@ha
|
||||
. addi 2,2,.TOC.@l
|
||||
if .TOC. is in range. */
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
&& !info->traditional_format
|
||||
&& h != NULL && &h->elf == htab->elf.hgot
|
||||
&& rel + 1 < relend
|
||||
@ -14078,9 +14078,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
||||
if (h != NULL)
|
||||
{
|
||||
bfd_boolean dyn = htab->elf.dynamic_sections_created;
|
||||
if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared,
|
||||
if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info),
|
||||
&h->elf)
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, &h->elf)))
|
||||
/* This is actually a static link, or it is a
|
||||
-Bsymbolic link and the symbol is defined
|
||||
@ -14139,7 +14139,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
||||
: ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC);
|
||||
if (ifunc)
|
||||
relgot = htab->elf.irelplt;
|
||||
else if ((info->shared || indx != 0)
|
||||
else if ((bfd_link_pic (info) || indx != 0)
|
||||
&& (h == NULL
|
||||
|| (tls_type == (TLS_TLS | TLS_LD)
|
||||
&& !h->elf.def_dynamic)
|
||||
@ -14357,7 +14357,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
if (htab->elf.tls_sec != NULL)
|
||||
addend -= htab->elf.tls_sec->vma + TP_OFFSET;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
/* The TPREL16 relocs shouldn't really be used in shared
|
||||
libs as they will result in DT_TEXTREL being set, but
|
||||
support them anyway. */
|
||||
@ -14434,19 +14434,19 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
||||
if (NO_OPD_RELOCS && is_opd)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->elf.other) == STV_DEFAULT
|
||||
|| h->elf.root.type != bfd_link_hash_undefweak)
|
||||
&& (must_be_dyn_reloc (info, r_type)
|
||||
|| !SYMBOL_CALLS_LOCAL (info, &h->elf)))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->elf.dynindx != -1
|
||||
&& !h->elf.non_got_ref
|
||||
&& !h->elf.def_regular)
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (h != NULL
|
||||
? h->elf.type == STT_GNU_IFUNC
|
||||
: ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)))
|
||||
@ -14909,7 +14909,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
||||
adjusted. Worse, reloc symbol indices will be for the output
|
||||
file rather than the input. Save a copy of the relocs for
|
||||
opd_entry_value. */
|
||||
if (is_opd && (info->emitrelocations || info->relocatable))
|
||||
if (is_opd && (info->emitrelocations || bfd_link_relocatable (info)))
|
||||
{
|
||||
bfd_size_type amt;
|
||||
amt = input_section->reloc_count * sizeof (Elf_Internal_Rela);
|
||||
@ -14944,7 +14944,7 @@ ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
|
||||
return 1;
|
||||
|
||||
value = elfsym->st_value - input_sec->output_offset;
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
value -= input_sec->output_section->vma;
|
||||
|
||||
adjust = opd->adjust[OPD_NDX (value)];
|
||||
|
@ -775,11 +775,11 @@ elf_s390_create_dynamic_sections (bfd *dynobj,
|
||||
htab->elf.splt = bfd_get_linker_section (dynobj, ".plt");
|
||||
htab->elf.srelplt = bfd_get_linker_section (dynobj, ".rela.plt");
|
||||
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
|
||||
|
||||
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -856,7 +856,7 @@ elf_s390_tls_transition (struct bfd_link_info *info,
|
||||
int r_type,
|
||||
int is_local)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return r_type;
|
||||
|
||||
switch (r_type)
|
||||
@ -896,7 +896,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
int tls_type, old_tls_type;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_s390_elf (abfd));
|
||||
@ -1109,7 +1109,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
case R_390_TLS_GOTIE20:
|
||||
case R_390_TLS_GOTIE64:
|
||||
case R_390_TLS_IEENT:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
@ -1186,10 +1186,10 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
/* For static linking and executables this reloc will be
|
||||
calculated at linktime otherwise a TLS_TPOFF runtime
|
||||
reloc will be generated. */
|
||||
if (r_type == R_390_TLS_LE64 && info->pie)
|
||||
if (r_type == R_390_TLS_LE64 && bfd_link_pie (info))
|
||||
break;
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
break;
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
@ -1215,7 +1215,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
adjust_dynamic_symbol. */
|
||||
h->non_got_ref = 1;
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a .plt entry if the function this reloc
|
||||
refers to is in a shared lib. */
|
||||
@ -1244,7 +1244,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& ((ELF64_R_TYPE (rel->r_info) != R_390_PC16
|
||||
&& ELF64_R_TYPE (rel->r_info) != R_390_PC12DBL
|
||||
@ -1258,7 +1258,7 @@ elf_s390_check_relocs (bfd *abfd,
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -1395,7 +1395,7 @@ elf_s390_gc_sweep_hook (bfd *abfd,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf_s390_hash_table (info);
|
||||
@ -1505,7 +1505,7 @@ elf_s390_gc_sweep_hook (bfd *abfd,
|
||||
case R_390_PC32:
|
||||
case R_390_PC32DBL:
|
||||
case R_390_PC64:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
break;
|
||||
/* Fall through */
|
||||
|
||||
@ -1645,7 +1645,7 @@ elf_s390_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
|
||||
@ -1747,7 +1747,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
{
|
||||
asection *s = htab->elf.splt;
|
||||
@ -1764,7 +1764,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h,
|
||||
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;
|
||||
@ -1800,7 +1800,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h,
|
||||
to R_390_TLS_LE64 requiring no TLS entry. For GOTIE12 and IEENT
|
||||
we can save the dynamic TLS relocation. */
|
||||
if (h->got.refcount > 0
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& elf_s390_hash_entry(h)->tls_type >= GOT_TLS_IE)
|
||||
{
|
||||
@ -1846,7 +1846,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h,
|
||||
htab->elf.srelgot->size += 2 * sizeof (Elf64_External_Rela);
|
||||
else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
htab->elf.srelgot->size += sizeof (Elf64_External_Rela);
|
||||
}
|
||||
@ -1862,7 +1862,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h,
|
||||
space for pc-relative relocs that have become local due to symbol
|
||||
visibility changes. */
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
@ -1989,7 +1989,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (htab->elf.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");
|
||||
if (s == NULL)
|
||||
@ -2057,7 +2057,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
s->size += GOT_ENTRY_SIZE;
|
||||
if (*local_tls_type == GOT_TLS_GD)
|
||||
s->size += GOT_ENTRY_SIZE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
srela->size += sizeof (Elf64_External_Rela);
|
||||
}
|
||||
else
|
||||
@ -2167,7 +2167,7 @@ elf_s390_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;
|
||||
@ -2391,7 +2391,7 @@ elf_s390_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;
|
||||
|
||||
switch (r_type)
|
||||
@ -2476,8 +2476,10 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
finish_dynamic_symbol. */
|
||||
}
|
||||
}
|
||||
else if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|
||||
|| (info->shared
|
||||
else if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h)
|
||||
|| (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -2504,7 +2506,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
|
||||
if ((h->def_regular
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
/* lgrl rx,sym@GOTENT -> larl rx, sym */
|
||||
&& ((r_type == R_390_GOTENT
|
||||
@ -2554,7 +2556,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
bfd_put_64 (output_bfd, relocation,
|
||||
htab->elf.sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -2692,7 +2694,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
&& s390_is_ifunc_symbol_p (h)
|
||||
&& h->def_regular)
|
||||
{
|
||||
if (!info->shared || !h->non_got_ref)
|
||||
if (!bfd_link_pic (info) || !h->non_got_ref)
|
||||
{
|
||||
/* For a non-shared object STT_GNU_IFUNC symbol must
|
||||
go through PLT. */
|
||||
@ -2723,7 +2725,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (h->dynindx == -1
|
||||
|| h->forced_local
|
||||
|| info->executable)
|
||||
|| bfd_link_executable (info))
|
||||
{
|
||||
/* This symbol is resolved locally. */
|
||||
outrel.r_info = ELF64_R_INFO (0, R_390_IRELATIVE);
|
||||
@ -2752,7 +2754,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
if ((input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
@ -2765,7 +2767,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
&& r_type != R_390_PC64)
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -2807,7 +2809,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|| r_type == R_390_PC32
|
||||
|| r_type == R_390_PC32DBL
|
||||
|| r_type == R_390_PC64
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
{
|
||||
@ -2879,7 +2881,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|
||||
/* Relocations for tls literal pool entries. */
|
||||
case R_390_TLS_IE64:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@ -2907,7 +2909,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
else if (h != NULL)
|
||||
{
|
||||
tls_type = elf_s390_hash_entry(h)->tls_type;
|
||||
if (!info->shared && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
|
||||
if (!bfd_link_pic (info) && h->dynindx == -1 && tls_type >= GOT_TLS_IE)
|
||||
r_type = R_390_TLS_LE64;
|
||||
}
|
||||
if (r_type == R_390_TLS_GD64 && tls_type >= GOT_TLS_IE)
|
||||
@ -3018,14 +3020,14 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
if (local_got_offsets == NULL)
|
||||
abort();
|
||||
off = local_got_offsets[r_symndx];
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
goto emit_tls_relocs;
|
||||
}
|
||||
else
|
||||
{
|
||||
off = h->got.offset;
|
||||
tls_type = elf_s390_hash_entry(h)->tls_type;
|
||||
if (info->shared || h->dynindx != -1 || tls_type < GOT_TLS_IE)
|
||||
if (bfd_link_pic (info) || h->dynindx != -1 || tls_type < GOT_TLS_IE)
|
||||
goto emit_tls_relocs;
|
||||
}
|
||||
|
||||
@ -3042,7 +3044,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_390_TLS_LDM64:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
/* The literal pool entry this relocation refers to gets ignored
|
||||
by the optimized code of the local exec model. Do nothing
|
||||
and the value will turn out zero. */
|
||||
@ -3080,7 +3082,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_390_TLS_LE64:
|
||||
if (info->shared && !info->pie)
|
||||
if (bfd_link_pic (info) && !bfd_link_pie (info))
|
||||
{
|
||||
/* Linking a shared library with non-fpic code requires
|
||||
a R_390_TLS_TPOFF relocation. */
|
||||
@ -3117,7 +3119,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
continue;
|
||||
|
||||
case R_390_TLS_LDO64:
|
||||
if (info->shared || (input_section->flags & SEC_DEBUGGING))
|
||||
if (bfd_link_pic (info) || (input_section->flags & SEC_DEBUGGING))
|
||||
relocation -= dtpoff_base (info);
|
||||
else
|
||||
/* When converting LDO to LE, we must negate. */
|
||||
@ -3139,7 +3141,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (r_type == R_390_TLS_LOAD)
|
||||
{
|
||||
if (!info->shared && (h == NULL || h->dynindx == -1))
|
||||
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
/* IE->LE transition. Four valid cases:
|
||||
lg %rx,(0,%ry) -> sllg %rx,%ry,0
|
||||
@ -3181,7 +3183,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
|
||||
if ((insn0 & 0xffff0000) != 0xc0e50000)
|
||||
invalid_tls_insn (input_bfd, input_section, rel);
|
||||
if (!info->shared && (h == NULL || h->dynindx == -1))
|
||||
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
/* GD->LE transition.
|
||||
brasl %r14,__tls_get_addr@plt -> brcl 0,. */
|
||||
@ -3200,7 +3202,7 @@ elf_s390_relocate_section (bfd *output_bfd,
|
||||
}
|
||||
else if (r_type == R_390_TLS_LDCALL)
|
||||
{
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
unsigned int insn0, insn1;
|
||||
|
||||
@ -3370,7 +3372,7 @@ elf_s390_finish_ifunc_symbol (bfd *output_bfd,
|
||||
|
||||
if (!h
|
||||
|| h->dynindx == -1
|
||||
|| ((info->executable
|
||||
|| ((bfd_link_executable (info)
|
||||
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
|
||||
&& h->def_regular))
|
||||
{
|
||||
@ -3512,7 +3514,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
if (h->def_regular && s390_is_ifunc_symbol_p (h))
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* An explicit GOT slot usage needs GLOB_DAT. If the
|
||||
symbol references local the implicit got.iplt slot
|
||||
@ -3532,7 +3534,7 @@ elf_s390_finish_dynamic_symbol (bfd *output_bfd,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (info->shared
|
||||
else if (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
/* If this is a static link, or it is a -Bsymbolic link and
|
||||
|
@ -53,7 +53,7 @@
|
||||
#define elf_sh64_plt_symbol_offset(info) 0
|
||||
|
||||
/* Return offset of the relocation in PLT entry. */
|
||||
#define elf_sh64_plt_reloc_offset(info) (info->shared ? 52 : 44)
|
||||
#define elf_sh64_plt_reloc_offset(info) (bfd_link_pic (info) ? 52 : 44)
|
||||
|
||||
#define ELF_DYNAMIC_INTERPRETER "/usr/lib/libc.so.1"
|
||||
|
||||
@ -1516,7 +1516,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (sec != NULL && discarded_section (sec))
|
||||
/* Handled below. */
|
||||
;
|
||||
else if (info->relocatable)
|
||||
else 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,
|
||||
@ -1592,7 +1592,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|| r_type == R_SH_GOT_MEDHI16
|
||||
|| r_type == R_SH_GOT_HI16)
|
||||
&& elf_hash_table (info)->dynamic_sections_created
|
||||
&& (! info->shared
|
||||
&& (! bfd_link_pic (info)
|
||||
|| (! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular))
|
||||
/* The cases above are those in which relocation is
|
||||
@ -1600,7 +1600,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
below are those in which we must defer relocation
|
||||
to run-time, because we can't resolve absolute
|
||||
addresses when creating a shared library. */
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& ((! info->symbolic && h->dynindx != -1)
|
||||
|| !h->def_regular)
|
||||
&& ((r_type == R_SH_64
|
||||
@ -1629,7 +1629,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
STT_DATALABEL on the way to it. */
|
||||
| ((h->other & STO_SH5_ISA32) != 0
|
||||
&& ! seen_stt_datalabel));
|
||||
else if (!info->relocatable
|
||||
else if (!bfd_link_relocatable (info)
|
||||
&& (_bfd_elf_section_offset (output_bfd, info,
|
||||
input_section,
|
||||
rel->r_offset)
|
||||
@ -1649,7 +1649,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
else if (info->unresolved_syms_in_objects == RM_IGNORE
|
||||
&& ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)
|
||||
;
|
||||
else if (!info->relocatable)
|
||||
else if (!bfd_link_relocatable (info))
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
@ -1664,7 +1664,7 @@ sh_elf64_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;
|
||||
|
||||
disp = (relocation
|
||||
@ -1691,7 +1691,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
case R_SH_64:
|
||||
case R_SH_64_PCREL:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (r_type != R_SH_64_PCREL
|
||||
|| (h != NULL
|
||||
@ -1785,7 +1785,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
if (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
|
||||
|| ! info->shared
|
||||
|| ! bfd_link_pic (info)
|
||||
|| info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->plt.offset == (bfd_vma) -1
|
||||
@ -1838,7 +1838,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
BFD_ASSERT (off != (bfd_vma) -1);
|
||||
|
||||
if (! elf_hash_table (info)->dynamic_sections_created
|
||||
|| (info->shared
|
||||
|| (bfd_link_pic (info)
|
||||
&& (info->symbolic || h->dynindx == -1
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN)
|
||||
@ -1907,7 +1907,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
bfd_put_64 (output_bfd, relocation, sgot->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -2378,7 +2378,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
srelgot = NULL;
|
||||
sreloc = NULL;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -2477,7 +2477,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
}
|
||||
|
||||
if (srelgot == NULL
|
||||
&& (h != NULL || info->shared))
|
||||
&& (h != NULL || bfd_link_pic (info)))
|
||||
{
|
||||
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
|
||||
if (srelgot == NULL)
|
||||
@ -2569,7 +2569,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
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_SH_RELATIVE reloc so that the dynamic
|
||||
@ -2594,7 +2594,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
if (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
|
||||
|| ! info->shared
|
||||
|| ! bfd_link_pic (info)
|
||||
|| info->symbolic
|
||||
|| h->dynindx == -1
|
||||
|| h->got.offset != (bfd_vma) -1)
|
||||
@ -2652,7 +2652,7 @@ sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
later (it is never cleared). We account for that
|
||||
possibility below by storing information in the
|
||||
pcrel_relocs_copied field of the hash table entry. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (ELF32_R_TYPE (rel->r_info) != R_SH_64_PCREL
|
||||
|| (h != NULL
|
||||
@ -2763,7 +2763,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
right, and tweak the name when it's output. Otherwise, we make
|
||||
an indirect symbol of it. */
|
||||
flagword flags
|
||||
= info->relocatable || info->emitrelocations
|
||||
= bfd_link_relocatable (info) || info->emitrelocations
|
||||
? BSF_GLOBAL : BSF_GLOBAL | BSF_INDIRECT;
|
||||
|
||||
char *dl_name
|
||||
@ -2807,9 +2807,9 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
free (dl_name);
|
||||
|
||||
if (h->type != STT_DATALABEL
|
||||
|| ((info->relocatable || info->emitrelocations)
|
||||
|| ((bfd_link_relocatable (info) || info->emitrelocations)
|
||||
&& h->root.type != bfd_link_hash_undefined)
|
||||
|| (! info->relocatable && !info->emitrelocations
|
||||
|| (! bfd_link_relocatable (info) && !info->emitrelocations
|
||||
&& h->root.type != bfd_link_hash_indirect))
|
||||
{
|
||||
/* Make sure we don't get confused on invalid input. */
|
||||
@ -2853,7 +2853,7 @@ sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info,
|
||||
{
|
||||
char *name = (char *) cname;
|
||||
|
||||
if (info->relocatable || info->emitrelocations)
|
||||
if (bfd_link_relocatable (info) || info->emitrelocations)
|
||||
{
|
||||
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL)
|
||||
name[strlen (name) - strlen (DATALABEL_SUFFIX)] = 0;
|
||||
@ -3161,7 +3161,7 @@ sh64_elf64_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
h->type = STT_OBJECT;
|
||||
elf_hash_table (info)->hplt = h;
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
}
|
||||
@ -3201,7 +3201,7 @@ sh64_elf64_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
|
||||
@ -3245,7 +3245,7 @@ sh64_elf64_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)
|
||||
{
|
||||
@ -3278,7 +3278,7 @@ sh64_elf64_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;
|
||||
@ -3325,7 +3325,7 @@ sh64_elf64_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
|
||||
@ -3404,7 +3404,7 @@ sh64_elf64_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);
|
||||
@ -3428,7 +3428,7 @@ sh64_elf64_size_dynamic_sections (bfd *output_bfd,
|
||||
PC relative relocs against symbols defined in a regular object.
|
||||
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 && info->symbolic)
|
||||
if (bfd_link_pic (info) && info->symbolic)
|
||||
sh64_elf64_link_hash_traverse (elf_hash_table (info),
|
||||
sh64_elf64_discard_copies, NULL);
|
||||
|
||||
@ -3525,7 +3525,7 @@ sh64_elf64_size_dynamic_sections (bfd *output_bfd,
|
||||
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;
|
||||
@ -3604,11 +3604,11 @@ sh64_elf64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
The first three are reserved. */
|
||||
got_offset = (plt_index + 3) * 8;
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
got_offset -= GOT_BIAS;
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
if (elf_sh64_plt_entry == NULL)
|
||||
{
|
||||
@ -3647,7 +3647,7 @@ sh64_elf64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
+ elf_sh64_plt_symbol_offset (info)));
|
||||
}
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
got_offset += GOT_BIAS;
|
||||
|
||||
movi_shori_putval (output_bfd,
|
||||
@ -3704,7 +3704,7 @@ sh64_elf64_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)
|
||||
{
|
||||
@ -3858,7 +3858,7 @@ sh64_elf64_finish_dynamic_sections (bfd *output_bfd,
|
||||
splt = bfd_get_linker_section (dynobj, ".plt");
|
||||
if (splt && splt->size > 0)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (elf_sh64_pic_plt_entry == NULL)
|
||||
{
|
||||
|
@ -1071,7 +1071,7 @@ elf_x86_64_create_dynamic_sections (bfd *dynobj,
|
||||
if (!htab->sdynbss)
|
||||
abort ();
|
||||
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
/* Always allow copy relocs for building executables. */
|
||||
asection *s = bfd_get_linker_section (dynobj, ".rela.bss");
|
||||
@ -1434,7 +1434,7 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
case R_X86_64_GOTPC32_TLSDESC:
|
||||
case R_X86_64_TLSDESC_CALL:
|
||||
case R_X86_64_GOTTPOFF:
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
if (h == NULL)
|
||||
to_type = R_X86_64_TPOFF32;
|
||||
@ -1449,7 +1449,7 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
{
|
||||
unsigned int new_to_type = to_type;
|
||||
|
||||
if (info->executable
|
||||
if (bfd_link_executable (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx == -1
|
||||
&& tls_type == GOT_TLS_IE)
|
||||
@ -1473,7 +1473,7 @@ elf_x86_64_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
break;
|
||||
|
||||
case R_X86_64_TLSLD:
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
to_type = R_X86_64_TPOFF32;
|
||||
break;
|
||||
|
||||
@ -1550,7 +1550,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
asection *sreloc;
|
||||
bfd_boolean use_plt_got;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_x86_64_elf (abfd));
|
||||
@ -1742,7 +1742,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
goto create_got;
|
||||
|
||||
case R_X86_64_TPOFF32:
|
||||
if (!info->executable && ABI_64_P (abfd))
|
||||
if (!bfd_link_executable (info) && ABI_64_P (abfd))
|
||||
{
|
||||
if (h)
|
||||
name = h->root.root.string;
|
||||
@ -1759,7 +1759,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
break;
|
||||
|
||||
case R_X86_64_GOTTPOFF:
|
||||
if (!info->executable)
|
||||
if (!bfd_link_executable (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
@ -1911,7 +1911,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
cannot be used in shared libs. Don't error out for
|
||||
sections we don't care about, such as debug sections or
|
||||
non-constant sections. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (sec->flags & SEC_READONLY) != 0)
|
||||
{
|
||||
@ -1934,7 +1934,7 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_X86_64_PC64:
|
||||
case R_X86_64_64:
|
||||
pointer:
|
||||
if (h != NULL && info->executable)
|
||||
if (h != NULL && bfd_link_executable (info))
|
||||
{
|
||||
/* If this reloc is in a read-only section, we might
|
||||
need a copy reloc. We can't check reliably at this
|
||||
@ -1976,7 +1976,7 @@ do_size:
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (! IS_X86_64_PCREL_TYPE (r_type)
|
||||
|| (h != NULL
|
||||
@ -1984,7 +1984,7 @@ do_size:
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -2157,7 +2157,7 @@ elf_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf_x86_64_hash_table (info);
|
||||
@ -2273,7 +2273,7 @@ elf_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_X86_64_PC64:
|
||||
case R_X86_64_SIZE32:
|
||||
case R_X86_64_SIZE64:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (h == NULL || h->type != STT_GNU_IFUNC))
|
||||
break;
|
||||
/* Fall thru */
|
||||
@ -2409,7 +2409,7 @@ elf_x86_64_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
|
||||
@ -2568,7 +2568,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
{
|
||||
asection *s = htab->elf.splt;
|
||||
@ -2595,7 +2595,7 @@ elf_x86_64_allocate_dynrelocs (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)
|
||||
{
|
||||
if (use_plt_got)
|
||||
@ -2659,7 +2659,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
/* If R_X86_64_GOTTPOFF symbol is now local to the binary,
|
||||
make it a R_X86_64_TPOFF32 requiring no GOT entry. */
|
||||
if (h->got.refcount > 0
|
||||
&& info->executable
|
||||
&& bfd_link_executable (info)
|
||||
&& h->dynindx == -1
|
||||
&& elf_x86_64_hash_entry (h)->tls_type == GOT_TLS_IE)
|
||||
{
|
||||
@ -2708,7 +2708,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
else if (! GOT_TLS_GDESC_P (tls_type)
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
htab->elf.srelgot->size += bed->s->sizeof_rela;
|
||||
if (GOT_TLS_GDESC_P (tls_type))
|
||||
@ -2729,7 +2729,7 @@ elf_x86_64_allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Relocs that use pc_count are those that appear on a call
|
||||
insn, or certain REL relocs that can generated via assembly.
|
||||
@ -2770,7 +2770,7 @@ elf_x86_64_allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
}
|
||||
/* For PIE, discard space for pc-relative relocs against
|
||||
symbols which turn out to need copy relocs. */
|
||||
else if (info->executable
|
||||
else if (bfd_link_executable (info)
|
||||
&& (h->needs_copy || eh->needs_copy)
|
||||
&& h->def_dynamic
|
||||
&& !h->def_regular)
|
||||
@ -2876,7 +2876,7 @@ elf_x86_64_readonly_dynrelocs (struct elf_link_hash_entry *h,
|
||||
|
||||
info->flags |= DF_TEXTREL;
|
||||
|
||||
if ((info->warn_shared_textrel && info->shared)
|
||||
if ((info->warn_shared_textrel && bfd_link_pic (info))
|
||||
|| info->error_textrel)
|
||||
info->callbacks->einfo (_("%P: %B: warning: relocation against `%s' in readonly section `%A'\n"),
|
||||
p->sec->owner, h->root.root.string,
|
||||
@ -3181,7 +3181,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
|
||||
if (htab->elf.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");
|
||||
if (s == NULL)
|
||||
@ -3234,7 +3234,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
|
||||
&& (info->flags & DF_TEXTREL) == 0)
|
||||
{
|
||||
info->flags |= DF_TEXTREL;
|
||||
if ((info->warn_shared_textrel && info->shared)
|
||||
if ((info->warn_shared_textrel && bfd_link_pic (info))
|
||||
|| info->error_textrel)
|
||||
info->callbacks->einfo (_("%P: %B: warning: relocation in readonly section `%A'\n"),
|
||||
p->sec->owner, p->sec);
|
||||
@ -3275,7 +3275,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
|
||||
if (GOT_TLS_GD_P (*local_tls_type))
|
||||
s->size += GOT_ENTRY_SIZE;
|
||||
}
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| GOT_TLS_GD_ANY_P (*local_tls_type)
|
||||
|| *local_tls_type == GOT_TLS_IE)
|
||||
{
|
||||
@ -3470,7 +3470,7 @@ elf_x86_64_size_dynamic_sections (bfd *output_bfd,
|
||||
#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;
|
||||
@ -3587,7 +3587,7 @@ elf_x86_64_set_tls_module_base (struct bfd_link_info *info)
|
||||
struct elf_x86_64_link_hash_table *htab;
|
||||
struct bfd_link_hash_entry *base;
|
||||
|
||||
if (!info->executable)
|
||||
if (!bfd_link_executable (info))
|
||||
return;
|
||||
|
||||
htab = elf_x86_64_hash_table (info);
|
||||
@ -3738,7 +3738,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
st_size = sym->st_size;
|
||||
|
||||
/* Relocate against local STT_GNU_IFUNC symbol. */
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
|
||||
{
|
||||
h = elf_x86_64_get_local_sym_hash (htab, input_bfd,
|
||||
@ -3767,7 +3767,7 @@ elf_x86_64_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 (rel->r_addend == 0 && !ABI_64_P (output_bfd))
|
||||
@ -3851,7 +3851,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
return FALSE;
|
||||
|
||||
case R_X86_64_32S:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
abort ();
|
||||
goto do_relocation;
|
||||
|
||||
@ -3878,7 +3878,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
|
||||
/* Generate dynamic relcoation 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)
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@ -3898,7 +3898,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (h->dynindx == -1
|
||||
|| h->forced_local
|
||||
|| info->executable)
|
||||
|| bfd_link_executable (info))
|
||||
{
|
||||
/* This symbol is resolved locally. */
|
||||
outrel.r_info = htab->r_info (0, R_X86_64_IRELATIVE);
|
||||
@ -4028,8 +4028,8 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
|
||||
dyn = htab->elf.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))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -4076,7 +4076,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
bfd_put_64 (output_bfd, relocation,
|
||||
base_got->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -4118,7 +4118,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
symbol for shared library since it may not be local when
|
||||
used as function address or with copy relocation. We also
|
||||
need to make sure that a symbol is referenced locally. */
|
||||
if (info->shared && h)
|
||||
if (bfd_link_pic (info) && h)
|
||||
{
|
||||
if (!h->def_regular)
|
||||
{
|
||||
@ -4146,7 +4146,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return FALSE;
|
||||
}
|
||||
else if (!info->executable
|
||||
else if (!bfd_link_executable (info)
|
||||
&& !SYMBOL_REFERENCES_LOCAL (info, h)
|
||||
&& (h->type == STT_FUNC
|
||||
|| h->type == STT_OBJECT)
|
||||
@ -4266,11 +4266,11 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
case R_X86_64_PC32_BND:
|
||||
/* Don't complain about -fPIC if the symbol is undefined when
|
||||
building executable. */
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (input_section->flags & SEC_READONLY) != 0
|
||||
&& h != NULL
|
||||
&& !(info->executable
|
||||
&& !(bfd_link_executable (info)
|
||||
&& h->root.type == bfd_link_hash_undefined))
|
||||
{
|
||||
bfd_boolean fail = FALSE;
|
||||
@ -4285,7 +4285,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|
||||
defined locally or for a branch. */
|
||||
fail = !h->def_regular && !branch;
|
||||
}
|
||||
else if (!(info->executable
|
||||
else if (!(bfd_link_executable (info)
|
||||
&& (h->needs_copy || eh->needs_copy)))
|
||||
{
|
||||
/* Symbol doesn't need copy reloc and isn't referenced
|
||||
@ -4347,8 +4347,8 @@ direct:
|
||||
/* Don't copy a pc-relative relocation into the output file
|
||||
if the symbol needs copy reloc or the symbol is undefined
|
||||
when building executable. */
|
||||
if ((info->shared
|
||||
&& !(info->executable
|
||||
if ((bfd_link_pic (info)
|
||||
&& !(bfd_link_executable (info)
|
||||
&& h != NULL
|
||||
&& (h->needs_copy
|
||||
|| eh->needs_copy
|
||||
@ -4362,7 +4362,7 @@ direct:
|
||||
&& r_type != R_X86_64_SIZE64)
|
||||
|| ! SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (ELIMINATE_COPY_RELOCS
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -4400,7 +4400,7 @@ direct:
|
||||
else if (h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& (IS_X86_64_PCREL_TYPE (r_type)
|
||||
|| ! info->shared
|
||||
|| ! bfd_link_pic (info)
|
||||
|| ! SYMBOLIC_BIND (info, h)
|
||||
|| ! h->def_regular))
|
||||
{
|
||||
@ -4978,7 +4978,8 @@ direct:
|
||||
break;
|
||||
|
||||
case R_X86_64_DTPOFF32:
|
||||
if (!info->executable|| (input_section->flags & SEC_CODE) == 0)
|
||||
if (!bfd_link_executable (info)
|
||||
|| (input_section->flags & SEC_CODE) == 0)
|
||||
relocation -= elf_x86_64_dtpoff_base (info);
|
||||
else
|
||||
relocation = elf_x86_64_tpoff (info, relocation);
|
||||
@ -4986,7 +4987,7 @@ direct:
|
||||
|
||||
case R_X86_64_TPOFF32:
|
||||
case R_X86_64_TPOFF64:
|
||||
BFD_ASSERT (info->executable);
|
||||
BFD_ASSERT (bfd_link_executable (info));
|
||||
relocation = elf_x86_64_tpoff (info, relocation);
|
||||
break;
|
||||
|
||||
@ -5119,7 +5120,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
/* This symbol has an entry in the procedure linkage table. Set
|
||||
it up. */
|
||||
if ((h->dynindx == -1
|
||||
&& !((h->forced_local || info->executable)
|
||||
&& !((h->forced_local || bfd_link_executable (info))
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
|| plt == NULL
|
||||
@ -5230,7 +5231,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
+ gotplt->output_offset
|
||||
+ got_offset);
|
||||
if (h->dynindx == -1
|
||||
|| ((info->executable
|
||||
|| ((bfd_link_executable (info)
|
||||
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
@ -5374,7 +5375,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
if (h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Generate R_X86_64_GLOB_DAT. */
|
||||
goto do_glob_dat;
|
||||
@ -5397,7 +5398,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (info->shared
|
||||
else if (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
if (!h->def_regular)
|
||||
|
122
bfd/elflink.c
122
bfd/elflink.c
@ -246,7 +246,7 @@ _bfd_elf_link_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
|
||||
/* A dynamically linked executable has a .interp section, but a
|
||||
shared library does not. */
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
s = bfd_make_section_anyway_with_flags (abfd, ".interp",
|
||||
flags | SEC_READONLY);
|
||||
@ -418,7 +418,7 @@ _bfd_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->rela_plts_and_copies_p
|
||||
@ -519,7 +519,7 @@ bfd_elf_link_mark_dynamic_symbol (struct bfd_link_info *info,
|
||||
struct bfd_elf_dynamic_list *d = info->dynamic_list;
|
||||
|
||||
/* It may be called more than once on the same H. */
|
||||
if(h->dynamic || info->relocatable)
|
||||
if(h->dynamic || bfd_link_relocatable (info))
|
||||
return;
|
||||
|
||||
if ((info->dynamic_data
|
||||
@ -623,7 +623,7 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
|
||||
|
||||
/* STV_HIDDEN and STV_INTERNAL symbols must be STB_LOCAL in shared objects
|
||||
and executables. */
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& h->dynindx != -1
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_HIDDEN
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_INTERNAL))
|
||||
@ -631,8 +631,9 @@ bfd_elf_record_link_assignment (bfd *output_bfd,
|
||||
|
||||
if ((h->def_dynamic
|
||||
|| h->ref_dynamic
|
||||
|| info->shared
|
||||
|| (info->executable && elf_hash_table (info)->is_relocatable_executable))
|
||||
|| bfd_link_pic (info)
|
||||
|| (bfd_link_executable (info)
|
||||
&& elf_hash_table (info)->is_relocatable_executable))
|
||||
&& h->dynindx == -1)
|
||||
{
|
||||
if (! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
@ -842,7 +843,8 @@ _bfd_elf_link_renumber_dynsyms (bfd *output_bfd,
|
||||
{
|
||||
unsigned long dynsymcount = 0;
|
||||
|
||||
if (info->shared || elf_hash_table (info)->is_relocatable_executable)
|
||||
if (bfd_link_pic (info)
|
||||
|| elf_hash_table (info)->is_relocatable_executable)
|
||||
{
|
||||
const struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
|
||||
asection *p;
|
||||
@ -1743,7 +1745,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
|
||||
if (! override)
|
||||
{
|
||||
/* Add the default symbol if not performing a relocatable link. */
|
||||
if (! info->relocatable)
|
||||
if (! bfd_link_relocatable (info))
|
||||
{
|
||||
bh = &hi->root;
|
||||
if (! (_bfd_generic_link_add_one_symbol
|
||||
@ -1824,7 +1826,7 @@ _bfd_elf_add_default_symbol (bfd *abfd,
|
||||
{
|
||||
if (! dynamic)
|
||||
{
|
||||
if (! info->executable
|
||||
if (! bfd_link_executable (info)
|
||||
|| hi->def_dynamic
|
||||
|| hi->ref_dynamic)
|
||||
*dynsym = TRUE;
|
||||
@ -1896,7 +1898,7 @@ nondefault:
|
||||
{
|
||||
if (! dynamic)
|
||||
{
|
||||
if (! info->executable
|
||||
if (! bfd_link_executable (info)
|
||||
|| hi->ref_dynamic)
|
||||
*dynsym = TRUE;
|
||||
}
|
||||
@ -2119,7 +2121,7 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data)
|
||||
|
||||
/* If we are building an application, we need to create a
|
||||
version node for this version. */
|
||||
if (t == NULL && info->executable)
|
||||
if (t == NULL && bfd_link_executable (info))
|
||||
{
|
||||
struct bfd_elf_version_tree **pp;
|
||||
int version_index;
|
||||
@ -2481,7 +2483,7 @@ bfd_boolean
|
||||
_bfd_elf_link_hash_fixup_symbol (struct bfd_link_info *info,
|
||||
struct elf_link_hash_entry *h)
|
||||
{
|
||||
if (info->pie
|
||||
if (bfd_link_pie (info)
|
||||
&& h->dynindx == -1
|
||||
&& h->root.type == bfd_link_hash_undefweak)
|
||||
return bfd_elf_link_record_dynamic_symbol (info, h);
|
||||
@ -2584,7 +2586,7 @@ _bfd_elf_fix_symbol_flags (struct elf_link_hash_entry *h,
|
||||
visibility. If the symbol has hidden or internal visibility, we
|
||||
will force it local. */
|
||||
if (h->needs_plt
|
||||
&& eif->info->shared
|
||||
&& bfd_link_pic (eif->info)
|
||||
&& is_elf_hash_table (eif->info->hash)
|
||||
&& (SYMBOLIC_BIND (eif->info, h)
|
||||
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
|
||||
@ -2856,7 +2858,8 @@ _bfd_elf_dynamic_symbol_p (struct elf_link_hash_entry *h,
|
||||
|
||||
/* Identify the cases where name binding rules say that a
|
||||
visible symbol resolves locally. */
|
||||
binding_stays_local_p = info->executable || SYMBOLIC_BIND (info, h);
|
||||
binding_stays_local_p = (bfd_link_executable (info)
|
||||
|| SYMBOLIC_BIND (info, h));
|
||||
|
||||
switch (ELF_ST_VISIBILITY (h->other))
|
||||
{
|
||||
@ -2941,7 +2944,7 @@ _bfd_elf_symbol_refs_local_p (struct elf_link_hash_entry *h,
|
||||
/* At this point, we know the symbol is defined and dynamic. In an
|
||||
executable it must resolve locally, likewise when building symbolic
|
||||
shared libraries. */
|
||||
if (info->executable || SYMBOLIC_BIND (info, h))
|
||||
if (bfd_link_executable (info) || SYMBOLIC_BIND (info, h))
|
||||
return TRUE;
|
||||
|
||||
/* Now deal with defined dynamic symbols in shared libraries. Ones
|
||||
@ -3488,11 +3491,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||
/* You can't use -r against a dynamic object. Also, there's no
|
||||
hope of using a dynamic object which does not exactly match
|
||||
the format of the output file. */
|
||||
if (info->relocatable
|
||||
if (bfd_link_relocatable (info)
|
||||
|| !is_elf_hash_table (htab)
|
||||
|| info->output_bfd->xvec != abfd->xvec)
|
||||
{
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
else
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
@ -3565,7 +3568,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||
FALSE, bed->collect, NULL)))
|
||||
goto error_return;
|
||||
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
/* Clobber the section size so that the warning does
|
||||
not get copied into the output file. */
|
||||
@ -3591,7 +3594,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
|
||||
are no input BFD's of the same format as the output, we can't
|
||||
make a shared library. */
|
||||
if (!just_syms
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& is_elf_hash_table (htab)
|
||||
&& info->output_bfd->xvec == abfd->xvec
|
||||
&& !htab->dynamic_sections_created)
|
||||
@ -4043,7 +4046,7 @@ error_free_dyn:
|
||||
}
|
||||
else if (isym->st_shndx == SHN_COMMON
|
||||
&& ELF_ST_TYPE (isym->st_info) == STT_TLS
|
||||
&& !info->relocatable)
|
||||
&& !bfd_link_relocatable (info))
|
||||
{
|
||||
asection *tcomm = bfd_get_section_by_name (abfd, ".tcommon");
|
||||
|
||||
@ -4339,7 +4342,7 @@ error_free_dyn:
|
||||
/* If the indirect symbol has been forced local, don't
|
||||
make the real symbol dynamic. */
|
||||
if ((h == hi || !hi->forced_local)
|
||||
&& ((! info->executable && ! info->relocatable)
|
||||
&& (bfd_link_dll (info)
|
||||
|| h->def_dynamic
|
||||
|| h->ref_dynamic))
|
||||
dynsym = TRUE;
|
||||
@ -4491,7 +4494,9 @@ error_free_dyn:
|
||||
elf_merge_st_other (abfd, h, isym, sec, definition, dynamic);
|
||||
|
||||
/* We don't want to make debug symbol dynamic. */
|
||||
if (definition && (sec->flags & SEC_DEBUGGING) && !info->relocatable)
|
||||
if (definition
|
||||
&& (sec->flags & SEC_DEBUGGING)
|
||||
&& !bfd_link_relocatable (info))
|
||||
dynsym = FALSE;
|
||||
|
||||
/* Nor should we make plugin symbols dynamic. */
|
||||
@ -4694,7 +4699,7 @@ error_free_dyn:
|
||||
/* Now that all the symbols from this input file are created, if
|
||||
not performing a relocatable link, handle .symver foo, foo@BAR
|
||||
such that any relocs against foo become foo@BAR. */
|
||||
if (!info->relocatable && nondeflt_vers != NULL)
|
||||
if (!bfd_link_relocatable (info) && nondeflt_vers != NULL)
|
||||
{
|
||||
bfd_size_type cnt, symidx;
|
||||
|
||||
@ -5696,7 +5701,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
elf_hash_table (info)->init_plt_refcount
|
||||
= elf_hash_table (info)->init_plt_offset;
|
||||
|
||||
if (info->relocatable
|
||||
if (bfd_link_relocatable (info)
|
||||
&& !_bfd_elf_size_group_sections (info))
|
||||
return FALSE;
|
||||
|
||||
@ -5739,7 +5744,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
}
|
||||
if (notesec || info->stacksize > 0)
|
||||
elf_stack_flags (output_bfd) = PF_R | PF_W | exec;
|
||||
if (notesec && exec && info->relocatable
|
||||
if (notesec && exec && bfd_link_relocatable (info)
|
||||
&& notesec->output_section != bfd_abs_section_ptr)
|
||||
notesec->output_section->flags |= SEC_CODE;
|
||||
}
|
||||
@ -5757,7 +5762,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
bfd_boolean all_defined;
|
||||
|
||||
*sinterpptr = bfd_get_linker_section (dynobj, ".interp");
|
||||
BFD_ASSERT (*sinterpptr != NULL || !info->executable);
|
||||
BFD_ASSERT (*sinterpptr != NULL || !bfd_link_executable (info));
|
||||
|
||||
if (soname != NULL)
|
||||
{
|
||||
@ -5845,7 +5850,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
/* If we are supposed to export all symbols into the dynamic symbol
|
||||
table (this is not the normal case), then do so. */
|
||||
if (info->export_dynamic
|
||||
|| (info->executable && info->dynamic))
|
||||
|| (bfd_link_executable (info) && info->dynamic))
|
||||
{
|
||||
elf_link_hash_traverse (elf_hash_table (info),
|
||||
_bfd_elf_export_symbol,
|
||||
@ -5980,7 +5985,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
if (s != NULL && s->linker_has_input)
|
||||
{
|
||||
/* DT_PREINIT_ARRAY is not allowed in shared library. */
|
||||
if (! info->executable)
|
||||
if (! bfd_link_executable (info))
|
||||
{
|
||||
bfd *sub;
|
||||
asection *o;
|
||||
@ -6314,7 +6319,7 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
|
||||
if (info->flags_1)
|
||||
{
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
info->flags_1 &= ~ (DF_1_INITFIRST
|
||||
| DF_1_NODELETE
|
||||
| DF_1_NOOPEN);
|
||||
@ -8993,7 +8998,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|
||||
defined, hidden versioned, not referenced by shared library and
|
||||
not exported when linking executable. */
|
||||
bfd_boolean local_bind = (h->forced_local
|
||||
|| (flinfo->info->executable
|
||||
|| (bfd_link_executable (flinfo->info)
|
||||
&& !flinfo->info->export_dynamic
|
||||
&& !h->dynamic
|
||||
&& !h->ref_dynamic
|
||||
@ -9058,7 +9063,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|
||||
|
||||
/* We should also warn if a forced local symbol is referenced from
|
||||
shared libraries. */
|
||||
if (flinfo->info->executable
|
||||
if (bfd_link_executable (flinfo->info)
|
||||
&& h->forced_local
|
||||
&& h->ref_dynamic
|
||||
&& h->def_regular
|
||||
@ -9189,7 +9194,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|
||||
but in nonrelocatable files they are virtual
|
||||
addresses. */
|
||||
sym.st_value = h->root.u.def.value + input_sec->output_offset;
|
||||
if (!flinfo->info->relocatable)
|
||||
if (!bfd_link_relocatable (flinfo->info))
|
||||
{
|
||||
sym.st_value += input_sec->output_section->vma;
|
||||
if (h->type == STT_TLS)
|
||||
@ -9233,10 +9238,10 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|
||||
STT_GNU_IFUNC symbol must go through PLT. */
|
||||
if ((h->type == STT_GNU_IFUNC
|
||||
&& h->def_regular
|
||||
&& !flinfo->info->relocatable)
|
||||
&& !bfd_link_relocatable (flinfo->info))
|
||||
|| ((h->dynindx != -1
|
||||
|| h->forced_local)
|
||||
&& ((flinfo->info->shared
|
||||
&& ((bfd_link_pic (flinfo->info)
|
||||
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak))
|
||||
|| !h->forced_local)
|
||||
@ -9286,7 +9291,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|
||||
|
||||
/* If a non-weak symbol with non-default visibility is not defined
|
||||
locally, it is a fatal error. */
|
||||
if (!flinfo->info->relocatable
|
||||
if (!bfd_link_relocatable (flinfo->info)
|
||||
&& ELF_ST_VISIBILITY (sym.st_other) != STV_DEFAULT
|
||||
&& ELF_ST_BIND (sym.st_info) != STB_WEAK
|
||||
&& h->root.type == bfd_link_hash_undefined
|
||||
@ -9322,7 +9327,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|
||||
*/
|
||||
if (h->verinfo.verdef == NULL
|
||||
&& !local_bind
|
||||
&& (!flinfo->info->executable
|
||||
&& (!bfd_link_executable (flinfo->info)
|
||||
|| h->ref_dynamic
|
||||
|| !h->def_regular))
|
||||
{
|
||||
@ -9410,7 +9415,7 @@ elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
|
||||
relocatable output or when needed for --emit-relocs. */
|
||||
else if (input_sec == bfd_und_section_ptr
|
||||
&& h->indx != -2
|
||||
&& !flinfo->info->relocatable)
|
||||
&& !bfd_link_relocatable (flinfo->info))
|
||||
return TRUE;
|
||||
/* Also strip others that we couldn't earlier due to dynamic symbol
|
||||
processing. */
|
||||
@ -9711,7 +9716,8 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
&& (bfd_hash_lookup (flinfo->info->keep_hash, name, FALSE, FALSE)
|
||||
== NULL))
|
||||
|| (((flinfo->info->discard == discard_sec_merge
|
||||
&& (isec->flags & SEC_MERGE) && !flinfo->info->relocatable)
|
||||
&& (isec->flags & SEC_MERGE)
|
||||
&& !bfd_link_relocatable (flinfo->info))
|
||||
|| flinfo->info->discard == discard_l)
|
||||
&& bfd_is_local_label_name (input_bfd, name)))
|
||||
continue;
|
||||
@ -9762,7 +9768,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
output_section. Any special sections must be set up to meet
|
||||
these requirements. */
|
||||
osym.st_value += isec->output_offset;
|
||||
if (!flinfo->info->relocatable)
|
||||
if (!bfd_link_relocatable (flinfo->info))
|
||||
{
|
||||
osym.st_value += isec->output_section->vma;
|
||||
if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
|
||||
@ -9806,7 +9812,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (flinfo->info->relocatable
|
||||
if (bfd_link_relocatable (flinfo->info)
|
||||
&& (o->flags & (SEC_LINKER_CREATED | SEC_GROUP)) == SEC_GROUP)
|
||||
{
|
||||
/* Deal with the group signature symbol. */
|
||||
@ -10029,7 +10035,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
}
|
||||
|
||||
if ((s_type == STT_RELC || s_type == STT_SRELC)
|
||||
&& !flinfo->info->relocatable)
|
||||
&& !bfd_link_relocatable (flinfo->info))
|
||||
{
|
||||
bfd_vma val;
|
||||
bfd_vma dot = (rel->r_offset
|
||||
@ -10119,7 +10125,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
return FALSE;
|
||||
|
||||
if (ret == 2
|
||||
|| flinfo->info->relocatable
|
||||
|| bfd_link_relocatable (flinfo->info)
|
||||
|| flinfo->info->emitrelocations)
|
||||
{
|
||||
Elf_Internal_Rela *irela;
|
||||
@ -10150,7 +10156,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
rel_hash_list = rel_hash;
|
||||
rela_hash_list = NULL;
|
||||
last_offset = o->output_offset;
|
||||
if (!flinfo->info->relocatable)
|
||||
if (!bfd_link_relocatable (flinfo->info))
|
||||
last_offset += o->output_section->vma;
|
||||
for (next_erel = 0; irela < irelaend; irela++, next_erel++)
|
||||
{
|
||||
@ -10190,7 +10196,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
irela->r_offset += o->output_offset;
|
||||
|
||||
/* Relocs in an executable have to be virtual addresses. */
|
||||
if (!flinfo->info->relocatable)
|
||||
if (!bfd_link_relocatable (flinfo->info))
|
||||
irela->r_offset += o->output_section->vma;
|
||||
|
||||
last_offset = irela->r_offset;
|
||||
@ -10318,7 +10324,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
|
||||
return FALSE;
|
||||
|
||||
sym.st_value += sec->output_offset;
|
||||
if (!flinfo->info->relocatable)
|
||||
if (!bfd_link_relocatable (flinfo->info))
|
||||
{
|
||||
sym.st_value += osec->vma;
|
||||
if (ELF_ST_TYPE (sym.st_info) == STT_TLS)
|
||||
@ -10594,7 +10600,7 @@ elf_reloc_link_order (bfd *output_bfd,
|
||||
relocatable file, and is a virtual address in an executable
|
||||
file. */
|
||||
offset = link_order->offset;
|
||||
if (! info->relocatable)
|
||||
if (! bfd_link_relocatable (info))
|
||||
offset += output_section->vma;
|
||||
|
||||
for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
|
||||
@ -10845,13 +10851,13 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
if (! is_elf_hash_table (info->hash))
|
||||
return FALSE;
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
abfd->flags |= DYNAMIC;
|
||||
|
||||
dynamic = elf_hash_table (info)->dynamic_sections_created;
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
|
||||
emit_relocs = (info->relocatable
|
||||
emit_relocs = (bfd_link_relocatable (info)
|
||||
|| info->emitrelocations);
|
||||
|
||||
flinfo.info = info;
|
||||
@ -10964,7 +10970,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
to count particular types of relocs. Of course,
|
||||
reloc sections themselves can't have relocations. */
|
||||
reloc_count = 0;
|
||||
else if (info->relocatable || info->emitrelocations)
|
||||
else if (emit_relocs)
|
||||
reloc_count = sec->reloc_count;
|
||||
else if (bed->elf_backend_count_relocs)
|
||||
reloc_count = (*bed->elf_backend_count_relocs) (info, sec);
|
||||
@ -11016,8 +11022,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
|
||||
o->reloc_count += reloc_count;
|
||||
|
||||
if (p->type == bfd_indirect_link_order
|
||||
&& (info->relocatable || info->emitrelocations))
|
||||
if (p->type == bfd_indirect_link_order && emit_relocs)
|
||||
{
|
||||
if (esdi->rel.hdr)
|
||||
esdo->rel.count += NUM_SHDR_ENTRIES (esdi->rel.hdr);
|
||||
@ -11052,7 +11057,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
o->vma = 0;
|
||||
}
|
||||
|
||||
if (! info->relocatable && merged)
|
||||
if (! bfd_link_relocatable (info) && merged)
|
||||
elf_link_hash_traverse (elf_hash_table (info),
|
||||
_bfd_elf_link_sec_merge_syms, abfd);
|
||||
|
||||
@ -11168,7 +11173,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
{
|
||||
o->target_index = bfd_get_symcount (abfd);
|
||||
elfsym.st_shndx = i;
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
elfsym.st_value = o->vma;
|
||||
if (elf_link_output_symstrtab (&flinfo, NULL, &elfsym, o,
|
||||
NULL) != 1)
|
||||
@ -11410,7 +11415,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
long last_local = 0;
|
||||
|
||||
/* Write out the section symbols for the output sections. */
|
||||
if (info->shared || elf_hash_table (info)->is_relocatable_executable)
|
||||
if (bfd_link_pic (info)
|
||||
|| elf_hash_table (info)->is_relocatable_executable)
|
||||
{
|
||||
asection *s;
|
||||
|
||||
@ -11761,7 +11767,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
goto error_return;
|
||||
|
||||
/* Check for DT_TEXTREL (late, in case the backend removes it). */
|
||||
if (((info->warn_shared_textrel && info->shared)
|
||||
if (((info->warn_shared_textrel && bfd_link_pic (info))
|
||||
|| info->error_textrel)
|
||||
&& (o = bfd_get_linker_section (dynobj, ".dynamic")) != NULL)
|
||||
{
|
||||
@ -11828,7 +11834,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
}
|
||||
}
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_boolean failed = FALSE;
|
||||
|
||||
@ -12571,7 +12577,7 @@ bfd_elf_gc_mark_dynamic_ref_symbol (struct elf_link_hash_entry *h, void *inf)
|
||||
|| ((h->def_regular || ELF_COMMON_DEF_P (h))
|
||||
&& ELF_ST_VISIBILITY (h->other) != STV_INTERNAL
|
||||
&& ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
|
||||
&& (!info->executable
|
||||
&& (!bfd_link_executable (info)
|
||||
|| info->export_dynamic
|
||||
|| (h->dynamic
|
||||
&& d != NULL
|
||||
@ -13220,7 +13226,7 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
|
||||
_bfd_elf_end_eh_frame_parsing (info);
|
||||
|
||||
if (info->eh_frame_hdr_type
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& _bfd_elf_discard_section_eh_frame_hdr (output_bfd, info))
|
||||
changed = 1;
|
||||
|
||||
|
@ -4066,8 +4066,8 @@ aarch64_calculate_got_entry_vma (struct elf_link_hash_entry *h,
|
||||
BFD_ASSERT (basegot != NULL);
|
||||
off = h->got.offset;
|
||||
BFD_ASSERT (off != (bfd_vma) - 1);
|
||||
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))
|
||||
|| (ELF_ST_VISIBILITY (h->other)
|
||||
&& h->root.type == bfd_link_hash_undefweak))
|
||||
@ -4229,7 +4229,7 @@ aarch64_can_relax_tls (bfd *input_bfd,
|
||||
if (symbol_got_type == GOT_TLS_IE && GOT_TLS_GD_ANY_P (reloc_got_type))
|
||||
return TRUE;
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return FALSE;
|
||||
|
||||
if (h && h->root.type == bfd_link_hash_undefweak)
|
||||
@ -4669,7 +4669,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
|
||||
|
||||
/* Generate dynamic relocation 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)
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
asection *sreloc;
|
||||
@ -4689,7 +4689,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
|
||||
|
||||
if (h->dynindx == -1
|
||||
|| h->forced_local
|
||||
|| info->executable)
|
||||
|| bfd_link_executable (info))
|
||||
{
|
||||
/* This symbol is resolved locally. */
|
||||
outrel.r_info = ELFNN_R_INFO (0, AARCH64_R (IRELATIVE));
|
||||
@ -4810,7 +4810,8 @@ elfNN_aarch64_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 == TRUE) || globals->root.is_relocatable_executable)
|
||||
if (((bfd_link_pic (info) == TRUE)
|
||||
|| globals->root.is_relocatable_executable)
|
||||
&& (input_section->flags & SEC_ALLOC)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
@ -4845,7 +4846,9 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
|
||||
memset (&outrel, 0, sizeof outrel);
|
||||
else if (h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& (!info->shared || !SYMBOLIC_BIND (info, h) || !h->def_regular))
|
||||
&& (!bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type);
|
||||
else
|
||||
{
|
||||
@ -4936,7 +4939,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
|
||||
case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
|
||||
case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
|
||||
case BFD_RELOC_AARCH64_LD_LO19_PCREL:
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& (input_section->flags & SEC_ALLOC) != 0
|
||||
&& (input_section->flags & SEC_READONLY) != 0
|
||||
&& h != NULL
|
||||
@ -5026,7 +5029,7 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
|
||||
{
|
||||
bfd_put_64 (output_bfd, value, base_got->contents + off);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -5463,7 +5466,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
|
||||
|
||||
/* Relocate against local STT_GNU_IFUNC symbol. */
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
|
||||
{
|
||||
h = elfNN_aarch64_get_local_sym_hash (globals, input_bfd,
|
||||
@ -5492,7 +5495,7 @@ elfNN_aarch64_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)
|
||||
@ -5577,7 +5580,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
indx = h && h->dynindx != -1 ? h->dynindx : 0;
|
||||
|
||||
need_relocs =
|
||||
(info->shared || indx != 0) &&
|
||||
(bfd_link_pic (info) || indx != 0) &&
|
||||
(h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak);
|
||||
@ -5670,7 +5673,7 @@ elfNN_aarch64_relocate_section (bfd *output_bfd,
|
||||
indx = h && h->dynindx != -1 ? h->dynindx : 0;
|
||||
|
||||
need_relocs =
|
||||
(info->shared || indx != 0) &&
|
||||
(bfd_link_pic (info) || indx != 0) &&
|
||||
(h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak);
|
||||
@ -6020,7 +6023,7 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd,
|
||||
struct elf_aarch64_local_symbol *locals;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = elf_aarch64_hash_table (info);
|
||||
@ -6157,7 +6160,7 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd,
|
||||
case BFD_RELOC_AARCH64_MOVW_G2_NC:
|
||||
case BFD_RELOC_AARCH64_MOVW_G3:
|
||||
case BFD_RELOC_AARCH64_NN:
|
||||
if (h != NULL && info->executable)
|
||||
if (h != NULL && bfd_link_executable (info))
|
||||
{
|
||||
if (h->plt.refcount > 0)
|
||||
h->plt.refcount -= 1;
|
||||
@ -6230,7 +6233,7 @@ elfNN_aarch64_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
|
||||
@ -6366,7 +6369,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
struct elf_aarch64_link_hash_table *htab;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_aarch64_elf (abfd));
|
||||
@ -6482,7 +6485,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
if (h != NULL)
|
||||
{
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
h->non_got_ref = 1;
|
||||
|
||||
h->plt.refcount += 1;
|
||||
@ -6491,7 +6494,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* No need to do anything if we're not creating a shared
|
||||
object. */
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
break;
|
||||
|
||||
{
|
||||
@ -6663,7 +6666,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case BFD_RELOC_AARCH64_MOVW_G1_NC:
|
||||
case BFD_RELOC_AARCH64_MOVW_G2_NC:
|
||||
case BFD_RELOC_AARCH64_MOVW_G3:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
|
||||
(*_bfd_error_handler)
|
||||
@ -6678,7 +6681,7 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
|
||||
case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
|
||||
case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
|
||||
if (h != NULL && info->executable)
|
||||
if (h != NULL && bfd_link_executable (info))
|
||||
{
|
||||
/* If this reloc is in a read-only section, we might
|
||||
need a copy reloc. We can't check reliably at this
|
||||
@ -7281,10 +7284,10 @@ elfNN_aarch64_create_dynamic_sections (bfd *dynobj,
|
||||
|
||||
htab = elf_aarch64_hash_table (info);
|
||||
htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss");
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss");
|
||||
|
||||
if (!htab->sdynbss || (!info->shared && !htab->srelbss))
|
||||
if (!htab->sdynbss || (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -7336,7 +7339,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (info->shared || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
if (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
|
||||
{
|
||||
asection *s = htab->root.splt;
|
||||
|
||||
@ -7352,7 +7355,7 @@ elfNN_aarch64_allocate_dynrelocs (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 && !h->def_regular)
|
||||
if (!bfd_link_pic (info) && !h->def_regular)
|
||||
{
|
||||
h->root.u.def.section = s;
|
||||
h->root.u.def.value = h->plt.offset;
|
||||
@ -7426,7 +7429,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
htab->root.sgot->size += GOT_ENTRY_SIZE;
|
||||
if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
{
|
||||
htab->root.srelgot->size += RELOC_SIZE (htab);
|
||||
@ -7459,7 +7462,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
indx = h && h->dynindx != -1 ? h->dynindx : 0;
|
||||
if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (info->shared
|
||||
&& (bfd_link_pic (info)
|
||||
|| indx != 0
|
||||
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
|
||||
{
|
||||
@ -7496,7 +7499,7 @@ elfNN_aarch64_allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Relocs that use pc_count are those that appear on a call
|
||||
insn, or certain REL relocs that can generated via assembly.
|
||||
@ -7708,7 +7711,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
if (htab->root.dynamic_sections_created)
|
||||
{
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
s = bfd_get_linker_section (dynobj, ".interp");
|
||||
if (s == NULL)
|
||||
@ -7794,7 +7797,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
{
|
||||
}
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (got_type & GOT_TLSDESC_GD)
|
||||
{
|
||||
@ -7947,7 +7950,7 @@ elfNN_aarch64_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;
|
||||
@ -8088,7 +8091,7 @@ elfNN_aarch64_create_small_pltn_entry (struct elf_link_hash_entry *h,
|
||||
rela.r_offset = gotplt_entry_address;
|
||||
|
||||
if (h->dynindx == -1
|
||||
|| ((info->executable
|
||||
|| ((bfd_link_executable (info)
|
||||
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
@ -8123,7 +8126,7 @@ elfNN_aarch64_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;
|
||||
@ -8193,7 +8196,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
/* This symbol has an entry in the procedure linkage table. Set
|
||||
it up. */
|
||||
if ((h->dynindx == -1
|
||||
&& !((h->forced_local || info->executable)
|
||||
&& !((h->forced_local || bfd_link_executable (info))
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
|| plt == NULL
|
||||
@ -8238,7 +8241,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
if (h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* Generate R_AARCH64_GLOB_DAT. */
|
||||
goto do_glob_dat;
|
||||
@ -8262,7 +8265,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else if (info->shared && SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
else if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
if (!h->def_regular)
|
||||
return FALSE;
|
||||
|
@ -346,7 +346,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
|
||||
one pass. */
|
||||
*again = 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"));
|
||||
|
||||
@ -831,7 +831,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
|
||||
{
|
||||
/* Resize .rela.got. */
|
||||
ia64_info->root.srelgot->size = 0;
|
||||
if (link_info->shared
|
||||
if (bfd_link_pic (link_info)
|
||||
&& ia64_info->self_dtpmod_offset != (bfd_vma) -1)
|
||||
ia64_info->root.srelgot->size += sizeof (ElfNN_External_Rela);
|
||||
data.only_got = TRUE;
|
||||
@ -1033,7 +1033,7 @@ elfNN_ia64_add_symbol_hook (bfd *abfd,
|
||||
bfd_vma *valp)
|
||||
{
|
||||
if (sym->st_shndx == SHN_COMMON
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& sym->st_size <= elf_gp_size (abfd))
|
||||
{
|
||||
/* Common symbols less than or equal to -G nn bytes are
|
||||
@ -1993,8 +1993,8 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
|
||||
| SEC_LOAD
|
||||
| SEC_HAS_CONTENTS
|
||||
| SEC_IN_MEMORY
|
||||
| (info->pie ? 0
|
||||
: SEC_READONLY)
|
||||
| (bfd_link_pie (info)
|
||||
? 0 : SEC_READONLY)
|
||||
| SEC_LINKER_CREATED));
|
||||
if (!fptr
|
||||
|| !bfd_set_section_alignment (abfd, fptr, 4))
|
||||
@ -2005,7 +2005,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
ia64_info->fptr_sec = fptr;
|
||||
|
||||
if (info->pie)
|
||||
if (bfd_link_pie (info))
|
||||
{
|
||||
asection *fptr_rel;
|
||||
fptr_rel = bfd_make_section_anyway_with_flags (dynobj, ".rela.opd",
|
||||
@ -2158,7 +2158,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
unsigned long r_symndx;
|
||||
bfd_boolean maybe_dynamic;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -2191,7 +2191,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
locally or externally defined, as not all of the input files
|
||||
have yet been processed. Do something with what we know, as
|
||||
this may help reduce memory usage and processing time later. */
|
||||
maybe_dynamic = (h && ((!info->executable
|
||||
maybe_dynamic = (h && ((!bfd_link_executable (info)
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|
||||
|| !h->def_regular
|
||||
@ -2202,13 +2202,13 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
{
|
||||
case R_IA64_TPREL64MSB:
|
||||
case R_IA64_TPREL64LSB:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
break;
|
||||
|
||||
case R_IA64_LTOFF_TPREL22:
|
||||
need_entry = NEED_TPREL;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
break;
|
||||
|
||||
@ -2216,7 +2216,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_DTPREL32LSB:
|
||||
case R_IA64_DTPREL64MSB:
|
||||
case R_IA64_DTPREL64LSB:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
break;
|
||||
|
||||
@ -2226,7 +2226,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
case R_IA64_DTPMOD64MSB:
|
||||
case R_IA64_DTPMOD64LSB:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
break;
|
||||
|
||||
@ -2248,7 +2248,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_FPTR32LSB:
|
||||
case R_IA64_FPTR64MSB:
|
||||
case R_IA64_FPTR64LSB:
|
||||
if (info->shared || h)
|
||||
if (bfd_link_pic (info) || h)
|
||||
need_entry = NEED_FPTR | NEED_DYNREL;
|
||||
else
|
||||
need_entry = NEED_FPTR;
|
||||
@ -2299,14 +2299,14 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_DIR64MSB:
|
||||
case R_IA64_DIR64LSB:
|
||||
/* Shared objects will always need at least a REL relocation. */
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
break;
|
||||
|
||||
case R_IA64_IPLTMSB:
|
||||
case R_IA64_IPLTLSB:
|
||||
/* Shared objects will always need at least a REL relocation. */
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
break;
|
||||
|
||||
@ -2366,7 +2366,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
locally or externally defined, as not all of the input files
|
||||
have yet been processed. Do something with what we know, as
|
||||
this may help reduce memory usage and processing time later. */
|
||||
maybe_dynamic = (h && ((!info->executable
|
||||
maybe_dynamic = (h && ((!bfd_link_executable (info)
|
||||
&& (!SYMBOLIC_BIND (info, h)
|
||||
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|
||||
|| !h->def_regular
|
||||
@ -2377,16 +2377,16 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
{
|
||||
case R_IA64_TPREL64MSB:
|
||||
case R_IA64_TPREL64LSB:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
dynrel_type = R_IA64_TPREL64LSB;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
break;
|
||||
|
||||
case R_IA64_LTOFF_TPREL22:
|
||||
need_entry = NEED_TPREL;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
break;
|
||||
|
||||
@ -2394,7 +2394,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_DTPREL32LSB:
|
||||
case R_IA64_DTPREL64MSB:
|
||||
case R_IA64_DTPREL64LSB:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
dynrel_type = R_IA64_DTPRELNNLSB;
|
||||
break;
|
||||
@ -2405,7 +2405,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
case R_IA64_DTPMOD64MSB:
|
||||
case R_IA64_DTPMOD64LSB:
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
dynrel_type = R_IA64_DTPMOD64LSB;
|
||||
break;
|
||||
@ -2428,7 +2428,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_FPTR32LSB:
|
||||
case R_IA64_FPTR64MSB:
|
||||
case R_IA64_FPTR64LSB:
|
||||
if (info->shared || h)
|
||||
if (bfd_link_pic (info) || h)
|
||||
need_entry = NEED_FPTR | NEED_DYNREL;
|
||||
else
|
||||
need_entry = NEED_FPTR;
|
||||
@ -2474,7 +2474,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_DIR64MSB:
|
||||
case R_IA64_DIR64LSB:
|
||||
/* Shared objects will always need at least a REL relocation. */
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
dynrel_type = R_IA64_DIRNNLSB;
|
||||
break;
|
||||
@ -2482,7 +2482,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_IA64_IPLTMSB:
|
||||
case R_IA64_IPLTLSB:
|
||||
/* Shared objects will always need at least a REL relocation. */
|
||||
if (info->shared || maybe_dynamic)
|
||||
if (bfd_link_pic (info) || maybe_dynamic)
|
||||
need_entry = NEED_DYNREL;
|
||||
dynrel_type = R_IA64_IPLTLSB;
|
||||
break;
|
||||
@ -2540,7 +2540,7 @@ elfNN_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
/* FPTRs for shared libraries are allocated by the dynamic
|
||||
linker. Make sure this local symbol will appear in the
|
||||
dynamic symbol table. */
|
||||
if (!h && info->shared)
|
||||
if (!h && bfd_link_pic (info))
|
||||
{
|
||||
if (! (bfd_elf_link_record_local_dynamic_symbol
|
||||
(info, abfd, (long) r_symndx)))
|
||||
@ -2712,7 +2712,7 @@ allocate_fptr (struct elfNN_ia64_dyn_sym_info *dyn_i, void * data)
|
||||
|| h->root.type == bfd_link_hash_warning)
|
||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
|
||||
if (!x->info->executable
|
||||
if (!bfd_link_executable (x->info)
|
||||
&& (!h
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| (h->root.type != bfd_link_hash_undefweak
|
||||
@ -2841,7 +2841,7 @@ allocate_dynrel_entries (struct elfNN_ia64_dyn_sym_info *dyn_i,
|
||||
/* Note that this can't be used in relation to FPTR relocs below. */
|
||||
dynamic_symbol = elfNN_ia64_dynamic_symbol_p (dyn_i->h, x->info, 0);
|
||||
|
||||
shared = x->info->shared;
|
||||
shared = bfd_link_pic (x->info);
|
||||
resolved_zero = (dyn_i->h
|
||||
&& ELF_ST_VISIBILITY (dyn_i->h->other)
|
||||
&& dyn_i->h->root.type == bfd_link_hash_undefweak);
|
||||
@ -2856,7 +2856,7 @@ allocate_dynrel_entries (struct elfNN_ia64_dyn_sym_info *dyn_i,
|
||||
&& dyn_i->h->dynindx != -1))
|
||||
{
|
||||
if (!dyn_i->want_ltoff_fptr
|
||||
|| !x->info->pie
|
||||
|| !bfd_link_pie (x->info)
|
||||
|| dyn_i->h == NULL
|
||||
|| dyn_i->h->root.type != bfd_link_hash_undefweak)
|
||||
ia64_info->root.srelgot->size += sizeof (ElfNN_External_Rela);
|
||||
@ -2906,7 +2906,7 @@ allocate_dynrel_entries (struct elfNN_ia64_dyn_sym_info *dyn_i,
|
||||
will be true only if we're actually allocating one statically
|
||||
in the main executable. Position independent executables
|
||||
need a relative reloc. */
|
||||
if (dyn_i->want_fptr && !x->info->pie)
|
||||
if (dyn_i->want_fptr && !bfd_link_pie (x->info))
|
||||
continue;
|
||||
break;
|
||||
case R_IA64_PCREL32LSB:
|
||||
@ -2992,7 +2992,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
|
||||
/* Set the contents of the .interp section to the interpreter. */
|
||||
if (ia64_info->root.dynamic_sections_created
|
||||
&& info->executable)
|
||||
&& bfd_link_executable (info))
|
||||
{
|
||||
sec = bfd_get_linker_section (dynobj, ".interp");
|
||||
BFD_ASSERT (sec != NULL);
|
||||
@ -3069,7 +3069,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
/* Allocate space for the dynamic relocations that turned out to be
|
||||
required. */
|
||||
|
||||
if (info->shared && ia64_info->self_dtpmod_offset != (bfd_vma) -1)
|
||||
if (bfd_link_pic (info) && ia64_info->self_dtpmod_offset != (bfd_vma) -1)
|
||||
ia64_info->root.srelgot->size += sizeof (ElfNN_External_Rela);
|
||||
data.only_got = FALSE;
|
||||
elfNN_ia64_dyn_sym_traverse (ia64_info, allocate_dynrel_entries, &data);
|
||||
@ -3181,7 +3181,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
later (in finish_dynamic_sections) but we must add the entries now
|
||||
so that we get the correct size for the .dynamic section. */
|
||||
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
/* The DT_DEBUG entry is filled in by the dynamic linker and used
|
||||
by the debugger. */
|
||||
@ -3315,7 +3315,7 @@ set_got_entry (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd_put_64 (abfd, value, got_sec->contents + got_offset);
|
||||
|
||||
/* Install a dynamic relocation if needed. */
|
||||
if (((info->shared
|
||||
if (((bfd_link_pic (info)
|
||||
&& (!dyn_i->h
|
||||
|| ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
|
||||
|| dyn_i->h->root.type != bfd_link_hash_undefweak)
|
||||
@ -3326,7 +3326,7 @@ set_got_entry (bfd *abfd, struct bfd_link_info *info,
|
||||
&& (dyn_r_type == R_IA64_FPTR32LSB
|
||||
|| dyn_r_type == R_IA64_FPTR64LSB)))
|
||||
&& (!dyn_i->want_ltoff_fptr
|
||||
|| !info->pie
|
||||
|| !bfd_link_pie (info)
|
||||
|| !dyn_i->h
|
||||
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
|
||||
{
|
||||
@ -3479,7 +3479,7 @@ set_pltoff_entry (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* Install dynamic relocations if needed. */
|
||||
if (!is_plt
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& (!dyn_i->h
|
||||
|| ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
|
||||
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
|
||||
@ -3715,7 +3715,7 @@ elfNN_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
return FALSE;
|
||||
|
||||
/* Make sure we've got ourselves a nice fat __gp value. */
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_vma gp_val;
|
||||
struct elf_link_hash_entry *gp;
|
||||
@ -3741,7 +3741,7 @@ elfNN_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
of the .IA_64.unwind section. Force this section to be relocated
|
||||
into memory rather than written immediately to the output file. */
|
||||
unwind_output_sec = NULL;
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind);
|
||||
if (s)
|
||||
@ -3799,7 +3799,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
return FALSE;
|
||||
|
||||
/* Infect various flags from the input section to the output section. */
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_vma flags;
|
||||
|
||||
@ -3856,7 +3856,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
sym_sec = local_sections[r_symndx];
|
||||
msec = sym_sec;
|
||||
value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& (sym_sec->flags & SEC_MERGE) != 0
|
||||
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
|
||||
&& sym_sec->sec_info_type == SEC_INFO_TYPE_MERGE)
|
||||
@ -3913,7 +3913,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (h->root.type == bfd_link_hash_undefweak)
|
||||
undef_weak_ref = TRUE;
|
||||
else if (warned || (ignored && info->executable))
|
||||
else if (warned || (ignored && bfd_link_executable (info)))
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -3921,7 +3921,7 @@ elfNN_ia64_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;
|
||||
|
||||
hit_addr = contents + rel->r_offset;
|
||||
@ -3942,7 +3942,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
case R_IA64_DIR64MSB:
|
||||
case R_IA64_DIR64LSB:
|
||||
/* Install a dynamic relocation for this reloc. */
|
||||
if ((dynamic_symbol_p || info->shared)
|
||||
if ((dynamic_symbol_p || bfd_link_pic (info))
|
||||
&& r_symndx != STN_UNDEF
|
||||
&& (input_section->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
@ -4070,7 +4070,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
if (!undef_weak_ref)
|
||||
value = set_fptr_entry (output_bfd, info, dyn_i, value);
|
||||
}
|
||||
if (!dyn_i->want_fptr || info->pie)
|
||||
if (!dyn_i->want_fptr || bfd_link_pie (info))
|
||||
{
|
||||
long dynindx;
|
||||
unsigned int dyn_r_type = r_type;
|
||||
@ -4291,7 +4291,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
case R_IA64_IPLTMSB:
|
||||
case R_IA64_IPLTLSB:
|
||||
/* Install a dynamic relocation for this reloc. */
|
||||
if ((dynamic_symbol_p || info->shared)
|
||||
if ((dynamic_symbol_p || bfd_link_pic (info))
|
||||
&& (input_section->flags & SEC_ALLOC) != 0)
|
||||
{
|
||||
BFD_ASSERT (srel != NULL);
|
||||
@ -4368,7 +4368,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
{
|
||||
if (elf_hash_table (info)->tls_sec == NULL)
|
||||
goto missing_tls_sec;
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
value -= elfNN_ia64_tprel_base (info);
|
||||
else
|
||||
{
|
||||
@ -4379,7 +4379,7 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
|
||||
got_r_type = R_IA64_TPREL64LSB;
|
||||
break;
|
||||
case R_IA64_LTOFF_DTPMOD22:
|
||||
if (!dynamic_symbol_p && !info->shared)
|
||||
if (!dynamic_symbol_p && !bfd_link_pic (info))
|
||||
value = 1;
|
||||
got_r_type = R_IA64_DTPMOD64LSB;
|
||||
break;
|
||||
|
135
bfd/elfxx-mips.c
135
bfd/elfxx-mips.c
@ -1969,7 +1969,7 @@ mips_elf_check_symbols (struct mips_elf_link_hash_entry *h, void *data)
|
||||
struct mips_htab_traverse_info *hti;
|
||||
|
||||
hti = (struct mips_htab_traverse_info *) data;
|
||||
if (!hti->info->relocatable)
|
||||
if (!bfd_link_relocatable (hti->info))
|
||||
mips_elf_check_mips16_stubs (hti->info, h);
|
||||
|
||||
if (mips_elf_local_pic_function_p (h))
|
||||
@ -1984,7 +1984,7 @@ mips_elf_check_symbols (struct mips_elf_link_hash_entry *h, void *data)
|
||||
being PIC. If we're creating a non-relocatable object with
|
||||
non-PIC branches and jumps to H, make sure that H has an la25
|
||||
stub. */
|
||||
if (hti->info->relocatable)
|
||||
if (bfd_link_relocatable (hti->info))
|
||||
{
|
||||
if (!PIC_OBJECT_P (hti->output_bfd))
|
||||
h->root.other = ELF_ST_SET_MIPS_PIC (h->root.other);
|
||||
@ -3219,11 +3219,11 @@ mips_tls_got_relocs (struct bfd_link_info *info, unsigned char tls_type,
|
||||
bfd_boolean need_relocs = FALSE;
|
||||
bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created;
|
||||
|
||||
if (h && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|
||||
&& (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||
if (h && WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h)
|
||||
&& (!bfd_link_pic (info) || !SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||
indx = h->dynindx;
|
||||
|
||||
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))
|
||||
@ -3241,7 +3241,7 @@ mips_tls_got_relocs (struct bfd_link_info *info, unsigned char tls_type,
|
||||
return 1;
|
||||
|
||||
case GOT_TLS_LDM:
|
||||
return info->shared ? 1 : 0;
|
||||
return bfd_link_pic (info) ? 1 : 0;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
@ -3325,15 +3325,17 @@ mips_elf_initialize_tls_slots (bfd *abfd, struct bfd_link_info *info,
|
||||
{
|
||||
bfd_boolean dyn = elf_hash_table (info)->dynamic_sections_created;
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, &h->root)
|
||||
&& (!info->shared || !SYMBOL_REFERENCES_LOCAL (info, &h->root)))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info),
|
||||
&h->root)
|
||||
&& (!bfd_link_pic (info)
|
||||
|| !SYMBOL_REFERENCES_LOCAL (info, &h->root)))
|
||||
indx = h->root.dynindx;
|
||||
}
|
||||
|
||||
if (entry->tls_initialized)
|
||||
return;
|
||||
|
||||
if ((info->shared || indx != 0)
|
||||
if ((bfd_link_pic (info) || indx != 0)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->root.other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak))
|
||||
@ -3408,7 +3410,7 @@ mips_elf_initialize_tls_slots (bfd *abfd, struct bfd_link_info *info,
|
||||
sgot->contents + got_offset
|
||||
+ MIPS_ELF_GOT_SIZE (abfd));
|
||||
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
MIPS_ELF_PUT_WORD (abfd, 1,
|
||||
sgot->contents + got_offset);
|
||||
else
|
||||
@ -3769,7 +3771,8 @@ count_section_dynsyms (bfd *output_bfd, struct bfd_link_info *info)
|
||||
bfd_size_type count;
|
||||
|
||||
count = 0;
|
||||
if (info->shared || elf_hash_table (info)->is_relocatable_executable)
|
||||
if (bfd_link_pic (info)
|
||||
|| elf_hash_table (info)->is_relocatable_executable)
|
||||
{
|
||||
asection *p;
|
||||
const struct elf_backend_data *bed;
|
||||
@ -4408,7 +4411,7 @@ mips_use_local_got_p (struct bfd_link_info *info,
|
||||
/* If this is an executable that must provide a definition of the symbol,
|
||||
either though PLTs or copy relocations, then that address should go in
|
||||
the local rather than global GOT. */
|
||||
if (info->executable && h->has_static_relocs)
|
||||
if (bfd_link_executable (info) && h->has_static_relocs)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@ -4716,7 +4719,7 @@ mips_elf_set_global_gotidx (void **entryp, void *data)
|
||||
}
|
||||
arg->g->assigned_low_gotno += 1;
|
||||
|
||||
if (arg->info->shared
|
||||
if (bfd_link_pic (arg->info)
|
||||
|| (elf_hash_table (arg->info)->dynamic_sections_created
|
||||
&& entry->d.h->root.def_dynamic
|
||||
&& !entry->d.h->root.def_regular))
|
||||
@ -4923,7 +4926,7 @@ mips_elf_multi_got (bfd *abfd, struct bfd_link_info *info,
|
||||
BFD_ASSERT (g->assigned_low_gotno == g->local_gotno + g->global_gotno);
|
||||
g->assigned_low_gotno = save_assign;
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
g->relocs += g->local_gotno - g->assigned_low_gotno;
|
||||
BFD_ASSERT (g->assigned_low_gotno == g->next->local_gotno
|
||||
@ -5126,7 +5129,7 @@ mips_elf_create_got_section (bfd *abfd, struct bfd_link_info *info)
|
||||
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
|
||||
elf_hash_table (info)->hgot = h;
|
||||
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
|
||||
return FALSE;
|
||||
|
||||
@ -5155,7 +5158,7 @@ static bfd_boolean
|
||||
is_gott_symbol (struct bfd_link_info *info, struct elf_link_hash_entry *h)
|
||||
{
|
||||
return (mips_elf_hash_table (info)->is_vxworks
|
||||
&& info->shared
|
||||
&& bfd_link_pic (info)
|
||||
&& (strcmp (h->root.root.string, "__GOTT_BASE__") == 0
|
||||
|| strcmp (h->root.root.string, "__GOTT_INDEX__") == 0));
|
||||
}
|
||||
@ -5395,7 +5398,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
|
||||
Otherwise, we should define the symbol with a value of 0.
|
||||
FIXME: It should probably get into the symbol table
|
||||
somehow as well. */
|
||||
BFD_ASSERT (! info->shared);
|
||||
BFD_ASSERT (! bfd_link_pic (info));
|
||||
BFD_ASSERT (bfd_get_section_by_name (abfd, ".dynamic") == NULL);
|
||||
symbol = 0;
|
||||
}
|
||||
@ -5437,7 +5440,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
|
||||
|
||||
(c) the section allows direct references to MIPS16 functions. */
|
||||
if (r_type != R_MIPS16_26
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& ((h != NULL
|
||||
&& h->fn_stub != NULL
|
||||
&& (r_type != R_MIPS16_CALL16 || h->need_fn_stub))
|
||||
@ -5479,7 +5482,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
|
||||
to a standard MIPS function, we need to redirect the call to the stub.
|
||||
Note that we specifically exclude R_MIPS16_CALL16 from this behavior;
|
||||
indirect calls should use an indirect stub instead. */
|
||||
else if (r_type == R_MIPS16_26 && !info->relocatable
|
||||
else if (r_type == R_MIPS16_26 && !bfd_link_relocatable (info)
|
||||
&& ((h != NULL && (h->call_stub != NULL || h->call_fp_stub != NULL))
|
||||
|| (local_p
|
||||
&& mips_elf_tdata (input_bfd)->local_call_stubs != NULL
|
||||
@ -5532,7 +5535,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
|
||||
to point to the standard PLT entry, so redirect to the compressed
|
||||
one. */
|
||||
else if ((r_type == R_MIPS16_26 || r_type == R_MICROMIPS_26_S1)
|
||||
&& !info->relocatable
|
||||
&& !bfd_link_relocatable (info)
|
||||
&& h != NULL
|
||||
&& h->use_plt_entry
|
||||
&& h->root.plt.plist->comp_offset != MINUS_ONE
|
||||
@ -5567,7 +5570,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
|
||||
because the assembly writer may have "known" that any definition of the
|
||||
symbol would be 16-bit code, and that direct jumps were therefore
|
||||
acceptable. */
|
||||
*cross_mode_jump_p = (!info->relocatable
|
||||
*cross_mode_jump_p = (!bfd_link_relocatable (info)
|
||||
&& !(h && h->root.root.type == bfd_link_hash_undefweak)
|
||||
&& ((r_type == R_MIPS16_26 && !target_is_16_bit_code_p)
|
||||
|| (r_type == R_MICROMIPS_26_S1
|
||||
@ -5718,7 +5721,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_bfd,
|
||||
case R_MIPS_32:
|
||||
case R_MIPS_REL32:
|
||||
case R_MIPS_64:
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
|| (htab->root.dynamic_sections_created
|
||||
&& h != NULL
|
||||
&& h->root.def_dynamic
|
||||
@ -6279,7 +6282,7 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
|
||||
|
||||
/* Try converting JAL to BAL and J(AL)R to B(AL), if the target is in
|
||||
range. */
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& !cross_mode_jump_p
|
||||
&& ((JAL_TO_BAL_P (input_bfd)
|
||||
&& r_type == R_MIPS_26
|
||||
@ -6318,7 +6321,7 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
|
||||
if (size != 0)
|
||||
bfd_put (8 * size, input_bfd, x, location);
|
||||
|
||||
_bfd_mips_elf_reloc_shuffle (input_bfd, r_type, !info->relocatable,
|
||||
_bfd_mips_elf_reloc_shuffle (input_bfd, r_type, !bfd_link_relocatable (info),
|
||||
location);
|
||||
|
||||
return TRUE;
|
||||
@ -7448,7 +7451,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
elf_text_symbol->section = elf_text_section;
|
||||
}
|
||||
/* This code used to do *secp = bfd_und_section_ptr if
|
||||
info->shared. I don't know why, and that doesn't make sense,
|
||||
bfd_link_pic (info). I don't know why, and that doesn't make sense,
|
||||
so I took it out. */
|
||||
*secp = mips_elf_tdata (abfd)->elf_text_section;
|
||||
break;
|
||||
@ -7489,7 +7492,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
elf_data_symbol->section = elf_data_section;
|
||||
}
|
||||
/* This code used to do *secp = bfd_und_section_ptr if
|
||||
info->shared. I don't know why, and that doesn't make sense,
|
||||
bfd_link_pic (info). I don't know why, and that doesn't make sense,
|
||||
so I took it out. */
|
||||
*secp = mips_elf_tdata (abfd)->elf_data_section;
|
||||
break;
|
||||
@ -7500,7 +7503,7 @@ _bfd_mips_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
}
|
||||
|
||||
if (SGI_COMPAT (abfd)
|
||||
&& ! info->shared
|
||||
&& ! bfd_link_pic (info)
|
||||
&& info->output_bfd->xvec == abfd->xvec
|
||||
&& strcmp (*namep, "__rld_obj_head") == 0)
|
||||
{
|
||||
@ -7608,7 +7611,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
htab->sstubs = s;
|
||||
|
||||
if (!mips_elf_hash_table (info)->use_rld_obj_head
|
||||
&& info->executable
|
||||
&& bfd_link_executable (info)
|
||||
&& bfd_get_linker_section (abfd, ".rld_map") == NULL)
|
||||
{
|
||||
s = bfd_make_section_anyway_with_flags (abfd, ".rld_map",
|
||||
@ -7672,7 +7675,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
(void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
|
||||
}
|
||||
|
||||
if (info->executable)
|
||||
if (bfd_link_executable (info))
|
||||
{
|
||||
const char *name;
|
||||
|
||||
@ -7734,7 +7737,7 @@ _bfd_mips_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
|
||||
else
|
||||
htab->srelplt = bfd_get_linker_section (abfd, ".rel.plt");
|
||||
if (!htab->sdynbss
|
||||
|| (htab->is_vxworks && !htab->srelbss && !info->shared)
|
||||
|| (htab->is_vxworks && !htab->srelbss && !bfd_link_pic (info))
|
||||
|| !htab->srelplt
|
||||
|| !htab->splt)
|
||||
abort ();
|
||||
@ -7912,7 +7915,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd_vma addend;
|
||||
reloc_howto_type *howto;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = mips_elf_hash_table (info);
|
||||
@ -8268,7 +8271,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
elf_hash_table (info)->dynobj = dynobj = abfd;
|
||||
if (!mips_elf_create_got_section (dynobj, info))
|
||||
return FALSE;
|
||||
if (htab->is_vxworks && !info->shared)
|
||||
if (htab->is_vxworks && !bfd_link_pic (info))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: GOT reloc at 0x%lx not expected in executables"),
|
||||
@ -8311,7 +8314,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
one or using copy relocations or PLT entries. It is
|
||||
usually better to do the former, unless the relocation is
|
||||
against a read-only section. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
|| (h != NULL
|
||||
&& !htab->is_vxworks
|
||||
&& strcmp (h->root.root.string, "__gnu_local_gp") != 0
|
||||
@ -8476,7 +8479,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
/* This symbol is definitely not overridable. */
|
||||
if (hmips->root.def_regular
|
||||
&& ! (info->shared && ! info->symbolic
|
||||
&& ! (bfd_link_pic (info) && ! info->symbolic
|
||||
&& ! hmips->root.forced_local))
|
||||
h = NULL;
|
||||
}
|
||||
@ -8495,7 +8498,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_MIPS_TLS_GOTTPREL:
|
||||
case R_MIPS16_TLS_GOTTPREL:
|
||||
case R_MICROMIPS_TLS_GOTTPREL:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
@ -8543,7 +8546,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
if (sreloc == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
if (info->shared && h == NULL)
|
||||
if (bfd_link_pic (info) && h == NULL)
|
||||
{
|
||||
/* When creating a shared object, we must copy these
|
||||
reloc types into the output file as R_MIPS_REL32
|
||||
@ -8657,7 +8660,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
not PIC, but we can create dynamic relocations and the result
|
||||
will be fine. Also do not refuse R_MIPS_LO16, which can be
|
||||
combined with R_MIPS_GOT16. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
switch (r_type)
|
||||
{
|
||||
@ -8721,7 +8724,7 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec,
|
||||
/* We are not currently changing any sizes, so only one pass. */
|
||||
*again = FALSE;
|
||||
|
||||
if (link_info->relocatable)
|
||||
if (bfd_link_relocatable (link_info))
|
||||
return TRUE;
|
||||
|
||||
internal_relocs = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
|
||||
@ -8767,7 +8770,7 @@ _bfd_mips_relax_section (bfd *abfd, asection *sec,
|
||||
if (! ((h->root.root.type == bfd_link_hash_defined
|
||||
|| h->root.root.type == bfd_link_hash_defweak)
|
||||
&& h->root.root.u.def.section)
|
||||
|| (link_info->shared && ! link_info->symbolic
|
||||
|| (bfd_link_pic (link_info) && ! link_info->symbolic
|
||||
&& !h->root.forced_local))
|
||||
continue;
|
||||
|
||||
@ -8883,7 +8886,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
|
||||
/* VxWorks executables are handled elsewhere; we only need to
|
||||
allocate relocations in shared objects. */
|
||||
if (htab->is_vxworks && !info->shared)
|
||||
if (htab->is_vxworks && !bfd_link_pic (info))
|
||||
return TRUE;
|
||||
|
||||
/* Ignore indirect symbols. All relocations against such symbols
|
||||
@ -8894,11 +8897,11 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
/* If this symbol is defined in a dynamic object, or we are creating
|
||||
a shared library, we will need to copy any R_MIPS_32 or
|
||||
R_MIPS_REL32 relocs against it into the output file. */
|
||||
if (! info->relocatable
|
||||
if (! bfd_link_relocatable (info)
|
||||
&& hmips->possibly_dynamic_relocs != 0
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
|| (!h->def_regular && !ELF_COMMON_DEF_P (h))
|
||||
|| info->shared))
|
||||
|| bfd_link_pic (info)))
|
||||
{
|
||||
bfd_boolean do_copy = TRUE;
|
||||
|
||||
@ -9052,11 +9055,11 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
|
||||
/* On VxWorks, also allocate room for the header's
|
||||
.rela.plt.unloaded entries. */
|
||||
if (htab->is_vxworks && !info->shared)
|
||||
if (htab->is_vxworks && !bfd_link_pic (info))
|
||||
htab->srelplt2->size += 2 * sizeof (Elf32_External_Rela);
|
||||
|
||||
/* Now work out the sizes of individual PLT entries. */
|
||||
if (htab->is_vxworks && info->shared)
|
||||
if (htab->is_vxworks && bfd_link_pic (info))
|
||||
htab->plt_mips_entry_size
|
||||
= 4 * ARRAY_SIZE (mips_vxworks_shared_plt_entry);
|
||||
else if (htab->is_vxworks)
|
||||
@ -9140,7 +9143,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
|
||||
/* If the output file has no definition of the symbol, set the
|
||||
symbol's value to the address of the stub. */
|
||||
if (!info->shared && !h->def_regular)
|
||||
if (!bfd_link_pic (info) && !h->def_regular)
|
||||
hmips->use_plt_entry = TRUE;
|
||||
|
||||
/* Make room for the R_MIPS_JUMP_SLOT relocation. */
|
||||
@ -9149,7 +9152,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
: MIPS_ELF_REL_SIZE (dynobj));
|
||||
|
||||
/* Make room for the .rela.plt.unloaded relocations. */
|
||||
if (htab->is_vxworks && !info->shared)
|
||||
if (htab->is_vxworks && !bfd_link_pic (info))
|
||||
htab->srelplt2->size += 3 * sizeof (Elf32_External_Rela);
|
||||
|
||||
/* All relocations against this symbol that could have been made
|
||||
@ -9183,7 +9186,7 @@ _bfd_mips_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
||||
|
||||
/* We're now relying on copy relocations. Complain if we have
|
||||
some that we can't convert. */
|
||||
if (!htab->use_plts_and_copy_relocs || info->shared)
|
||||
if (!htab->use_plts_and_copy_relocs || bfd_link_pic (info))
|
||||
{
|
||||
(*_bfd_error_handler) (_("non-dynamic relocations refer to "
|
||||
"dynamic symbol %s"),
|
||||
@ -9364,7 +9367,7 @@ mips_elf_lay_out_got (bfd *output_bfd, struct bfd_link_info *info)
|
||||
== g->global_gotno + g->local_gotno + g->tls_gotno);
|
||||
|
||||
/* Each VxWorks GOT entry needs an explicit relocation. */
|
||||
if (htab->is_vxworks && info->shared)
|
||||
if (htab->is_vxworks && bfd_link_pic (info))
|
||||
g->relocs += g->global_gotno + g->local_gotno - htab->reserved_gotno;
|
||||
|
||||
/* Allocate room for the TLS relocations. */
|
||||
@ -9576,7 +9579,7 @@ _bfd_mips_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);
|
||||
@ -9611,7 +9614,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
BFD_ASSERT (htab->sgotplt->size == 0);
|
||||
BFD_ASSERT (htab->splt->size == 0);
|
||||
|
||||
if (htab->is_vxworks && info->shared)
|
||||
if (htab->is_vxworks && bfd_link_pic (info))
|
||||
size = 4 * ARRAY_SIZE (mips_vxworks_shared_plt0_entry);
|
||||
else if (htab->is_vxworks)
|
||||
size = 4 * ARRAY_SIZE (mips_vxworks_exec_plt0_entry);
|
||||
@ -9713,7 +9716,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
info->combreloc = 0;
|
||||
}
|
||||
}
|
||||
else if (info->executable
|
||||
else if (bfd_link_executable (info)
|
||||
&& ! mips_elf_hash_table (info)->use_rld_obj_head
|
||||
&& CONST_STRNEQ (name, ".rld_map"))
|
||||
{
|
||||
@ -9772,17 +9775,17 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
DT_MIPS_RLD_MAP entry. This must come first because glibc
|
||||
only fills in DT_MIPS_RLD_MAP (not DT_DEBUG) and some tools
|
||||
may only look at the first one they see. */
|
||||
if (!info->shared
|
||||
if (!bfd_link_pic (info)
|
||||
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP, 0))
|
||||
return FALSE;
|
||||
|
||||
if (info->executable
|
||||
if (bfd_link_executable (info)
|
||||
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_MIPS_RLD_MAP_REL, 0))
|
||||
return FALSE;
|
||||
|
||||
/* The DT_DEBUG entry may be filled in by the dynamic linker and
|
||||
used by the debugger. */
|
||||
if (info->executable
|
||||
if (bfd_link_executable (info)
|
||||
&& !SGI_COMPAT (output_bfd)
|
||||
&& !MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_DEBUG, 0))
|
||||
return FALSE;
|
||||
@ -9918,7 +9921,7 @@ mips_elf_adjust_addend (bfd *output_bfd, struct bfd_link_info *info,
|
||||
sym = local_syms + r_symndx;
|
||||
|
||||
/* Adjust REL's addend to account for section merging. */
|
||||
if (!info->relocatable)
|
||||
if (!bfd_link_relocatable (info))
|
||||
{
|
||||
sec = local_sections[r_symndx];
|
||||
_bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
|
||||
@ -10109,7 +10112,7 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
local_syms, local_sections, rel);
|
||||
}
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
{
|
||||
if (r_type == R_MIPS_64 && ! NEWABI_P (output_bfd)
|
||||
&& bfd_big_endian (input_bfd))
|
||||
@ -10852,7 +10855,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
{
|
||||
offset = p->gotidx;
|
||||
BFD_ASSERT (offset > 0 && offset < htab->sgot->size);
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| (elf_hash_table (info)->dynamic_sections_created
|
||||
&& p->d.h != NULL
|
||||
&& p->d.h->root.def_dynamic
|
||||
@ -11028,7 +11031,7 @@ _bfd_mips_vxworks_finish_dynamic_symbol (bfd *output_bfd,
|
||||
/* Find out where the .plt entry should go. */
|
||||
loc = htab->splt->contents + plt_offset;
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
plt_entry = mips_vxworks_shared_plt_entry;
|
||||
bfd_put_32 (output_bfd, plt_entry[0] | branch_offset, loc);
|
||||
@ -11643,7 +11646,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
sgot->contents
|
||||
+ got_index++ * MIPS_ELF_GOT_SIZE (output_bfd));
|
||||
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
continue;
|
||||
|
||||
for (; got_index < g->local_gotno; got_index++)
|
||||
@ -11779,14 +11782,14 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd,
|
||||
{
|
||||
if (htab->is_vxworks)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
mips_vxworks_finish_shared_plt (output_bfd, info);
|
||||
else
|
||||
mips_vxworks_finish_exec_plt (output_bfd, info);
|
||||
}
|
||||
else
|
||||
{
|
||||
BFD_ASSERT (!info->shared);
|
||||
BFD_ASSERT (!bfd_link_pic (info));
|
||||
if (!mips_finish_exec_plt (output_bfd, info))
|
||||
return FALSE;
|
||||
}
|
||||
@ -12391,7 +12394,7 @@ _bfd_mips_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
unsigned long r_symndx;
|
||||
struct elf_link_hash_entry *h;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
@ -13405,7 +13408,7 @@ _bfd_mips_elf_relax_section (bfd *abfd, asection *sec,
|
||||
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)
|
||||
@ -14162,7 +14165,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
elf_gp (abfd) = (h->u.def.section->output_section->vma
|
||||
+ h->u.def.section->output_offset
|
||||
+ h->u.def.value);
|
||||
else if (info->relocatable)
|
||||
else if (bfd_link_relocatable (info))
|
||||
{
|
||||
bfd_vma lo = MINUS_ONE;
|
||||
|
||||
@ -14448,7 +14451,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
input_section->flags &= ~SEC_HAS_CONTENTS;
|
||||
}
|
||||
|
||||
if (SGI_COMPAT (abfd) && info->shared)
|
||||
if (SGI_COMPAT (abfd) && bfd_link_pic (info))
|
||||
{
|
||||
/* Create .rtproc section. */
|
||||
rtproc_sec = bfd_get_linker_section (abfd, ".rtproc");
|
||||
@ -14504,7 +14507,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
information describing how the small data area would
|
||||
change depending upon the -G switch. These sections
|
||||
not used in executables files. */
|
||||
if (! info->relocatable)
|
||||
if (! bfd_link_relocatable (info))
|
||||
{
|
||||
for (p = o->map_head.link_order; p != NULL; p = p->next)
|
||||
{
|
||||
|
@ -1208,14 +1208,14 @@ _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj,
|
||||
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, ".rela.bss");
|
||||
|
||||
if (htab->is_vxworks)
|
||||
{
|
||||
if (!elf_vxworks_create_dynamic_sections (dynobj, info, &htab->srelplt2))
|
||||
return FALSE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
htab->plt_header_size
|
||||
= 4 * ARRAY_SIZE (sparc_vxworks_shared_plt0_entry);
|
||||
@ -1232,7 +1232,7 @@ _bfd_sparc_elf_create_dynamic_sections (bfd *dynobj,
|
||||
}
|
||||
|
||||
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -1330,7 +1330,7 @@ sparc_elf_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
&& ! _bfd_sparc_elf_tdata (abfd)->has_tlsgd)
|
||||
r_type = R_SPARC_REV32;
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return r_type;
|
||||
|
||||
switch (r_type)
|
||||
@ -1377,7 +1377,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
int num_relocs;
|
||||
bfd_boolean checked_tlsgd = FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = _bfd_sparc_elf_hash_table (info);
|
||||
@ -1501,13 +1501,13 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
case R_SPARC_TLS_LE_HIX22:
|
||||
case R_SPARC_TLS_LE_LOX10:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
goto r_sparc_plt32;
|
||||
break;
|
||||
|
||||
case R_SPARC_TLS_IE_HI22:
|
||||
case R_SPARC_TLS_IE_LO10:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
@ -1617,7 +1617,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
|
||||
case R_SPARC_TLS_GD_CALL:
|
||||
case R_SPARC_TLS_LDM_CALL:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* These are basically R_SPARC_TLS_WPLT30 relocs against
|
||||
__tls_get_addr. */
|
||||
@ -1735,7 +1735,7 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
h->non_got_ref = 1;
|
||||
|
||||
r_sparc_plt32:
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a .plt entry if the function this reloc
|
||||
refers to is in a shared lib. */
|
||||
@ -1763,19 +1763,19 @@ _bfd_sparc_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (! _bfd_sparc_elf_howto_table[r_type].pc_relative
|
||||
|| (h != NULL
|
||||
&& (! SYMBOLIC_BIND (info, h)
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
{
|
||||
@ -1878,8 +1878,8 @@ _bfd_sparc_elf_gc_mark_hook (asection *sec,
|
||||
}
|
||||
|
||||
/* FIXME: The test here, in check_relocs and in relocate_section
|
||||
dealing with TLS optimization, ought to be !info->executable. */
|
||||
if (info->shared)
|
||||
dealing with TLS optimization, ought to be !bfd_link_executable (info). */
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
switch (SPARC_ELF_R_TYPE (rel->r_info))
|
||||
{
|
||||
@ -1928,7 +1928,7 @@ _bfd_sparc_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_sparc_elf (abfd) || sec->reloc_count == 0);
|
||||
@ -2057,7 +2057,7 @@ _bfd_sparc_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_SPARC_L44:
|
||||
case R_SPARC_H34:
|
||||
case R_SPARC_UA64:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
break;
|
||||
/* Fall through. */
|
||||
|
||||
@ -2158,7 +2158,7 @@ _bfd_sparc_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
|
||||
@ -2247,7 +2247,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h)
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h)
|
||||
|| (h->type == STT_GNU_IFUNC
|
||||
&& h->def_regular))
|
||||
{
|
||||
@ -2262,7 +2262,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
s->size = htab->plt_header_size;
|
||||
|
||||
/* Allocate space for the .rela.plt.unloaded relocations. */
|
||||
if (htab->is_vxworks && !info->shared)
|
||||
if (htab->is_vxworks && !bfd_link_pic (info))
|
||||
htab->srelplt2->size = sizeof (Elf32_External_Rela) * 2;
|
||||
}
|
||||
|
||||
@ -2293,7 +2293,7 @@ allocate_dynrelocs (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 = s;
|
||||
@ -2315,7 +2315,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
htab->elf.sgotplt->size += 4;
|
||||
|
||||
/* ...and for the .rela.plt.unloaded relocations. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
htab->srelplt2->size += sizeof (Elf32_External_Rela) * 3;
|
||||
}
|
||||
}
|
||||
@ -2334,7 +2334,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
/* If R_SPARC_TLS_IE_{HI22,LO10} symbol is now local to the binary,
|
||||
make it a R_SPARC_TLS_LE_{HI22,LO10} requiring no TLS entry. */
|
||||
if (h->got.refcount > 0
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& _bfd_sparc_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
|
||||
h->got.offset = (bfd_vma) -1;
|
||||
@ -2369,7 +2369,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
|
||||
htab->elf.srelgot->size += SPARC_ELF_RELA_BYTES (htab);
|
||||
else if (tls_type == GOT_TLS_GD)
|
||||
htab->elf.srelgot->size += 2 * SPARC_ELF_RELA_BYTES (htab);
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h))
|
||||
htab->elf.srelgot->size += SPARC_ELF_RELA_BYTES (htab);
|
||||
}
|
||||
else
|
||||
@ -2385,7 +2387,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
@ -2557,7 +2559,7 @@ _bfd_sparc_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);
|
||||
@ -2631,7 +2633,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
s->size += SPARC_ELF_WORD_BYTES (htab);
|
||||
if (*local_tls_type == GOT_TLS_GD)
|
||||
s->size += SPARC_ELF_WORD_BYTES (htab);
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| *local_tls_type == GOT_TLS_GD
|
||||
|| *local_tls_type == GOT_TLS_IE)
|
||||
srel->size += SPARC_ELF_RELA_BYTES (htab);
|
||||
@ -2745,7 +2747,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
|
||||
#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;
|
||||
@ -2864,7 +2866,7 @@ _bfd_sparc_elf_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
|
||||
struct bfd_link_info *link_info ATTRIBUTE_UNUSED,
|
||||
bfd_boolean *again)
|
||||
{
|
||||
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"));
|
||||
|
||||
@ -2957,7 +2959,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
sreloc = elf_section_data (input_section)->sreloc;
|
||||
/* We have to handle relocations in vxworks .tls_vars sections
|
||||
specially, because the dynamic loader is 'weird'. */
|
||||
is_vxworks_tls = (htab->is_vxworks && info->shared
|
||||
is_vxworks_tls = (htab->is_vxworks && bfd_link_pic (info)
|
||||
&& !strcmp (input_section->output_section->name,
|
||||
".tls_vars"));
|
||||
|
||||
@ -3003,7 +3005,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
sec = local_sections[r_symndx];
|
||||
relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
|
||||
|
||||
if (!info->relocatable
|
||||
if (!bfd_link_relocatable (info)
|
||||
&& ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
|
||||
{
|
||||
/* Relocate against local STT_GNU_IFUNC symbol. */
|
||||
@ -3041,7 +3043,7 @@ _bfd_sparc_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;
|
||||
|
||||
if (h != NULL
|
||||
@ -3091,7 +3093,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_SPARC_32:
|
||||
case R_SPARC_64:
|
||||
if (info->shared && h->non_got_ref)
|
||||
if (bfd_link_pic (info) && h->non_got_ref)
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_vma offset;
|
||||
@ -3109,7 +3111,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
if (h->dynindx == -1
|
||||
|| h->forced_local
|
||||
|| info->executable)
|
||||
|| bfd_link_executable (info))
|
||||
{
|
||||
outrel.r_info = SPARC_ELF_R_INFO (htab, NULL,
|
||||
0, R_SPARC_IRELATIVE);
|
||||
@ -3134,7 +3136,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
case R_SPARC_HI22:
|
||||
case R_SPARC_LO10:
|
||||
/* We should only see such relocs in static links. */
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
abort();
|
||||
relocation = (plt_sec->output_section->vma
|
||||
+ plt_sec->output_offset + h->plt.offset);
|
||||
@ -3206,8 +3208,10 @@ _bfd_sparc_elf_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)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||
{
|
||||
/* This is actually a static link, or it is a
|
||||
@ -3249,7 +3253,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
else
|
||||
{
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -3382,13 +3386,13 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
|| is_vxworks_tls)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (! howto->pc_relative
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -3467,7 +3471,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
else if (h != NULL &&
|
||||
h->dynindx != -1
|
||||
&& (! is_plt
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
{
|
||||
@ -3565,7 +3569,9 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
else if (h != NULL)
|
||||
{
|
||||
tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
|
||||
if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
|
||||
if (!bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& tls_type == GOT_TLS_IE)
|
||||
switch (SPARC_ELF_R_TYPE (rel->r_info))
|
||||
{
|
||||
case R_SPARC_TLS_GD_HI22:
|
||||
@ -3687,7 +3693,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_SPARC_TLS_LDM_HI22:
|
||||
case R_SPARC_TLS_LDM_LO10:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
|
||||
continue;
|
||||
@ -3698,7 +3704,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_SPARC_TLS_LDO_HIX22:
|
||||
case R_SPARC_TLS_LDO_LOX10:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
relocation -= dtpoff_base (info);
|
||||
break;
|
||||
@ -3710,7 +3716,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_SPARC_TLS_LE_HIX22:
|
||||
case R_SPARC_TLS_LE_LOX10:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_boolean skip;
|
||||
@ -3742,7 +3748,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
break;
|
||||
|
||||
case R_SPARC_TLS_LDM_CALL:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
/* mov %g0, %o0 */
|
||||
bfd_put_32 (output_bfd, 0x90100000, contents + rel->r_offset);
|
||||
@ -3756,13 +3762,13 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
|
||||
else if (h != NULL)
|
||||
tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
|
||||
if (! info->shared
|
||||
if (! bfd_link_pic (info)
|
||||
|| (r_type == R_SPARC_TLS_GD_CALL && tls_type == GOT_TLS_IE))
|
||||
{
|
||||
Elf_Internal_Rela *rel2;
|
||||
bfd_vma insn;
|
||||
|
||||
if (!info->shared && (h == NULL || h->dynindx == -1))
|
||||
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
/* GD -> LE */
|
||||
bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
|
||||
@ -3832,7 +3838,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
tls_type = _bfd_sparc_elf_local_got_tls_type (input_bfd) [r_symndx];
|
||||
else if (h != NULL)
|
||||
tls_type = _bfd_sparc_elf_hash_entry(h)->tls_type;
|
||||
if (! info->shared || tls_type == GOT_TLS_IE)
|
||||
if (! bfd_link_pic (info) || tls_type == GOT_TLS_IE)
|
||||
{
|
||||
/* add %reg1, %reg2, %reg3, %tgd_add(foo)
|
||||
changed into IE:
|
||||
@ -3840,7 +3846,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
or LE:
|
||||
add %g7, %reg2, %reg3. */
|
||||
bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
|
||||
if ((h != NULL && h->dynindx != -1) || info->shared)
|
||||
if ((h != NULL && h->dynindx != -1) || bfd_link_pic (info))
|
||||
relocation = insn | (ABI_64_P (output_bfd) ? 0xc0580000 : 0xc0000000);
|
||||
else
|
||||
relocation = (insn & ~0x7c000) | 0x1c000;
|
||||
@ -3849,12 +3855,12 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
continue;
|
||||
|
||||
case R_SPARC_TLS_LDM_ADD:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
bfd_put_32 (output_bfd, SPARC_NOP, contents + rel->r_offset);
|
||||
continue;
|
||||
|
||||
case R_SPARC_TLS_LDO_ADD:
|
||||
if (! info->shared)
|
||||
if (! bfd_link_pic (info))
|
||||
{
|
||||
/* Change rs1 into %g7. */
|
||||
bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
|
||||
@ -3865,7 +3871,7 @@ _bfd_sparc_elf_relocate_section (bfd *output_bfd,
|
||||
|
||||
case R_SPARC_TLS_IE_LD:
|
||||
case R_SPARC_TLS_IE_LDX:
|
||||
if (! info->shared && (h == NULL || h->dynindx == -1))
|
||||
if (! bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
bfd_vma insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
|
||||
int rs2 = insn & 0x1f;
|
||||
@ -4226,7 +4232,7 @@ sparc_vxworks_build_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
|
||||
htab = _bfd_sparc_elf_hash_table (info);
|
||||
BFD_ASSERT (htab != NULL);
|
||||
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
plt_entry = sparc_vxworks_shared_plt_entry;
|
||||
got_base = 0;
|
||||
@ -4270,7 +4276,7 @@ sparc_vxworks_build_plt_entry (bfd *output_bfd, struct bfd_link_info *info,
|
||||
htab->elf.sgotplt->contents + got_offset);
|
||||
|
||||
/* Add relocations to .rela.plt.unloaded. */
|
||||
if (!info->shared)
|
||||
if (!bfd_link_pic (info))
|
||||
{
|
||||
loc = (htab->srelplt2->contents
|
||||
+ (2 + 3 * plt_index) * sizeof (Elf32_External_Rela));
|
||||
@ -4376,7 +4382,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
|
||||
if (h == NULL
|
||||
|| h->dynindx == -1
|
||||
|| ((info->executable
|
||||
|| ((bfd_link_executable (info)
|
||||
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
|
||||
&& h->def_regular
|
||||
&& h->type == STT_GNU_IFUNC))
|
||||
@ -4476,7 +4482,7 @@ _bfd_sparc_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)
|
||||
&& h->type == STT_GNU_IFUNC
|
||||
&& h->def_regular)
|
||||
{
|
||||
@ -4491,7 +4497,7 @@ _bfd_sparc_elf_finish_dynamic_symbol (bfd *output_bfd,
|
||||
+ (h->got.offset & ~(bfd_vma) 1));
|
||||
return TRUE;
|
||||
}
|
||||
else if (info->shared
|
||||
else if (bfd_link_pic (info)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h))
|
||||
{
|
||||
asection *sec = h->root.u.def.section;
|
||||
@ -4779,7 +4785,7 @@ _bfd_sparc_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
|
||||
{
|
||||
if (htab->is_vxworks)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
sparc_vxworks_finish_shared_plt (output_bfd, info);
|
||||
else
|
||||
sparc_vxworks_finish_exec_plt (output_bfd, info);
|
||||
|
@ -1513,11 +1513,11 @@ tilegx_elf_create_dynamic_sections (bfd *dynobj,
|
||||
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, ".rela.bss");
|
||||
|
||||
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
|
||||
|| (!info->shared && !htab->srelbss))
|
||||
|| (!bfd_link_pic (info) && !htab->srelbss))
|
||||
abort ();
|
||||
|
||||
return TRUE;
|
||||
@ -1643,7 +1643,7 @@ static int
|
||||
tilegx_elf_tls_transition (struct bfd_link_info *info, int r_type,
|
||||
int is_local, bfd_boolean disable_le_transition)
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
return r_type;
|
||||
|
||||
if (is_local && !disable_le_transition)
|
||||
@ -1669,7 +1669,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
int num_relocs;
|
||||
bfd_boolean has_tls_gd_or_ie = FALSE, has_tls_add = FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
htab = tilegx_elf_hash_table (info);
|
||||
@ -1754,7 +1754,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE:
|
||||
case R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE:
|
||||
case R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
goto r_tilegx_plt32;
|
||||
break;
|
||||
|
||||
@ -1764,7 +1764,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD:
|
||||
case R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD:
|
||||
case R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD:
|
||||
BFD_ASSERT (info->shared);
|
||||
BFD_ASSERT (bfd_link_pic (info));
|
||||
tls_type = GOT_TLS_GD;
|
||||
goto have_got_reference;
|
||||
|
||||
@ -1775,7 +1775,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE:
|
||||
case R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE:
|
||||
tls_type = GOT_TLS_IE;
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
goto have_got_reference;
|
||||
|
||||
@ -1856,7 +1856,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
break;
|
||||
|
||||
case R_TILEGX_TLS_GD_CALL:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
/* These are basically R_TILEGX_JUMPOFF_X1_PLT relocs
|
||||
against __tls_get_addr. */
|
||||
@ -1975,7 +1975,7 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
h->non_got_ref = 1;
|
||||
|
||||
r_tilegx_plt32:
|
||||
if (h != NULL && !info->shared)
|
||||
if (h != NULL && !bfd_link_pic (info))
|
||||
{
|
||||
/* We may need a .plt entry if the function this reloc
|
||||
refers to is in a shared lib. */
|
||||
@ -2003,14 +2003,14 @@ tilegx_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
|
||||
may need to keep relocations for symbols satisfied by a
|
||||
dynamic library if we manage to avoid copy relocs for the
|
||||
symbol. */
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& (! tilegx_elf_howto_table[r_type].pc_relative
|
||||
|| (h != NULL
|
||||
&& (! info->symbolic
|
||||
|| h->root.type == bfd_link_hash_defweak
|
||||
|| !h->def_regular))))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& (sec->flags & SEC_ALLOC) != 0
|
||||
&& h != NULL
|
||||
&& (h->root.type == bfd_link_hash_defweak
|
||||
@ -2119,8 +2119,8 @@ tilegx_elf_gc_mark_hook (asection *sec,
|
||||
}
|
||||
|
||||
/* FIXME: The test here, in check_relocs and in relocate_section
|
||||
dealing with TLS optimization, ought to be !info->executable. */
|
||||
if (info->shared)
|
||||
dealing with TLS optimization, ought to be !bfd_link_executable (info). */
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
switch (TILEGX_ELF_R_TYPE (rel->r_info))
|
||||
{
|
||||
@ -2154,7 +2154,7 @@ tilegx_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
|
||||
BFD_ASSERT (is_tilegx_elf (abfd) || sec->reloc_count == 0);
|
||||
@ -2298,7 +2298,7 @@ tilegx_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
|
||||
case R_TILEGX_IMM16_X1_HW1_LAST:
|
||||
case R_TILEGX_IMM16_X0_HW2_LAST:
|
||||
case R_TILEGX_IMM16_X1_HW2_LAST:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
break;
|
||||
/* Fall through. */
|
||||
|
||||
@ -2405,7 +2405,7 @@ tilegx_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
|
||||
@ -2489,7 +2489,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info->shared, h))
|
||||
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, bfd_link_pic (info), h))
|
||||
{
|
||||
asection *s = htab->elf.splt;
|
||||
|
||||
@ -2506,7 +2506,7 @@ allocate_dynrelocs (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 = s;
|
||||
@ -2538,7 +2538,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
requiring no TLS entry. */
|
||||
if (h->got.refcount > 0
|
||||
&& !htab->disable_le_transition
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& tilegx_elf_hash_entry(h)->tls_type == GOT_TLS_IE)
|
||||
h->got.offset = (bfd_vma) -1;
|
||||
@ -2568,7 +2568,9 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
TLS_GD needs two if local symbol and two if global. */
|
||||
if (tls_type == GOT_TLS_GD || tls_type == GOT_TLS_IE)
|
||||
htab->elf.srelgot->size += 2 * TILEGX_ELF_RELA_BYTES (htab);
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h))
|
||||
else if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn,
|
||||
bfd_link_pic (info),
|
||||
h))
|
||||
htab->elf.srelgot->size += TILEGX_ELF_RELA_BYTES (htab);
|
||||
}
|
||||
else
|
||||
@ -2584,7 +2586,7 @@ allocate_dynrelocs (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)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
if (SYMBOL_CALLS_LOCAL (info, h))
|
||||
{
|
||||
@ -2722,7 +2724,7 @@ tilegx_elf_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);
|
||||
@ -2787,7 +2789,7 @@ tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
||||
s->size += TILEGX_ELF_WORD_BYTES (htab);
|
||||
if (*local_tls_type == GOT_TLS_GD)
|
||||
s->size += TILEGX_ELF_WORD_BYTES (htab);
|
||||
if (info->shared
|
||||
if (bfd_link_pic (info)
|
||||
|| *local_tls_type == GOT_TLS_GD
|
||||
|| *local_tls_type == GOT_TLS_IE)
|
||||
srel->size += TILEGX_ELF_RELA_BYTES (htab);
|
||||
@ -2899,7 +2901,7 @@ tilegx_elf_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;
|
||||
@ -3214,7 +3216,7 @@ tilegx_elf_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;
|
||||
|
||||
if (h != NULL)
|
||||
@ -3245,9 +3247,9 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (h != NULL)
|
||||
tls_type = tilegx_elf_hash_entry(h)->tls_type;
|
||||
|
||||
is_tls_iele = (! info->shared || tls_type == GOT_TLS_IE);
|
||||
is_tls_iele = (! bfd_link_pic (info) || tls_type == GOT_TLS_IE);
|
||||
is_tls_le = is_tls_iele && (!input_section->sec_flg0
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& (h == NULL || h->dynindx == -1));
|
||||
|
||||
if (r_type == R_TILEGX_TLS_GD_CALL)
|
||||
@ -3392,7 +3394,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
break;
|
||||
case R_TILEGX_TLS_IE_LOAD:
|
||||
if (!input_section->sec_flg0
|
||||
&& !info->shared
|
||||
&& !bfd_link_pic (info)
|
||||
&& (h == NULL || h->dynindx == -1))
|
||||
{
|
||||
/* IE -> LE */
|
||||
@ -3439,8 +3441,10 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
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)
|
||||
&& SYMBOL_REFERENCES_LOCAL (info, h)))
|
||||
{
|
||||
/* This is actually a static link, or it is a
|
||||
@ -3481,7 +3485,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
off &= ~1;
|
||||
else
|
||||
{
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
asection *s;
|
||||
Elf_Internal_Rela outrel;
|
||||
@ -3611,13 +3615,13 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
if ((input_section->flags & SEC_ALLOC) == 0)
|
||||
break;
|
||||
|
||||
if ((info->shared
|
||||
if ((bfd_link_pic (info)
|
||||
&& (h == NULL
|
||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||
|| h->root.type != bfd_link_hash_undefweak)
|
||||
&& (! howto->pc_relative
|
||||
|| !SYMBOL_CALLS_LOCAL (info, h)))
|
||||
|| (!info->shared
|
||||
|| (!bfd_link_pic (info)
|
||||
&& h != NULL
|
||||
&& h->dynindx != -1
|
||||
&& !h->non_got_ref
|
||||
@ -3670,7 +3674,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (h != NULL &&
|
||||
h->dynindx != -1
|
||||
&& (! is_plt
|
||||
|| !info->shared
|
||||
|| !bfd_link_pic (info)
|
||||
|| !SYMBOLIC_BIND (info, h)
|
||||
|| !h->def_regular))
|
||||
{
|
||||
@ -3753,7 +3757,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
case R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE:
|
||||
case R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE:
|
||||
case R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE:
|
||||
if (info->shared)
|
||||
if (bfd_link_pic (info))
|
||||
{
|
||||
Elf_Internal_Rela outrel;
|
||||
bfd_boolean skip;
|
||||
@ -3805,7 +3809,9 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
else if (h != NULL)
|
||||
{
|
||||
tls_type = tilegx_elf_hash_entry(h)->tls_type;
|
||||
if (!info->shared && h->dynindx == -1 && tls_type == GOT_TLS_IE)
|
||||
if (!bfd_link_pic (info)
|
||||
&& h->dynindx == -1
|
||||
&& tls_type == GOT_TLS_IE)
|
||||
r_type = (!input_section->sec_flg0
|
||||
? tilegx_tls_translate_to_le (r_type)
|
||||
: tilegx_tls_translate_to_ie (r_type));
|
||||
@ -3856,8 +3862,10 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
bfd_boolean dyn;
|
||||
dyn = htab->elf.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)))
|
||||
{
|
||||
indx = h->dynindx;
|
||||
@ -3866,7 +3874,7 @@ tilegx_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
|
||||
|
||||
/* The GOT entries have not been initialized yet. Do it
|
||||
now, and emit any relocations. */
|
||||
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))
|
||||
@ -4171,7 +4179,7 @@ tilegx_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)
|
||||
{
|
||||
|
@ -318,7 +318,7 @@ linux_add_one_symbol (struct bfd_link_info *info,
|
||||
|
||||
insert = FALSE;
|
||||
|
||||
if (! info->relocatable
|
||||
if (! bfd_link_relocatable (info)
|
||||
&& linux_hash_table (info)->dynobj == NULL
|
||||
&& strcmp (name, SHARABLE_CONFLICTS) == 0
|
||||
&& (flags & BSF_CONSTRUCTOR) != 0
|
||||
|
10
bfd/linker.c
10
bfd/linker.c
@ -1906,7 +1906,7 @@ _bfd_generic_final_link (bfd *abfd, struct bfd_link_info *info)
|
||||
if (! generic_add_output_symbol (abfd, &outsymalloc, NULL))
|
||||
return FALSE;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
{
|
||||
/* Allocate space for the output relocs for each section. */
|
||||
for (o = abfd->sections; o != NULL; o = o->next)
|
||||
@ -2210,7 +2210,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
|
||||
break;
|
||||
case discard_sec_merge:
|
||||
output = TRUE;
|
||||
if (info->relocatable
|
||||
if (bfd_link_relocatable (info)
|
||||
|| ! (sym->section->flags & SEC_MERGE))
|
||||
break;
|
||||
/* FALLTHROUGH */
|
||||
@ -2380,7 +2380,7 @@ _bfd_generic_reloc_link_order (bfd *abfd,
|
||||
{
|
||||
arelent *r;
|
||||
|
||||
if (! info->relocatable)
|
||||
if (! bfd_link_relocatable (info))
|
||||
abort ();
|
||||
if (sec->orelocation == NULL)
|
||||
abort ();
|
||||
@ -2611,7 +2611,7 @@ default_indirect_link_order (bfd *output_bfd,
|
||||
BFD_ASSERT (input_section->output_offset == link_order->offset);
|
||||
BFD_ASSERT (input_section->size == link_order->size);
|
||||
|
||||
if (info->relocatable
|
||||
if (bfd_link_relocatable (info)
|
||||
&& input_section->reloc_count > 0
|
||||
&& output_section->orelocation == NULL)
|
||||
{
|
||||
@ -2705,7 +2705,7 @@ default_indirect_link_order (bfd *output_bfd,
|
||||
goto error_return;
|
||||
new_contents = (bfd_get_relocated_section_contents
|
||||
(output_bfd, info, link_order, contents,
|
||||
info->relocatable,
|
||||
bfd_link_relocatable (info),
|
||||
_bfd_generic_link_get_symbols (input_bfd)));
|
||||
if (!new_contents)
|
||||
goto error_return;
|
||||
|
@ -320,7 +320,7 @@ linux_add_one_symbol (struct bfd_link_info *info,
|
||||
|
||||
insert = FALSE;
|
||||
|
||||
if (! info->relocatable
|
||||
if (! bfd_link_relocatable (info)
|
||||
&& linux_hash_table (info)->dynobj == NULL
|
||||
&& strcmp (name, SHARABLE_CONFLICTS) == 0
|
||||
&& (flags & BSF_CONSTRUCTOR) != 0
|
||||
|
12
bfd/pdp11.c
12
bfd/pdp11.c
@ -3264,7 +3264,7 @@ pdp11_aout_link_input_section (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);
|
||||
@ -3474,7 +3474,7 @@ pdp11_aout_link_input_section (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)
|
||||
if (hundef && ! bfd_link_pic (flaginfo->info))
|
||||
{
|
||||
const char *name;
|
||||
|
||||
@ -3581,7 +3581,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;
|
||||
@ -3682,7 +3682,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;
|
||||
@ -3710,7 +3710,7 @@ NAME (aout, final_link) (bfd *abfd,
|
||||
{
|
||||
size_t sz;
|
||||
|
||||
if (info->relocatable)
|
||||
if (bfd_link_relocatable (info))
|
||||
{
|
||||
if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
|
||||
{
|
||||
@ -3754,7 +3754,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)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user