aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ia64-vms.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-08-18 05:51:03 -0700
committerH.J. Lu <hjl.tools@gmail.com>2015-08-18 05:51:19 -0700
commit0e1862bb401f47716446aef143b2bf7a4563f541 (patch)
tree8410cdece79e8df2f1394b53d1e992736323baac /bfd/elf64-ia64-vms.c
parentb2a33439909493f5bf93ada871bd588f365d61f4 (diff)
downloadgdb-0e1862bb401f47716446aef143b2bf7a4563f541.zip
gdb-0e1862bb401f47716446aef143b2bf7a4563f541.tar.gz
gdb-0e1862bb401f47716446aef143b2bf7a4563f541.tar.bz2
Add output_type to bfd_link_info
The "shared" field in bfd_link_info is set for both DSO and and PIE. There are separate fields for executable and relocatable outputs. This patch adds an "output_type" field: enum output_type { type_unknown = 0, type_executable, type_dll, type_relocatable }; and a "pic" field to bfd_link_info to replace shared, executable and relocatable fields so that we can use the "output_type" field to check for output type and the "pic" field check if output is PIC. Macros, bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie, are provided to check for output features. bfd/ * bfd/aoutx.h: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * bfd/bout.c: Likewise. * bfd/coff-alpha.c: Likewise. * bfd/coff-arm.c: Likewise. * bfd/coff-i386.c: Likewise. * bfd/coff-i960.c: Likewise. * bfd/coff-m68k.c: Likewise. * bfd/coff-mcore.c: Likewise. * bfd/coff-mips.c: Likewise. * bfd/coff-ppc.c: Likewise. * bfd/coff-rs6000.c: Likewise. * bfd/coff-sh.c: Likewise. * bfd/coff-tic80.c: Likewise. * bfd/coff-x86_64.c: Likewise. * bfd/coff64-rs6000.c: Likewise. * bfd/coffgen.c: Likewise. * bfd/cofflink.c: Likewise. * bfd/ecoff.c: Likewise. * bfd/ecofflink.c: Likewise. * bfd/elf-bfd.h: Likewise. * bfd/elf-eh-frame.c: Likewise. * bfd/elf-ifunc.c: Likewise. * bfd/elf-m10200.c: Likewise. * bfd/elf-m10300.c: Likewise. * bfd/elf-s390-common.c: Likewise. * bfd/elf-vxworks.c: Likewise. * bfd/elf.c: Likewise. * bfd/elf32-arm.c: Likewise. * bfd/elf32-avr.c: Likewise. * bfd/elf32-bfin.c: Likewise. * bfd/elf32-cr16.c: Likewise. * bfd/elf32-cr16c.c: Likewise. * bfd/elf32-cris.c: Likewise. * bfd/elf32-crx.c: Likewise. * bfd/elf32-d10v.c: Likewise. * bfd/elf32-dlx.c: Likewise. * bfd/elf32-epiphany.c: Likewise. * bfd/elf32-fr30.c: Likewise. * bfd/elf32-frv.c: Likewise. * bfd/elf32-ft32.c: Likewise. * bfd/elf32-h8300.c: Likewise. * bfd/elf32-hppa.c: Likewise. * bfd/elf32-i370.c: Likewise. * bfd/elf32-i386.c: Likewise. * bfd/elf32-i860.c: Likewise. * bfd/elf32-ip2k.c: Likewise. * bfd/elf32-iq2000.c: Likewise. * bfd/elf32-lm32.c: Likewise. * bfd/elf32-m32c.c: Likewise. * bfd/elf32-m32r.c: Likewise. * bfd/elf32-m68hc11.c: Likewise. * bfd/elf32-m68hc1x.c: Likewise. * bfd/elf32-m68k.c: Likewise. * bfd/elf32-mcore.c: Likewise. * bfd/elf32-mep.c: Likewise. * bfd/elf32-metag.c: Likewise. * bfd/elf32-microblaze.c: Likewise. * bfd/elf32-moxie.c: Likewise. * bfd/elf32-msp430.c: Likewise. * bfd/elf32-mt.c: Likewise. * bfd/elf32-nds32.c: Likewise. * bfd/elf32-nios2.c: Likewise. * bfd/elf32-or1k.c: Likewise. * bfd/elf32-ppc.c: Likewise. * bfd/elf32-rl78.c: Likewise. * bfd/elf32-rx.c: Likewise. * bfd/elf32-s390.c: Likewise. * bfd/elf32-score.c: Likewise. * bfd/elf32-score7.c: Likewise. * bfd/elf32-sh-symbian.c: Likewise. * bfd/elf32-sh.c: Likewise. * bfd/elf32-sh64.c: Likewise. * bfd/elf32-spu.c: Likewise. * bfd/elf32-tic6x.c: Likewise. * bfd/elf32-tilepro.c: Likewise. * bfd/elf32-v850.c: Likewise. * bfd/elf32-vax.c: Likewise. * bfd/elf32-visium.c: Likewise. * bfd/elf32-xc16x.c: Likewise. * bfd/elf32-xstormy16.c: Likewise. * bfd/elf32-xtensa.c: Likewise. * bfd/elf64-alpha.c: Likewise. * bfd/elf64-hppa.c: Likewise. * bfd/elf64-ia64-vms.c: Likewise. * bfd/elf64-mmix.c: Likewise. * bfd/elf64-ppc.c: Likewise. * bfd/elf64-s390.c: Likewise. * bfd/elf64-sh64.c: Likewise. * bfd/elf64-x86-64.c: Likewise. * bfd/elflink.c: Likewise. * bfd/elfnn-aarch64.c: Likewise. * bfd/elfnn-ia64.c: Likewise. * bfd/elfxx-mips.c: Likewise. * bfd/elfxx-sparc.c: Likewise. * bfd/elfxx-tilegx.c: Likewise. * bfd/i386linux.c: Likewise. * bfd/linker.c: Likewise. * bfd/m68klinux.c: Likewise. * bfd/pdp11.c: Likewise. * bfd/pe-mips.c: Likewise. * bfd/peXXigen.c: Likewise. * bfd/reloc.c: Likewise. * bfd/reloc16.c: Likewise. * bfd/sparclinux.c: Likewise. * bfd/sunos.c: Likewise. * bfd/vms-alpha.c: Likewise. * bfd/xcofflink.c: Likewise. include/ * include/bfdlink.h (output_type): New enum. (bfd_link_executable): New macro. (bfd_link_dll): Likewise. (bfd_link_relocatable): Likewise. (bfd_link_pic): Likewise. (bfd_link_pie): Likewise. (bfd_link_info): Remove shared, executable, pie and relocatable. Add output_type and pic. ld/ * ld/ldctor.c: Replace shared, executable, relocatable and pie fields with bfd_link_executable, bfd_link_dll, bfd_link_relocatable, bfd_link_pic and bfd_link_pie. * ld/ldemul.c: Likewise. * ld/ldfile.c: Likewise. * ld/ldlang.c: Likewise. * ld/ldmain.c: Likewise. * ld/ldwrite.c: Likewise. * ld/lexsup.c: Likewise. * ld/pe-dll.c: Likewise. * ld/plugin.c: Likewise. * ld/emultempl/aarch64elf.em: Likewise. * ld/emultempl/aix.em: Likewise. * ld/emultempl/alphaelf.em: Likewise. * ld/emultempl/armcoff.em: Likewise. * ld/emultempl/armelf.em: Likewise. * ld/emultempl/avrelf.em: Likewise. * ld/emultempl/beos.em: Likewise. * ld/emultempl/cr16elf.em: Likewise. * ld/emultempl/elf-generic.em: Likewise. * ld/emultempl/elf32.em: Likewise. * ld/emultempl/genelf.em: Likewise. * ld/emultempl/generic.em: Likewise. * ld/emultempl/gld960.em: Likewise. * ld/emultempl/gld960c.em: Likewise. * ld/emultempl/hppaelf.em: Likewise. * ld/emultempl/irix.em: Likewise. * ld/emultempl/linux.em: Likewise. * ld/emultempl/lnk960.em: Likewise. * ld/emultempl/m68hc1xelf.em: Likewise. * ld/emultempl/m68kcoff.em: Likewise. * ld/emultempl/m68kelf.em: Likewise. * ld/emultempl/metagelf.em: Likewise. * ld/emultempl/mipself.em: Likewise. * ld/emultempl/mmo.em: Likewise. * ld/emultempl/msp430.em: Likewise. * ld/emultempl/nds32elf.em: Likewise. * ld/emultempl/needrelax.em: Likewise. * ld/emultempl/nios2elf.em: Likewise. * ld/emultempl/pe.em: Likewise. * ld/emultempl/pep.em: Likewise. * ld/emultempl/ppc32elf.em: Likewise. * ld/emultempl/ppc64elf.em: Likewise. * ld/emultempl/sh64elf.em: Likewise. * ld/emultempl/solaris2.em: Likewise. * ld/emultempl/spuelf.em: Likewise. * ld/emultempl/sunos.em: Likewise. * ld/emultempl/tic6xdsbt.em: Likewise. * ld/emultempl/ticoff.em: Likewise. * ld/emultempl/v850elf.em: Likewise. * ld/emultempl/vms.em: Likewise. * ld/emultempl/vxworks.em: Likewise.
Diffstat (limited to 'bfd/elf64-ia64-vms.c')
-rw-r--r--bfd/elf64-ia64-vms.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index b1b9f46..4dc5363 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -348,7 +348,7 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
one pass. */
*again = FALSE;
- if (link_info->relocatable)
+ if (bfd_link_relocatable (link_info))
(*link_info->callbacks->einfo)
(_("%P%F: --relax and -r may not be used together\n"));
@@ -858,7 +858,7 @@ elf64_ia64_add_symbol_hook (bfd *abfd,
bfd_vma *valp)
{
if (sym->st_shndx == SHN_COMMON
- && !info->relocatable
+ && !bfd_link_relocatable (info)
&& sym->st_size <= elf_gp_size (abfd))
{
/* Common symbols less than or equal to -G nn bytes are
@@ -1757,7 +1757,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
| SEC_LOAD
| SEC_HAS_CONTENTS
| SEC_IN_MEMORY
- | (info->pie ? 0
+ | (bfd_link_pie (info) ? 0
: SEC_READONLY)
| SEC_LINKER_CREATED));
if (!fptr
@@ -1769,7 +1769,7 @@ get_fptr (bfd *abfd, struct bfd_link_info *info,
ia64_info->fptr_sec = fptr;
- if (info->pie)
+ if (bfd_link_pie (info))
{
asection *fptr_rel;
fptr_rel = bfd_make_section_anyway_with_flags (dynobj, ".rela.opd",
@@ -1922,7 +1922,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
unsigned long r_symndx;
bfd_boolean maybe_dynamic;
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
return TRUE;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
@@ -1955,7 +1955,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
locally or externally defined, as not all of the input files
have yet been processed. Do something with what we know, as
this may help reduce memory usage and processing time later. */
- maybe_dynamic = (h && ((!info->executable
+ maybe_dynamic = (h && ((!bfd_link_executable (info)
&& (!SYMBOLIC_BIND (info, h)
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|| !h->def_regular
@@ -1996,7 +1996,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_IA64_FPTR32LSB:
case R_IA64_FPTR64MSB:
case R_IA64_FPTR64LSB:
- if (info->shared || h)
+ if (bfd_link_pic (info) || h)
need_entry = NEED_FPTR | NEED_DYNREL;
else
need_entry = NEED_FPTR;
@@ -2047,7 +2047,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Shared objects will always need at least a REL relocation. */
- if (info->shared || maybe_dynamic)
+ if (bfd_link_pic (info) || maybe_dynamic)
need_entry = NEED_DYNREL;
break;
@@ -2107,7 +2107,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
locally or externally defined, as not all of the input files
have yet been processed. Do something with what we know, as
this may help reduce memory usage and processing time later. */
- maybe_dynamic = (h && ((!info->executable
+ maybe_dynamic = (h && ((!bfd_link_executable (info)
&& (!SYMBOLIC_BIND (info, h)
|| info->unresolved_syms_in_shared_libs == RM_IGNORE))
|| !h->def_regular
@@ -2144,7 +2144,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_IA64_FPTR32LSB:
case R_IA64_FPTR64MSB:
case R_IA64_FPTR64LSB:
- if (info->shared || h)
+ if (bfd_link_pic (info) || h)
need_entry = NEED_FPTR | NEED_DYNREL;
else
need_entry = NEED_FPTR;
@@ -2190,7 +2190,7 @@ elf64_ia64_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Shared objects will always need at least a REL relocation. */
- if (info->shared || maybe_dynamic)
+ if (bfd_link_pic (info) || maybe_dynamic)
need_entry = NEED_DYNREL;
dynrel_type = R_IA64_DIR64LSB;
break;
@@ -2460,7 +2460,7 @@ allocate_dynrel_entries (struct elf64_ia64_dyn_sym_info *dyn_i,
/* Note that this can't be used in relation to FPTR relocs below. */
dynamic_symbol = elf64_ia64_dynamic_symbol_p (dyn_i->h);
- shared = x->info->shared;
+ shared = bfd_link_pic (x->info);
resolved_zero = (dyn_i->h
&& ELF_ST_VISIBILITY (dyn_i->h->other)
&& dyn_i->h->root.type == bfd_link_hash_undefweak);
@@ -2519,7 +2519,7 @@ allocate_dynrel_entries (struct elf64_ia64_dyn_sym_info *dyn_i,
will be true only if we're actually allocating one statically
in the main executable. Position independent executables
need a relative reloc. */
- if (dyn_i->want_fptr && !x->info->pie)
+ if (dyn_i->want_fptr && !bfd_link_pie (x->info))
continue;
break;
case R_IA64_PCREL32LSB:
@@ -2999,13 +2999,13 @@ set_got_entry (bfd *abfd, struct bfd_link_info *info,
bfd_put_64 (abfd, value, got_sec->contents + got_offset);
/* Install a dynamic relocation if needed. */
- if (((info->shared
+ if (((bfd_link_pic (info)
&& (!dyn_i->h
|| ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
|| elf64_ia64_dynamic_symbol_p (dyn_i->h))
&& (!dyn_i->want_ltoff_fptr
- || !info->pie
+ || !bfd_link_pie (info)
|| !dyn_i->h
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
{
@@ -3109,7 +3109,7 @@ set_pltoff_entry (bfd *abfd, struct bfd_link_info *info,
/* Install dynamic relocations if needed. */
if (!is_plt
- && info->shared
+ && bfd_link_pic (info)
&& (!dyn_i->h
|| ELF_ST_VISIBILITY (dyn_i->h->other) == STV_DEFAULT
|| dyn_i->h->root.type != bfd_link_hash_undefweak))
@@ -3309,7 +3309,7 @@ elf64_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
return FALSE;
/* Make sure we've got ourselves a nice fat __gp value. */
- if (!info->relocatable)
+ if (!bfd_link_relocatable (info))
{
bfd_vma gp_val;
struct elf_link_hash_entry *gp;
@@ -3335,7 +3335,7 @@ elf64_ia64_final_link (bfd *abfd, struct bfd_link_info *info)
of the .IA_64.unwind section. Force this section to be relocated
into memory rather than written immediately to the output file. */
unwind_output_sec = NULL;
- if (!info->relocatable)
+ if (!bfd_link_relocatable (info))
{
asection *s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_unwind);
if (s)
@@ -3392,7 +3392,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
return FALSE;
/* Infect various flags from the input section to the output section. */
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
{
bfd_vma flags;
@@ -3448,7 +3448,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
sym_sec = local_sections[r_symndx];
msec = sym_sec;
value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
- if (!info->relocatable
+ if (!bfd_link_relocatable (info)
&& (sym_sec->flags & SEC_MERGE) != 0
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
&& sym_sec->sec_info_type == SEC_INFO_TYPE_MERGE)
@@ -3516,7 +3516,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
rel, 1, relend, howto, 0, contents);
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
continue;
hit_addr = contents + rel->r_offset;
@@ -3537,7 +3537,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
case R_IA64_DIR64MSB:
case R_IA64_DIR64LSB:
/* Install a dynamic relocation for this reloc. */
- if ((dynamic_symbol_p || info->shared)
+ if ((dynamic_symbol_p || bfd_link_pic (info))
&& r_symndx != 0
&& (input_section->flags & SEC_ALLOC) != 0)
{
@@ -3657,7 +3657,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
if (!undef_weak_ref)
value = set_fptr_entry (output_bfd, info, dyn_i, value);
}
- if (!dyn_i->want_fptr || info->pie)
+ if (!dyn_i->want_fptr || bfd_link_pie (info))
{
/* Otherwise, we expect the dynamic linker to create
the entry. */
@@ -3838,7 +3838,7 @@ elf64_ia64_relocate_section (bfd *output_bfd,
case R_IA64_IPLTMSB:
case R_IA64_IPLTLSB:
/* Install a dynamic relocation for this reloc. */
- if ((dynamic_symbol_p || info->shared)
+ if ((dynamic_symbol_p || bfd_link_pic (info))
&& (input_section->flags & SEC_ALLOC) != 0)
{
/* VMS: FIXFD ?? */
@@ -4740,11 +4740,11 @@ elf64_vms_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
/* You can't use -r against a dynamic object. Also, there's no
hope of using a dynamic object which does not exactly match
the format of the output file. */
- if (info->relocatable
+ if (bfd_link_relocatable (info)
|| !is_elf_hash_table (htab)
|| info->output_bfd->xvec != abfd->xvec)
{
- if (info->relocatable)
+ if (bfd_link_relocatable (info))
bfd_set_error (bfd_error_invalid_operation);
else
bfd_set_error (bfd_error_wrong_format);
@@ -4759,7 +4759,7 @@ elf64_vms_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
so we attach them to this BFD, provided it is the right
format. FIXME: If there are no input BFD's of the same
format as the output, we can't make a shared library. */
- if (info->shared
+ if (bfd_link_pic (info)
&& is_elf_hash_table (htab)
&& info->output_bfd->xvec == abfd->xvec
&& !htab->dynamic_sections_created)