/* IA-64 support for OpenVMS
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1998-2016 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
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
return entry1->id == entry2->id && entry1->r_sym == entry2->r_sym;
}
-/* Create the derived linker hash table. The IA-64 ELF port uses this
- derived hash table to keep information specific to the IA-64 ElF
- linker (without using static variables). */
-
-static struct bfd_link_hash_table *
-elf64_ia64_hash_table_create (bfd *abfd)
-{
- struct elf64_ia64_link_hash_table *ret;
-
- ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret));
- if (!ret)
- return NULL;
-
- if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
- elf64_ia64_new_elf_hash_entry,
- sizeof (struct elf64_ia64_link_hash_entry),
- IA64_ELF_DATA))
- {
- free (ret);
- return NULL;
- }
-
- ret->loc_hash_table = htab_try_create (1024, elf64_ia64_local_htab_hash,
- elf64_ia64_local_htab_eq, NULL);
- ret->loc_hash_memory = objalloc_create ();
- if (!ret->loc_hash_table || !ret->loc_hash_memory)
- {
- free (ret);
- return NULL;
- }
-
- return &ret->root.root;
-}
-
/* Free the global elf64_ia64_dyn_sym_info array. */
static bfd_boolean
/* Destroy IA-64 linker hash table. */
static void
-elf64_ia64_hash_table_free (struct bfd_link_hash_table *hash)
+elf64_ia64_link_hash_table_free (bfd *obfd)
{
struct elf64_ia64_link_hash_table *ia64_info
- = (struct elf64_ia64_link_hash_table *) hash;
+ = (struct elf64_ia64_link_hash_table *) obfd->link.hash;
if (ia64_info->loc_hash_table)
{
htab_traverse (ia64_info->loc_hash_table,
objalloc_free ((struct objalloc *) ia64_info->loc_hash_memory);
elf_link_hash_traverse (&ia64_info->root,
elf64_ia64_global_dyn_info_free, NULL);
- _bfd_elf_link_hash_table_free (hash);
+ _bfd_elf_link_hash_table_free (obfd);
+}
+
+/* Create the derived linker hash table. The IA-64 ELF port uses this
+ derived hash table to keep information specific to the IA-64 ElF
+ linker (without using static variables). */
+
+static struct bfd_link_hash_table *
+elf64_ia64_hash_table_create (bfd *abfd)
+{
+ struct elf64_ia64_link_hash_table *ret;
+
+ ret = bfd_zmalloc ((bfd_size_type) sizeof (*ret));
+ if (!ret)
+ return NULL;
+
+ if (!_bfd_elf_link_hash_table_init (&ret->root, abfd,
+ elf64_ia64_new_elf_hash_entry,
+ sizeof (struct elf64_ia64_link_hash_entry),
+ IA64_ELF_DATA))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ ret->loc_hash_table = htab_try_create (1024, elf64_ia64_local_htab_hash,
+ elf64_ia64_local_htab_eq, NULL);
+ ret->loc_hash_memory = objalloc_create ();
+ if (!ret->loc_hash_table || !ret->loc_hash_memory)
+ {
+ elf64_ia64_link_hash_table_free (abfd);
+ return NULL;
+ }
+ ret->root.root.hash_table_free = elf64_ia64_link_hash_table_free;
+
+ return &ret->root.root;
}
/* Traverse both local and global hash tables. */
| 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:
return FALSE;
/* Add entries for shared libraries. */
- for (abfd = info->input_bfds; abfd; abfd = abfd->link_next)
+ for (abfd = info->input_bfds; abfd; abfd = abfd->link.next)
{
char *soname;
size_t soname_len;
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)
/* Stuff for the BFD linker: */
#define bfd_elf64_bfd_link_hash_table_create \
elf64_ia64_hash_table_create
-#define bfd_elf64_bfd_link_hash_table_free \
- elf64_ia64_hash_table_free
#define elf_backend_create_dynamic_sections \
elf64_ia64_create_dynamic_sections
#define elf_backend_check_relocs \
/* VMS-specific vectors. */
#undef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM bfd_elf64_ia64_vms_vec
+#define TARGET_LITTLE_SYM ia64_elf64_vms_vec
#undef TARGET_LITTLE_NAME
#define TARGET_LITTLE_NAME "elf64-ia64-vms"
#undef TARGET_BIG_SYM