/* Support for HPPA 64-bit ELF
- Copyright (C) 1999-2016 Free Software Foundation, Inc.
+ Copyright (C) 1999-2018 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
entry = bfd_hash_allocate (table,
sizeof (struct elf64_hppa_link_hash_entry));
if (entry == NULL)
- return entry;
+ return entry;
}
/* Call the allocation method of the superclass. */
return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 11);
case EFA_PARISC_2_0:
if (i_ehdrp->e_ident[EI_CLASS] == ELFCLASS64)
- return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 25);
+ return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 25);
else
- return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 20);
+ return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 20);
case EFA_PARISC_2_0 | EF_PARISC_WIDE:
return bfd_default_set_arch_mach (abfd, bfd_arch_hppa, 25);
}
struct elf64_hppa_link_hash_entry *hh,
int type,
asection *sec,
- int sec_symndx,
- bfd_vma offset,
+ int sec_symndx,
+ bfd_vma offset,
bfd_vma addend)
{
struct elf64_hppa_dyn_reloc_entry *rent;
/* PR15323, ref flags aren't set for references in the same
object. */
- hh->eh.root.non_ir_ref = 1;
hh->eh.ref_regular = 1;
}
else
/* If this is a weak symbol, and there is a real definition, the
processor independent code will have arranged for us to see the
real definition first, and we can just use the same value. */
- if (eh->u.weakdef != NULL)
+ if (eh->is_weakalias)
{
- BFD_ASSERT (eh->u.weakdef->root.type == bfd_link_hash_defined
- || eh->u.weakdef->root.type == bfd_link_hash_defweak);
- eh->root.u.def.section = eh->u.weakdef->root.u.def.section;
- eh->root.u.def.value = eh->u.weakdef->root.u.def.value;
+ struct elf_link_hash_entry *def = weakdef (eh);
+ BFD_ASSERT (def->root.type == bfd_link_hash_defined);
+ eh->root.u.def.section = def->root.u.def.section;
+ eh->root.u.def.value = def->root.u.def.value;
return TRUE;
}
*local_dlt = sec->size;
sec->size += DLT_ENTRY_SIZE;
if (bfd_link_pic (info))
- {
+ {
srel->size += sizeof (Elf64_External_Rela);
- }
+ }
}
else
*local_dlt = (bfd_vma) -1;
{
data.ofs = hppa_info->plt_sec->size;
elf_link_hash_traverse (&hppa_info->root,
- allocate_global_data_plt, &data);
+ allocate_global_data_plt, &data);
hppa_info->plt_sec->size = data.ofs;
}
{
_bfd_error_handler
/* xgettext:c-format */
- (_("stub entry for %s cannot load .plt, dp offset = %ld"),
- hh->eh.root.root.string, (long) value);
+ (_("stub entry for %s cannot load .plt, dp offset = %" PRId64),
+ hh->eh.root.root.string, (int64_t) value);
return FALSE;
}
existence of a .interp section. */
static bfd_boolean
-elf64_hppa_modify_segment_map (bfd *abfd,
- struct bfd_link_info *info ATTRIBUTE_UNUSED)
+elf64_hppa_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
{
struct elf_segment_map *m;
- asection *s;
- s = bfd_get_section_by_name (abfd, ".interp");
- if (! s)
+ m = elf_seg_map (abfd);
+ if (info != NULL && !info->user_phdrs && m != NULL && m->p_type != PT_PHDR)
{
- for (m = elf_seg_map (abfd); m != NULL; m = m->next)
- if (m->p_type == PT_PHDR)
- break;
-
+ m = ((struct elf_segment_map *)
+ bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
if (m == NULL)
- {
- m = ((struct elf_segment_map *)
- bfd_zalloc (abfd, (bfd_size_type) sizeof *m));
- if (m == NULL)
- return FALSE;
+ return FALSE;
- m->p_type = PT_PHDR;
- m->p_flags = PF_R | PF_X;
- m->p_flags_valid = 1;
- m->p_paddr_valid = 1;
- m->includes_phdrs = 1;
+ m->p_type = PT_PHDR;
+ m->p_flags = PF_R | PF_X;
+ m->p_flags_valid = 1;
+ m->p_paddr_valid = 1;
+ m->includes_phdrs = 1;
- m->next = elf_seg_map (abfd);
- elf_seg_map (abfd) = m;
- }
+ m->next = elf_seg_map (abfd);
+ elf_seg_map (abfd) = m;
}
- for (m = elf_seg_map (abfd); m != NULL; m = m->next)
+ for (m = elf_seg_map (abfd) ; m != NULL; m = m->next)
if (m->p_type == PT_LOAD)
{
unsigned int i;
{
_bfd_error_handler
/* xgettext:c-format */
- (_("%B(%A+0x%" BFD_VMA_FMT "x): cannot reach %s"),
+ (_("%pB(%pA+%#" PRIx64 "): cannot reach %s"),
input_bfd,
input_section,
- offset,
+ (uint64_t) offset,
eh ? eh->root.root.string : "unknown");
bfd_set_error (bfd_error_bad_value);
return bfd_reloc_overflow;
{
bfd_vma *local_opd_offsets, *local_dlt_offsets;
- if (local_offsets == NULL)
- abort ();
+ if (local_offsets == NULL)
+ abort ();
/* Now do .opd creation if needed. */
if (r_type == R_PARISC_LTOFF_FPTR14R
{
bfd_vma *local_opd_offsets;
- if (local_offsets == NULL)
- abort ();
+ if (local_offsets == NULL)
+ abort ();
local_opd_offsets = local_offsets + 2 * symtab_hdr->sh_info;
off = local_opd_offsets[r_symndx];
if ((off & 1) != 0)
{
BFD_ASSERT (off != (bfd_vma) -1);
- off &= ~1;
+ off &= ~1;
}
else
{
rel->r_offset, err);
}
- if (!bfd_link_relocatable (info)
- && relocation == 0
- && eh->root.type != bfd_link_hash_defined
- && eh->root.type != bfd_link_hash_defweak
- && eh->root.type != bfd_link_hash_undefweak)
- {
- if (info->unresolved_syms_in_objects == RM_IGNORE
- && ELF_ST_VISIBILITY (eh->other) == STV_DEFAULT
- && eh->type == STT_PARISC_MILLI)
+ if (!bfd_link_relocatable (info)
+ && relocation == 0
+ && eh->root.type != bfd_link_hash_defined
+ && eh->root.type != bfd_link_hash_defweak
+ && eh->root.type != bfd_link_hash_undefweak)
+ {
+ if (info->unresolved_syms_in_objects == RM_IGNORE
+ && ELF_ST_VISIBILITY (eh->other) == STV_DEFAULT
+ && eh->type == STT_PARISC_MILLI)
(*info->callbacks->undefined_symbol)
(info, eh_name (eh), input_bfd,
input_section, rel->r_offset, FALSE);
- }
+ }
}
if (sym_sec != NULL && discarded_section (sym_sec))
static const struct bfd_elf_special_section elf64_hppa_special_sections[] =
{
- { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { STRING_COMMA_LEN (".dlt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".dlt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
{ STRING_COMMA_LEN (".sdata"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { STRING_COMMA_LEN (".sbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { STRING_COMMA_LEN (".tbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_HP_TLS },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".sbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".tbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_HP_TLS },
+ { NULL, 0, 0, 0, 0 }
};
/* The hash bucket size is the standard one, namely 4. */
elf64_hppa_create_dynamic_sections
#define elf_backend_post_process_headers elf64_hppa_post_process_headers
-#define elf_backend_omit_section_dynsym \
- ((bfd_boolean (*) (bfd *, struct bfd_link_info *, asection *)) bfd_true)
+#define elf_backend_omit_section_dynsym _bfd_elf_omit_section_dynsym_all
+
#define elf_backend_adjust_dynamic_symbol \
elf64_hppa_adjust_dynamic_symbol