/* IA-64 support for 64-bit ELF
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1998-2015 Free Software Foundation, Inc.
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
#define LOG_SECTION_ALIGN 2
#endif
-/* Only add code for vms when the vms target is enabled. This is required
- because it depends on vms-lib.c for its archive format and we don't want
- to compile that code if it is not used. */
-#if ARCH_SIZE == 64 && \
- (defined (HAVE_bfd_elf64_ia64_vms_vec) || defined (HAVE_all_vecs))
-#define INCLUDE_IA64_VMS
-#endif
-
typedef struct bfd_hash_entry *(*new_hash_entry_func)
(struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
(bfd *abfd, struct bfd_link_info *info, bfd_boolean final);
static void elfNN_ia64_dyn_sym_traverse
(struct elfNN_ia64_link_hash_table *ia64_info,
- bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
- PTR info);
+ bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, void *),
+ void * info);
static bfd_boolean allocate_global_data_got
- (struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data);
+ (struct elfNN_ia64_dyn_sym_info *dyn_i, void * data);
static bfd_boolean allocate_global_fptr_got
- (struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data);
+ (struct elfNN_ia64_dyn_sym_info *dyn_i, void * data);
static bfd_boolean allocate_local_got
- (struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data);
+ (struct elfNN_ia64_dyn_sym_info *dyn_i, void * data);
static bfd_boolean elfNN_ia64_hpux_vec
(const bfd_target *vec);
static bfd_boolean allocate_dynrel_entries
- (struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data);
+ (struct elfNN_ia64_dyn_sym_info *dyn_i, void * data);
static asection *get_pltoff
(bfd *abfd, struct bfd_link_info *info,
struct elfNN_ia64_link_hash_table *ia64_info);
symtype = h->type;
}
- if (tsec->sec_info_type == ELF_INFO_TYPE_MERGE)
+ if (tsec->sec_info_type == SEC_INFO_TYPE_MERGE)
{
/* At this stage in linking, no SEC_MERGE symbol has been
adjusted, so all references to such symbols need to be
.plt section. After the first relaxation pass, linker may
increase the gap between the .plt and .text sections up
to 32byte. We assume linker will always insert 32byte
- between the .plt and .text sections after the the first
+ between the .plt and .text sections after the first
relaxation pass. */
if (tsec == ia64_info->root.splt)
offset = -0x1000000 + 32;
s = bfd_get_section_by_name (abfd, ELF_STRING_ia64_archext);
if (s && (s->flags & SEC_LOAD))
{
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
if (m->p_type == PT_IA_64_ARCHEXT)
break;
if (m == NULL)
m->sections[0] = s;
/* We want to put it after the PHDR and INTERP segments. */
- pm = &elf_tdata (abfd)->segment_map;
+ pm = &elf_seg_map (abfd);
while (*pm != NULL
&& ((*pm)->p_type == PT_PHDR
|| (*pm)->p_type == PT_INTERP))
if (s && (s->flags & SEC_LOAD))
{
- for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
+ for (m = elf_seg_map (abfd); m != NULL; m = m->next)
if (m->p_type == PT_IA_64_UNWIND)
{
int i;
m->next = NULL;
/* We want to put it last. */
- pm = &elf_tdata (abfd)->segment_map;
+ pm = &elf_seg_map (abfd);
while (*pm != NULL)
pm = &(*pm)->next;
*pm = m;
struct elf_segment_map *m;
Elf_Internal_Phdr *p;
- for (p = tdata->phdr, m = tdata->segment_map; m != NULL; m = m->next, p++)
+ for (p = tdata->phdr, m = elf_seg_map (abfd); m != NULL; m = m->next, p++)
if (m->p_type == PT_LOAD)
{
int i;
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 *
-elfNN_ia64_hash_table_create (bfd *abfd)
-{
- struct elfNN_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,
- elfNN_ia64_new_elf_hash_entry,
- sizeof (struct elfNN_ia64_link_hash_entry),
- IA64_ELF_DATA))
- {
- free (ret);
- return NULL;
- }
-
- ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash,
- elfNN_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 elfNN_ia64_dyn_sym_info array. */
static bfd_boolean
elfNN_ia64_global_dyn_info_free (void **xentry,
- PTR unused ATTRIBUTE_UNUSED)
+ void * unused ATTRIBUTE_UNUSED)
{
struct elfNN_ia64_link_hash_entry *entry
= (struct elfNN_ia64_link_hash_entry *) xentry;
- if (entry->root.root.type == bfd_link_hash_warning)
- entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
-
if (entry->info)
{
free (entry->info);
static bfd_boolean
elfNN_ia64_local_dyn_info_free (void **slot,
- PTR unused ATTRIBUTE_UNUSED)
+ void * unused ATTRIBUTE_UNUSED)
{
struct elfNN_ia64_local_hash_entry *entry
= (struct elfNN_ia64_local_hash_entry *) *slot;
/* Destroy IA-64 linker hash table. */
static void
-elfNN_ia64_hash_table_free (struct bfd_link_hash_table *hash)
+elfNN_ia64_link_hash_table_free (bfd *obfd)
{
struct elfNN_ia64_link_hash_table *ia64_info
- = (struct elfNN_ia64_link_hash_table *) hash;
+ = (struct elfNN_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,
elfNN_ia64_global_dyn_info_free, NULL);
- _bfd_generic_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 *
+elfNN_ia64_hash_table_create (bfd *abfd)
+{
+ struct elfNN_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,
+ elfNN_ia64_new_elf_hash_entry,
+ sizeof (struct elfNN_ia64_link_hash_entry),
+ IA64_ELF_DATA))
+ {
+ free (ret);
+ return NULL;
+ }
+
+ ret->loc_hash_table = htab_try_create (1024, elfNN_ia64_local_htab_hash,
+ elfNN_ia64_local_htab_eq, NULL);
+ ret->loc_hash_memory = objalloc_create ();
+ if (!ret->loc_hash_table || !ret->loc_hash_memory)
+ {
+ elfNN_ia64_link_hash_table_free (abfd);
+ return NULL;
+ }
+ ret->root.root.hash_table_free = elfNN_ia64_link_hash_table_free;
+
+ return &ret->root.root;
}
/* Traverse both local and global hash tables. */
struct elfNN_ia64_dyn_sym_traverse_data
{
- bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR);
- PTR data;
+ bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, void *);
+ void * data;
};
static bfd_boolean
elfNN_ia64_global_dyn_sym_thunk (struct bfd_hash_entry *xentry,
- PTR xdata)
+ void * xdata)
{
struct elfNN_ia64_link_hash_entry *entry
= (struct elfNN_ia64_link_hash_entry *) xentry;
struct elfNN_ia64_dyn_sym_info *dyn_i;
unsigned int count;
- if (entry->root.root.type == bfd_link_hash_warning)
- entry = (struct elfNN_ia64_link_hash_entry *) entry->root.root.u.i.link;
-
for (count = entry->count, dyn_i = entry->info;
count != 0;
count--, dyn_i++)
}
static bfd_boolean
-elfNN_ia64_local_dyn_sym_thunk (void **slot, PTR xdata)
+elfNN_ia64_local_dyn_sym_thunk (void **slot, void * xdata)
{
struct elfNN_ia64_local_hash_entry *entry
= (struct elfNN_ia64_local_hash_entry *) *slot;
static void
elfNN_ia64_dyn_sym_traverse (struct elfNN_ia64_link_hash_table *ia64_info,
- bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, PTR),
- PTR data)
+ bfd_boolean (*func) (struct elfNN_ia64_dyn_sym_info *, void *),
+ void * data)
{
struct elfNN_ia64_dyn_sym_traverse_data xdata;
bfd_set_section_flags (abfd, ia64_info->root.sgot,
SEC_SMALL_DATA | flags);
/* The .got section is always aligned at 8 bytes. */
- bfd_set_section_alignment (abfd, ia64_info->root.sgot, 3);
+ if (! bfd_set_section_alignment (abfd, ia64_info->root.sgot, 3))
+ return FALSE;
}
if (!get_pltoff (abfd, info, ia64_info))
return FALSE;
- s = bfd_make_section_with_flags (abfd, ".rela.IA_64.pltoff",
- (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY));
+ s = bfd_make_section_anyway_with_flags (abfd, ".rela.IA_64.pltoff",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
if (s == NULL
|| !bfd_set_section_alignment (abfd, s, LOG_SECTION_ALIGN))
return FALSE;
if (!dynobj)
ia64_info->root.dynobj = dynobj = abfd;
if (!_bfd_elf_create_got_section (dynobj, info))
- return 0;
+ return NULL;
got = ia64_info->root.sgot;
/* The .got section is always aligned at 8 bytes. */
if (!bfd_set_section_alignment (abfd, got, 3))
- return 0;
+ return NULL;
flags = bfd_get_section_flags (abfd, got);
- bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags);
+ if (! bfd_set_section_flags (abfd, got, SEC_SMALL_DATA | flags))
+ return NULL;
}
return got;
if (!dynobj)
ia64_info->root.dynobj = dynobj = abfd;
- fptr = bfd_make_section_with_flags (dynobj, ".opd",
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | (info->pie ? 0 : SEC_READONLY)
- | SEC_LINKER_CREATED));
+ fptr = bfd_make_section_anyway_with_flags (dynobj, ".opd",
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | (info->pie ? 0
+ : SEC_READONLY)
+ | SEC_LINKER_CREATED));
if (!fptr
|| !bfd_set_section_alignment (abfd, fptr, 4))
{
if (info->pie)
{
asection *fptr_rel;
- fptr_rel = bfd_make_section_with_flags (dynobj, ".rela.opd",
- (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY));
+ fptr_rel = bfd_make_section_anyway_with_flags (dynobj, ".rela.opd",
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
if (fptr_rel == NULL
|| !bfd_set_section_alignment (abfd, fptr_rel,
LOG_SECTION_ALIGN))
if (!dynobj)
ia64_info->root.dynobj = dynobj = abfd;
- pltoff = bfd_make_section_with_flags (dynobj,
- ELF_STRING_ia64_pltoff,
- (SEC_ALLOC
- | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_SMALL_DATA
- | SEC_LINKER_CREATED));
+ pltoff = bfd_make_section_anyway_with_flags (dynobj,
+ ELF_STRING_ia64_pltoff,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_SMALL_DATA
+ | SEC_LINKER_CREATED));
if (!pltoff
|| !bfd_set_section_alignment (abfd, pltoff, 4))
{
if (!dynobj)
ia64_info->root.dynobj = dynobj = abfd;
- srel = bfd_get_section_by_name (dynobj, srel_name);
+ srel = bfd_get_linker_section (dynobj, srel_name);
if (srel == NULL && create)
{
- srel = bfd_make_section_with_flags (dynobj, srel_name,
- (SEC_ALLOC | SEC_LOAD
- | SEC_HAS_CONTENTS
- | SEC_IN_MEMORY
- | SEC_LINKER_CREATED
- | SEC_READONLY));
+ srel = bfd_make_section_anyway_with_flags (dynobj, srel_name,
+ (SEC_ALLOC | SEC_LOAD
+ | SEC_HAS_CONTENTS
+ | SEC_IN_MEMORY
+ | SEC_LINKER_CREATED
+ | SEC_READONLY));
if (srel == NULL
|| !bfd_set_section_alignment (dynobj, srel,
LOG_SECTION_ALIGN))
rent->count = 0;
dyn_i->reloc_entries = rent;
}
- rent->reltext |= reltext;
+ rent->reltext = reltext;
rent->count++;
return TRUE;
|| h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ /* PR15323, ref flags aren't set for references in the same
+ object. */
+ h->root.non_ir_ref = 1;
h->ref_regular = 1;
}
else
static bfd_boolean
allocate_local_got (struct elfNN_ia64_dyn_sym_info *dyn_i,
- PTR data)
+ void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
in a main executable that is not exported. */
static bfd_boolean
-allocate_fptr (struct elfNN_ia64_dyn_sym_info *dyn_i, PTR data)
+allocate_fptr (struct elfNN_ia64_dyn_sym_info *dyn_i, void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
static bfd_boolean
allocate_plt_entries (struct elfNN_ia64_dyn_sym_info *dyn_i,
- PTR data)
+ void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
static bfd_boolean
allocate_plt2_entries (struct elfNN_ia64_dyn_sym_info *dyn_i,
- PTR data)
+ void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
static bfd_boolean
allocate_pltoff_entries (struct elfNN_ia64_dyn_sym_info *dyn_i,
- PTR data)
+ void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
static bfd_boolean
allocate_dynrel_entries (struct elfNN_ia64_dyn_sym_info *dyn_i,
- PTR data)
+ void * data)
{
struct elfNN_ia64_allocate_data *x = (struct elfNN_ia64_allocate_data *)data;
struct elfNN_ia64_link_hash_table *ia64_info;
if (ia64_info->root.dynamic_sections_created
&& info->executable)
{
- sec = bfd_get_section_by_name (dynobj, ".interp");
+ sec = bfd_get_linker_section (dynobj, ".interp");
BFD_ASSERT (sec != NULL);
sec->contents = (bfd_byte *) ELF_DYNAMIC_INTERPRETER;
sec->size = strlen (ELF_DYNAMIC_INTERPRETER) + 1;
/* If we've got a .plt, we need some extra memory for the dynamic
linker. We stuff these in .got.plt. */
- sec = bfd_get_section_by_name (dynobj, ".got.plt");
+ sec = bfd_get_linker_section (dynobj, ".got.plt");
sec->size = 8 * PLT_RESERVED_WORDS;
}
static bfd *elfNN_ia64_unwind_entry_compare_bfd;
static int
-elfNN_ia64_unwind_entry_compare (const PTR a, const PTR b)
+elfNN_ia64_unwind_entry_compare (const void * a, const void * b)
{
bfd_vma av, bv;
if (!info->relocatable
&& (sym_sec->flags & SEC_MERGE) != 0
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
- && sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
+ && sym_sec->sec_info_type == SEC_INFO_TYPE_MERGE)
{
struct elfNN_ia64_local_hash_entry *loc_h;
else
{
bfd_boolean unresolved_reloc;
- bfd_boolean warned;
+ bfd_boolean warned, ignored;
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
r_symndx, symtab_hdr, sym_hashes,
h, sym_sec, value,
- unresolved_reloc, warned);
+ unresolved_reloc, warned, ignored);
if (h->root.type == bfd_link_hash_undefweak)
undef_weak_ref = TRUE;
- else if (warned)
+ else if (warned || (ignored && info->executable))
continue;
}
- if (sym_sec != NULL && elf_discarded_section (sym_sec))
+ if (sym_sec != NULL && discarded_section (sym_sec))
RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
- rel, relend, howto, contents);
+ rel, 1, relend, howto, 0, contents);
if (info->relocatable)
continue;
}
/* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
+ if (h == ia64_info->root.hdynamic
|| h == ia64_info->root.hgot
|| h == ia64_info->root.hplt)
sym->st_shndx = SHN_ABS;
asection *sdyn, *sgotplt;
bfd_vma gp_val;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
- sgotplt = bfd_get_section_by_name (dynobj, ".got.plt");
+ sdyn = bfd_get_linker_section (dynobj, ".dynamic");
+ sgotplt = bfd_get_linker_section (dynobj, ".got.plt");
BFD_ASSERT (sdyn != NULL);
dyncon = (ElfNN_External_Dyn *) sdyn->contents;
dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->size);
}
static bfd_boolean
-elfNN_ia64_print_private_bfd_data (bfd *abfd, PTR ptr)
+elfNN_ia64_print_private_bfd_data (bfd *abfd, void * ptr)
{
FILE *file = (FILE *) ptr;
flagword flags = elf_elfheader (abfd)->e_flags;
}
static enum elf_reloc_type_class
-elfNN_ia64_reloc_type_class (const Elf_Internal_Rela *rela)
+elfNN_ia64_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const asection *rel_sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela *rela)
{
switch ((int) ELFNN_R_TYPE (rela->r_info))
{
static bfd_boolean
elfNN_ia64_hpux_vec (const bfd_target *vec)
{
- extern const bfd_target bfd_elfNN_ia64_hpux_big_vec;
- return (vec == & bfd_elfNN_ia64_hpux_big_vec);
+ extern const bfd_target ia64_elfNN_hpux_be_vec;
+ return (vec == &ia64_elfNN_hpux_be_vec);
}
static void
break;
}
}
-
-#ifdef INCLUDE_IA64_VMS
-
-static bfd_boolean
-elfNN_vms_section_from_shdr (bfd *abfd,
- Elf_Internal_Shdr *hdr,
- const char *name,
- int shindex)
-{
- switch (hdr->sh_type)
- {
- case SHT_IA_64_VMS_TRACE:
- case SHT_IA_64_VMS_DEBUG:
- case SHT_IA_64_VMS_DEBUG_STR:
- break;
-
- default:
- return elfNN_ia64_section_from_shdr (abfd, hdr, name, shindex);
- }
-
- if (! _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
- return FALSE;
-
- return TRUE;
-}
-
-static bfd_boolean
-elfNN_vms_object_p (bfd *abfd)
-{
- Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
- Elf_Internal_Phdr *i_phdr = elf_tdata (abfd)->phdr;
- unsigned int i;
- unsigned int num_text = 0;
- unsigned int num_data = 0;
- unsigned int num_rodata = 0;
- char name[16];
-
- if (!elfNN_ia64_object_p (abfd))
- return FALSE;
-
- for (i = 0; i < i_ehdrp->e_phnum; i++, i_phdr++)
- {
- /* Is there a section for this segment? */
- bfd_vma base_vma = i_phdr->p_vaddr;
- bfd_vma limit_vma = base_vma + i_phdr->p_filesz;
-
- if (i_phdr->p_type != PT_LOAD)
- continue;
-
- again:
- while (base_vma < limit_vma)
- {
- bfd_vma next_vma = limit_vma;
- asection *nsec;
- asection *sec;
- flagword flags;
- char *nname = NULL;
-
- /* Find a section covering base_vma. */
- for (sec = abfd->sections; sec != NULL; sec = sec->next)
- {
- if ((sec->flags & (SEC_ALLOC | SEC_LOAD)) == 0)
- continue;
- if (sec->vma <= base_vma && sec->vma + sec->size > base_vma)
- {
- base_vma = sec->vma + sec->size;
- goto again;
- }
- if (sec->vma < next_vma && sec->vma + sec->size >= base_vma)
- next_vma = sec->vma;
- }
-
- /* No section covering [base_vma; next_vma). Create a fake one. */
- flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
- if (i_phdr->p_flags & PF_X)
- {
- flags |= SEC_CODE;
- if (num_text++ == 0)
- nname = ".text";
- else
- sprintf (name, ".text$%u", num_text);
- }
- else if ((i_phdr->p_flags & (PF_R | PF_W)) == PF_R)
- {
- flags |= SEC_READONLY;
- sprintf (name, ".rodata$%u", num_rodata++);
- }
- else
- {
- flags |= SEC_DATA;
- sprintf (name, ".data$%u", num_data++);
- }
-
- /* Allocate name. */
- if (nname == NULL)
- {
- size_t name_len = strlen (name) + 1;
- nname = bfd_alloc (abfd, name_len);
- if (nname == NULL)
- return FALSE;
- memcpy (nname, name, name_len);
- }
-
- /* Create and fill new section. */
- nsec = bfd_make_section_anyway_with_flags (abfd, nname, flags);
- if (nsec == NULL)
- return FALSE;
- nsec->vma = base_vma;
- nsec->size = next_vma - base_vma;
- nsec->filepos = i_phdr->p_offset + (base_vma - i_phdr->p_vaddr);
-
- base_vma = next_vma;
- }
- }
- return TRUE;
-}
-
-static void
-elfNN_vms_post_process_headers (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
-{
- Elf_Internal_Ehdr *i_ehdrp = elf_elfheader (abfd);
-
- i_ehdrp->e_ident[EI_OSABI] = ELFOSABI_OPENVMS;
- i_ehdrp->e_ident[EI_ABIVERSION] = 2;
-}
-
-static bfd_boolean
-elfNN_vms_section_processing (bfd *abfd ATTRIBUTE_UNUSED,
- Elf_Internal_Shdr *hdr)
-{
- if (hdr->bfd_section != NULL)
- {
- const char *name = bfd_get_section_name (abfd, hdr->bfd_section);
-
- if (strcmp (name, ".text") == 0)
- hdr->sh_flags |= SHF_IA_64_VMS_SHARED;
- else if ((strcmp (name, ".debug") == 0)
- || (strcmp (name, ".debug_abbrev") == 0)
- || (strcmp (name, ".debug_aranges") == 0)
- || (strcmp (name, ".debug_frame") == 0)
- || (strcmp (name, ".debug_info") == 0)
- || (strcmp (name, ".debug_loc") == 0)
- || (strcmp (name, ".debug_macinfo") == 0)
- || (strcmp (name, ".debug_pubnames") == 0)
- || (strcmp (name, ".debug_pubtypes") == 0))
- hdr->sh_type = SHT_IA_64_VMS_DEBUG;
- else if ((strcmp (name, ".debug_line") == 0)
- || (strcmp (name, ".debug_ranges") == 0))
- hdr->sh_type = SHT_IA_64_VMS_TRACE;
- else if (strcmp (name, ".debug_str") == 0)
- hdr->sh_type = SHT_IA_64_VMS_DEBUG_STR;
- else if (strcmp (name, ".vms_display_name_info") == 0)
- {
- int idx, symcount;
- asymbol **syms;
- struct elf_obj_tdata *t = elf_tdata (abfd);
- int buf[2];
- int demangler_sym_idx = -1;
-
- symcount = bfd_get_symcount (abfd);
- syms = bfd_get_outsymbols (abfd);
- for (idx = 0; idx < symcount; idx++)
- {
- asymbol *sym;
- sym = syms[idx];
- if ((sym->flags & (BSF_DEBUGGING | BSF_DYNAMIC))
- && strchr (sym->name, '@')
- && (strcmp (sym->section->name, BFD_ABS_SECTION_NAME) == 0))
- {
- demangler_sym_idx = sym->udata.i;
- break;
- }
- }
-
- hdr->sh_type = SHT_IA_64_VMS_DISPLAY_NAME_INFO;
- hdr->sh_entsize = 4;
- hdr->sh_addralign = 0;
- hdr->sh_link = t->symtab_section;
-
- /* Find symtab index of demangler routine and stuff it in
- the second long word of section data. */
-
- if (demangler_sym_idx > -1)
- {
- bfd_seek (abfd, hdr->sh_offset, SEEK_SET);
- bfd_bread (buf, hdr->sh_size, abfd);
- buf [1] = demangler_sym_idx;
- bfd_seek (abfd, hdr->sh_offset, SEEK_SET);
- bfd_bwrite (buf, hdr->sh_size, abfd);
- }
- }
- }
-
- return TRUE;
-}
-
-/* The final processing done just before writing out a VMS IA-64 ELF
- object file. */
-
-static void
-elfNN_vms_final_write_processing (bfd *abfd,
- bfd_boolean linker ATTRIBUTE_UNUSED)
-{
- Elf_Internal_Shdr *hdr;
- asection *s;
- int unwind_info_sect_idx = 0;
-
- for (s = abfd->sections; s; s = s->next)
- {
- hdr = &elf_section_data (s)->this_hdr;
-
- if (strcmp (bfd_get_section_name (abfd, hdr->bfd_section),
- ".IA_64.unwind_info") == 0)
- unwind_info_sect_idx = elf_section_data (s)->this_idx;
-
- switch (hdr->sh_type)
- {
- case SHT_IA_64_UNWIND:
- /* VMS requires sh_info to point to the unwind info section. */
- hdr->sh_info = unwind_info_sect_idx;
- break;
- }
- }
-
- if (! elf_flags_init (abfd))
- {
- unsigned long flags = 0;
-
- if (abfd->xvec->byteorder == BFD_ENDIAN_BIG)
- flags |= EF_IA_64_BE;
- if (bfd_get_mach (abfd) == bfd_mach_ia64_elf64)
- flags |= EF_IA_64_ABI64;
-
- elf_elfheader(abfd)->e_flags = flags;
- elf_flags_init (abfd) = TRUE;
- }
-}
-
-static bfd_boolean
-elfNN_vms_close_and_cleanup (bfd *abfd)
-{
- if (bfd_get_format (abfd) == bfd_object)
- {
- long isize, irsize;
-
- if (elf_shstrtab (abfd) != NULL)
- _bfd_elf_strtab_free (elf_shstrtab (abfd));
-
- /* Pad to 8 byte boundary for IPF/VMS. */
- isize = bfd_get_size (abfd);
- if ((irsize = isize/8*8) < isize)
- {
- int ishort = (irsize + 8) - isize;
- bfd_seek (abfd, isize, SEEK_SET);
- bfd_bwrite (bfd_zmalloc (ishort), ishort, abfd);
- }
- }
-
- return _bfd_generic_close_and_cleanup (abfd);
-}
-#endif /* INCLUDE_IA64_VMS */
\f
-#define TARGET_LITTLE_SYM bfd_elfNN_ia64_little_vec
+#define TARGET_LITTLE_SYM ia64_elfNN_le_vec
#define TARGET_LITTLE_NAME "elfNN-ia64-little"
-#define TARGET_BIG_SYM bfd_elfNN_ia64_big_vec
+#define TARGET_BIG_SYM ia64_elfNN_be_vec
#define TARGET_BIG_NAME "elfNN-ia64-big"
#define ELF_ARCH bfd_arch_ia64
#define ELF_TARGET_ID IA64_ELF_DATA
/* Stuff for the BFD linker: */
#define bfd_elfNN_bfd_link_hash_table_create \
elfNN_ia64_hash_table_create
-#define bfd_elfNN_bfd_link_hash_table_free \
- elfNN_ia64_hash_table_free
#define elf_backend_create_dynamic_sections \
elfNN_ia64_create_dynamic_sections
#define elf_backend_check_relocs \
#undef TARGET_LITTLE_SYM
#undef TARGET_LITTLE_NAME
#undef TARGET_BIG_SYM
-#define TARGET_BIG_SYM bfd_elfNN_ia64_hpux_big_vec
+#define TARGET_BIG_SYM ia64_elfNN_hpux_be_vec
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elfNN-ia64-hpux-big"
#define elfNN_bed elfNN_ia64_hpux_bed
#include "elfNN-target.h"
-
-/* VMS-specific vectors. */
-#ifdef INCLUDE_IA64_VMS
-
-#undef TARGET_LITTLE_SYM
-#define TARGET_LITTLE_SYM bfd_elfNN_ia64_vms_vec
-#undef TARGET_LITTLE_NAME
-#define TARGET_LITTLE_NAME "elfNN-ia64-vms"
-#undef TARGET_BIG_SYM
-#undef TARGET_BIG_NAME
-
-/* These are VMS specific functions. */
-
-#undef elf_backend_object_p
-#define elf_backend_object_p elfNN_vms_object_p
-
-#undef elf_backend_section_from_shdr
-#define elf_backend_section_from_shdr elfNN_vms_section_from_shdr
-
-#undef elf_backend_post_process_headers
-#define elf_backend_post_process_headers elfNN_vms_post_process_headers
-
-#undef elf_backend_section_processing
-#define elf_backend_section_processing elfNN_vms_section_processing
-
-#undef elf_backend_final_write_processing
-#define elf_backend_final_write_processing elfNN_vms_final_write_processing
-
-#undef bfd_elfNN_close_and_cleanup
-#define bfd_elfNN_close_and_cleanup elfNN_vms_close_and_cleanup
-
-#undef elf_backend_section_from_bfd_section
-
-#undef elf_backend_symbol_processing
-
-#undef elf_backend_want_p_paddr_set_to_zero
-
-#undef ELF_OSABI
-#define ELF_OSABI ELFOSABI_OPENVMS
-
-#undef ELF_MAXPAGESIZE
-#define ELF_MAXPAGESIZE 0x10000 /* 64KB */
-
-#undef elfNN_bed
-#define elfNN_bed elfNN_ia64_vms_bed
-
-/* Use VMS-style archives (in particular, don't use the standard coff
- archive format). */
-#define bfd_elfNN_archive_functions
-
-#undef bfd_elfNN_archive_p
-#define bfd_elfNN_archive_p _bfd_vms_lib_ia64_archive_p
-#undef bfd_elfNN_write_archive_contents
-#define bfd_elfNN_write_archive_contents _bfd_vms_lib_write_archive_contents
-#undef bfd_elfNN_mkarchive
-#define bfd_elfNN_mkarchive _bfd_vms_lib_ia64_mkarchive
-
-#define bfd_elfNN_archive_slurp_armap \
- _bfd_vms_lib_slurp_armap
-#define bfd_elfNN_archive_slurp_extended_name_table \
- _bfd_vms_lib_slurp_extended_name_table
-#define bfd_elfNN_archive_construct_extended_name_table \
- _bfd_vms_lib_construct_extended_name_table
-#define bfd_elfNN_archive_truncate_arname \
- _bfd_vms_lib_truncate_arname
-#define bfd_elfNN_archive_write_armap \
- _bfd_vms_lib_write_armap
-#define bfd_elfNN_archive_read_ar_hdr \
- _bfd_vms_lib_read_ar_hdr
-#define bfd_elfNN_archive_write_ar_hdr \
- _bfd_vms_lib_write_ar_hdr
-#define bfd_elfNN_archive_openr_next_archived_file \
- _bfd_vms_lib_openr_next_archived_file
-#define bfd_elfNN_archive_get_elt_at_index \
- _bfd_vms_lib_get_elt_at_index
-#define bfd_elfNN_archive_generic_stat_arch_elt \
- _bfd_vms_lib_generic_stat_arch_elt
-#define bfd_elfNN_archive_update_armap_timestamp \
- _bfd_vms_lib_update_armap_timestamp
-
-#include "elfNN-target.h"
-
-#endif /* INCLUDE_IA64_VMS */