/* BFD back-end for HP PA-RISC ELF files.
- Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+ Copyright (C) 1990-2015 Free Software Foundation, Inc.
Original code by
Center for Software Science
Largely rewritten by Alan Modra <alan@linuxcare.com.au>
Naming cleanup by Carlos O'Donell <carlos@systemhalted.org>
TLS support written by Randolph Chung <tausq@debian.org>
-
+
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
Structure/Variable Prefix
elf_link_hash_table "etab"
elf_link_hash_entry "eh"
-
+
elf32_hppa_link_hash_table "htab"
elf32_hppa_link_hash_entry "hh"
bfd_hash_table "btab"
bfd_hash_entry "bh"
-
+
bfd_hash_table containing stubs "bstab"
elf32_hppa_stub_hash_entry "hsh"
elf32_hppa_dyn_reloc_entry "hdh"
-
+
Always remember to use GNU Coding Style. */
-
+
#define PLT_ENTRY_SIZE 8
#define GOT_ENTRY_SIZE 4
#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1"
#define eh_name(eh) \
(eh ? eh->root.root.string : "<undef>")
-/* Override the generic function because we want to mark our BFDs. */
-
-static bfd_boolean
-elf32_hppa_mkobject (bfd *abfd)
-{
- return bfd_elf_allocate_object (abfd, sizeof (struct elf_obj_tdata),
- HPPA32_ELF_DATA);
-}
-
/* Assorted hash table functions. */
/* Initialize an entry in the stub hash table. */
return entry;
}
+/* Free the derived linker hash table. */
+
+static void
+elf32_hppa_link_hash_table_free (bfd *obfd)
+{
+ struct elf32_hppa_link_hash_table *htab
+ = (struct elf32_hppa_link_hash_table *) obfd->link.hash;
+
+ bfd_hash_table_free (&htab->bstab);
+ _bfd_elf_link_hash_table_free (obfd);
+}
+
/* Create the derived linker hash table. The PA ELF port uses the derived
hash table to keep information specific to the PA ELF linker (without
using static variables). */
struct elf32_hppa_link_hash_table *htab;
bfd_size_type amt = sizeof (*htab);
- htab = bfd_malloc (amt);
+ htab = bfd_zmalloc (amt);
if (htab == NULL)
return NULL;
/* Init the stub hash table too. */
if (!bfd_hash_table_init (&htab->bstab, stub_hash_newfunc,
sizeof (struct elf32_hppa_stub_hash_entry)))
- return NULL;
+ {
+ _bfd_elf_link_hash_table_free (abfd);
+ return NULL;
+ }
+ htab->etab.root.hash_table_free = elf32_hppa_link_hash_table_free;
- htab->stub_bfd = NULL;
- htab->add_stub_section = NULL;
- htab->layout_sections_again = NULL;
- htab->stub_group = NULL;
- htab->sgot = NULL;
- htab->srelgot = NULL;
- htab->splt = NULL;
- htab->srelplt = NULL;
- htab->sdynbss = NULL;
- htab->srelbss = NULL;
htab->text_segment_base = (bfd_vma) -1;
htab->data_segment_base = (bfd_vma) -1;
- htab->multi_subspace = 0;
- htab->has_12bit_branch = 0;
- htab->has_17bit_branch = 0;
- htab->has_22bit_branch = 0;
- htab->need_plt_stub = 0;
- htab->sym_cache.abfd = NULL;
- htab->tls_ldm_got.refcount = 0;
-
return &htab->etab.root;
}
-/* Free the derived linker hash table. */
-
-static void
-elf32_hppa_link_hash_table_free (struct bfd_link_hash_table *btab)
-{
- struct elf32_hppa_link_hash_table *htab
- = (struct elf32_hppa_link_hash_table *) btab;
-
- bfd_hash_table_free (&htab->bstab);
- _bfd_generic_link_hash_table_free (btab);
-}
-
/* Build a name for an entry in the stub hash table. */
static char *
i_ehdrp = elf_elfheader (abfd);
if (strcmp (bfd_get_target (abfd), "elf32-hppa-linux") == 0)
{
- /* GCC on hppa-linux produces binaries with OSABI=Linux,
+ /* GCC on hppa-linux produces binaries with OSABI=GNU,
but the kernel produces corefiles with OSABI=SysV. */
- if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_LINUX &&
+ if (i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_GNU &&
i_ehdrp->e_ident[EI_OSABI] != ELFOSABI_NONE) /* aka SYSV */
return FALSE;
}
if (! _bfd_elf_create_dynamic_sections (abfd, info))
return FALSE;
- htab->splt = bfd_get_section_by_name (abfd, ".plt");
- htab->srelplt = bfd_get_section_by_name (abfd, ".rela.plt");
+ htab->splt = bfd_get_linker_section (abfd, ".plt");
+ htab->srelplt = bfd_get_linker_section (abfd, ".rela.plt");
- htab->sgot = bfd_get_section_by_name (abfd, ".got");
- htab->srelgot = bfd_get_section_by_name (abfd, ".rela.got");
+ htab->sgot = bfd_get_linker_section (abfd, ".got");
+ htab->srelgot = bfd_get_linker_section (abfd, ".rela.got");
- htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss");
- htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss");
+ htab->sdynbss = bfd_get_linker_section (abfd, ".dynbss");
+ htab->srelbss = bfd_get_linker_section (abfd, ".rela.bss");
/* hppa-linux needs _GLOBAL_OFFSET_TABLE_ to be visible from the main
application, because __canonicalize_funcptr_for_compare needs it. */
{
Elf_Internal_Shdr *symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
bfd_signed_vma *local_refcounts;
-
+
local_refcounts = elf_local_got_refcounts (abfd);
if (local_refcounts == NULL)
{
while (hh->eh.root.type == bfd_link_hash_indirect
|| hh->eh.root.type == bfd_link_hash_warning)
hh = hppa_elf_hash_entry (hh->eh.root.u.i.link);
+
+ /* PR15323, ref flags aren't set for references in the same
+ object. */
+ hh->eh.root.non_ir_ref = 1;
}
r_type = ELF32_R_TYPE (rela->r_info);
else
{
bfd_signed_vma *local_got_refcounts;
-
+
/* This is a global offset table entry for a local symbol. */
local_got_refcounts = hppa32_elf_local_refcounts (abfd);
if (local_got_refcounts == NULL)
case 396: /* Linux/hppa */
/* pr_cursig */
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12);
+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12);
/* pr_pid */
- elf_tdata (abfd)->core_pid = bfd_get_32 (abfd, note->descdata + 24);
+ elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 24);
/* pr_reg */
offset = 72;
return FALSE;
case 124: /* Linux/hppa elf_prpsinfo. */
- elf_tdata (abfd)->core_program
+ elf_tdata (abfd)->core->program
= _bfd_elfcore_strndup (abfd, note->descdata + 28, 16);
- elf_tdata (abfd)->core_command
+ elf_tdata (abfd)->core->command
= _bfd_elfcore_strndup (abfd, note->descdata + 44, 80);
}
onto the end of the args in some (at least one anyway)
implementations, so strip it off if it exists. */
{
- char *command = elf_tdata (abfd)->core_command;
+ char *command = elf_tdata (abfd)->core->command;
int n = strlen (command);
if (0 < n && command[n - 1] == ' ')
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
eh->dynstr_index);
}
+
+ /* PR 16082: Remove version information from hidden symbol. */
+ eh->verinfo.verdef = NULL;
+ eh->verinfo.vertree = NULL;
}
- if (! hppa_elf_hash_entry (eh)->plabel)
+ /* STT_GNU_IFUNC symbol must go through PLT. */
+ if (! hppa_elf_hash_entry (eh)->plabel
+ && eh->type != STT_GNU_IFUNC)
{
eh->needs_plt = 0;
- eh->plt = elf_hash_table (info)->init_plt_refcount;
+ eh->plt = elf_hash_table (info)->init_plt_offset;
}
}
if (eh->type == STT_FUNC
|| eh->needs_plt)
{
+ /* If the symbol is used by a plabel, we must allocate a PLT slot.
+ The refcounts are not reliable when it has been hidden since
+ hide_symbol can be called before the plabel flag is set. */
+ if (hppa_elf_hash_entry (eh)->plabel
+ && eh->plt.refcount <= 0)
+ eh->plt.refcount = 1;
+
if (eh->plt.refcount <= 0
|| (eh->def_regular
&& eh->root.type != bfd_link_hash_defweak
}
}
- if (eh->size == 0)
- {
- (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
- eh->root.root.string);
- return TRUE;
- }
-
/* We must allocate the symbol in our .dynbss section, which will
become part of the .bss section of the executable. There will be
an entry for this symbol in the .dynsym section. The dynamic
/* We must generate a COPY reloc to tell the dynamic linker to
copy the initial value out of the dynamic object and into the
runtime process image. */
- if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0)
+ if ((eh->root.u.def.section->flags & SEC_ALLOC) != 0 && eh->size != 0)
{
htab->srelbss->size += sizeof (Elf32_External_Rela);
eh->needs_copy = 1;
sec = htab->sdynbss;
- return _bfd_elf_adjust_dynamic_copy (eh, sec);
+ return _bfd_elf_adjust_dynamic_copy (info, eh, sec);
}
/* Allocate space in the .plt for entries that won't have relocations.
if (eh->root.type == bfd_link_hash_indirect)
return TRUE;
- if (eh->root.type == bfd_link_hash_warning)
- eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
info = (struct bfd_link_info *) inf;
hh = hppa_elf_hash_entry (eh);
htab = hppa_link_hash_table (info);
means that the plt entry is only used by a plabel.
We'll be using a normal plt entry for this symbol, so
clear the plabel indicator. */
-
+
hh->plabel = 0;
}
else if (hh->plabel)
if (eh->root.type == bfd_link_hash_indirect)
return TRUE;
- if (eh->root.type == bfd_link_hash_warning)
- eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
info = inf;
htab = hppa_link_hash_table (info);
if (htab == NULL)
return FALSE;
hh = hppa_elf_hash_entry (eh);
-
+
if (htab->etab.dynamic_sections_created
&& eh->plt.offset != (bfd_vma) -1
&& !hh->plabel
/* For the non-shared case, discard space for relocs against
symbols which turn out to need copy relocs or are not
dynamic. */
-
+
if (!eh->non_got_ref
&& ((ELIMINATE_COPY_RELOCS
&& eh->def_dynamic
clobber_millicode_symbols (struct elf_link_hash_entry *eh,
struct bfd_link_info *info)
{
- if (eh->root.type == bfd_link_hash_warning)
- eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
if (eh->type == STT_PARISC_MILLI
&& !eh->forced_local)
{
struct elf32_hppa_link_hash_entry *hh;
struct elf32_hppa_dyn_reloc_entry *hdh_p;
- if (eh->root.type == bfd_link_hash_warning)
- eh = (struct elf_link_hash_entry *) eh->root.u.i.link;
-
hh = hppa_elf_hash_entry (eh);
for (hdh_p = hh->dyn_relocs; hdh_p != NULL; hdh_p = hdh_p->hdh_next)
{
/* Set the contents of the .interp section to the interpreter. */
if (info->executable)
{
- sec = bfd_get_section_by_name (dynobj, ".interp");
+ sec = bfd_get_linker_section (dynobj, ".interp");
if (sec == NULL)
abort ();
sec->size = sizeof ELF_DYNAMIC_INTERPRETER;
/* Set up .got and .plt offsets for local syms, and space for local
dynamic relocs. */
- for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
+ for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
{
bfd_signed_vma *local_got;
bfd_signed_vma *end_local_got;
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 (info->shared)
{
srel->size += sizeof (Elf32_External_Rela);
if ((*local_tls_type & (GOT_TLS_GD | GOT_TLS_IE)) == (GOT_TLS_GD | GOT_TLS_IE))
}
}
}
-
+
if (htab->tls_ldm_got.refcount > 0)
{
- /* Allocate 2 got entries and 1 dynamic reloc for
+ /* Allocate 2 got entries and 1 dynamic reloc for
R_PARISC_TLS_DTPMOD32 relocs. */
htab->tls_ldm_got.offset = htab->sgot->size;
htab->sgot->size += (GOT_ENTRY_SIZE * 2);
bfd_size_type mask;
if (gotalign > pltalign)
- bfd_set_section_alignment (dynobj, sec, gotalign);
+ (void) bfd_set_section_alignment (dynobj, sec, gotalign);
mask = ((bfd_size_type) 1 << gotalign) - 1;
sec->size = (sec->size + sizeof (plt_stub) + mask) & ~mask;
}
/* Count the number of input BFDs and find the top input section id. */
for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0;
input_bfd != NULL;
- input_bfd = input_bfd->link_next)
+ input_bfd = input_bfd->link.next)
{
bfd_count += 1;
for (section = input_bfd->sections;
export stubs. */
for (bfd_indx = 0;
input_bfd != NULL;
- input_bfd = input_bfd->link_next, bfd_indx++)
+ input_bfd = input_bfd->link.next, bfd_indx++)
{
Elf_Internal_Shdr *symtab_hdr;
for (input_bfd = info->input_bfds, bfd_indx = 0;
input_bfd != NULL;
- input_bfd = input_bfd->link_next, bfd_indx++)
+ input_bfd = input_bfd->link.next, bfd_indx++)
{
Elf_Internal_Shdr *symtab_hdr;
asection *section;
}
/* Return the base vma address which should be subtracted from the real
- address when resolving a dtpoff relocation.
+ address when resolving a dtpoff relocation.
This is PT_TLS segment p_vaddr. */
static bfd_vma
/* If tls_sec is NULL, we should have signalled an error already. */
if (htab->tls_sec == NULL)
return 0;
- /* hppa TLS ABI is variant I and static TLS block start just after
+ /* hppa TLS ABI is variant I and static TLS block start just after
tcbhead structure which has 2 pointer fields. */
- return (address - htab->tls_sec->vma
+ return (address - htab->tls_sec->vma
+ align_power ((bfd_vma) 8, htab->tls_sec->alignment_power));
}
bfd_signed_vma addend = rela->r_addend;
bfd_vma location;
struct elf32_hppa_stub_hash_entry *hsh = NULL;
- int val;
+ int val;
if (r_type == R_PARISC_NONE)
return bfd_reloc_ok;
switch (r_type)
{
case R_PARISC_DLTIND21L:
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_IE21L:
r_type = R_PARISC_DPREL21L;
break;
case R_PARISC_DLTIND14R:
+ case R_PARISC_TLS_GD14R:
+ case R_PARISC_TLS_LDM14R:
+ case R_PARISC_TLS_IE14R:
r_type = R_PARISC_DPREL14R;
break;
case R_PARISC_DPREL21L:
case R_PARISC_DPREL14R:
case R_PARISC_DPREL14F:
- case R_PARISC_TLS_GD21L:
- case R_PARISC_TLS_LDM21L:
- case R_PARISC_TLS_IE21L:
/* Convert instructions that use the linkage table pointer (r19) to
instructions that use the global data pointer (dp). This is the
most efficient way of using PIC code in an incomplete executable,
but the user must follow the standard runtime conventions for
accessing data for this to work. */
- if (orig_r_type == R_PARISC_DLTIND21L
- || (!info->shared
- && (r_type == R_PARISC_TLS_GD21L
- || r_type == R_PARISC_TLS_LDM21L
- || r_type == R_PARISC_TLS_IE21L)))
- {
- /* Convert addil instructions if the original reloc was a
- DLTIND21L. GCC sometimes uses a register other than r19 for
- the operation, so we must convert any addil instruction
- that uses this relocation. */
- if ((insn & 0xfc000000) == ((int) OP_ADDIL << 26))
- insn = ADDIL_DP;
- else
- /* We must have a ldil instruction. It's too hard to find
- and convert the associated add instruction, so issue an
- error. */
- (*_bfd_error_handler)
- (_("%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"),
- input_bfd,
- input_section,
- (long) offset,
- howto->name,
- insn);
- }
- else if (orig_r_type == R_PARISC_DLTIND14F)
+ if (orig_r_type != r_type)
{
- /* This must be a format 1 load/store. Change the base
- register to dp. */
- insn = (insn & 0xfc1ffff) | (27 << 21);
+ if (r_type == R_PARISC_DPREL21L)
+ {
+ /* GCC sometimes uses a register other than r19 for the
+ operation, so we must convert any addil instruction
+ that uses this relocation. */
+ if ((insn & 0xfc000000) == ((int) OP_ADDIL << 26))
+ insn = ADDIL_DP;
+ else
+ /* We must have a ldil instruction. It's too hard to find
+ and convert the associated add instruction, so issue an
+ error. */
+ (*_bfd_error_handler)
+ (_("%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"),
+ input_bfd,
+ input_section,
+ (long) offset,
+ howto->name,
+ insn);
+ }
+ else if (r_type == R_PARISC_DPREL14F)
+ {
+ /* This must be a format 1 load/store. Change the base
+ register to dp. */
+ insn = (insn & 0xfc1ffff) | (27 << 21);
+ }
}
- /* For all the DP relative relocations, we need to examine the symbol's
- section. If it has no section or if it's a code section, then
- "data pointer relative" makes no sense. In that case we don't
- adjust the "value", and for 21 bit addil instructions, we change the
- source addend register from %dp to %r0. This situation commonly
- arises for undefined weak symbols and when a variable's "constness"
- is declared differently from the way the variable is defined. For
- instance: "extern int foo" with foo defined as "const int foo". */
+ /* For all the DP relative relocations, we need to examine the symbol's
+ section. If it has no section or if it's a code section, then
+ "data pointer relative" makes no sense. In that case we don't
+ adjust the "value", and for 21 bit addil instructions, we change the
+ source addend register from %dp to %r0. This situation commonly
+ arises for undefined weak symbols and when a variable's "constness"
+ is declared differently from the way the variable is defined. For
+ instance: "extern int foo" with foo defined as "const int foo". */
if (sym_sec == NULL || (sym_sec->flags & SEC_CODE) != 0)
{
if ((insn & ((0x3f << 26) | (0x1f << 21)))
case R_PARISC_DLTIND21L:
case R_PARISC_DLTIND14R:
case R_PARISC_DLTIND14F:
+ case R_PARISC_TLS_GD21L:
+ case R_PARISC_TLS_LDM21L:
+ case R_PARISC_TLS_IE21L:
case R_PARISC_TLS_GD14R:
case R_PARISC_TLS_LDM14R:
case R_PARISC_TLS_IE14R:
else
{
struct elf_link_hash_entry *eh;
- bfd_boolean unresolved_reloc;
+ bfd_boolean unresolved_reloc, ignored;
struct elf_link_hash_entry **sym_hashes = elf_sym_hashes (input_bfd);
RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rela,
r_symndx, symtab_hdr, sym_hashes,
eh, sym_sec, relocation,
- unresolved_reloc, warned_undef);
+ unresolved_reloc, warned_undef,
+ ignored);
if (!info->relocatable
&& relocation == 0
hh = hppa_elf_hash_entry (eh);
}
- if (sym_sec != NULL && elf_discarded_section (sym_sec))
- {
- /* For relocs against symbols from removed linkonce
- sections, or sections discarded by a linker script,
- we just want the section contents zeroed. Avoid any
- special processing. */
- _bfd_clear_contents (elf_hppa_howto_table + r_type, input_bfd,
- contents + rela->r_offset);
- rela->r_info = 0;
- rela->r_addend = 0;
- continue;
- }
+ if (sym_sec != NULL && discarded_section (sym_sec))
+ RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section,
+ rela, 1, relend,
+ elf_hppa_howto_table + r_type, 0,
+ contents);
if (info->relocatable)
continue;
|| outrel.r_offset == (bfd_vma) -2);
outrel.r_offset += (input_section->output_offset
+ input_section->output_section->vma);
-
+
if (skip)
{
memset (&outrel, 0, sizeof (outrel));
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
break;
-
+
case R_PARISC_TLS_LDM21L:
case R_PARISC_TLS_LDM14R:
{
bfd_vma off;
-
+
off = htab->tls_ldm_got.offset;
if (off & 1)
off &= ~1;
Elf_Internal_Rela outrel;
bfd_byte *loc;
- outrel.r_offset = (off
+ outrel.r_offset = (off
+ htab->sgot->output_section->vma
+ htab->sgot->output_offset);
outrel.r_addend = 0;
outrel.r_info = ELF32_R_INFO (0, R_PARISC_TLS_DTPMOD32);
- loc = htab->srelgot->contents;
+ loc = htab->srelgot->contents;
loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
|| hh->eh.root.type != bfd_link_hash_undefweak))
{
need_relocs = TRUE;
- loc = htab->srelgot->contents;
+ loc = htab->srelgot->contents;
/* FIXME (CAO): Should this be reloc_count++ ? */
loc += htab->srelgot->reloc_count * sizeof (Elf32_External_Rela);
}
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
- if (eh_name (eh)[0] == '_'
- && (strcmp (eh_name (eh), "_DYNAMIC") == 0
- || eh == htab->etab.hgot))
+ if (eh == htab->etab.hdynamic || eh == htab->etab.hgot)
{
sym->st_shndx = SHN_ABS;
}
dynamic linker, before writing them out. */
static enum elf_reloc_type_class
-elf32_hppa_reloc_type_class (const Elf_Internal_Rela *rela)
+elf32_hppa_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ const asection *rel_sec ATTRIBUTE_UNUSED,
+ const Elf_Internal_Rela *rela)
{
/* Handle TLS relocs first; we don't want them to be marked
- relative by the "if (ELF32_R_SYM (rela->r_info) == 0)"
+ relative by the "if (ELF32_R_SYM (rela->r_info) == STN_UNDEF)"
check below. */
switch ((int) ELF32_R_TYPE (rela->r_info))
{
return reloc_class_normal;
}
- if (ELF32_R_SYM (rela->r_info) == 0)
+ if (ELF32_R_SYM (rela->r_info) == STN_UNDEF)
return reloc_class_relative;
switch ((int) ELF32_R_TYPE (rela->r_info))
bfd *dynobj;
struct elf32_hppa_link_hash_table *htab;
asection *sdyn;
+ asection * sgot;
htab = hppa_link_hash_table (info);
if (htab == NULL)
dynobj = htab->etab.dynobj;
- sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
+ sgot = htab->sgot;
+ /* A broken linker script might have discarded the dynamic sections.
+ Catch this here so that we do not seg-fault later on. */
+ if (sgot != NULL && bfd_is_abs_section (sgot->output_section))
+ return FALSE;
+
+ sdyn = bfd_get_linker_section (dynobj, ".dynamic");
if (htab->etab.dynamic_sections_created)
{
}
}
- if (htab->sgot != NULL && htab->sgot->size != 0)
+ if (sgot != NULL && sgot->size != 0)
{
/* Fill in the first entry in the global offset table.
We use it to point to our dynamic section, if we have one. */
bfd_put_32 (output_bfd,
sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0,
- htab->sgot->contents);
+ sgot->contents);
/* The second entry is reserved for use by the dynamic linker. */
- memset (htab->sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE);
+ memset (sgot->contents + GOT_ENTRY_SIZE, 0, GOT_ENTRY_SIZE);
/* Set .got entry size. */
- elf_section_data (htab->sgot->output_section)
+ elf_section_data (sgot->output_section)
->this_hdr.sh_entsize = GOT_ENTRY_SIZE;
}
if ((htab->splt->output_offset
+ htab->splt->output_section->vma
+ htab->splt->size)
- != (htab->sgot->output_offset
- + htab->sgot->output_section->vma))
+ != (sgot->output_offset
+ + sgot->output_section->vma))
{
(*_bfd_error_handler)
(_(".got section not immediately after .plt section"));
#define elf_info_to_howto_rel elf_hppa_info_to_howto_rel
/* Stuff for the BFD linker. */
-#define bfd_elf32_mkobject elf32_hppa_mkobject
#define bfd_elf32_bfd_final_link elf32_hppa_final_link
#define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create
-#define bfd_elf32_bfd_link_hash_table_free elf32_hppa_link_hash_table_free
#define elf_backend_adjust_dynamic_symbol elf32_hppa_adjust_dynamic_symbol
#define elf_backend_copy_indirect_symbol elf32_hppa_copy_indirect_symbol
#define elf_backend_check_relocs elf32_hppa_check_relocs
#define elf_backend_grok_psinfo elf32_hppa_grok_psinfo
#define elf_backend_object_p elf32_hppa_object_p
#define elf_backend_final_write_processing elf_hppa_final_write_processing
-#define elf_backend_post_process_headers _bfd_elf_set_osabi
#define elf_backend_get_symbol_type elf32_hppa_elf_get_symbol_type
#define elf_backend_reloc_type_class elf32_hppa_reloc_type_class
#define elf_backend_action_discarded elf_hppa_action_discarded
#define elf_backend_got_header_size 8
#define elf_backend_rela_normal 1
-#define TARGET_BIG_SYM bfd_elf32_hppa_vec
+#define TARGET_BIG_SYM hppa_elf32_vec
#define TARGET_BIG_NAME "elf32-hppa"
#define ELF_ARCH bfd_arch_hppa
+#define ELF_TARGET_ID HPPA32_ELF_DATA
#define ELF_MACHINE_CODE EM_PARISC
#define ELF_MAXPAGESIZE 0x1000
#define ELF_OSABI ELFOSABI_HPUX
#include "elf32-target.h"
#undef TARGET_BIG_SYM
-#define TARGET_BIG_SYM bfd_elf32_hppa_linux_vec
+#define TARGET_BIG_SYM hppa_elf32_linux_vec
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf32-hppa-linux"
#undef ELF_OSABI
-#define ELF_OSABI ELFOSABI_LINUX
+#define ELF_OSABI ELFOSABI_GNU
#undef elf32_bed
#define elf32_bed elf32_hppa_linux_bed
#include "elf32-target.h"
#undef TARGET_BIG_SYM
-#define TARGET_BIG_SYM bfd_elf32_hppa_nbsd_vec
+#define TARGET_BIG_SYM hppa_elf32_nbsd_vec
#undef TARGET_BIG_NAME
#define TARGET_BIG_NAME "elf32-hppa-netbsd"
#undef ELF_OSABI