aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-hppa.c
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/elf32-hppa.c')
-rw-r--r--bfd/elf32-hppa.c464
1 files changed, 128 insertions, 336 deletions
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index ca3e8e1..9338793 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -223,8 +223,8 @@ struct elf32_hppa_link_hash_table {
bfd *stub_bfd;
/* Linker call-backs. */
- asection * (*add_stub_section) PARAMS ((const char *, asection *));
- void (*layout_sections_again) PARAMS ((void));
+ asection * (*add_stub_section) (const char *, asection *);
+ void (*layout_sections_again) (void);
/* Array to keep track of which stub sections have been created, and
information on stub grouping. */
@@ -279,139 +279,14 @@ struct elf32_hppa_link_hash_table {
((struct elf32_hppa_stub_hash_entry *) \
bfd_hash_lookup ((table), (string), (create), (copy)))
-static struct bfd_hash_entry *stub_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-
-static struct bfd_hash_entry *hppa_link_hash_newfunc
- PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
-
-static struct bfd_link_hash_table *elf32_hppa_link_hash_table_create
- PARAMS ((bfd *));
-
-static void elf32_hppa_link_hash_table_free
- PARAMS ((struct bfd_link_hash_table *));
-
-/* Stub handling functions. */
-static char *hppa_stub_name
- PARAMS ((const asection *, const asection *,
- const struct elf32_hppa_link_hash_entry *,
- const Elf_Internal_Rela *));
-
-static struct elf32_hppa_stub_hash_entry *hppa_get_stub_entry
- PARAMS ((const asection *, const asection *,
- struct elf32_hppa_link_hash_entry *,
- const Elf_Internal_Rela *,
- struct elf32_hppa_link_hash_table *));
-
-static struct elf32_hppa_stub_hash_entry *hppa_add_stub
- PARAMS ((const char *, asection *, struct elf32_hppa_link_hash_table *));
-
-static enum elf32_hppa_stub_type hppa_type_of_stub
- PARAMS ((asection *, const Elf_Internal_Rela *,
- struct elf32_hppa_link_hash_entry *, bfd_vma));
-
-static bfd_boolean hppa_build_one_stub
- PARAMS ((struct bfd_hash_entry *, PTR));
-
-static bfd_boolean hppa_size_one_stub
- PARAMS ((struct bfd_hash_entry *, PTR));
-
-/* BFD and elf backend functions. */
-static bfd_boolean elf32_hppa_object_p PARAMS ((bfd *));
-
-static bfd_boolean elf32_hppa_add_symbol_hook
- PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
- const char **, flagword *, asection **, bfd_vma *));
-
-static bfd_boolean elf32_hppa_create_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void elf32_hppa_copy_indirect_symbol
- PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
- struct elf_link_hash_entry *));
-
-static bfd_boolean elf32_hppa_check_relocs
- PARAMS ((bfd *, struct bfd_link_info *,
- asection *, const Elf_Internal_Rela *));
-
-static asection *elf32_hppa_gc_mark_hook
- PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-
-static bfd_boolean elf32_hppa_gc_sweep_hook
- PARAMS ((bfd *, struct bfd_link_info *,
- asection *, const Elf_Internal_Rela *));
-
-static void elf32_hppa_hide_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean));
-
-static bfd_boolean elf32_hppa_adjust_dynamic_symbol
- PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
-
-static bfd_boolean mark_PIC_calls
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean allocate_plt_static
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean allocate_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean readonly_dynrelocs
- PARAMS ((struct elf_link_hash_entry *, PTR));
-
-static bfd_boolean clobber_millicode_symbols
- PARAMS ((struct elf_link_hash_entry *, struct bfd_link_info *));
-
-static bfd_boolean elf32_hppa_size_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void group_sections
- PARAMS ((struct elf32_hppa_link_hash_table *, bfd_size_type, bfd_boolean));
-
-static int get_local_syms
- PARAMS ((bfd *, bfd *, struct bfd_link_info *));
-
-static bfd_boolean elf32_hppa_final_link
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void hppa_record_segment_addr
- PARAMS ((bfd *, asection *, PTR));
-
-static bfd_reloc_status_type final_link_relocate
- PARAMS ((asection *, bfd_byte *, const Elf_Internal_Rela *,
- bfd_vma, struct elf32_hppa_link_hash_table *, asection *,
- struct elf32_hppa_link_hash_entry *));
-
-static bfd_boolean elf32_hppa_relocate_section
- PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *,
- bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
-
-static bfd_boolean elf32_hppa_finish_dynamic_symbol
- PARAMS ((bfd *, struct bfd_link_info *,
- struct elf_link_hash_entry *, Elf_Internal_Sym *));
-
-static enum elf_reloc_type_class elf32_hppa_reloc_type_class
- PARAMS ((const Elf_Internal_Rela *));
-
-static bfd_boolean elf32_hppa_finish_dynamic_sections
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static void elf32_hppa_post_process_headers
- PARAMS ((bfd *, struct bfd_link_info *));
-
-static int elf32_hppa_elf_get_symbol_type
- PARAMS ((Elf_Internal_Sym *, int));
-
/* Assorted hash table functions. */
/* Initialize an entry in the stub hash table. */
static struct bfd_hash_entry *
-stub_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+stub_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
@@ -446,10 +321,9 @@ stub_hash_newfunc (entry, table, string)
/* Initialize an entry in the link hash table. */
static struct bfd_hash_entry *
-hppa_link_hash_newfunc (entry, table, string)
- struct bfd_hash_entry *entry;
- struct bfd_hash_table *table;
- const char *string;
+hppa_link_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
{
/* Allocate the structure if it has not already been allocated by a
subclass. */
@@ -483,13 +357,12 @@ hppa_link_hash_newfunc (entry, table, string)
using static variables). */
static struct bfd_link_hash_table *
-elf32_hppa_link_hash_table_create (abfd)
- bfd *abfd;
+elf32_hppa_link_hash_table_create (bfd *abfd)
{
struct elf32_hppa_link_hash_table *ret;
bfd_size_type amt = sizeof (*ret);
- ret = (struct elf32_hppa_link_hash_table *) bfd_malloc (amt);
+ ret = bfd_malloc (amt);
if (ret == NULL)
return NULL;
@@ -528,8 +401,7 @@ elf32_hppa_link_hash_table_create (abfd)
/* Free the derived linker hash table. */
static void
-elf32_hppa_link_hash_table_free (hash)
- struct bfd_link_hash_table *hash;
+elf32_hppa_link_hash_table_free (struct bfd_link_hash_table *hash)
{
struct elf32_hppa_link_hash_table *ret
= (struct elf32_hppa_link_hash_table *) hash;
@@ -541,11 +413,10 @@ elf32_hppa_link_hash_table_free (hash)
/* Build a name for an entry in the stub hash table. */
static char *
-hppa_stub_name (input_section, sym_sec, hash, rel)
- const asection *input_section;
- const asection *sym_sec;
- const struct elf32_hppa_link_hash_entry *hash;
- const Elf_Internal_Rela *rel;
+hppa_stub_name (const asection *input_section,
+ const asection *sym_sec,
+ const struct elf32_hppa_link_hash_entry *hash,
+ const Elf_Internal_Rela *rel)
{
char *stub_name;
bfd_size_type len;
@@ -582,12 +453,11 @@ hppa_stub_name (input_section, sym_sec, hash, rel)
creating the stub name takes a bit of time. */
static struct elf32_hppa_stub_hash_entry *
-hppa_get_stub_entry (input_section, sym_sec, hash, rel, htab)
- const asection *input_section;
- const asection *sym_sec;
- struct elf32_hppa_link_hash_entry *hash;
- const Elf_Internal_Rela *rel;
- struct elf32_hppa_link_hash_table *htab;
+hppa_get_stub_entry (const asection *input_section,
+ const asection *sym_sec,
+ struct elf32_hppa_link_hash_entry *hash,
+ const Elf_Internal_Rela *rel,
+ struct elf32_hppa_link_hash_table *htab)
{
struct elf32_hppa_stub_hash_entry *stub_entry;
const asection *id_sec;
@@ -628,10 +498,9 @@ hppa_get_stub_entry (input_section, sym_sec, hash, rel, htab)
stub entry are initialised. */
static struct elf32_hppa_stub_hash_entry *
-hppa_add_stub (stub_name, section, htab)
- const char *stub_name;
- asection *section;
- struct elf32_hppa_link_hash_table *htab;
+hppa_add_stub (const char *stub_name,
+ asection *section,
+ struct elf32_hppa_link_hash_table *htab)
{
asection *link_sec;
asection *stub_sec;
@@ -684,11 +553,10 @@ hppa_add_stub (stub_name, section, htab)
/* Determine the type of stub needed, if any, for a call. */
static enum elf32_hppa_stub_type
-hppa_type_of_stub (input_sec, rel, hash, destination)
- asection *input_sec;
- const Elf_Internal_Rela *rel;
- struct elf32_hppa_link_hash_entry *hash;
- bfd_vma destination;
+hppa_type_of_stub (asection *input_sec,
+ const Elf_Internal_Rela *rel,
+ struct elf32_hppa_link_hash_entry *hash,
+ bfd_vma destination)
{
bfd_vma location;
bfd_vma branch_offset;
@@ -777,9 +645,7 @@ hppa_type_of_stub (input_sec, rel, hash, destination)
#endif
static bfd_boolean
-hppa_build_one_stub (gen_entry, in_arg)
- struct bfd_hash_entry *gen_entry;
- PTR in_arg;
+hppa_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
{
struct elf32_hppa_stub_hash_entry *stub_entry;
struct bfd_link_info *info;
@@ -795,7 +661,7 @@ hppa_build_one_stub (gen_entry, in_arg)
/* Massage our args to the form they really have. */
stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry;
- info = (struct bfd_link_info *) in_arg;
+ info = in_arg;
htab = hppa_link_hash_table (info);
stub_sec = stub_entry->stub_sec;
@@ -817,11 +683,11 @@ hppa_build_one_stub (gen_entry, in_arg)
+ stub_entry->target_section->output_offset
+ stub_entry->target_section->output_section->vma);
- val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_lrsel);
+ val = hppa_field_adjust (sym_value, 0, e_lrsel);
insn = hppa_rebuild_insn ((int) LDIL_R1, val, 21);
bfd_put_32 (stub_bfd, insn, loc);
- val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_rrsel) >> 2;
+ val = hppa_field_adjust (sym_value, 0, e_rrsel) >> 2;
insn = hppa_rebuild_insn ((int) BE_SR4_R1, val, 17);
bfd_put_32 (stub_bfd, insn, loc + 4);
@@ -867,7 +733,7 @@ hppa_build_one_stub (gen_entry, in_arg)
if (stub_entry->stub_type == hppa_stub_import_shared)
insn = ADDIL_R19;
#endif
- val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_lrsel),
+ val = hppa_field_adjust (sym_value, 0, e_lrsel),
insn = hppa_rebuild_insn ((int) insn, val, 21);
bfd_put_32 (stub_bfd, insn, loc);
@@ -876,7 +742,7 @@ hppa_build_one_stub (gen_entry, in_arg)
lsel/rsel then with unfortunate sym_values we will round
sym_value+4 up to the next 2k block leading to a mis-match
between the lsel and rsel value. */
- val = hppa_field_adjust (sym_value, (bfd_signed_vma) 0, e_rrsel);
+ val = hppa_field_adjust (sym_value, 0, e_rrsel);
insn = hppa_rebuild_insn ((int) LDW_R1_R21, val, 14);
bfd_put_32 (stub_bfd, insn, loc + 4);
@@ -1018,9 +884,7 @@ hppa_build_one_stub (gen_entry, in_arg)
we know stub section sizes. */
static bfd_boolean
-hppa_size_one_stub (gen_entry, in_arg)
- struct bfd_hash_entry *gen_entry;
- PTR in_arg;
+hppa_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
{
struct elf32_hppa_stub_hash_entry *stub_entry;
struct elf32_hppa_link_hash_table *htab;
@@ -1028,7 +892,7 @@ hppa_size_one_stub (gen_entry, in_arg)
/* Massage our args to the form they really have. */
stub_entry = (struct elf32_hppa_stub_hash_entry *) gen_entry;
- htab = (struct elf32_hppa_link_hash_table *) in_arg;
+ htab = in_arg;
if (stub_entry->stub_type == hppa_stub_long_branch)
size = 8;
@@ -1052,8 +916,7 @@ hppa_size_one_stub (gen_entry, in_arg)
Additionally we set the default architecture and machine. */
static bfd_boolean
-elf32_hppa_object_p (abfd)
- bfd *abfd;
+elf32_hppa_object_p (bfd *abfd)
{
Elf_Internal_Ehdr * i_ehdrp;
unsigned int flags;
@@ -1085,30 +948,11 @@ elf32_hppa_object_p (abfd)
return TRUE;
}
-/* Undo the generic ELF code's subtraction of section->vma from the
- value of each external symbol. */
-
-static bfd_boolean
-elf32_hppa_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
- bfd *abfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- const Elf_Internal_Sym *sym ATTRIBUTE_UNUSED;
- const char **namep ATTRIBUTE_UNUSED;
- flagword *flagsp ATTRIBUTE_UNUSED;
- asection **secp;
- bfd_vma *valp;
-{
- *valp += (*secp)->vma;
- return TRUE;
-}
-
/* Create the .plt and .got sections, and set up our hash table
short-cuts to various dynamic sections. */
static bfd_boolean
-elf32_hppa_create_dynamic_sections (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf32_hppa_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
struct elf32_hppa_link_hash_table *htab;
@@ -1146,9 +990,9 @@ elf32_hppa_create_dynamic_sections (abfd, info)
/* Copy the extra info we tack onto an elf_link_hash_entry. */
static void
-elf32_hppa_copy_indirect_symbol (bed, dir, ind)
- struct elf_backend_data *bed;
- struct elf_link_hash_entry *dir, *ind;
+elf32_hppa_copy_indirect_symbol (struct elf_backend_data *bed,
+ struct elf_link_hash_entry *dir,
+ struct elf_link_hash_entry *ind)
{
struct elf32_hppa_link_hash_entry *edir, *eind;
@@ -1200,11 +1044,10 @@ elf32_hppa_copy_indirect_symbol (bed, dir, ind)
necessarily read all the input files. */
static bfd_boolean
-elf32_hppa_check_relocs (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+elf32_hppa_check_relocs (bfd *abfd,
+ struct bfd_link_info *info,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
@@ -1422,8 +1265,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
pointer. */
size = symtab_hdr->sh_info;
size *= 2 * sizeof (bfd_signed_vma);
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
+ local_got_refcounts = bfd_zalloc (abfd, size);
if (local_got_refcounts == NULL)
return FALSE;
elf_local_got_refcounts (abfd) = local_got_refcounts;
@@ -1469,8 +1311,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
plt offsets. */
size = symtab_hdr->sh_info;
size *= 2 * sizeof (bfd_signed_vma);
- local_got_refcounts = ((bfd_signed_vma *)
- bfd_zalloc (abfd, size));
+ local_got_refcounts = bfd_zalloc (abfd, size);
if (local_got_refcounts == NULL)
return FALSE;
elf_local_got_refcounts (abfd) = local_got_refcounts;
@@ -1604,9 +1445,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
p = *head;
if (p == NULL || p->sec != sec)
{
- p = ((struct elf32_hppa_dyn_reloc_entry *)
- bfd_alloc (htab->elf.dynobj,
- (bfd_size_type) sizeof *p));
+ p = bfd_alloc (htab->elf.dynobj, sizeof *p);
if (p == NULL)
return FALSE;
p->next = *head;
@@ -1634,12 +1473,11 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
for a given relocation. */
static asection *
-elf32_hppa_gc_mark_hook (sec, info, rel, h, sym)
- asection *sec;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- Elf_Internal_Rela *rel;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf32_hppa_gc_mark_hook (asection *sec,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ Elf_Internal_Rela *rel,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
if (h != NULL)
{
@@ -1674,11 +1512,10 @@ elf32_hppa_gc_mark_hook (sec, info, rel, h, sym)
removed. */
static bfd_boolean
-elf32_hppa_gc_sweep_hook (abfd, info, sec, relocs)
- bfd *abfd;
- struct bfd_link_info *info ATTRIBUTE_UNUSED;
- asection *sec;
- const Elf_Internal_Rela *relocs;
+elf32_hppa_gc_sweep_hook (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED,
+ asection *sec,
+ const Elf_Internal_Rela *relocs)
{
Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes;
@@ -1777,10 +1614,9 @@ elf32_hppa_gc_sweep_hook (abfd, info, sec, relocs)
plabels. */
static void
-elf32_hppa_hide_symbol (info, h, force_local)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- bfd_boolean force_local;
+elf32_hppa_hide_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ bfd_boolean force_local)
{
if (force_local)
{
@@ -1818,9 +1654,8 @@ elf32_hppa_hide_symbol (info, h, force_local)
understand. */
static bfd_boolean
-elf32_hppa_adjust_dynamic_symbol (info, h)
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
+elf32_hppa_adjust_dynamic_symbol (struct bfd_link_info *info,
+ struct elf_link_hash_entry *h)
{
struct elf32_hppa_link_hash_table *htab;
struct elf32_hppa_link_hash_entry *eh;
@@ -1963,9 +1798,7 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
the first part of elf32_hppa_adjust_dynamic_symbol. */
static bfd_boolean
-mark_PIC_calls (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf ATTRIBUTE_UNUSED;
+mark_PIC_calls (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
{
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -1990,9 +1823,7 @@ mark_PIC_calls (h, inf)
ie. pic_call and plabel entries. */
static bfd_boolean
-allocate_plt_static (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+allocate_plt_static (struct elf_link_hash_entry *h, void *inf)
{
struct bfd_link_info *info;
struct elf32_hppa_link_hash_table *htab;
@@ -2004,7 +1835,7 @@ allocate_plt_static (h, inf)
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- info = (struct bfd_link_info *) inf;
+ info = inf;
htab = hppa_link_hash_table (info);
if (((struct elf32_hppa_link_hash_entry *) h)->pic_call)
{
@@ -2064,9 +1895,7 @@ allocate_plt_static (h, inf)
global syms. */
static bfd_boolean
-allocate_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{
struct bfd_link_info *info;
struct elf32_hppa_link_hash_table *htab;
@@ -2080,7 +1909,7 @@ allocate_dynrelocs (h, inf)
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
- info = (struct bfd_link_info *) inf;
+ info = inf;
htab = hppa_link_hash_table (info);
if (htab->elf.dynamic_sections_created
&& h->plt.offset != (bfd_vma) -1
@@ -2205,9 +2034,8 @@ allocate_dynrelocs (h, inf)
elf_adjust_dynamic_symbol. */
static bfd_boolean
-clobber_millicode_symbols (h, info)
- struct elf_link_hash_entry *h;
- struct bfd_link_info *info;
+clobber_millicode_symbols (struct elf_link_hash_entry *h,
+ struct bfd_link_info *info)
{
if (h->root.type == bfd_link_hash_warning)
h = (struct elf_link_hash_entry *) h->root.u.i.link;
@@ -2223,9 +2051,7 @@ clobber_millicode_symbols (h, info)
/* Find any dynamic relocs that apply to read-only sections. */
static bfd_boolean
-readonly_dynrelocs (h, inf)
- struct elf_link_hash_entry *h;
- PTR inf;
+readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
{
struct elf32_hppa_link_hash_entry *eh;
struct elf32_hppa_dyn_reloc_entry *p;
@@ -2240,7 +2066,7 @@ readonly_dynrelocs (h, inf)
if (s != NULL && (s->flags & SEC_READONLY) != 0)
{
- struct bfd_link_info *info = (struct bfd_link_info *) inf;
+ struct bfd_link_info *info = inf;
info->flags |= DF_TEXTREL;
@@ -2254,9 +2080,8 @@ readonly_dynrelocs (h, inf)
/* Set the sizes of the dynamic sections. */
static bfd_boolean
-elf32_hppa_size_dynamic_sections (output_bfd, info)
- bfd *output_bfd ATTRIBUTE_UNUSED;
- struct bfd_link_info *info;
+elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
{
struct elf32_hppa_link_hash_table *htab;
bfd *dynobj;
@@ -2292,7 +2117,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
PIC, and mark them as needing .plt entries so that %r19 will
be set up. */
if (! info->shared)
- elf_link_hash_traverse (&htab->elf, mark_PIC_calls, (PTR) info);
+ elf_link_hash_traverse (&htab->elf, mark_PIC_calls, info);
}
/* Set up .got and .plt offsets for local syms, and space for local
@@ -2389,11 +2214,11 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
/* Do all the .plt entries without relocs first. The dynamic linker
uses the last .plt reloc to find the end of the .plt (and hence
the start of the .got) for lazy linking. */
- elf_link_hash_traverse (&htab->elf, allocate_plt_static, (PTR) info);
+ elf_link_hash_traverse (&htab->elf, allocate_plt_static, info);
/* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */
- elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
+ elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, info);
/* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate
@@ -2460,7 +2285,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
/* Allocate memory for the section contents. Zero it, because
we may not fill in all the reloc sections. */
- s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size);
+ s->contents = bfd_zalloc (dynobj, s->_raw_size);
if (s->contents == NULL && s->_raw_size != 0)
return FALSE;
}
@@ -2506,8 +2331,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
/* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */
if ((info->flags & DF_TEXTREL) == 0)
- elf_link_hash_traverse (&htab->elf, readonly_dynrelocs,
- (PTR) info);
+ elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, info);
if ((info->flags & DF_TEXTREL) != 0)
{
@@ -2528,9 +2352,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
0 when no stubs will be needed, and 1 on success. */
int
-elf32_hppa_setup_section_lists (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+elf32_hppa_setup_section_lists (bfd *output_bfd, struct bfd_link_info *info)
{
bfd *input_bfd;
unsigned int bfd_count;
@@ -2560,7 +2382,7 @@ elf32_hppa_setup_section_lists (output_bfd, info)
htab->bfd_count = bfd_count;
amt = sizeof (struct map_stub) * (top_id + 1);
- htab->stub_group = (struct map_stub *) bfd_zmalloc (amt);
+ htab->stub_group = bfd_zmalloc (amt);
if (htab->stub_group == NULL)
return -1;
@@ -2577,7 +2399,7 @@ elf32_hppa_setup_section_lists (output_bfd, info)
htab->top_index = top_index;
amt = sizeof (asection *) * (top_index + 1);
- input_list = (asection **) bfd_malloc (amt);
+ input_list = bfd_malloc (amt);
htab->input_list = input_list;
if (input_list == NULL)
return -1;
@@ -2606,9 +2428,7 @@ elf32_hppa_setup_section_lists (output_bfd, info)
we may insert linker stubs. */
void
-elf32_hppa_next_input_section (info, isec)
- struct bfd_link_info *info;
- asection *isec;
+elf32_hppa_next_input_section (struct bfd_link_info *info, asection *isec)
{
struct elf32_hppa_link_hash_table *htab = hppa_link_hash_table (info);
@@ -2635,10 +2455,9 @@ elf32_hppa_next_input_section (info, isec)
the middle of a function is not a good idea. */
static void
-group_sections (htab, stub_group_size, stubs_always_before_branch)
- struct elf32_hppa_link_hash_table *htab;
- bfd_size_type stub_group_size;
- bfd_boolean stubs_always_before_branch;
+group_sections (struct elf32_hppa_link_hash_table *htab,
+ bfd_size_type stub_group_size,
+ bfd_boolean stubs_always_before_branch)
{
asection **list = htab->input_list + htab->top_index;
do
@@ -2716,10 +2535,7 @@ group_sections (htab, stub_group_size, stubs_always_before_branch)
Returns -1 on error, 1 if export stubs created, 0 otherwise. */
static int
-get_local_syms (output_bfd, input_bfd, info)
- bfd *output_bfd;
- bfd *input_bfd;
- struct bfd_link_info *info;
+get_local_syms (bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info)
{
unsigned int bfd_indx;
Elf_Internal_Sym *local_syms, **all_local_syms;
@@ -2730,7 +2546,7 @@ get_local_syms (output_bfd, input_bfd, info)
we need to read in the local symbols in parallel and save them for
later use; so hold pointers to the local symbols in an array. */
bfd_size_type amt = sizeof (Elf_Internal_Sym *) * htab->bfd_count;
- all_local_syms = (Elf_Internal_Sym **) bfd_zmalloc (amt);
+ all_local_syms = bfd_zmalloc (amt);
htab->all_local_syms = all_local_syms;
if (all_local_syms == NULL)
return -1;
@@ -2844,15 +2660,11 @@ get_local_syms (output_bfd, input_bfd, info)
instruction. */
bfd_boolean
-elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
- add_stub_section, layout_sections_again)
- bfd *output_bfd;
- bfd *stub_bfd;
- struct bfd_link_info *info;
- bfd_boolean multi_subspace;
- bfd_signed_vma group_size;
- asection * (*add_stub_section) PARAMS ((const char *, asection *));
- void (*layout_sections_again) PARAMS ((void));
+elf32_hppa_size_stubs
+ (bfd *output_bfd, bfd *stub_bfd, struct bfd_link_info *info,
+ bfd_boolean multi_subspace, bfd_signed_vma group_size,
+ asection * (*add_stub_section) (const char *, asection *),
+ void (*layout_sections_again) (void))
{
bfd_size_type stub_group_size;
bfd_boolean stubs_always_before_branch;
@@ -2950,8 +2762,7 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
/* Get the relocs. */
internal_relocs
- = _bfd_elf_link_read_relocs (input_bfd, section, NULL,
- (Elf_Internal_Rela *) NULL,
+ = _bfd_elf_link_read_relocs (input_bfd, section, NULL, NULL,
info->keep_memory);
if (internal_relocs == NULL)
goto error_ret_free_local;
@@ -3138,9 +2949,7 @@ elf32_hppa_size_stubs (output_bfd, stub_bfd, info, multi_subspace, group_size,
stubs to provide a value for __gp. */
bfd_boolean
-elf32_hppa_set_gp (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf32_hppa_set_gp (bfd *abfd, struct bfd_link_info *info)
{
struct bfd_link_hash_entry *h;
asection *sec = NULL;
@@ -3234,8 +3043,7 @@ elf32_hppa_set_gp (abfd, info)
linker. */
bfd_boolean
-elf32_hppa_build_stubs (info)
- struct bfd_link_info *info;
+elf32_hppa_build_stubs (struct bfd_link_info *info)
{
asection *stub_sec;
struct bfd_hash_table *table;
@@ -3251,7 +3059,7 @@ elf32_hppa_build_stubs (info)
/* Allocate memory to hold the linker stubs. */
size = stub_sec->_raw_size;
- stub_sec->contents = (unsigned char *) bfd_zalloc (htab->stub_bfd, size);
+ stub_sec->contents = bfd_zalloc (htab->stub_bfd, size);
if (stub_sec->contents == NULL && size != 0)
return FALSE;
stub_sec->_raw_size = 0;
@@ -3267,9 +3075,7 @@ elf32_hppa_build_stubs (info)
/* Perform a final link. */
static bfd_boolean
-elf32_hppa_final_link (abfd, info)
- bfd *abfd;
- struct bfd_link_info *info;
+elf32_hppa_final_link (bfd *abfd, struct bfd_link_info *info)
{
/* Invoke the regular ELF linker to do all the work. */
if (!bfd_elf32_bfd_final_link (abfd, info))
@@ -3283,10 +3089,9 @@ elf32_hppa_final_link (abfd, info)
/* Record the lowest address for the data and text segments. */
static void
-hppa_record_segment_addr (abfd, section, data)
- bfd *abfd ATTRIBUTE_UNUSED;
- asection *section;
- PTR data;
+hppa_record_segment_addr (bfd *abfd ATTRIBUTE_UNUSED,
+ asection *section,
+ void *data)
{
struct elf32_hppa_link_hash_table *htab;
@@ -3312,14 +3117,13 @@ hppa_record_segment_addr (abfd, section, data)
/* Perform a relocation as part of a final link. */
static bfd_reloc_status_type
-final_link_relocate (input_section, contents, rel, value, htab, sym_sec, h)
- asection *input_section;
- bfd_byte *contents;
- const Elf_Internal_Rela *rel;
- bfd_vma value;
- struct elf32_hppa_link_hash_table *htab;
- asection *sym_sec;
- struct elf32_hppa_link_hash_entry *h;
+final_link_relocate (asection *input_section,
+ bfd_byte *contents,
+ const Elf_Internal_Rela *rel,
+ bfd_vma value,
+ struct elf32_hppa_link_hash_table *htab,
+ asection *sym_sec,
+ struct elf32_hppa_link_hash_entry *h)
{
int insn;
unsigned int r_type = ELF32_R_TYPE (rel->r_info);
@@ -3576,16 +3380,14 @@ final_link_relocate (input_section, contents, rel, value, htab, sym_sec, h)
/* Relocate an HPPA ELF section. */
static bfd_boolean
-elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
- contents, relocs, local_syms, local_sections)
- bfd *output_bfd;
- struct bfd_link_info *info;
- bfd *input_bfd;
- asection *input_section;
- bfd_byte *contents;
- Elf_Internal_Rela *relocs;
- Elf_Internal_Sym *local_syms;
- asection **local_sections;
+elf32_hppa_relocate_section (bfd *output_bfd,
+ struct bfd_link_info *info,
+ bfd *input_bfd,
+ asection *input_section,
+ bfd_byte *contents,
+ Elf_Internal_Rela *relocs,
+ Elf_Internal_Sym *local_syms,
+ asection **local_sections)
{
bfd_vma *local_got_offsets;
struct elf32_hppa_link_hash_table *htab;
@@ -4049,8 +3851,8 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
if (!((*info->callbacks->reloc_overflow)
- (info, sym_name, howto->name, (bfd_vma) 0,
- input_bfd, input_section, rel->r_offset)))
+ (info, sym_name, howto->name, 0, input_bfd, input_section,
+ rel->r_offset)))
return FALSE;
}
}
@@ -4062,11 +3864,10 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
dynamic sections here. */
static bfd_boolean
-elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
- bfd *output_bfd;
- struct bfd_link_info *info;
- struct elf_link_hash_entry *h;
- Elf_Internal_Sym *sym;
+elf32_hppa_finish_dynamic_symbol (bfd *output_bfd,
+ struct bfd_link_info *info,
+ struct elf_link_hash_entry *h,
+ Elf_Internal_Sym *sym)
{
struct elf32_hppa_link_hash_table *htab;
@@ -4171,8 +3972,7 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
{
if ((h->got.offset & 1) != 0)
abort ();
- bfd_put_32 (output_bfd, (bfd_vma) 0,
- htab->sgot->contents + h->got.offset);
+ bfd_put_32 (output_bfd, 0, htab->sgot->contents + h->got.offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_DIR32);
rel.r_addend = 0;
}
@@ -4221,8 +4021,7 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
dynamic linker, before writing them out. */
static enum elf_reloc_type_class
-elf32_hppa_reloc_type_class (rela)
- const Elf_Internal_Rela *rela;
+elf32_hppa_reloc_type_class (const Elf_Internal_Rela *rela)
{
if (ELF32_R_SYM (rela->r_info) == 0)
return reloc_class_relative;
@@ -4241,9 +4040,8 @@ elf32_hppa_reloc_type_class (rela)
/* Finish up the dynamic sections. */
static bfd_boolean
-elf32_hppa_finish_dynamic_sections (output_bfd, info)
- bfd *output_bfd;
- struct bfd_link_info *info;
+elf32_hppa_finish_dynamic_sections (bfd *output_bfd,
+ struct bfd_link_info *info)
{
bfd *dynobj;
struct elf32_hppa_link_hash_table *htab;
@@ -4321,9 +4119,7 @@ elf32_hppa_finish_dynamic_sections (output_bfd, info)
/* 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 != NULL
- ? sdyn->output_section->vma + sdyn->output_offset
- : (bfd_vma) 0),
+ sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0,
htab->sgot->contents);
/* The second entry is reserved for use by the dynamic linker. */
@@ -4366,9 +4162,8 @@ elf32_hppa_finish_dynamic_sections (output_bfd, info)
/* Tweak the OSABI field of the elf header. */
static void
-elf32_hppa_post_process_headers (abfd, link_info)
- bfd *abfd;
- struct bfd_link_info *link_info ATTRIBUTE_UNUSED;
+elf32_hppa_post_process_headers (bfd *abfd,
+ struct bfd_link_info *info ATTRIBUTE_UNUSED)
{
Elf_Internal_Ehdr * i_ehdrp;
@@ -4387,9 +4182,7 @@ elf32_hppa_post_process_headers (abfd, link_info)
/* Called when writing out an object file to decide the type of a
symbol. */
static int
-elf32_hppa_elf_get_symbol_type (elf_sym, type)
- Elf_Internal_Sym *elf_sym;
- int type;
+elf32_hppa_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
{
if (ELF_ST_TYPE (elf_sym->st_info) == STT_PARISC_MILLI)
return STT_PARISC_MILLI;
@@ -4407,7 +4200,6 @@ elf32_hppa_elf_get_symbol_type (elf_sym, type)
#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_add_symbol_hook elf32_hppa_add_symbol_hook
#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