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.
+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
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);
/* 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;
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);
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)
/* 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;
asection *o;
bfd_boolean have_link_order_relocs;
- if (info->shared)
+ if (bfd_link_pic (info))
abfd->flags |= DYNAMIC;
aout_info.info = info;
{
bfd_size_type sz;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
{
}
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (obj_textsec (abfd) != NULL)
trsize += (_bfd_count_link_order_relocs (obj_textsec (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"));
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)
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;
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;
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)
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);
/* 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;
abort ();
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* We are generating relocatable output, and must
convert the existing reloc. */
}
}
- if (info->relocatable && adjust_addrp)
+ if (bfd_link_relocatable (info) && adjust_addrp)
{
/* Change the address of the relocation. */
H_PUT_64 (input_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
#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
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
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))
{
+ 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,
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
}
#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,
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
/* 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);
/* 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
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,
asection *o;
bfd_byte *esym;
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
return TRUE;
esym = (bfd_byte *) bfd_malloc (symesz);
+ 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,
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;
bfd_byte *p;
bfd_size_type amt;
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
*errmsg = NULL;
/* 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 */
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)
{
}
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* We are generating relocatable output, and must convert
the existing reloc. */
/* 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;
|| 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)
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;
/* 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;
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 =
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);
|| (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;
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
}
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
*again = FALSE;
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
return TRUE;
+ 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,
+ 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,
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);
}
else
{
- BFD_ASSERT (info->relocatable
+ BFD_ASSERT (bfd_link_relocatable (info)
|| (h->flags & XCOFF_DEF_DYNAMIC) != 0
|| (h->flags & XCOFF_IMPORT) != 0);
}
{
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);
/* 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))
|| 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)
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;
/* 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;
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 =
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);
|| (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;
== 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;
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
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)
);
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);
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;
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)));
flaginfo->sec_ptrs))
return FALSE;
- if (flaginfo->info->relocatable)
+ if (bfd_link_relocatable (flaginfo->info))
{
bfd_vma offset;
struct internal_reloc *irelend;
/* 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;
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),
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),
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;
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,
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);
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
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
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;
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)))
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);
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;
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
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))
/* 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))
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 \
_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 \
/* 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)))
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;
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;
}
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)))
}
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))
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);
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
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)
/* 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)
{
/* 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;
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. */
{
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;
}
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,
/* 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)
&& 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))
srelgot = NULL;
sreloc = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
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 */
}
if (srelgot == NULL
- && (h != NULL || info->shared))
+ && (h != NULL || bfd_link_pic (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
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
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. */
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))
/* 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
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. */
{
bfd_put_32 (output_bfd, value, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection * srelgot;
Elf_Internal_Rela outrel;
/* _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
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)
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,
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"));
/* 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 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
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
if (h->type == STT_FUNC
|| h->needs_plt)
{
- if (! info->shared
+ if (! bfd_link_pic (info)
&& !h->def_dynamic
&& !h->ref_dynamic)
{
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;
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
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);
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;
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));
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)
{
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));
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);
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)
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;
/* 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. */
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. */
{
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;
}
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));
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
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,
_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)
}
/* 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;
{
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)
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);
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"));
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
if (!htab->root.splt
|| !htab->root.srelplt
|| !htab->sdynbss
- || (!info->shared && !htab->srelbss))
+ || (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
/* 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))
}
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. */
}
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. */
|| (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. */
|| (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. */
{
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. */
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)
{
/* 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)
/* 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. */
/* 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
/* 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. */
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. */
--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,
+ 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;
/* 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,
{
char *v = _("shared object");
- if (info->executable)
+ if (bfd_link_executable (info))
v = _("PIE executable");
(*_bfd_error_handler)
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);
{
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);
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;
{
/* 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_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;
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))
/* 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);
}
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"),
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)
{
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,
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);
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
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));
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)
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"),
/* 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;
}
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
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
h->got.refcount = 0;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| eh->is_iplt
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, 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 = htab->root.splt;
/* 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_. */
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))
{
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);
}
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
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);
&& (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);
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
#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;
{
asection *tls_sec;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
tls_sec = elf_hash_table (info)->tls_sec;
#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. */
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)
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;
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,
|| !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"));
/* 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)
}
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)
asection *sgot;
asection *srelgot;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
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)
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
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;
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)
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
{
/* 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);
}
}
/* 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 (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
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)))
{
/* 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)
/* 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
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);
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
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;
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;
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)
/* 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
&& 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;
}
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;
}
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",
{
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
{
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);
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;
bfd *dynobj;
struct bfinfdpic_relocs_info *picrel;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
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)
{
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
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);
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);
#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;
bfd_byte *p;
bfd_size_type amt;
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
*errmsg = NULL;
srelgot = NULL;
bfd_boolean result = FALSE;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
}
if (srelgot == NULL
- && (h != NULL || info->executable))
+ && (h != NULL || bfd_link_executable (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
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. */
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,
/* 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)
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
if (h->type == STT_FUNC
|| h->needs_plt)
{
- if (! info->executable
+ if (! bfd_link_executable (info)
&& !h->def_dynamic
&& !h->ref_dynamic)
{
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
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");
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;
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)
{
bfd_byte *p;
bfd_size_type amt;
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
*errmsg = NULL;
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,
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
|| 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)
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)
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)))))
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
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
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))))
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
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)))
{
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;
break;
case R_CRIS_32_GD:
- if (info->shared)
+ if (bfd_link_pic (info))
{
bfd_set_error (bfd_error_invalid_operation);
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. */
break;
case R_CRIS_32_IE:
- if (info->shared)
+ if (bfd_link_pic (info))
{
bfd_set_error (bfd_error_invalid_operation);
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. */
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);
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);
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
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))
{
{
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
}
else
{
- if (info->shared)
+ if (bfd_link_pic (info))
memcpy (splt->contents, elf_cris_pic_plt0_entry,
PLT_ENTRY_SIZE);
else
asection *sgot;
asection *srelgot;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
{
/* 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);
}
}
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,
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;
/* 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;
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;
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
asection *srelgot;
asection *sreloc;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
htab = elf_cris_hash_table (info);
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. */
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)
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"
/* 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;
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
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)
{
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
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
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);
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);
{
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)
#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;
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,
/* 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)
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;
+ 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;
addend = extract_rel_addend (input_bfd, where, howto);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
addend += sec->output_offset;
else
{
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)
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;
/* 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)
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. */
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,
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;
/* 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 (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
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)))
{
/* 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)
/* 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
/* *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)))
{
/* 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)))
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)))
{
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;
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
{
#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) \
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;
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;
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)
/* 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
(_("%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;
}
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
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
{
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;
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;
{
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)
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)))
{
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
_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
{
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)))
{
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);
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;
{
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"));
/* 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
bfd *dynobj;
struct frvfdpic_relocs_info *picrel;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
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,
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,
/* 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)
&& 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))
{
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);
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"),
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;
/* 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
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
|| 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
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);
|| (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
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
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.
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)))
{
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))
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)
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))
{
*local_plt = sec->size;
sec->size += PLT_ENTRY_SIZE;
- if (info->shared)
+ if (bfd_link_pic (info))
srel->size += sizeof (Elf32_External_Rela);
}
else
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;
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;
}
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)
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;
/* 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);
/* 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)
{
&& 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)))
{
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
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
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,
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
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
if (do_plt)
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
/* Output a dynamic IPLT relocation for this
PLT entry. */
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
&& 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))
{
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;
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))
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)
{
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);
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
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);
#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;
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;
const Elf_Internal_Rela *rel_end;
asection *sreloc;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
#ifdef DEBUG
h->root.non_ir_ref = 1;
}
- if (info->shared)
+ if (bfd_link_pic (info))
{
#ifdef DEBUG
fprintf (stderr,
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
}
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *sdynsym;
asection *s;
_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 ])
|| 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
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,
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)
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;
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");
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;
{
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))
break;
case R_386_TLS_LDM:
- if (info->executable)
+ if (bfd_link_executable (info))
to_type = R_386_TLS_LE_32;
break;
asection *sreloc;
bfd_boolean use_plt_got;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
BFD_ASSERT (is_i386_elf (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 */
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
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
|| 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
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);
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 */
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
return FALSE;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->elf.splt;
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)
}
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,
/* 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;
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))
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
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,
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)
&& (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);
|| *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))
{
#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;
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);
/* 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"));
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;
abort ();
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
addend += sec->output_offset;
else
{
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. */
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
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;
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);
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))
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;
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)
{
|| 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
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);
break;
case R_386_TLS_IE:
- if (!info->executable)
+ if (!bfd_link_executable (info))
{
Elf_Internal_Rela outrel;
asection *sreloc;
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. */
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;
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
}
/* 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);
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;
+ 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))
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;
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;
return TRUE;
}
}
- else if (info->shared
+ else if (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
{
BFD_ASSERT((h->got.offset & 1) != 0);
/* 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);
->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);
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)
/* 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)
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. */
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;
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)
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,
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)
+ off);
}
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *srelgot;
Elf_Internal_Rela outrel;
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;
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);
got_offset = (plt_index + 3) * 4;
/* Fill in the entry in the procedure linkage table. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
{
/* TODO */
}
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)
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
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
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;
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;
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
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
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);
{
*local_got = s->size;
s->size += 4;
- if (info->shared)
+ if (bfd_link_pic (info))
srel->size += sizeof (Elf32_External_Rela);
}
else
#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;
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;
}
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
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))
}
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,
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,
asection *splt;
bfd *dynobj;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
bfd *dynobj;
asection *splt;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
/* Assume nothing changes. */
*again = FALSE;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
/* Quick check for an empty plt. */
/* 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)
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))
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;
}
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
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
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
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;
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;
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
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
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);
{
*local_got = s->size;
s->size += 4;
- if (info->shared)
+ if (bfd_link_pic (info))
srel->size += sizeof (Elf32_External_Rela);
}
else
#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;
|| 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
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)
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,
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,
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,
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)
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *srelgot;
Elf_Internal_Rela outrel;
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
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
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)
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);
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;
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;
bfd *dynobj;
asection *sreloc;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
sreloc = NULL;
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;
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
&& (! 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
/* 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)
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;
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,
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
asection *sreloc;
struct elf_m68k_got *got;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
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;
}
if (srelgot == NULL
- && (h != NULL || info->shared))
+ && (h != NULL || bfd_link_pic (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
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)
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
bfd *dynobj;
struct elf_m68k_got *got;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
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;
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
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);
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);
#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;
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)
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))
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)
*off_ptr |= 1;
}
- else /* h == NULL && !info->shared */
+ else /* h == NULL && !bfd_link_pic (info) */
{
elf_m68k_init_got_entry_static (info,
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 "
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
&& (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))
{
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;
bfd_byte *p;
bfd_size_type amt;
- BFD_ASSERT (! info->relocatable);
+ BFD_ASSERT (! bfd_link_relocatable (info));
*errmsg = NULL;
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 */
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)
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;
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)
_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 \
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)
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
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,
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
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;
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))
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"),
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);
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;
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);
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. */
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)
{
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;
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
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
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;
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;
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
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))
{
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)
/* 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
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;
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]
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)
{
/* 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,
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;
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;
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;
}
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)
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,
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))
/* 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);
}
/* 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,
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)
&& h->dynindx != -1
&& (!info->symbolic
|| !h->def_regular))))
- || (!info->shared
+ || (!bfd_link_pic (info)
&& h != NULL
&& h->dynindx != -1
&& !h->non_got_ref
*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)
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);
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;
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
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;
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
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;
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;
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
{
*local_got = s->size;
s->size += need;
- if (info->shared)
+ if (bfd_link_pic (info))
srel->size += need * (sizeof (Elf32_External_Rela) / 4);
}
}
{
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
#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;
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
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)
{
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
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,
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;
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;
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,
/* 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;
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. */
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;
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;
}
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"));
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
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
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;
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;
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
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))
{
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);
{
*local_got = s->size;
s->size += 4;
- if (info->shared)
+ if (bfd_link_pic (info))
srel->size += sizeof (Elf32_External_Rela);
}
else
#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;
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);
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);
}
- 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,
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))
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *srelgot;
Elf_Internal_Rela outrel;
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))
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 "
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
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *srelgot;
Elf_Internal_Rela outrel;
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;
}
{
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))
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;
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)
{
splt = htab->splt;
if (splt && splt->size > 0)
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
unsigned long insn;
long offset;
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;
bfd *dynobj;
asection *sreloc = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
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;
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
&& (!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
* 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
}
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)
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)
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))
bfd_put_32 (output_bfd, relocation,
sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *srelgot;
Elf_Internal_Rela outrel;
}
}
- 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
{
/* 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;
{
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;
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))
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 "
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
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))
{
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)
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;
}
if (srelgot == NULL
- && (h != NULL || info->shared))
+ && (h != NULL || bfd_link_pic (info)))
{
srelgot = htab->root.srelgot;
BFD_ASSERT (srelgot != NULL);
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
/* 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
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;
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);
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,
{
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);
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)
&& !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;
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;
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))
{
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);
}
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)))
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);
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
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
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;
#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))
|| !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
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))
{
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)
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
{
/* 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;
|| (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
/* 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));
bfd *dynobj;
asection *sreloc = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
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;
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
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);
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;
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
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
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
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;
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;
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);
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))
{
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);
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);
#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;
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;
case R_PPC_TPREL16_LO:
case R_PPC_TPREL16_HI:
case R_PPC_TPREL16_HA:
- return !info->executable;
+ return !bfd_link_executable (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
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))
{
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.
/* 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))
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;
/* 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;
/* Indirect .sdata relocation. */
case R_PPC_EMB_SDAI16:
- if (info->shared)
+ if (bfd_link_pic (info))
{
bad_shared_reloc (abfd, r_type);
return FALSE;
/* Indirect .sdata2 relocation. */
case R_PPC_EMB_SDA2I16:
- if (info->shared)
+ if (bfd_link_pic (info))
{
bad_shared_reloc (abfd, r_type);
return FALSE;
break;
case R_PPC_EMB_SDA2REL:
- if (info->shared)
+ if (bfd_link_pic (info))
{
bad_shared_reloc (abfd, r_type);
return FALSE;
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;
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;
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;
}
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,
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;
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
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. */
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. */
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)))
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
const Elf_Internal_Rela *rel, *relend;
asection *got2;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
if ((sec->flags & SEC_ALLOC) == 0)
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 **)
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)
{
if (h->got.refcount > 0)
h->got.refcount--;
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
struct plt_entry *ent;
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:
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)
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);
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,
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;
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.";
}
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))
{
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;
s->size += TLS_GET_ADDR_GLINK_SIZE - GLINK_ENTRY_SIZE;
}
if (!doneone
- && !info->shared
+ && !bfd_link_pic (info)
&& h->def_dynamic
&& !h->def_regular)
{
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)
{
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
{
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))
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
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);
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)
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;
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
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;
{
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)
#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;
/* 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;
/* 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);
|| 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;
/* 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)
{
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)
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
/* 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))
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;
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;
+ plt_sec->output_section->vma
+ plt_sec->output_offset);
- if (info->shared)
+ if (bfd_link_pic (info))
{
bfd_vma got = 0;
"%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");
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)
rel, 1, relend, howto, 0, contents);
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (got2 != NULL
&& r_type == R_PPC_PLTREL24
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);
}
{
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
}
/* 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
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 */
|| 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
&& (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
if (r_type == R_PPC_RELAX_PLTREL24)
{
- if (info->shared)
+ if (bfd_link_pic (info))
got2_addend = addend;
addend = 0;
}
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
}
relocation += addend;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
relocation = 0;
/* First insn is HA, second is LO. */
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)
{
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)))
{
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;
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),
+ 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
}
}
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
write_glink_stub (ent, splt, p, info);
- if (!info->shared)
+ if (!bfd_link_pic (info))
/* We only need one non-PIC glink stub. */
break;
}
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);
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;
}
/* Last comes the PLTresolve stub. */
- if (info->shared)
+ if (bfd_link_pic (info))
{
bfd_vma bcl;
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,
asection *splt;
bfd *dynobj;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
bfd *dynobj;
asection *splt;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->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. */
/* 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)
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,
/* 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)
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;
int r_type,
int is_local)
{
- if (info->shared)
+ if (bfd_link_pic (info))
return r_type;
switch (r_type)
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));
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. */
/* 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. */
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. */
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
|| 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
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);
case R_390_PC24DBL:
case R_390_PC32DBL:
case R_390_PC32:
- if (info->shared)
+ if (bfd_link_pic (info))
break;
/* Fall through. */
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
return FALSE;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->elf.splt;
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;
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)
{
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);
}
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))
{
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)
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
#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;
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)
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))
}
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
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;
&& 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. */
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);
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)
&& 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
|| 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))
{
/* 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;
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)
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;
}
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. */
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. */
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. */
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
(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)
{
}
else if (r_type == R_390_TLS_LDCALL)
{
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
unsigned int insn;
= -(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);
if (!h
|| h->dynindx == -1
- || ((info->executable
+ || ((bfd_link_executable (info)
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
&& h->def_regular))
{
= -(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);
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
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
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);
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);
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;
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)))
{
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
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);
+ 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)
{
/* 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,
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,
asection *sreloc;
const struct elf_backend_data *bed;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
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:
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)
{
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
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))
{
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);
return FALSE;
}
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
const char *name;
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);
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;
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)))
{
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
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);
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))
/* 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,
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,
asection *sreloc;
const struct elf_backend_data *bed;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
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:
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)
{
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
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))
{
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);
return FALSE;
}
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
const char *name;
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;
*again = FALSE;
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
return TRUE;
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;
}
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
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
return FALSE;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->splt;
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;
/* 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
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. */
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;
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
|| (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
/* 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);
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))
{
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);
}
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;
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);
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);
}
}
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;
{
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);
#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;
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)
{
/* 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"));
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,
|| 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
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
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)
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,
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
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)
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)
{
if (h == NULL
|| h->forced_local
- || ! info->shared
+ || ! bfd_link_pic (info)
|| info->symbolic
|| h->dynindx == -1
|| h->plt.offset == (bfd_vma) -1
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))
/* 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))
{
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
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;
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;
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;
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);
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;
/* 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"),
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;
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. */
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 */
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)
sreloc = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
BFD_ASSERT (is_sh_elf (abfd));
}
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
break;
case R_SH_TLS_IE_32:
- if (info->shared)
+ if (bfd_link_pic (info))
info->flags |= DF_STATIC_TLS;
/* FALLTHROUGH */
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);
if (h == NULL
|| h->forced_local
- || ! info->shared
+ || ! bfd_link_pic (info)
|| info->symbolic
|| h->dynindx == -1)
goto force_got;
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;
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
/* 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"),
got_offset = (plt_index + 3) * 4;
#ifdef GOT_BIAS
- if (info->shared)
+ if (bfd_link_pic (info))
got_offset -= GOT_BIAS;
#endif
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)
{
/* 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)
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. */
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)
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)
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
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. */
{
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;
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. */
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;
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". */
}
}
- 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)
{
{
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
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);
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;
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
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)
{
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);
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
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
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 */
/* 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
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))
{
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))
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))
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;
const Elf_Internal_Rela *rel_end;
asection *sreloc;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
htab = elf32_tic6x_hash_table (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))
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 */
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;
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. */
return FALSE;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->elf.splt;
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;
/* 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. */
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)
*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);
}
#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;
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;
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;
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)
asection *sreloc;
int num_relocs;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
htab = tilepro_elf_hash_table (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;
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;
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;
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. */
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. */
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
}
/* 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))
{
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);
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. */
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
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;
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;
/* 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;
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
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))
{
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);
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;
#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;
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)
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)
}
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,
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
off &= ~1;
else
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
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
else if (h != NULL &&
h->dynindx != -1
&& (! is_plt
- || !info->shared
+ || !bfd_link_pic (info)
|| !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
{
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;
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)
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;
/* 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))
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)
{
int other = 0;
const char *common = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
#ifdef DEBUG
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. */
*again = FALSE;
- if (link_info->relocatable
+ if (bfd_link_relocatable (link_info)
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
return TRUE;
asection *srelgot;
asection *sreloc;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
}
if (srelgot == NULL
- && (h != NULL || info->shared))
+ && (h != NULL || bfd_link_pic (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
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
/* 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
const Elf_Internal_Rela *rel, *relend;
bfd *dynobj;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
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;
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
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);
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);
#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;
&& 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
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)
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:
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
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;
continue;
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
switch (r_type)
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,
asection *splt;
bfd *dynobj;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata(abfd)->symtab_hdr;
/* Assume nothing changes. */
*again = FALSE;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
/* We only relax the .plt section at the moment. */
bfd *dynobj;
asection *splt;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
dynobj = elf_hash_table (info)->dynobj;
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)
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));
switch (r_type)
{
case R_XTENSA_TLSDESC_FN:
- if (info->shared)
+ if (bfd_link_pic (info))
{
tls_type = GOT_TLS_GD;
is_got = TRUE;
break;
case R_XTENSA_TLSDESC_ARG:
- if (info->shared)
+ if (bfd_link_pic (info))
{
tls_type = GOT_TLS_GD;
is_got = TRUE;
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;
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;
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)
{
if (htab == NULL)
return FALSE;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
if ((sec->flags & SEC_ALLOC) == 0)
switch (r_type)
{
case R_XTENSA_TLSDESC_FN:
- if (info->shared)
+ if (bfd_link_pic (info))
{
is_got = TRUE;
is_tlsfunc = TRUE;
break;
case R_XTENSA_TLSDESC_ARG:
- if (info->shared)
+ if (bfd_link_pic (info))
is_got = TRUE;
else
{
break;
case R_XTENSA_TLS_TPOFF:
- if (info->shared || h)
+ if (bfd_link_pic (info) || h)
is_got = TRUE;
break;
&& 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)
/* 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
#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;
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
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);
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;
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;
{
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;
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
}
/* 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);
/* 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;
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
/* 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);
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;
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,
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;
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
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.
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
case R_ALPHA_REFLONG:
case R_ALPHA_REFQUAD:
- if (info->shared || maybe_dynamic)
+ if (bfd_link_pic (info) || maybe_dynamic)
need = NEED_DYNREL;
break;
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;
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. */
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);
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);
/* 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 +=
/* 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 (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)
{
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)));
}
}
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);
#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;
/* 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)
/* 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;
/* 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
/* 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:
{
/* 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)
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);
/* 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);
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;
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
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"),
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);
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"),
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
{
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
/* 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;
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);
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
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;
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);
/* 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);
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;
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
/* 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
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;
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;
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. */
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);
{
*local_dlt = sec->size;
sec->size += DLT_ENTRY_SIZE;
- if (info->shared)
+ if (bfd_link_pic (info))
{
srel->size += sizeof (Elf64_External_Rela);
}
{
*local_plt = sec->size;
sec->size += PLT_ENTRY_SIZE;
- if (info->shared)
+ if (bfd_link_pic (info))
srel->size += sizeof (Elf64_External_Rela);
}
else
{
*local_opd = sec->size;
sec->size += OPD_ENTRY_SIZE;
- if (info->shared)
+ if (bfd_link_pic (info))
srel->size += sizeof (Elf64_External_Rela);
}
else
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)
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);
/* 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;
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;
/* 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;
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)
/* 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.
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;
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
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
if (hppa_info == NULL)
return FALSE;
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
{
struct elf_link_hash_entry *gp;
bfd_vma gp_val;
/* 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;
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
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
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,
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"));
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
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
- | (info->pie ? 0
+ | (bfd_link_pie (info) ? 0
: SEC_READONLY)
| SEC_LINKER_CREATED));
if (!fptr
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",
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;
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
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;
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;
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
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;
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;
/* 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);
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:
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))
{
/* 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))
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;
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)
return FALSE;
/* Infect various flags from the input section to the output section. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
bfd_vma flags;
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)
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;
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)
{
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. */
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 ?? */
/* 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);
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)
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
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)
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;
/* 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);
/* 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
case R_PPC64_TPREL16_HIGHEST:
case R_PPC64_TPREL16_HIGHESTA:
case R_PPC64_TPREL64:
- return !info->executable;
+ return !bfd_link_executable (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
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);
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;
/* 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
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)
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.
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;
/* 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;
/* 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 ();
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;
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;
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
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;
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.
|| ((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
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)
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))
{
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
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);
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
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:
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)))
}
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)
/* 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;
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);
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))
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;
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
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)
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;
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;
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);
#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;
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;
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);
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;
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)
. 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
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
: 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)
}
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. */
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)))
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);
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)];
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;
int r_type,
int is_local)
{
- if (info->shared)
+ if (bfd_link_pic (info))
return r_type;
switch (r_type)
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));
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 */
/* 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 */
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. */
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
|| 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
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);
case R_390_PC32:
case R_390_PC32DBL:
case R_390_PC64:
- if (info->shared)
+ if (bfd_link_pic (info))
break;
/* Fall through */
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
return FALSE;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->elf.splt;
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;
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)
{
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);
}
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))
{
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)
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
#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;
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)
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))
}
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
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;
&& 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. */
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);
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)
&& 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
|| 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))
{
/* 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;
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)
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;
}
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. */
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. */
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. */
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
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,. */
}
else if (r_type == R_390_TLS_LDCALL)
{
- if (!info->shared)
+ if (!bfd_link_pic (info))
{
unsigned int insn0, insn1;
if (!h
|| h->dynindx == -1
- || ((info->executable
+ || ((bfd_link_executable (info)
|| ELF_ST_VISIBILITY (h->other) != STV_DEFAULT)
&& h->def_regular))
{
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
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
#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"
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,
|| 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
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
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)
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,
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
{
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
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
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)
{
bfd_put_64 (output_bfd, relocation, sgot->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
srelgot = NULL;
sreloc = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
}
if (srelgot == NULL
- && (h != NULL || info->shared))
+ && (h != NULL || bfd_link_pic (info)))
{
srelgot = bfd_get_linker_section (dynobj, ".rela.got");
if (srelgot == NULL)
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
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)
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
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
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. */
{
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;
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;
}
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
if (h->type == STT_FUNC
|| h->needs_plt)
{
- if (! info->shared
+ if (! bfd_link_pic (info)
&& !h->def_dynamic
&& !h->ref_dynamic)
{
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;
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
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);
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);
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;
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)
{
+ elf_sh64_plt_symbol_offset (info)));
}
- if (info->shared)
+ if (bfd_link_pic (info))
got_offset += GOT_BIAS;
movi_shori_putval (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)
{
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)
{
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");
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;
{
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)
break;
case R_X86_64_TLSLD:
- if (info->executable)
+ if (bfd_link_executable (info))
to_type = R_X86_64_TPOFF32;
break;
asection *sreloc;
bfd_boolean use_plt_got;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
BFD_ASSERT (is_x86_64_elf (abfd));
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;
break;
case R_X86_64_GOTTPOFF:
- if (!info->executable)
+ if (!bfd_link_executable (info))
info->flags |= DF_STATIC_TLS;
/* Fall through */
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)
{
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
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
|| 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
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);
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 */
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
return FALSE;
}
- if (info->shared
+ if (bfd_link_pic (info)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->elf.splt;
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)
/* 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)
{
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))
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.
}
/* 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)
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,
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)
&& (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);
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)
{
#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;
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);
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,
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))
return FALSE;
case R_X86_64_32S:
- if (info->shared)
+ if (bfd_link_pic (info))
abort ();
goto do_relocation;
/* 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;
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);
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))
bfd_put_64 (output_bfd, relocation,
base_got->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
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)
{
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)
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;
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
/* 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
&& 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
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))
{
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);
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;
/* 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
+ 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))
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;
return TRUE;
}
}
- else if (info->shared
+ else if (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))
{
if (!h->def_regular)
/* 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);
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
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
/* 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))
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))
{
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;
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
{
if (! dynamic)
{
- if (! info->executable
+ if (! bfd_link_executable (info)
|| hi->def_dynamic
|| hi->ref_dynamic)
*dynsym = TRUE;
{
if (! dynamic)
{
- if (! info->executable
+ if (! bfd_link_executable (info)
|| hi->ref_dynamic)
*dynsym = TRUE;
}
/* 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;
_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);
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)
/* 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))
{
/* 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
/* 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);
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. */
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)
}
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");
/* 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;
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. */
/* 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;
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;
}
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;
}
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)
{
/* 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,
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;
if (info->flags_1)
{
- if (info->executable)
+ if (bfd_link_executable (info))
info->flags_1 &= ~ (DF_1_INITFIRST
| DF_1_NODELETE
| DF_1_NOOPEN);
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
/* 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
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)
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)
/* 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
*/
if (h->verinfo.verdef == NULL
&& !local_bind
- && (!flinfo->info->executable
+ && (!bfd_link_executable (flinfo->info)
|| h->ref_dynamic
|| !h->def_regular))
{
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. */
&& (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;
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)
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. */
}
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
return FALSE;
if (ret == 2
- || flinfo->info->relocatable
+ || bfd_link_relocatable (flinfo->info)
|| flinfo->info->emitrelocations)
{
Elf_Internal_Rela *irela;
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++)
{
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;
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)
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++)
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;
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);
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);
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);
{
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)
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;
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)
{
}
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
bfd_boolean failed = FALSE;
|| ((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
_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;
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))
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)
/* 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;
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));
/* 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
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
{
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
{
bfd_put_64 (output_bfd, value, base_got->contents + off);
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
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,
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)
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);
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);
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);
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;
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
struct elf_aarch64_link_hash_table *htab;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
BFD_ASSERT (is_aarch64_elf (abfd));
if (h != NULL)
{
- if (!info->shared)
+ if (!bfd_link_pic (info))
h->non_got_ref = 1;
h->plt.refcount += 1;
/* No need to do anything if we're not creating a shared
object. */
- if (! info->shared)
+ if (! bfd_link_pic (info))
break;
{
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)
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
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;
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;
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;
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);
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)))
{
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.
if (htab->root.dynamic_sections_created)
{
- if (info->executable)
+ if (bfd_link_executable (info))
{
s = bfd_get_linker_section (dynobj, ".interp");
if (s == NULL)
{
}
- if (info->shared)
+ if (bfd_link_pic (info))
{
if (got_type & GOT_TLSDESC_GD)
{
#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;
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))
{
asection *tls_sec;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
tls_sec = elf_hash_table (info)->tls_sec;
/* 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
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;
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;
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"));
{
/* 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;
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
| 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))
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",
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;
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
{
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;
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;
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;
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;
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;
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
{
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;
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;
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;
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;
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;
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;
/* 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)))
|| 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
/* 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);
&& 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);
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:
/* 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);
/* 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);
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. */
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)
&& (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))
{
/* 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))
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;
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)
return FALSE;
/* Infect various flags from the input section to the output section. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
bfd_vma flags;
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)
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;
}
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;
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)
{
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;
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);
{
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
{
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;
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))
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);
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))
return 1;
case GOT_TLS_LDM:
- return info->shared ? 1 : 0;
+ return bfd_link_pic (info) ? 1 : 0;
default:
return 0;
{
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))
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
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;
/* 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;
}
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))
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
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;
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));
}
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;
}
(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))
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
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
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
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
/* 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
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;
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;
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;
}
if (SGI_COMPAT (abfd)
- && ! info->shared
+ && ! bfd_link_pic (info)
&& info->output_bfd->xvec == abfd->xvec
&& strcmp (*namep, "__rld_obj_head") == 0)
{
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",
(void) bfd_set_section_alignment (abfd, s, MIPS_ELF_LOG_FILE_ALIGN (abfd));
}
- if (info->executable)
+ if (bfd_link_executable (info))
{
const char *name;
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 ();
bfd_vma addend;
reloc_howto_type *howto;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
htab = mips_elf_hash_table (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"),
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
/* 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;
}
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 */
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
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)
{
/* 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,
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;
/* 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
/* 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;
/* 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)
/* 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. */
: 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
/* 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"),
== 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. */
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);
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);
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"))
{
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;
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);
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))
{
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
/* 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);
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++)
{
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;
}
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;
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)
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;
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");
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)
{
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);
}
if (!htab->elf.splt || !htab->elf.srelplt || !htab->sdynbss
- || (!info->shared && !htab->srelbss))
+ || (!bfd_link_pic (info) && !htab->srelbss))
abort ();
return TRUE;
&& ! _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)
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);
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 */
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. */
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. */
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))
{
}
/* 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))
{
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);
case R_SPARC_L44:
case R_SPARC_H34:
case R_SPARC_UA64:
- if (info->shared)
+ if (bfd_link_pic (info))
break;
/* Fall through. */
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
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))
{
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;
}
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;
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;
}
}
/* 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;
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
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))
{
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);
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);
#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;
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"));
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"));
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. */
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
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;
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);
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);
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
else
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
|| 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
else if (h != NULL &&
h->dynindx != -1
&& (! is_plt
- || !info->shared
+ || !bfd_link_pic (info)
|| !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
{
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:
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;
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;
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;
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);
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);
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:
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;
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);
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;
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;
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));
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))
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)
{
+ (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;
{
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);
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;
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)
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);
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;
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;
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;
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. */
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. */
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
}
/* 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))
{
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);
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. */
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
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;
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;
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;
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
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))
{
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);
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);
#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;
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)
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)
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 */
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
off &= ~1;
else
{
- if (info->shared)
+ if (bfd_link_pic (info))
{
asection *s;
Elf_Internal_Rela outrel;
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
else if (h != NULL &&
h->dynindx != -1
&& (! is_plt
- || !info->shared
+ || !bfd_link_pic (info)
|| !SYMBOLIC_BIND (info, h)
|| !h->def_regular))
{
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;
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));
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;
/* 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))
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)
{
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
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)
break;
case discard_sec_merge:
output = TRUE;
- if (info->relocatable
+ if (bfd_link_relocatable (info)
|| ! (sym->section->flags & SEC_MERGE))
break;
/* FALLTHROUGH */
{
arelent *r;
- if (! info->relocatable)
+ if (! bfd_link_relocatable (info))
abort ();
if (sec->orelocation == NULL)
abort ();
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)
{
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;
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
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);
/* 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;
/* 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;
asection *o;
bfd_boolean have_link_order_relocs;
- if (info->shared)
+ if (bfd_link_pic (info))
abfd->flags |= DYNAMIC;
aout_info.info = info;
{
size_t sz;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (bfd_get_flavour (sub) == bfd_target_aout_flavour)
{
}
}
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
if (obj_textsec (abfd) != NULL)
trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd)
struct internal_reloc *rel_end;
unsigned int i;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
(*_bfd_error_handler)
(_("%B: `ld -r' not supported with PE MIPS objects\n"), input_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;
+ 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,
}
if (coff_data (abfd)->link_info
- && ! coff_data (abfd)->link_info->relocatable
- && ! coff_data (abfd)->link_info->shared
+ && ! bfd_link_relocatable (coff_data (abfd)->link_info)
+ && ! bfd_link_pic (coff_data (abfd)->link_info)
&& strcmp (scnhdr_int->s_name, ".text") == 0)
{
/* By inference from looking at MS output, the 32 bit field
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"));
arelent **reloc_vector = NULL;
long reloc_count;
- 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"));
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
}
if ((needed && ! sunos_hash_table (info)->dynamic_sections_needed)
- || info->shared)
+ || bfd_link_pic (info))
{
bfd *dynobj;
{
if (! sunos_create_dynamic_sections (abfd, info,
((abfd->flags & DYNAMIC) != 0
- && !info->relocatable)))
+ && !bfd_link_relocatable (info))))
return FALSE;
}
/* The native linker seems to just ignore dynamic objects when -r is
used. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
/* There's no hope of using a dynamic object which does not exactly
/* In a shared library, the __DYNAMIC symbol does not appear in the
dynamic symbol table. */
- if (! info->shared || strcmp (name, "__DYNAMIC") != 0)
+ if (! bfd_link_pic (info) || strcmp (name, "__DYNAMIC") != 0)
{
h->flags |= SUNOS_DEF_REGULAR;
/* If we are making a shared library, or if the symbol is
defined by a dynamic object, we will need a dynamic reloc
entry. */
- if (info->shared
+ if (bfd_link_pic (info)
|| (h != NULL
&& (h->flags & SUNOS_DEF_DYNAMIC) != 0
&& (h->flags & SUNOS_DEF_REGULAR) == 0))
{
/* But, if we are creating a shared library, we need to
generate an absolute reloc. */
- if (info->shared)
+ if (bfd_link_pic (info))
{
if (dynobj == NULL)
{
continue;
if (r_type != RELOC_JMP_TBL
- && ! info->shared
+ && ! bfd_link_pic (info)
&& ((h->flags & SUNOS_DEF_DYNAMIC) == 0
|| (h->flags & SUNOS_DEF_REGULAR) != 0))
continue;
if (r_type == RELOC_JMP_TBL
- && ! info->shared
+ && ! bfd_link_pic (info)
&& (h->flags & SUNOS_DEF_DYNAMIC) == 0
&& (h->flags & SUNOS_DEF_REGULAR) == 0)
{
}
BFD_ASSERT (r_type == RELOC_JMP_TBL
- || info->shared
+ || bfd_link_pic (info)
|| (h->flags & SUNOS_REF_REGULAR) != 0);
BFD_ASSERT (r_type == RELOC_JMP_TBL
- || info->shared
+ || bfd_link_pic (info)
|| h->plt_offset != 0
|| ((h->root.root.type == bfd_link_hash_defined
|| h->root.root.type == bfd_link_hash_defweak)
/* We will also need a dynamic reloc entry, unless this
is a JMP_TBL reloc produced by linking PIC compiled
code, and we are not making a shared library. */
- if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
+ if (bfd_link_pic (info) || (h->flags & SUNOS_DEF_REGULAR) == 0)
srel->size += RELOC_EXT_SIZE;
}
/* If we are creating a shared library, we need to copy over
any reloc other than a jump table reloc. */
- if (info->shared && r_type != RELOC_JMP_TBL)
+ if (bfd_link_pic (info) && r_type != RELOC_JMP_TBL)
srel->size += RELOC_EXT_SIZE;
}
}
*sneedptr = NULL;
*srulesptr = NULL;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
if (output_bfd->xvec != &MY(vec))
switch (bfd_get_arch (output_bfd))
{
case bfd_arch_sparc:
- if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
+ if (bfd_link_pic (info) || (h->flags & SUNOS_DEF_REGULAR) == 0)
{
bfd_put_32 (output_bfd, SPARC_PLT_ENTRY_WORD0, p);
bfd_put_32 (output_bfd,
break;
case bfd_arch_m68k:
- if (! info->shared && (h->flags & SUNOS_DEF_REGULAR) != 0)
+ if (! bfd_link_pic (info) && (h->flags & SUNOS_DEF_REGULAR) != 0)
abort ();
bfd_put_16 (output_bfd, M68K_PLT_ENTRY_WORD0, p);
bfd_put_32 (output_bfd, (- (h->plt_offset + 2)), p + 2);
/* We also need to add a jump table reloc, unless this is the
result of a JMP_TBL reloc from PIC compiled code. */
- if (info->shared || (h->flags & SUNOS_DEF_REGULAR) == 0)
+ if (bfd_link_pic (info) || (h->flags & SUNOS_DEF_REGULAR) == 0)
{
BFD_ASSERT (h->dynindx >= 0);
BFD_ASSERT (s->reloc_count * obj_reloc_entry_size (dynobj)
if (h != NULL
&& h->plt_offset != 0
- && (info->shared
+ && (bfd_link_pic (info)
|| (h->flags & SUNOS_DEF_REGULAR) == 0))
{
asection *splt;
if ((*got_offsetp & 1) == 0)
{
if (h == NULL
- || (! info->shared
+ || (! bfd_link_pic (info)
&& ((h->flags & SUNOS_DEF_DYNAMIC) == 0
|| (h->flags & SUNOS_DEF_REGULAR) != 0)))
PUT_WORD (dynobj, *relocationp, sgot->contents + *got_offsetp);
else
PUT_WORD (dynobj, 0, sgot->contents + *got_offsetp);
- if (info->shared
+ if (bfd_link_pic (info)
|| (h != NULL
&& (h->flags & SUNOS_DEF_DYNAMIC) != 0
&& (h->flags & SUNOS_DEF_REGULAR) == 0))
if (! sunos_hash_table (info)->dynamic_sections_needed)
return TRUE;
- if (! info->shared)
+ if (! bfd_link_pic (info))
{
if (h == NULL
|| h->dynindx == -1
dynamic information, unless this is a shared library. */
s = bfd_get_linker_section (dynobj, ".got");
BFD_ASSERT (s != NULL);
- if (info->shared || sdyn->size == 0)
+ if (bfd_link_pic (info) || sdyn->size == 0)
PUT_WORD (dynobj, 0, s->contents);
else
PUT_WORD (dynobj, sdyn->output_section->vma + sdyn->output_offset,
asection *dst;
asection *dmt;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
/* FIXME: we do not yet support relocatable link. It is not obvious
how to do it for debug infos. */
won't work if we're producing an XCOFF output file with no
XCOFF input files. FIXME. */
- if (!info->relocatable
+ if (!bfd_link_relocatable (info)
&& xcoff_hash_table (info)->loader_section == NULL)
{
asection *lsec;
/* If we're marking an undefined symbol, try find some way of
defining it. */
- if (!info->relocatable
+ if (!bfd_link_relocatable (info)
&& (h->flags & XCOFF_IMPORT) == 0
&& (h->flags & XCOFF_DEF_REGULAR) == 0
&& (h->root.type == bfd_link_hash_undefined
}
/* Garbage collect unused sections. */
- if (info->relocatable || !gc)
+ if (bfd_link_relocatable (info) || !gc)
{
gc = FALSE;
xcoff_hash_table (info)->gc = FALSE;
file_ptr pos;
bfd_size_type amt;
- if (info->shared)
+ if (bfd_link_pic (info))
abfd->flags |= DYNAMIC;
symesz = bfd_coff_symesz (abfd);
+2015-08-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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.
+
2015-08-12 H.J. Lu <hongjiu.lu@intel.com>
Sync with GCC
struct bfd_elf_dynamic_list;
struct bfd_elf_version_tree;
+/* Types of output. */
+
+enum output_type
+{
+ type_executable = 0,
+ type_dll,
+ type_relocatable
+};
+
+#define bfd_link_executable(info) ((info)->type == type_executable)
+#define bfd_link_dll(info) ((info)->type == type_dll)
+#define bfd_link_relocatable(info) ((info)->type == type_relocatable)
+#define bfd_link_pic(info) (info)->pic
+#define bfd_link_pie(info) (bfd_link_executable (info) \
+ && bfd_link_pic (info))
+
/* This structure holds all the information needed to communicate
between BFD and the linker when doing a link. */
struct bfd_link_info
{
- /* TRUE if BFD should generate a shared object (or a pie). */
- unsigned int shared: 1;
-
- /* TRUE if generating an executable, position independent or not. */
- unsigned int executable : 1;
-
- /* TRUE if generating a position independent executable. */
- unsigned int pie: 1;
+ /* Output type. */
+ ENUM_BITFIELD (output_type) type : 2;
- /* TRUE if BFD should generate a relocatable object file. */
- unsigned int relocatable: 1;
+ /* TRUE if BFD should generate a position independent object. */
+ unsigned int pic : 1;
/* TRUE if BFD should pre-bind symbols in a shared object. */
unsigned int symbolic: 1;
+2015-08-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ld/ldctor.c: Replace shared, executable, relocatable and pie
+ fields with bfd_link_executable, bfd_link_dll,
+ bfd_link_relocatable, bfd_link_pic and bfd_link_pie.
+ * ld/ldemul.c: Likewise.
+ * ld/ldfile.c: Likewise.
+ * ld/ldlang.c: Likewise.
+ * ld/ldmain.c: Likewise.
+ * ld/ldwrite.c: Likewise.
+ * ld/lexsup.c: Likewise.
+ * ld/pe-dll.c: Likewise.
+ * ld/plugin.c: Likewise.
+ * ld/emultempl/aarch64elf.em: Likewise.
+ * ld/emultempl/aix.em: Likewise.
+ * ld/emultempl/alphaelf.em: Likewise.
+ * ld/emultempl/armcoff.em: Likewise.
+ * ld/emultempl/armelf.em: Likewise.
+ * ld/emultempl/avrelf.em: Likewise.
+ * ld/emultempl/beos.em: Likewise.
+ * ld/emultempl/cr16elf.em: Likewise.
+ * ld/emultempl/elf-generic.em: Likewise.
+ * ld/emultempl/elf32.em: Likewise.
+ * ld/emultempl/genelf.em: Likewise.
+ * ld/emultempl/generic.em: Likewise.
+ * ld/emultempl/gld960.em: Likewise.
+ * ld/emultempl/gld960c.em: Likewise.
+ * ld/emultempl/hppaelf.em: Likewise.
+ * ld/emultempl/irix.em: Likewise.
+ * ld/emultempl/linux.em: Likewise.
+ * ld/emultempl/lnk960.em: Likewise.
+ * ld/emultempl/m68hc1xelf.em: Likewise.
+ * ld/emultempl/m68kcoff.em: Likewise.
+ * ld/emultempl/m68kelf.em: Likewise.
+ * ld/emultempl/metagelf.em: Likewise.
+ * ld/emultempl/mipself.em: Likewise.
+ * ld/emultempl/mmo.em: Likewise.
+ * ld/emultempl/msp430.em: Likewise.
+ * ld/emultempl/nds32elf.em: Likewise.
+ * ld/emultempl/needrelax.em: Likewise.
+ * ld/emultempl/nios2elf.em: Likewise.
+ * ld/emultempl/pe.em: Likewise.
+ * ld/emultempl/pep.em: Likewise.
+ * ld/emultempl/ppc32elf.em: Likewise.
+ * ld/emultempl/ppc64elf.em: Likewise.
+ * ld/emultempl/sh64elf.em: Likewise.
+ * ld/emultempl/solaris2.em: Likewise.
+ * ld/emultempl/spuelf.em: Likewise.
+ * ld/emultempl/sunos.em: Likewise.
+ * ld/emultempl/tic6xdsbt.em: Likewise.
+ * ld/emultempl/ticoff.em: Likewise.
+ * ld/emultempl/v850elf.em: Likewise.
+ * ld/emultempl/vms.em: Likewise.
+ * ld/emultempl/vxworks.em: Likewise.
+
2015-08-18 Alan Modra <amodra@gmail.com>
* ldexp.c (exp_fold_tree_1): Clear linker_def on symbol assignment.
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf${ELFSIZE}_aarch64_setup_section_lists (link_info.output_bfd,
&link_info);
static void
gld${EMULATION_NAME}_finish (void)
{
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Now build the linker stubs. */
if (stub_file->the_bfd->sections != NULL)
case OPTION_MODTYPE:
if (*optarg == 'S')
{
- link_info.shared = TRUE;
+ link_info.type = type_dll;
+ link_info.pic = TRUE;
++optarg;
}
if (*optarg == '\0' || optarg[1] == '\0')
static void
gld${EMULATION_NAME}_after_open (void)
{
- bfd_boolean r;
+ enum output_type t;
struct set_info *p;
after_open_default ();
entries for all references to symbols, even in a final
executable. Of course, we only want to do this if we are
producing an XCOFF output file. */
- r = link_info.relocatable;
+ t = link_info.type;
if (strstr (bfd_get_target (link_info.output_bfd), "xcoff") != NULL)
- link_info.relocatable = TRUE;
+ link_info.type = type_relocatable;
ldctor_build_sets ();
- link_info.relocatable = r;
+ link_info.type = t;
/* For each set, record the size, so that the XCOFF backend can
output the correct csect length. */
/* Executables and shared objects must always have .text, .data
and .bss output sections, so that the header can refer to them.
The kernel refuses to load objects that have missing sections. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
for (i = 0; i < ARRAY_SIZE (must_keep_sections); i++)
{
asection *sec;
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
alpha_after_parse (void)
{
link_info.relax_pass = 2;
- if (limit_32bit && !link_info.shared && !link_info.relocatable)
+ if (limit_32bit
+ && !bfd_link_pic (&link_info)
+ && !bfd_link_relocatable (&link_info))
lang_section_start (".interp",
exp_binop ('+',
exp_intop (ALPHA_TEXT_START_32BIT),
gld${EMULATION_NAME}_before_allocation ();
/* Add -relax if -O, not -r, and not explicitly disabled. */
- if (link_info.optimize && !link_info.relocatable && ! RELAXATION_DISABLED_BY_USER)
+ if (link_info.optimize
+ && !bfd_link_relocatable (&link_info)
+ && ! RELAXATION_DISABLED_BY_USER)
ENABLE_RELAXATION;
}
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
{
int ret;
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Build a sorted list of input text sections, then use that to process
the unwind table index. */
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf32_arm_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
}
}
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Now build the linker stubs. */
if (stub_file->the_bfd->sections != NULL)
/* If generating a relocatable output file, then
we don't have to generate the trampolines. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
avr_no_stubs = TRUE;
if (avr_no_stubs)
bfd *abfd;
bfd_boolean avr_link_relax;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
avr_link_relax = TRUE;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
if (!init[IMAGEBASEOFF].inited)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
init[IMAGEBASEOFF].value = 0;
else if (init[DLLOFF].value)
init[IMAGEBASEOFF].value = BEOS_DLL_IMAGE_BASE;
}
/* Don't do any symbol assignments if this is a relocatable link. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Glue the assignments into the abs section */
If they're marked as COMDAT sections, we don't want .text\$foo to
end up in .text and then have .text disappear because it's marked
link-once-discard. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return NULL;
/* Everything from the '\$' on gets deleted so don't allow '\$' as the
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
gld${EMULATION_NAME}_after_open ();
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && !bfd_link_relocatable (&link_info))
{
bfd *abfd;
gld${EMULATION_NAME}_before_allocation ();
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && (!bfd_link_relocatable (&link_info)))
{
bfd *abfd;
need_layout = FALSE;
if (link_info.output_bfd->xvec->flavour == bfd_target_elf_flavour
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
{
bfd_size_type phdr_size;
}
}
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
if (link_info.execstack == ! link_info.noexecstack)
/* PR ld/16744: If "-z [no]execstack" has been specified on the
/* Make __ehdr_start hidden if it has been referenced, to
prevent the symbol from being dynamic. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
struct elf_link_hash_entry *h
= elf_link_hash_lookup (elf_hash_table (&link_info), "__ehdr_start",
int iself = s->owner->xvec->flavour == bfd_target_elf_flavour;
unsigned int sh_type = iself ? elf_section_type (s) : SHT_NULL;
- if (! link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& link_info.combreloc
&& (s->flags & SEC_ALLOC))
{
/* If this is a final link, then always put .gnu.warning.SYMBOL
sections into the .text section to get them out of the way. */
- if (link_info.executable
- && ! link_info.relocatable
+ if (bfd_link_executable (&link_info)
&& CONST_STRNEQ (s->name, ".gnu.warning.")
&& hold[orphan_text].os != NULL)
{
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
fi
if test -n "$GENERATE_PIE_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
-echo ' ; else if (link_info.pie && link_info.combreloc' >> e${EMULATION_NAME}.c
-echo ' && link_info.relro' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdw >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.pie && link_info.combreloc) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_pie (&link_info)' >> e${EMULATION_NAME}.c
+echo ' && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xdc >> e${EMULATION_NAME}.c
fi
-echo ' ; else if (link_info.pie) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_pie (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xd >> e${EMULATION_NAME}.c
fi
if test -n "$GENERATE_SHLIB_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
-echo ' ; else if (link_info.shared && link_info.combreloc' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_dll (&link_info) && link_info.combreloc' >> e${EMULATION_NAME}.c
echo ' && link_info.relro' >> e${EMULATION_NAME}.c
echo ' && (link_info.flags & DF_BIND_NOW)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsw >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.shared && link_info.combreloc) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_dll (&link_info) && link_info.combreloc) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xsc >> e${EMULATION_NAME}.c
fi
-echo ' ; else if (link_info.shared) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_dll (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xs >> e${EMULATION_NAME}.c
fi
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
if test -n "$GENERATE_PIE_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
fragment <<EOF
- else if (link_info.pie && link_info.combreloc
- && link_info.relro && (link_info.flags & DF_BIND_NOW))
+ else if (bfd_link_pie (&link_info)
+ && link_info.combreloc
+ && link_info.relro
+ && (link_info.flags & DF_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xdw";
- else if (link_info.pie && link_info.combreloc)
+ else if (bfd_link_pie (&link_info)
+ && link_info.combreloc)
return "ldscripts/${EMULATION_NAME}.xdc";
EOF
fi
fragment <<EOF
- else if (link_info.pie)
+ else if (bfd_link_pie (&link_info))
return "ldscripts/${EMULATION_NAME}.xd";
EOF
fi
if test -n "$GENERATE_SHLIB_SCRIPT" ; then
if test -n "$GENERATE_COMBRELOC_SCRIPT" ; then
fragment <<EOF
- else if (link_info.shared && link_info.combreloc
+ else if (bfd_link_dll (&link_info) && link_info.combreloc
&& link_info.relro && (link_info.flags & DF_BIND_NOW))
return "ldscripts/${EMULATION_NAME}.xsw";
- else if (link_info.shared && link_info.combreloc)
+ else if (bfd_link_dll (&link_info) && link_info.combreloc)
return "ldscripts/${EMULATION_NAME}.xsc";
EOF
fi
fragment <<EOF
- else if (link_info.shared)
+ else if (bfd_link_dll (&link_info))
return "ldscripts/${EMULATION_NAME}.xs";
EOF
fi
after_open_default ();
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
for (ibfd = link_info.input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
if ((syms = bfd_get_outsymbols (ibfd)) != NULL
&& bfd_get_flavour (ibfd) == bfd_target_elf_flavour)
static void
gld${EMULATION_NAME}_before_allocation (void)
{
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
&& !_bfd_elf_size_group_sections (&link_info))
einfo ("%X%P: can not size group sections: %E\n");
before_allocation_default ();
case ${target} in
msp430-*-* )
fragment <<EOF
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
TARGET_ENABLE_RELAXATION;
EOF
;;
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
static void
hppaelf_after_parse (void)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
lang_add_unique (".text");
/* Enable this once we split millicode stuff from libgcc:
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf32_hppa_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
if (need_laying_out != -1)
gld${EMULATION_NAME}_map_segments (need_laying_out);
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Set the global data pointer. */
if (! elf32_hppa_set_gp (link_info.output_bfd, &link_info))
static void
irix_after_open (void)
{
- if (link_info.shared && command_line.soname == 0)
+ if (bfd_link_dll (&link_info) && command_line.soname == 0)
command_line.soname
= (char *) lbasename (bfd_get_filename (link_info.output_bfd));
static void
gld${EMULATION_NAME}_before_allocation (void)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Let the backend work out the sizes of any sections required by
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
static void
lnk960_after_allocation (void)
{
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
symbol_at_end_of (".text", "_etext");
symbol_at_end_of (".data", "_edata");
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
/* If generating a relocatable output file, then we don't
have to generate the trampolines. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
ret = elf32_m68hc11_setup_section_lists (link_info.output_bfd, &link_info);
after_open_default ();
if (! command_line.embedded_relocs
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
return;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
bfd *abfd;
if (! command_line.embedded_relocs
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
return;
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
#ifdef SUPPORT_EMBEDDED_RELOCS
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && (!bfd_link_relocatable (&link_info)))
{
bfd *abfd;
#ifdef SUPPORT_EMBEDDED_RELOCS
if (command_line.embedded_relocs
- && (! link_info.relocatable))
+ && (!bfd_link_relocatable (&link_info)))
{
bfd *abfd;
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = elf_metag_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
if (need_laying_out != -1)
gld${EMULATION_NAME}_map_segments (need_laying_out);
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Now build the linker stubs. */
if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
flagword flags;
flags = elf_elfheader (link_info.output_bfd)->e_flags;
- if (!link_info.shared
+ if (!bfd_link_pic (&link_info)
&& !link_info.nocopyreloc
&& (flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) == EF_MIPS_CPIC)
_bfd_mips_elf_use_plts_and_copy_relocs (&link_info);
/* We have nothing to say for anything other than a final link or
for sections that are excluded. */
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
|| (s->flags & SEC_EXCLUDE) != 0)
return NULL;
/* The MSP430 port *needs* linker relaxtion in order to cope with large
functions where conditional branches do not fit into a +/- 1024 byte range. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
TARGET_ENABLE_RELAXATION;
}
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
if ((s->flags & SEC_ALLOC) == 0)
return NULL;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return NULL;
/* If constraints are involved let the linker handle the placement normally. */
static void
nds32_elf_after_parse (void)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
DISABLE_RELAXATION;
if (!RELAXATION_ENABLED)
else
update_ex9_table = 0;
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
{
target_optimize = target_optimize & (!NDS32_RELAX_JUMP_IFC_ON);
target_optimize = target_optimize & (!NDS32_RELAX_EX9_ON);
/* Check object files if the target is dynamic linked executable
or shared object. */
if (elf_hash_table (&link_info)->dynamic_sections_created
- || link_info.shared || link_info.pie)
+ || bfd_link_pic (&link_info))
{
for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
{
if (!(elf_elfheader (abfd)->e_flags & E_NDS32_HAS_PIC))
{
/* Non-PIC object file is used. */
- if (link_info.shared || link_info.pie)
+ if (bfd_link_pic (&link_info))
{
/* For PIE or shared object, all input must be PIC. */
einfo (_("%B: must use -fpic to compile this file "
gld${EMULATION_NAME}_before_allocation ();
/* Force -relax on if not doing a relocatable link. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
ENABLE_RELAXATION;
}
EOF
/* If --no-relax was not explicitly specified by the user, enable
relaxation. If it's not enabled (either explicitly or by default),
we're done, as we won't need to create any stubs. */
- if (!link_info.relocatable && RELAXATION_DISABLED_BY_DEFAULT)
+ if (!bfd_link_relocatable (&link_info) && RELAXATION_DISABLED_BY_DEFAULT)
ENABLE_RELAXATION;
if (!RELAXATION_ENABLED)
return;
/* If generating a relocatable output file, then we don't
have to examine the relocs. */
- if (stub_file != NULL && !link_info.relocatable && RELAXATION_ENABLED)
+ if (stub_file != NULL
+ && !bfd_link_relocatable (&link_info)
+ && RELAXATION_ENABLED)
{
ret = nios2_elf32_setup_section_lists (link_info.output_bfd, &link_info);
if (ret != 0)
if (need_laying_out != -1)
gld${EMULATION_NAME}_map_segments (need_laying_out);
- if (!link_info.relocatable && RELAXATION_ENABLED)
+ if (!bfd_link_relocatable (&link_info) && RELAXATION_ENABLED)
{
/* Now build the linker stubs. */
if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
/* Entry point name for arbitrary subsystem numbers. */
static const char default_entry[] = "mainCRTStartup";
- if (link_info.shared || dll)
+ if (bfd_link_pic (&link_info) || dll)
{
#if defined (TARGET_IS_i386pe)
entry = "DllMainCRTStartup@12";
if (!init[IMAGEBASEOFF].inited)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
init[IMAGEBASEOFF].value = 0;
- else if (init[DLLOFF].value || (link_info.shared && !link_info.pie))
+ else if (init[DLLOFF].value || bfd_link_dll (&link_info))
{
#ifdef DLL_SUPPORT
init[IMAGEBASEOFF].value = (pe_enable_auto_image_base
}
/* Don't do any symbol assignments if this is a relocatable link. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Glue the assignments into the abs section. */
find it, so enable it in that case. */
if (pe_use_coff_long_section_names < 0 && link_info.strip == strip_none)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
pe_use_coff_long_section_names = 1;
else
{
|| defined (TARGET_IS_armpe) \
|| defined (TARGET_IS_arm_epoc_pe) \
|| defined (TARGET_IS_arm_wince_pe)
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
pe_dll_build_sections (link_info.output_bfd, &link_info);
#else
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
pe_dll_build_sections (link_info.output_bfd, &link_info);
else
pe_exe_build_sections (link_info.output_bfd, &link_info);
/* def_file_print (stdout, pe_def_file); */
if (pe_def_file->is_dll == 1)
- link_info.shared = 1;
+ {
+ link_info.type = type_dll;
+ link_info.pic = 1;
+ }
if (pe_def_file->base_address != (bfd_vma)(-1))
{
finish_default ();
#ifdef DLL_SUPPORT
- if (link_info.shared
+ if (bfd_link_pic (&link_info)
#if !defined(TARGET_IS_shpe)
- || (!link_info.relocatable && pe_def_file->num_exports != 0)
+ || (!bfd_link_relocatable (&link_info)
+ && pe_def_file->num_exports != 0)
#endif
)
{
lang_statement_union_type **pl;
/* Look through the script to see where to place this section. */
- if (!link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& (dollar = strchr (secname, '\$')) != NULL)
{
size_t len = dollar - secname;
address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
os = lang_insert_orphan (s, secname, constraint, after, place, address,
&add_child);
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
os->section_alignment = s->alignment_power;
os->bfd_section->alignment_power = s->alignment_power;
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
/* Entry point name for arbitrary subsystem numbers. */
static const char default_entry[] = "mainCRTStartup";
- if (link_info.shared || dll)
+ if (bfd_link_pic (&link_info) || dll)
{
entry = "DllMainCRTStartup";
}
if (!init[IMAGEBASEOFF].inited)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
init[IMAGEBASEOFF].value = 0;
- else if (init[DLLOFF].value || (link_info.shared && !link_info.pie))
+ else if (init[DLLOFF].value || bfd_link_dll (&link_info))
{
#ifdef DLL_SUPPORT
init[IMAGEBASEOFF].value = (pep_enable_auto_image_base
}
/* Don't do any symbol assignments if this is a relocatable link. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
/* Glue the assignments into the abs section. */
find it, so enable it in that case. */
if (pep_use_coff_long_section_names < 0 && link_info.strip == strip_none)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
pep_use_coff_long_section_names = 1;
else
{
pep_fixup_stdcalls ();
#ifndef TARGET_IS_i386pep
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
#else
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
#endif
pep_dll_build_sections (link_info.output_bfd, &link_info);
/* def_file_print (stdout, pep_def_file); */
if (pep_def_file->is_dll == 1)
- link_info.shared = 1;
+ {
+ link_info.type = type_dll;
+ link_info.pic = 1;
+ }
if (pep_def_file->base_address != (bfd_vma)(-1))
{
finish_default ();
#ifdef DLL_SUPPORT
- if (link_info.shared
- || (!link_info.relocatable && pep_def_file->num_exports != 0))
+ if (bfd_link_pic (&link_info)
+ || (!bfd_link_relocatable (&link_info)
+ && pep_def_file->num_exports != 0))
{
pep_dll_fill_sections (link_info.output_bfd, &link_info);
if (pep_implib_filename)
lang_statement_union_type **pl;
/* Look through the script to see where to place this section. */
- if (!link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& (dollar = strchr (secname, '\$')) != NULL)
{
size_t len = dollar - secname;
address = exp_unop (ALIGN_K, exp_nameop (NAME, "__section_alignment__"));
os = lang_insert_orphan (s, secname, constraint, after, place, address,
&add_child);
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
os->section_alignment = s->alignment_power;
os->bfd_section->alignment_power = s->alignment_power;
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
ppc_after_open_output (void)
{
if (params.emit_stub_syms < 0)
- params.emit_stub_syms = link_info.emitrelocations || link_info.shared;
+ params.emit_stub_syms = (link_info.emitrelocations
+ || bfd_link_pic (&link_info));
if (pagesize == 0)
pagesize = config.commonpagesize;
params.pagesize_p2 = bfd_log2 (pagesize);
ldlang_add_file (stub_file);
params.stub_bfd = stub_file->the_bfd;
if (params.save_restore_funcs < 0)
- params.save_restore_funcs = !link_info.relocatable;
+ params.save_restore_funcs = !bfd_link_relocatable (&link_info);
if (!ppc64_elf_init_stub_bfd (&link_info, ¶ms))
einfo ("%F%P: can not init BFD: %E\n");
}
}
if (!no_toc_opt
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
{
prelim_size_sections ();
add even more stubs. */
gld${EMULATION_NAME}_map_segments (TRUE);
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
need_laying_out = -1;
/* If generating a relocatable output file, then we don't have any
stubs. */
- if (stub_file != NULL && !link_info.relocatable)
+ if (stub_file != NULL && !bfd_link_relocatable (&link_info))
{
ret = ppc64_elf_setup_section_lists (&link_info);
if (ret < 0)
innocuous except for confusing ELF_SECTION_IN_SEGMENT. */
gld${EMULATION_NAME}_map_segments (need_laying_out > 0);
- if (need_laying_out != -1 && !link_info.relocatable)
+ if (need_laying_out != -1 && !bfd_link_relocatable (&link_info))
ppc64_elf_set_toc (&link_info, link_info.output_bfd);
}
if (params.emit_stub_syms < 0)
params.emit_stub_syms = 1;
if (stub_file != NULL
- && !link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& !ppc64_elf_build_stubs (&link_info, config.stats ? &msg : NULL))
einfo ("%X%P: can not build stubs: %E\n");
/* If we emit relocatable contents, we need a
relocation for the start address. */
- if (link_info.relocatable || link_info.emitrelocations)
+ if (bfd_link_relocatable (&link_info)
+ || link_info.emitrelocations)
{
/* FIXME: We could perhaps use lang_add_reloc and
friends here, but I'm not really sure that
const char **sym;
/* Do this for both executables and shared objects. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
for (sym = global_syms; *sym != NULL; sym++)
{
}
/* Only do this if emitting a shared object and versioning is in place. */
- if (link_info.shared
+ if (bfd_link_dll (&link_info)
&& (link_info.version_info != NULL
|| link_info.create_default_symver))
{
const char **sym;
/* Do this for both executables and shared objects. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
for (sym = local_syms; *sym != NULL; sym++)
{
params.emit_stub_syms |= link_info.emitrelocations;
spu_elf_setup (&link_info, ¶ms);
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
lang_add_unique (".text.ia.*");
- if (!link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
&& link_info.input_bfds != NULL
&& !spu_elf_create_sections (&link_info))
einfo ("%X%P: can not create note section: %E\n");
spu_before_allocation (void)
{
if (is_spu_target ()
- && !link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& !no_overlays)
{
int ret;
}
if (is_spu_target ()
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
spu_elf_size_sections (link_info.output_bfd, &link_info);
gld${EMULATION_NAME}_before_allocation ();
after_open_default ();
/* We only need to worry about this when doing a final link. */
- if (link_info.relocatable || link_info.shared)
+ if (bfd_link_relocatable (&link_info) || bfd_link_pic (&link_info))
return;
/* Get the list of files which appear in ld_need entries in dynamic
/* The SunOS native linker creates a shared library whenever there
are any undefined symbols in a link, unless -e is used. This is
pretty weird, but we are compatible. */
- if (! link_info.shared && ! link_info.relocatable && ! entry_from_cmdline)
+ if (! bfd_link_pic (&link_info)
+ && !bfd_link_relocatable (&link_info)
+ && ! entry_from_cmdline)
{
struct bfd_link_hash_entry *h;
lang_for_each_statement (gld${EMULATION_NAME}_find_assignment);
if (! found_assign)
{
- link_info.shared = TRUE;
+ link_info.type = type_dll;
+ link_info.pic = TRUE;
break;
}
}
}
}
- if (link_info.shared)
+ if (bfd_link_pic (&link_info))
{
lang_output_section_statement_type *os;
one. We need to create the symbol before calling
size_dynamic_sections, although we can't set the value until
afterward. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
hdyn = bfd_link_hash_lookup (link_info.hash, "__DYNAMIC", TRUE, FALSE,
FALSE);
/* We must assign a value to __DYNAMIC. It should be zero if we are
not doing a dynamic link, or the start of the .dynamic section if
we are doing one. */
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
hdyn->type = bfd_link_hash_defined;
hdyn->u.def.value = 0;
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return
EOF
sed $sc ldscripts/${EMULATION_NAME}.xu >> e${EMULATION_NAME}.c
-echo ' ; else if (link_info.relocatable) return' >> e${EMULATION_NAME}.c
+echo ' ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xr >> e${EMULATION_NAME}.c
echo ' ; else if (!config.text_read_only) return' >> e${EMULATION_NAME}.c
sed $sc ldscripts/${EMULATION_NAME}.xbn >> e${EMULATION_NAME}.c
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
int layout_changed = 0;
int ret;
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
/* Build a sorted list of input text sections, then use that to process
the unwind table index. */
fragment <<EOF
{
*isfile = 0;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return `sed "$sc" ldscripts/${EMULATION_NAME}.xu`;
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return `sed "$sc" ldscripts/${EMULATION_NAME}.xr`;
else if (!config.text_read_only)
return `sed "$sc" ldscripts/${EMULATION_NAME}.xbn`;
{
*isfile = 1;
- if (link_info.relocatable && config.build_constructors)
+ if (bfd_link_relocatable (&link_info) && config.build_constructors)
return "ldscripts/${EMULATION_NAME}.xu";
- else if (link_info.relocatable)
+ else if (bfd_link_relocatable (&link_info))
return "ldscripts/${EMULATION_NAME}.xr";
else if (!config.text_read_only)
return "ldscripts/${EMULATION_NAME}.xbn";
v850_after_open (void)
{
if (is_v850_target ()
- && ! link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& link_info.input_bfds != NULL
&& ! v850_elf_create_sections (& link_info))
einfo ("%X%P: can not create note section: %E\n");
/* We have nothing to say for anything other than a final link or an excluded
section. */
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
|| (s->flags & (SEC_EXCLUDE | SEC_LOAD)) != SEC_LOAD)
return NULL;
einfo ("%X%P: Cannot create dynamic sections %E\n");
if (!force_dynamic
- && !link_info.shared
+ && !bfd_link_pic (&link_info)
&& bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
&& elf_hash_table (&link_info)->dynamic_sections_created)
einfo ("%X%P: Dynamic sections created in non-dynamic link\n");
howto = bfd_reloc_type_lookup (link_info.output_bfd, p->reloc);
if (howto == NULL)
{
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
einfo (_("%P%X: %s does not support reloc %s for set %s\n"),
bfd_get_target (link_info.output_bfd),
if (! bfd_is_abs_section (e->section))
e->section->flags |= SEC_KEEP;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
lang_add_reloc (p->reloc, howto, e->section, e->name,
exp_intop (e->value));
else
after_parse_default (void)
{
if (entry_symbol.name != NULL
- && (link_info.executable || entry_from_cmdline))
+ && (bfd_link_executable (&link_info) || entry_from_cmdline))
{
bfd_boolean is_vma = FALSE;
void
before_allocation_default (void)
{
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
strip_excluded_output_sections ();
}
void
finish_default (void)
{
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
_bfd_fix_excluded_sec_syms (link_info.output_bfd, &link_info);
}
{
char *string;
- if (entry->flags.dynamic && ! link_info.relocatable)
+ if (entry->flags.dynamic && !bfd_link_relocatable (&link_info))
{
if (ldemul_open_dynamic_archive (arch, search, entry))
return TRUE;
struct unique_sections *unam;
const char *secnam;
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
&& sec->owner != NULL
&& bfd_is_group_section (sec->owner, sec))
return !(os != NULL
push_stat_ptr (&add);
}
- if (link_info.relocatable || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
+ if (bfd_link_relocatable (&link_info)
+ || (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
address = exp_intop (0);
os_tail = ((lang_output_section_statement_type **)
format targets, .text$foo sections go into .text and it's odd
to see .text with SEC_LINK_ONCE set. */
- if (!link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
flags &= ~(SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_RELOC);
switch (output->sectype)
ASSERT (link_info.output_bfd == NULL);
open_output (statement->output_statement.name);
ldemul_set_output_arch ();
- if (config.magic_demand_paged && !link_info.relocatable)
+ if (config.magic_demand_paged
+ && !bfd_link_relocatable (&link_info))
link_info.output_bfd->flags |= D_PAGED;
else
link_info.output_bfd->flags &= ~D_PAGED;
here, in lang_insert_orphan, or in the default linker scripts.
This is covering for coff backend linker bugs. See PR6945. */
if (os->addr_tree == NULL
- && link_info.relocatable
+ && bfd_link_relocatable (&link_info)
&& (bfd_get_flavour (link_info.output_bfd)
== bfd_target_coff_flavour))
os->addr_tree = exp_intop (0);
defined, issue an error message. */
if (!os->ignored
&& !IGNORE_SECTION (os->bfd_section)
- && ! link_info.relocatable
+ && !bfd_link_relocatable (&link_info)
&& check_regions
&& strcmp (os->region->name_list.name,
DEFAULT_MEMORY_REGION) == 0
&& dot >= (r->last_os->output_section_statement
.bfd_section->vma)))
&& os->lma_region == NULL
- && !link_info.relocatable)
+ && !bfd_link_relocatable (&link_info))
r->last_os = s;
/* .tbss sections effectively have zero size. */
if ((os->bfd_section->flags & SEC_HAS_CONTENTS) != 0
|| (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
dotdelta = TO_ADDR (os->bfd_section->size);
else
dotdelta = 0;
/* .tbss sections effectively have zero size. */
if ((os->bfd_section->flags & SEC_HAS_CONTENTS) != 0
|| (os->bfd_section->flags & SEC_THREAD_LOCAL) == 0
- || link_info.relocatable)
+ || bfd_link_relocatable (&link_info))
dot += TO_ADDR (os->bfd_section->size);
if (os->update_dot_tree != NULL)
{
asection *s;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return;
for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
struct bfd_link_hash_entry *h;
bfd_boolean warn;
- if ((link_info.relocatable && !link_info.gc_sections)
- || (link_info.shared && !link_info.executable))
+ if ((bfd_link_relocatable (&link_info) && !link_info.gc_sections)
+ || bfd_link_dll (&link_info))
warn = entry_from_cmdline;
else
warn = TRUE;
/* Force the user to specify a root when generating a relocatable with
--gc-sections. */
- if (link_info.gc_sections && link_info.relocatable
+ if (link_info.gc_sections && bfd_link_relocatable (&link_info)
&& !(entry_from_cmdline || undef_from_cmdline))
einfo (_("%P%F: gc-sections requires either an entry or "
"an undefined symbol\n"));
input format may not have equivalent representations in
the output format (and besides BFD does not translate
relocs for other link purposes than a final link). */
- if ((link_info.relocatable || link_info.emitrelocations)
+ if ((bfd_link_relocatable (&link_info)
+ || link_info.emitrelocations)
&& (compatible == NULL
|| (bfd_get_flavour (input_bfd)
!= bfd_get_flavour (link_info.output_bfd)))
{
if (command_line.inhibit_common_definition)
return;
- if (link_info.relocatable
+ if (bfd_link_relocatable (&link_info)
&& ! command_line.force_common_definition)
return;
/* This is a lonely common section which must have
come from an archive. We attach to the section
with the wildcard. */
- if (! link_info.relocatable
+ if (!bfd_link_relocatable (&link_info)
|| command_line.force_common_definition)
{
if (default_common_section == NULL)
constraint,
TRUE);
if (os->addr_tree == NULL
- && (link_info.relocatable
+ && (bfd_link_relocatable (&link_info)
|| (s->flags & (SEC_LOAD | SEC_ALLOC)) == 0))
os->addr_tree = exp_intop (0);
lang_add_section (&os->children, s, NULL, os);
/* SEC_EXCLUDE is ignored when doing a relocatable link, except in
the special case of debug info. (See bfd/stabs.c)
Twiddle the flag here, to simplify later linker code. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
{
LANG_FOR_EACH_INPUT_STATEMENT (f)
{
/* Find any sections not attached explicitly and handle them. */
lang_place_orphans ();
- if (! link_info.relocatable)
+ if (!bfd_link_relocatable (&link_info))
{
asection *found;
lang_record_phdrs ();
/* Check relro sections. */
- if (link_info.relro && ! link_info.relocatable)
+ if (link_info.relro && !bfd_link_relocatable (&link_info))
lang_find_relro_sections ();
/* Size up the sections. */
/* Print error messages for any missing symbols, for any warning
symbols, and possibly multiple definitions. */
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
link_info.output_bfd->flags &= ~EXEC_P;
else
link_info.output_bfd->flags |= EXEC_P;
/* If the --force-exe-suffix is enabled, and we're making an
executable file and it doesn't end in .exe, copy it to one
which does. */
- if (! link_info.relocatable && command_line.force_exe_suffix)
+ if (!bfd_link_relocatable (&link_info)
+ && command_line.force_exe_suffix)
{
int len = strlen (output_filename);
/* Ensure that BFD_RELOC_CTOR exists now, so that we can give a
useful error message. */
if (bfd_reloc_type_lookup (info->output_bfd, BFD_RELOC_CTOR) == NULL
- && (info->relocatable
+ && (bfd_link_relocatable (info)
|| bfd_reloc_type_lookup (abfd, BFD_RELOC_CTOR) == NULL))
einfo (_("%P%F: BFD backend error: BFD_RELOC_CTOR unsupported\n"));
|| info->strip == strip_some)
thislines = sec->lineno_count;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
thisrelocs = sec->reloc_count;
thissize = sec->size;
}
- else if (info->relocatable
+ else if (bfd_link_relocatable (info)
&& (p->type == bfd_section_reloc_link_order
|| p->type == bfd_symbol_reloc_link_order))
thisrelocs++;
and will seg-fault the next time around. */
einfo(_("%P%F: unrecognised option: %s\n"), argv[optind]);
- link_info.relocatable = TRUE;
+ if (bfd_link_pic (&link_info))
+ einfo (_("%P%F: -r and %s may not be used together\n"),
+ bfd_link_dll (&link_info) ? "-shared" : "-pie");
+
+ link_info.type = type_relocatable;
config.build_constructors = FALSE;
config.magic_demand_paged = FALSE;
config.text_read_only = FALSE;
case OPTION_SHARED:
if (config.has_shared)
{
- link_info.shared = TRUE;
+ if (bfd_link_relocatable (&link_info))
+ einfo (_("%P%F: -r and -shared may not be used together\n"));
+
+ link_info.type = type_dll;
+ link_info.pic = TRUE;
/* When creating a shared library, the default
behaviour is to ignore any unresolved references. */
if (link_info.unresolved_syms_in_objects == RM_NOT_YET_SET)
case OPTION_PIE:
if (config.has_shared)
{
- link_info.shared = TRUE;
- link_info.pie = TRUE;
+ if (bfd_link_relocatable (&link_info))
+ einfo (_("%P%F: -r and -pie may not be used together\n"));
+
+ link_info.type = type_executable;
+ link_info.pic = TRUE;
}
else
einfo (_("%P%F: -pie not supported\n"));
link_info.task_link = TRUE;
/* Fall through - do an implied -r option. */
case OPTION_UR:
- link_info.relocatable = TRUE;
+ if (bfd_link_pic (&link_info))
+ einfo (_("%P%F: -r and %s may not be used together\n"),
+ bfd_link_dll (&link_info) ? "-shared" : "-pie");
+
+ link_info.type = type_relocatable;
config.build_constructors = TRUE;
config.magic_demand_paged = FALSE;
config.text_read_only = FALSE;
/* FIXME: Should we allow emulations a chance to set this ? */
link_info.unresolved_syms_in_shared_libs = how_to_report_unresolved_symbols;
- if (link_info.relocatable)
- {
- if (command_line.check_section_addresses < 0)
- command_line.check_section_addresses = 0;
- if (link_info.shared)
- einfo (_("%P%F: -r and -shared may not be used together\n"));
- }
+ if (bfd_link_relocatable (&link_info)
+ && command_line.check_section_addresses < 0)
+ command_line.check_section_addresses = 0;
/* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
--dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
break;
case symbolic:
/* -Bsymbolic is for shared library only. */
- if (link_info.shared)
+ if (bfd_link_dll (&link_info))
{
link_info.symbolic = TRUE;
/* Should we free the unused memory? */
break;
case symbolic_functions:
/* -Bsymbolic-functions is for shared library only. */
- if (link_info.shared)
+ if (bfd_link_dll (&link_info))
command_line.dynamic_list = dynamic_list_data;
break;
}
break;
}
- if (! link_info.shared)
+ if (!bfd_link_dll (&link_info))
{
if (command_line.filter_shlib)
einfo (_("%P%F: -F may not be used without -shared\n"));
einfo (_("%P%F: -f may not be used without -shared\n"));
}
- if ((! link_info.shared && ! link_info.relocatable) || link_info.pie)
- link_info.executable = TRUE;
-
/* Treat ld -r -s as ld -r -S -x (i.e., strip all local symbols). I
don't see how else this can be handled, since in this case we
must preserve all externally visible symbols. */
- if (link_info.relocatable && link_info.strip == strip_all)
+ if (bfd_link_relocatable (&link_info) && link_info.strip == strip_all)
{
link_info.strip = strip_debugger;
if (link_info.discard == discard_sec_merge)
/* If we are building an executable and there is nothing
to export, we do not build an export table at all. */
- if (info->executable && pe_def_file->num_exports == 0
+ if (bfd_link_executable (info) && pe_def_file->num_exports == 0
&& (!pe_dll_export_everything || pe_dll_exclude_all_symbols))
return;
pe_output_file_set_long_section_names (abfd);
process_def_file_and_drectve (abfd, info);
- if (pe_def_file->num_exports == 0 && !info->shared)
+ if (pe_def_file->num_exports == 0 && !bfd_link_pic (info))
return;
generate_edata (abfd, info);
fill_edata (abfd, info);
- if (info->shared && !info->pie)
+ if (bfd_link_dll (info))
pe_data (abfd)->dll = 1;
edata_s->contents = edata_d;
{
struct bfd_sym_chain *sym;
- if (link_info.relocatable)
+ if (bfd_link_relocatable (&link_info))
return TRUE;
- if (link_info.export_dynamic || !link_info.executable)
+ if (link_info.export_dynamic || bfd_link_dll (&link_info))
{
/* Check if symbol is hidden by version script. */
if (bfd_hide_sym_by_version (link_info.version_info,
TVU(val) = major * 100 + minor;
break;
case LDPT_LINKER_OUTPUT:
- TVU(val) = (link_info.relocatable
+ TVU(val) = (bfd_link_relocatable (&link_info)
? LDPO_REL
- : (link_info.executable
- ? (link_info.pie ? LDPO_PIE : LDPO_EXEC)
+ : (bfd_link_executable (&link_info)
+ ? (bfd_link_pic (&link_info) ? LDPO_PIE : LDPO_EXEC)
: LDPO_DYN));
break;
case LDPT_OUTPUT_NAME: