* elf32-sh.c: Convert to C90. Replace PTR with void *.

* elf32-sh64-com.c: Likewise.
	* elf32-sh64.c: Likewise.
	* elf32-sh64.h: Likewise.
	* elf64-sh64.c: Likewise.
This commit is contained in:
Kaz Kojima 2003-07-25 06:19:20 +00:00
parent 13752416b5
commit 09fd220b8e
6 changed files with 317 additions and 496 deletions

View file

@ -1,3 +1,11 @@
2003-07-25 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* elf32-sh.c: Convert to C90. Replace PTR with void *.
* elf32-sh64-com.c: Likewise.
* elf32-sh64.c: Likewise.
* elf32-sh64.h: Likewise.
* elf64-sh64.c: Likewise.
2003-07-24 Kaz Kojima <kkojima@rr.iij4u.or.jp> 2003-07-24 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* elf32-sh.c (sh_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL. * elf32-sh.c (sh_elf_adjust_dynamic_symbol): Use SYMBOL_CALLS_LOCAL.

View file

@ -27,90 +27,88 @@
#include "elf/sh.h" #include "elf/sh.h"
static bfd_reloc_status_type sh_elf_reloc static bfd_reloc_status_type sh_elf_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type sh_elf_ignore_reloc static bfd_reloc_status_type sh_elf_ignore_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static reloc_howto_type *sh_elf_reloc_type_lookup static reloc_howto_type *sh_elf_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type)); (bfd *, bfd_reloc_code_real_type);
static void sh_elf_info_to_howto static void sh_elf_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); (bfd *, arelent *, Elf_Internal_Rela *);
static bfd_boolean sh_elf_set_private_flags static bfd_boolean sh_elf_set_private_flags
PARAMS ((bfd *, flagword)); (bfd *, flagword);
static bfd_boolean sh_elf_copy_private_data static bfd_boolean sh_elf_copy_private_data
PARAMS ((bfd *, bfd *)); (bfd *, bfd *);
static bfd_boolean sh_elf_merge_private_data static bfd_boolean sh_elf_merge_private_data
PARAMS ((bfd *, bfd *)); (bfd *, bfd *);
static bfd_boolean sh_elf_set_mach_from_flags static bfd_boolean sh_elf_set_mach_from_flags
PARAMS ((bfd *)); (bfd *);
static bfd_boolean sh_elf_relax_section static bfd_boolean sh_elf_relax_section
PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); (bfd *, asection *, struct bfd_link_info *, bfd_boolean *);
static bfd_boolean sh_elf_relax_delete_bytes static bfd_boolean sh_elf_relax_delete_bytes
PARAMS ((bfd *, asection *, bfd_vma, int)); (bfd *, asection *, bfd_vma, int);
static bfd_boolean sh_elf_align_loads static bfd_boolean sh_elf_align_loads
PARAMS ((bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, bfd_boolean *)); (bfd *, asection *, Elf_Internal_Rela *, bfd_byte *, bfd_boolean *);
static bfd_boolean sh_elf_swap_insns static bfd_boolean sh_elf_swap_insns
PARAMS ((bfd *, asection *, PTR, bfd_byte *, bfd_vma)); (bfd *, asection *, void *, bfd_byte *, bfd_vma);
static bfd_boolean sh_elf_relocate_section static bfd_boolean sh_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
static bfd_byte *sh_elf_get_relocated_section_contents static bfd_byte *sh_elf_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
bfd_byte *, bfd_boolean, asymbol **)); bfd_boolean, asymbol **);
static void sh_elf_copy_indirect_symbol static void sh_elf_copy_indirect_symbol
PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *, (struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *)); struct elf_link_hash_entry *);
static int sh_elf_optimized_tls_reloc static int sh_elf_optimized_tls_reloc
PARAMS ((struct bfd_link_info *, int, int)); (struct bfd_link_info *, int, int);
static bfd_boolean sh_elf_mkobject static bfd_boolean sh_elf_mkobject
PARAMS ((bfd *)); (bfd *);
static bfd_boolean sh_elf_object_p static bfd_boolean sh_elf_object_p
PARAMS ((bfd *)); (bfd *);
static bfd_boolean sh_elf_check_relocs static bfd_boolean sh_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *, (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
const Elf_Internal_Rela *));
static struct bfd_hash_entry *sh_elf_link_hash_newfunc static struct bfd_hash_entry *sh_elf_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
static struct bfd_link_hash_table *sh_elf_link_hash_table_create static struct bfd_link_hash_table *sh_elf_link_hash_table_create
PARAMS ((bfd *)); (bfd *);
static bfd_boolean sh_elf_adjust_dynamic_symbol static bfd_boolean sh_elf_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); (struct bfd_link_info *, struct elf_link_hash_entry *);
static bfd_boolean sh_elf_size_dynamic_sections static bfd_boolean sh_elf_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *)); (bfd *, struct bfd_link_info *);
static bfd_boolean sh_elf_finish_dynamic_symbol static bfd_boolean sh_elf_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *)); Elf_Internal_Sym *);
static bfd_boolean sh_elf_finish_dynamic_sections static bfd_boolean sh_elf_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *)); (bfd *, struct bfd_link_info *);
static bfd_reloc_status_type sh_elf_reloc_loop static bfd_reloc_status_type sh_elf_reloc_loop
PARAMS ((int, bfd *, asection *, bfd_byte *, bfd_vma, asection *, (int, bfd *, asection *, bfd_byte *, bfd_vma, asection *, bfd_vma,
bfd_vma, bfd_vma)); bfd_vma);
static bfd_boolean create_got_section static bfd_boolean create_got_section
PARAMS ((bfd *, struct bfd_link_info *)); (bfd *, struct bfd_link_info *);
static bfd_boolean sh_elf_create_dynamic_sections static bfd_boolean sh_elf_create_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *)); (bfd *, struct bfd_link_info *);
static bfd_vma dtpoff_base static bfd_vma dtpoff_base
PARAMS ((struct bfd_link_info *)); (struct bfd_link_info *);
static bfd_vma tpoff static bfd_vma tpoff
PARAMS ((struct bfd_link_info *, bfd_vma)); (struct bfd_link_info *, bfd_vma);
static asection * sh_elf_gc_mark_hook static asection * sh_elf_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *)); struct elf_link_hash_entry *, Elf_Internal_Sym *);
static bfd_boolean sh_elf_gc_sweep_hook static bfd_boolean sh_elf_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *, (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
const Elf_Internal_Rela *));
static bfd_boolean allocate_dynrelocs static bfd_boolean allocate_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR)); (struct elf_link_hash_entry *, void *);
static bfd_boolean readonly_dynrelocs static bfd_boolean readonly_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR)); (struct elf_link_hash_entry *, void *);
static enum elf_reloc_type_class sh_elf_reloc_type_class static enum elf_reloc_type_class sh_elf_reloc_type_class
PARAMS ((const Elf_Internal_Rela *)); (const Elf_Internal_Rela *);
#ifdef INCLUDE_SHMEDIA #ifdef INCLUDE_SHMEDIA
inline static void movi_shori_putval PARAMS ((bfd *, unsigned long, char *)); inline static void movi_shori_putval (bfd *, unsigned long, char *);
#endif #endif
static bfd_boolean elf32_shlin_grok_prstatus static bfd_boolean elf32_shlin_grok_prstatus
PARAMS ((bfd *abfd, Elf_Internal_Note *note)); (bfd *abfd, Elf_Internal_Note *note);
static bfd_boolean elf32_shlin_grok_psinfo static bfd_boolean elf32_shlin_grok_psinfo
PARAMS ((bfd *abfd, Elf_Internal_Note *note)); (bfd *abfd, Elf_Internal_Note *note);
/* The name of the dynamic interpreter. This is put in the .interp /* The name of the dynamic interpreter. This is put in the .interp
section. */ section. */
@ -1664,15 +1662,10 @@ static reloc_howto_type sh_elf_howto_table[] =
}; };
static bfd_reloc_status_type static bfd_reloc_status_type
sh_elf_reloc_loop (r_type, input_bfd, input_section, contents, addr, sh_elf_reloc_loop (int r_type ATTRIBUTE_UNUSED, bfd *input_bfd,
symbol_section, start, end) asection *input_section, bfd_byte *contents,
int r_type ATTRIBUTE_UNUSED; bfd_vma addr, asection *symbol_section,
bfd *input_bfd; bfd_vma start, bfd_vma end)
asection *input_section;
bfd_byte *contents;
bfd_vma addr;
asection *symbol_section;
bfd_vma start, end;
{ {
static bfd_vma last_addr; static bfd_vma last_addr;
static asection *last_symbol_section; static asection *last_symbol_section;
@ -1774,15 +1767,9 @@ sh_elf_reloc_loop (r_type, input_bfd, input_section, contents, addr,
function, and is almost certainly incorrect for other ELF targets. */ function, and is almost certainly incorrect for other ELF targets. */
static bfd_reloc_status_type static bfd_reloc_status_type
sh_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, sh_elf_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol_in,
error_message) void *data, asection *input_section, bfd *output_bfd,
bfd *abfd; char **error_message ATTRIBUTE_UNUSED)
arelent *reloc_entry;
asymbol *symbol_in;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{ {
unsigned long insn; unsigned long insn;
bfd_vma sym_value; bfd_vma sym_value;
@ -1849,15 +1836,11 @@ sh_elf_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd,
which the linker should otherwise ignore. */ which the linker should otherwise ignore. */
static bfd_reloc_status_type static bfd_reloc_status_type
sh_elf_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, sh_elf_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
output_bfd, error_message) asymbol *symbol ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; void *data ATTRIBUTE_UNUSED, asection *input_section,
arelent *reloc_entry; bfd *output_bfd,
asymbol *symbol ATTRIBUTE_UNUSED; char **error_message ATTRIBUTE_UNUSED)
PTR data ATTRIBUTE_UNUSED;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{ {
if (output_bfd != NULL) if (output_bfd != NULL)
reloc_entry->address += input_section->output_offset; reloc_entry->address += input_section->output_offset;
@ -1971,9 +1954,8 @@ static const struct elf_reloc_map sh_reloc_map[] =
corresponding SH ELf reloc. */ corresponding SH ELf reloc. */
static reloc_howto_type * static reloc_howto_type *
sh_elf_reloc_type_lookup (abfd, code) sh_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type code)
bfd_reloc_code_real_type code;
{ {
unsigned int i; unsigned int i;
@ -1989,10 +1971,8 @@ sh_elf_reloc_type_lookup (abfd, code)
/* Given an ELF reloc, fill in the howto field of a relent. */ /* Given an ELF reloc, fill in the howto field of a relent. */
static void static void
sh_elf_info_to_howto (abfd, cache_ptr, dst) sh_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
bfd *abfd ATTRIBUTE_UNUSED; Elf_Internal_Rela *dst)
arelent *cache_ptr;
Elf_Internal_Rela *dst;
{ {
unsigned int r; unsigned int r;
@ -2019,11 +1999,8 @@ sh_elf_info_to_howto (abfd, cache_ptr, dst)
they come from enum elf_sh_reloc_type in include/elf/sh.h. */ they come from enum elf_sh_reloc_type in include/elf/sh.h. */
static bfd_boolean static bfd_boolean
sh_elf_relax_section (abfd, sec, link_info, again) sh_elf_relax_section (bfd *abfd, asection *sec,
bfd *abfd; struct bfd_link_info *link_info, bfd_boolean *again)
asection *sec;
struct bfd_link_info *link_info;
bfd_boolean *again;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *internal_relocs; Elf_Internal_Rela *internal_relocs;
@ -2055,7 +2032,7 @@ sh_elf_relax_section (abfd, sec, link_info, again)
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
internal_relocs = (_bfd_elf_link_read_relocs internal_relocs = (_bfd_elf_link_read_relocs
(abfd, sec, (PTR) NULL, (Elf_Internal_Rela *) NULL, (abfd, sec, NULL, (Elf_Internal_Rela *) NULL,
link_info->keep_memory)); link_info->keep_memory));
if (internal_relocs == NULL) if (internal_relocs == NULL)
goto error_return; goto error_return;
@ -2411,11 +2388,8 @@ sh_elf_relax_section (abfd, sec, link_info, again)
in coff-sh.c. */ in coff-sh.c. */
static bfd_boolean static bfd_boolean
sh_elf_relax_delete_bytes (abfd, sec, addr, count) sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr,
bfd *abfd; int count)
asection *sec;
bfd_vma addr;
int count;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
unsigned int sec_shndx; unsigned int sec_shndx;
@ -2737,8 +2711,7 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
FALSE, we should free them, if we are permitted to, when we FALSE, we should free them, if we are permitted to, when we
leave sh_coff_relax_section. */ leave sh_coff_relax_section. */
internal_relocs = (_bfd_elf_link_read_relocs internal_relocs = (_bfd_elf_link_read_relocs
(abfd, o, (PTR) NULL, (Elf_Internal_Rela *) NULL, (abfd, o, NULL, (Elf_Internal_Rela *) NULL, TRUE));
TRUE));
if (internal_relocs == NULL) if (internal_relocs == NULL)
return FALSE; return FALSE;
@ -2892,12 +2865,10 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
boundaries. This is like sh_align_loads in coff-sh.c. */ boundaries. This is like sh_align_loads in coff-sh.c. */
static bfd_boolean static bfd_boolean
sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped) sh_elf_align_loads (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
bfd *abfd ATTRIBUTE_UNUSED; Elf_Internal_Rela *internal_relocs,
asection *sec; bfd_byte *contents ATTRIBUTE_UNUSED,
Elf_Internal_Rela *internal_relocs; bfd_boolean *pswapped)
bfd_byte *contents ATTRIBUTE_UNUSED;
bfd_boolean *pswapped;
{ {
Elf_Internal_Rela *irel, *irelend; Elf_Internal_Rela *irel, *irelend;
bfd_vma *labels = NULL; bfd_vma *labels = NULL;
@ -2948,7 +2919,7 @@ sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped)
stop = sec->_cooked_size; stop = sec->_cooked_size;
if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_elf_swap_insns, if (! _bfd_sh_align_load_span (abfd, sec, contents, sh_elf_swap_insns,
(PTR) internal_relocs, &label, internal_relocs, &label,
label_end, start, stop, pswapped)) label_end, start, stop, pswapped))
goto error_return; goto error_return;
} }
@ -2966,12 +2937,8 @@ sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped)
/* Swap two SH instructions. This is like sh_swap_insns in coff-sh.c. */ /* Swap two SH instructions. This is like sh_swap_insns in coff-sh.c. */
static bfd_boolean static bfd_boolean
sh_elf_swap_insns (abfd, sec, relocs, contents, addr) sh_elf_swap_insns (bfd *abfd, asection *sec, void *relocs,
bfd *abfd; bfd_byte *contents, bfd_vma addr)
asection *sec;
PTR relocs;
bfd_byte *contents;
bfd_vma addr;
{ {
Elf_Internal_Rela *internal_relocs = (Elf_Internal_Rela *) relocs; Elf_Internal_Rela *internal_relocs = (Elf_Internal_Rela *) relocs;
unsigned short i1, i2; unsigned short i1, i2;
@ -3252,10 +3219,7 @@ static const bfd_byte *elf_sh_pic_plt_entry;
#define elf_sh_plt_reloc_offset(info) (info->shared ? 52 : 44) #define elf_sh_plt_reloc_offset(info) (info->shared ? 52 : 44)
inline static void inline static void
movi_shori_putval (output_bfd, value, addr) movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr)
bfd *output_bfd;
unsigned long value;
char *addr;
{ {
bfd_put_32 (output_bfd, bfd_put_32 (output_bfd,
bfd_get_32 (output_bfd, addr) bfd_get_32 (output_bfd, addr)
@ -3573,8 +3537,7 @@ struct sh_elf_obj_tdata
as the specific tdata. */ as the specific tdata. */
static bfd_boolean static bfd_boolean
sh_elf_mkobject (abfd) sh_elf_mkobject (bfd *abfd)
bfd *abfd;
{ {
bfd_size_type amt = sizeof (struct sh_elf_obj_tdata); bfd_size_type amt = sizeof (struct sh_elf_obj_tdata);
abfd->tdata.any = bfd_zalloc (abfd, amt); abfd->tdata.any = bfd_zalloc (abfd, amt);
@ -3614,7 +3577,7 @@ struct elf_sh_link_hash_table
#define sh_elf_link_hash_traverse(table, func, info) \ #define sh_elf_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \ (elf_link_hash_traverse \
(&(table)->root, \ (&(table)->root, \
(bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
(info))) (info)))
/* Get the sh ELF linker hash table from a link_info structure. */ /* Get the sh ELF linker hash table from a link_info structure. */
@ -3625,10 +3588,9 @@ struct elf_sh_link_hash_table
/* Create an entry in an sh ELF linker hash table. */ /* Create an entry in an sh ELF linker hash table. */
static struct bfd_hash_entry * static struct bfd_hash_entry *
sh_elf_link_hash_newfunc (entry, table, string) sh_elf_link_hash_newfunc (struct bfd_hash_entry *entry,
struct bfd_hash_entry *entry; struct bfd_hash_table *table,
struct bfd_hash_table *table; const char *string)
const char *string;
{ {
struct elf_sh_link_hash_entry *ret = struct elf_sh_link_hash_entry *ret =
(struct elf_sh_link_hash_entry *) entry; (struct elf_sh_link_hash_entry *) entry;
@ -3662,8 +3624,7 @@ sh_elf_link_hash_newfunc (entry, table, string)
/* Create an sh ELF linker hash table. */ /* Create an sh ELF linker hash table. */
static struct bfd_link_hash_table * static struct bfd_link_hash_table *
sh_elf_link_hash_table_create (abfd) sh_elf_link_hash_table_create (bfd *abfd)
bfd *abfd;
{ {
struct elf_sh_link_hash_table *ret; struct elf_sh_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf_sh_link_hash_table); bfd_size_type amt = sizeof (struct elf_sh_link_hash_table);
@ -3696,9 +3657,7 @@ sh_elf_link_hash_table_create (abfd)
shortcuts to them in our hash table. */ shortcuts to them in our hash table. */
static bfd_boolean static bfd_boolean
create_got_section (dynobj, info) create_got_section (bfd *dynobj, struct bfd_link_info *info)
bfd *dynobj;
struct bfd_link_info *info;
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
@ -3728,9 +3687,7 @@ create_got_section (dynobj, info)
/* Create dynamic sections when linking against a dynamic object. */ /* Create dynamic sections when linking against a dynamic object. */
static bfd_boolean static bfd_boolean
sh_elf_create_dynamic_sections (abfd, info) sh_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
bfd *abfd;
struct bfd_link_info *info;
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
flagword flags, pltflags; flagword flags, pltflags;
@ -3885,9 +3842,8 @@ sh_elf_create_dynamic_sections (abfd, info)
understand. */ understand. */
static bfd_boolean static bfd_boolean
sh_elf_adjust_dynamic_symbol (info, h) sh_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
struct bfd_link_info *info; struct elf_link_hash_entry *h)
struct elf_link_hash_entry *h;
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
struct elf_sh_link_hash_entry *eh; struct elf_sh_link_hash_entry *eh;
@ -4054,9 +4010,7 @@ sh_elf_adjust_dynamic_symbol (info, h)
dynamic relocs. */ dynamic relocs. */
static bfd_boolean static bfd_boolean
allocate_dynrelocs (h, inf) allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
struct elf_link_hash_entry *h;
PTR inf;
{ {
struct bfd_link_info *info; struct bfd_link_info *info;
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
@ -4289,9 +4243,7 @@ allocate_dynrelocs (h, inf)
/* Find any dynamic relocs that apply to read-only sections. */ /* Find any dynamic relocs that apply to read-only sections. */
static bfd_boolean static bfd_boolean
readonly_dynrelocs (h, inf) readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
struct elf_link_hash_entry *h;
PTR inf;
{ {
struct elf_sh_link_hash_entry *eh; struct elf_sh_link_hash_entry *eh;
struct elf_sh_dyn_relocs *p; struct elf_sh_dyn_relocs *p;
@ -4320,9 +4272,8 @@ readonly_dynrelocs (h, inf)
/* Set the sizes of the dynamic sections. */ /* Set the sizes of the dynamic sections. */
static bfd_boolean static bfd_boolean
sh_elf_size_dynamic_sections (output_bfd, info) sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info)
struct bfd_link_info *info;
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
@ -4431,7 +4382,7 @@ sh_elf_size_dynamic_sections (output_bfd, info)
/* Allocate global sym .plt and .got entries, and space for global /* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */ sym dynamic relocs. */
elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); elf_link_hash_traverse (&htab->root, allocate_dynrelocs, info);
/* We now have determined the sizes of the various dynamic sections. /* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */ Allocate memory for them. */
@ -4525,8 +4476,7 @@ sh_elf_size_dynamic_sections (output_bfd, info)
/* If any dynamic relocs apply to a read-only section, /* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */ then we need a DT_TEXTREL entry. */
if ((info->flags & DF_TEXTREL) == 0) if ((info->flags & DF_TEXTREL) == 0)
elf_link_hash_traverse (&htab->root, readonly_dynrelocs, elf_link_hash_traverse (&htab->root, readonly_dynrelocs, info);
(PTR) info);
if ((info->flags & DF_TEXTREL) != 0) if ((info->flags & DF_TEXTREL) != 0)
{ {
@ -4543,16 +4493,11 @@ sh_elf_size_dynamic_sections (output_bfd, info)
/* Relocate an SH ELF section. */ /* Relocate an SH ELF section. */
static bfd_boolean static bfd_boolean
sh_elf_relocate_section (output_bfd, info, input_bfd, input_section, sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
contents, relocs, local_syms, local_sections) bfd *input_bfd, asection *input_section,
bfd *output_bfd; bfd_byte *contents, Elf_Internal_Rela *relocs,
struct bfd_link_info *info; Elf_Internal_Sym *local_syms,
bfd *input_bfd; asection **local_sections)
asection *input_section;
bfd_byte *contents;
Elf_Internal_Rela *relocs;
Elf_Internal_Sym *local_syms;
asection **local_sections;
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
@ -5710,14 +5655,12 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
which uses sh_elf_relocate_section. */ which uses sh_elf_relocate_section. */
static bfd_byte * static bfd_byte *
sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, sh_elf_get_relocated_section_contents (bfd *output_bfd,
data, relocatable, symbols) struct bfd_link_info *link_info,
bfd *output_bfd; struct bfd_link_order *link_order,
struct bfd_link_info *link_info; bfd_byte *data,
struct bfd_link_order *link_order; bfd_boolean relocatable,
bfd_byte *data; asymbol **symbols)
bfd_boolean relocatable;
asymbol **symbols;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
asection *input_section = link_order->u.indirect.section; asection *input_section = link_order->u.indirect.section;
@ -5748,7 +5691,7 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
bfd_size_type amt; bfd_size_type amt;
internal_relocs = (_bfd_elf_link_read_relocs internal_relocs = (_bfd_elf_link_read_relocs
(input_bfd, input_section, (PTR) NULL, (input_bfd, input_section, NULL,
(Elf_Internal_Rela *) NULL, FALSE)); (Elf_Internal_Rela *) NULL, FALSE));
if (internal_relocs == NULL) if (internal_relocs == NULL)
goto error_return; goto error_return;
@ -5820,8 +5763,7 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
This is PT_TLS segment p_vaddr. */ This is PT_TLS segment p_vaddr. */
static bfd_vma static bfd_vma
dtpoff_base (info) dtpoff_base (struct bfd_link_info *info)
struct bfd_link_info *info;
{ {
/* If tls_segment is NULL, we should have signalled an error already. */ /* If tls_segment is NULL, we should have signalled an error already. */
if (elf_hash_table (info)->tls_segment == NULL) if (elf_hash_table (info)->tls_segment == NULL)
@ -5832,9 +5774,7 @@ dtpoff_base (info)
/* Return the relocation value for R_SH_TLS_TPOFF32.. */ /* Return the relocation value for R_SH_TLS_TPOFF32.. */
static bfd_vma static bfd_vma
tpoff (info, address) tpoff (struct bfd_link_info *info, bfd_vma address)
struct bfd_link_info *info;
bfd_vma address;
{ {
/* If tls_segment is NULL, we should have signalled an error already. */ /* If tls_segment is NULL, we should have signalled an error already. */
if (elf_hash_table (info)->tls_segment == NULL) if (elf_hash_table (info)->tls_segment == NULL)
@ -5845,12 +5785,10 @@ tpoff (info, address)
} }
static asection * static asection *
sh_elf_gc_mark_hook (sec, info, rel, h, sym) sh_elf_gc_mark_hook (asection *sec,
asection *sec; struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct bfd_link_info *info ATTRIBUTE_UNUSED; Elf_Internal_Rela *rel, struct elf_link_hash_entry *h,
Elf_Internal_Rela *rel; Elf_Internal_Sym *sym)
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
{ {
if (h != NULL) if (h != NULL)
{ {
@ -5889,11 +5827,8 @@ sh_elf_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */ /* Update the got entry reference counts for the section being removed. */
static bfd_boolean static bfd_boolean
sh_elf_gc_sweep_hook (abfd, info, sec, relocs) sh_elf_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
bfd *abfd; asection *sec, const Elf_Internal_Rela *relocs)
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **sym_hashes;
@ -6076,9 +6011,9 @@ sh_elf_gc_sweep_hook (abfd, info, sec, relocs)
/* Copy the extra info we tack onto an elf_link_hash_entry. */ /* Copy the extra info we tack onto an elf_link_hash_entry. */
static void static void
sh_elf_copy_indirect_symbol (bed, dir, ind) sh_elf_copy_indirect_symbol (struct elf_backend_data *bed,
struct elf_backend_data *bed; struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *dir, *ind; struct elf_link_hash_entry *ind)
{ {
struct elf_sh_link_hash_entry *edir, *eind; struct elf_sh_link_hash_entry *edir, *eind;
#ifdef INCLUDE_SHMEDIA #ifdef INCLUDE_SHMEDIA
@ -6154,10 +6089,8 @@ sh_elf_copy_indirect_symbol (bed, dir, ind)
} }
static int static int
sh_elf_optimized_tls_reloc (info, r_type, is_local) sh_elf_optimized_tls_reloc (struct bfd_link_info *info, int r_type,
struct bfd_link_info *info; int is_local)
int r_type;
int is_local;
{ {
if (info->shared) if (info->shared)
return r_type; return r_type;
@ -6181,11 +6114,8 @@ sh_elf_optimized_tls_reloc (info, r_type, is_local)
virtual table relocs for gc. */ virtual table relocs for gc. */
static bfd_boolean static bfd_boolean
sh_elf_check_relocs (abfd, info, sec, relocs) sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
bfd *abfd; const Elf_Internal_Rela *relocs)
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
@ -6635,8 +6565,7 @@ sh_elf_check_relocs (abfd, info, sec, relocs)
#ifndef sh_elf_set_mach_from_flags #ifndef sh_elf_set_mach_from_flags
static bfd_boolean static bfd_boolean
sh_elf_set_mach_from_flags (abfd) sh_elf_set_mach_from_flags (bfd *abfd)
bfd *abfd;
{ {
flagword flags = elf_elfheader (abfd)->e_flags; flagword flags = elf_elfheader (abfd)->e_flags;
@ -6678,9 +6607,7 @@ sh_elf_set_mach_from_flags (abfd)
/* Function to keep SH specific file flags. */ /* Function to keep SH specific file flags. */
static bfd_boolean static bfd_boolean
sh_elf_set_private_flags (abfd, flags) sh_elf_set_private_flags (bfd *abfd, flagword flags)
bfd *abfd;
flagword flags;
{ {
BFD_ASSERT (! elf_flags_init (abfd) BFD_ASSERT (! elf_flags_init (abfd)
|| elf_elfheader (abfd)->e_flags == flags); || elf_elfheader (abfd)->e_flags == flags);
@ -6695,9 +6622,7 @@ sh_elf_set_private_flags (abfd, flags)
/* Copy backend specific data from one object module to another */ /* Copy backend specific data from one object module to another */
static bfd_boolean static bfd_boolean
sh_elf_copy_private_data (ibfd, obfd) sh_elf_copy_private_data (bfd * ibfd, bfd * obfd)
bfd * ibfd;
bfd * obfd;
{ {
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour) || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
@ -6712,9 +6637,7 @@ sh_elf_copy_private_data (ibfd, obfd)
together, and for linking sh-dsp with sh3e / sh4 objects. */ together, and for linking sh-dsp with sh3e / sh4 objects. */
static bfd_boolean static bfd_boolean
sh_elf_merge_private_data (ibfd, obfd) sh_elf_merge_private_data (bfd *ibfd, bfd *obfd)
bfd *ibfd;
bfd *obfd;
{ {
flagword old_flags, new_flags; flagword old_flags, new_flags;
@ -6755,8 +6678,7 @@ sh_elf_merge_private_data (ibfd, obfd)
here. */ here. */
static bfd_boolean static bfd_boolean
sh_elf_object_p (abfd) sh_elf_object_p (bfd *abfd)
bfd *abfd;
{ {
struct sh_elf_obj_tdata *new_tdata; struct sh_elf_obj_tdata *new_tdata;
bfd_size_type amt = sizeof (struct sh_elf_obj_tdata); bfd_size_type amt = sizeof (struct sh_elf_obj_tdata);
@ -6777,11 +6699,9 @@ sh_elf_object_p (abfd)
dynamic sections here. */ dynamic sections here. */
static bfd_boolean static bfd_boolean
sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym) sh_elf_finish_dynamic_symbol (bfd *output_bfd, struct bfd_link_info *info,
bfd *output_bfd; struct elf_link_hash_entry *h,
struct bfd_link_info *info; Elf_Internal_Sym *sym)
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
@ -7059,9 +6979,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Finish up the dynamic sections. */ /* Finish up the dynamic sections. */
static bfd_boolean static bfd_boolean
sh_elf_finish_dynamic_sections (output_bfd, info) sh_elf_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
bfd *output_bfd;
struct bfd_link_info *info;
{ {
struct elf_sh_link_hash_table *htab; struct elf_sh_link_hash_table *htab;
asection *sgot; asection *sgot;
@ -7228,8 +7146,7 @@ sh_elf_finish_dynamic_sections (output_bfd, info)
} }
static enum elf_reloc_type_class static enum elf_reloc_type_class
sh_elf_reloc_type_class (rela) sh_elf_reloc_type_class (const Elf_Internal_Rela *rela)
const Elf_Internal_Rela *rela;
{ {
switch ((int) ELF32_R_TYPE (rela->r_info)) switch ((int) ELF32_R_TYPE (rela->r_info))
{ {
@ -7246,9 +7163,7 @@ sh_elf_reloc_type_class (rela)
/* Support for Linux core dump NOTE sections. */ /* Support for Linux core dump NOTE sections. */
static bfd_boolean static bfd_boolean
elf32_shlin_grok_prstatus (abfd, note) elf32_shlin_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
bfd *abfd;
Elf_Internal_Note *note;
{ {
int offset; int offset;
unsigned int raw_size; unsigned int raw_size;
@ -7278,9 +7193,7 @@ elf32_shlin_grok_prstatus (abfd, note)
} }
static bfd_boolean static bfd_boolean
elf32_shlin_grok_psinfo (abfd, note) elf32_shlin_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
bfd *abfd;
Elf_Internal_Note *note;
{ {
switch (note->descsz) switch (note->descsz)
{ {

View file

@ -28,15 +28,13 @@
#include "../opcodes/sh64-opc.h" #include "../opcodes/sh64-opc.h"
static bfd_boolean sh64_address_in_cranges static bfd_boolean sh64_address_in_cranges
PARAMS ((asection *cranges, bfd_vma, sh64_elf_crange *)); (asection *cranges, bfd_vma, sh64_elf_crange *);
/* Ordering functions of a crange, for the qsort and bsearch calls and for /* Ordering functions of a crange, for the qsort and bsearch calls and for
different endianness. */ different endianness. */
int int
_bfd_sh64_crange_qsort_cmpb (p1, p2) _bfd_sh64_crange_qsort_cmpb (const void *p1, const void *p2)
const PTR p1;
const PTR p2;
{ {
bfd_vma a1 = bfd_getb32 (p1); bfd_vma a1 = bfd_getb32 (p1);
bfd_vma a2 = bfd_getb32 (p2); bfd_vma a2 = bfd_getb32 (p2);
@ -49,9 +47,7 @@ _bfd_sh64_crange_qsort_cmpb (p1, p2)
} }
int int
_bfd_sh64_crange_qsort_cmpl (p1, p2) _bfd_sh64_crange_qsort_cmpl (const void *p1, const void *p2)
const PTR p1;
const PTR p2;
{ {
bfd_vma a1 = (bfd_vma) bfd_getl32 (p1); bfd_vma a1 = (bfd_vma) bfd_getl32 (p1);
bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
@ -64,9 +60,7 @@ _bfd_sh64_crange_qsort_cmpl (p1, p2)
} }
int int
_bfd_sh64_crange_bsearch_cmpb (p1, p2) _bfd_sh64_crange_bsearch_cmpb (const void *p1, const void *p2)
const PTR p1;
const PTR p2;
{ {
bfd_vma a1 = *(bfd_vma *) p1; bfd_vma a1 = *(bfd_vma *) p1;
bfd_vma a2 = (bfd_vma) bfd_getb32 (p2); bfd_vma a2 = (bfd_vma) bfd_getb32 (p2);
@ -81,9 +75,7 @@ _bfd_sh64_crange_bsearch_cmpb (p1, p2)
} }
int int
_bfd_sh64_crange_bsearch_cmpl (p1, p2) _bfd_sh64_crange_bsearch_cmpl (const void *p1, const void *p2)
const PTR p1;
const PTR p2;
{ {
bfd_vma a1 = *(bfd_vma *) p1; bfd_vma a1 = *(bfd_vma *) p1;
bfd_vma a2 = (bfd_vma) bfd_getl32 (p2); bfd_vma a2 = (bfd_vma) bfd_getl32 (p2);
@ -102,10 +94,8 @@ _bfd_sh64_crange_bsearch_cmpl (p1, p2)
filled into RANGEP if non-NULL. */ filled into RANGEP if non-NULL. */
static bfd_boolean static bfd_boolean
sh64_address_in_cranges (cranges, addr, rangep) sh64_address_in_cranges (asection *cranges, bfd_vma addr,
asection *cranges; sh64_elf_crange *rangep)
bfd_vma addr;
sh64_elf_crange *rangep;
{ {
bfd_byte *cranges_contents; bfd_byte *cranges_contents;
bfd_byte *found_rangep; bfd_byte *found_rangep;
@ -200,10 +190,7 @@ error_return:
*RANGEP if it's non-NULL. */ *RANGEP if it's non-NULL. */
enum sh64_elf_cr_type enum sh64_elf_cr_type
sh64_get_contents_type (sec, addr, rangep) sh64_get_contents_type (asection *sec, bfd_vma addr, sh64_elf_crange *rangep)
asection *sec;
bfd_vma addr;
sh64_elf_crange *rangep;
{ {
asection *cranges; asection *cranges;
@ -256,9 +243,7 @@ sh64_get_contents_type (sec, addr, rangep)
/* This is a simpler exported interface for the benefit of gdb et al. */ /* This is a simpler exported interface for the benefit of gdb et al. */
bfd_boolean bfd_boolean
sh64_address_is_shmedia (sec, addr) sh64_address_is_shmedia (asection *sec, bfd_vma addr)
asection *sec;
bfd_vma addr;
{ {
sh64_elf_crange dummy; sh64_elf_crange dummy;
return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32; return sh64_get_contents_type (sec, addr, &dummy) == CRT_SH5_ISA32;

View file

@ -39,36 +39,36 @@ struct sh64_find_section_vma_data
}; };
static bfd_boolean sh64_elf_new_section_hook static bfd_boolean sh64_elf_new_section_hook
PARAMS ((bfd *, asection *)); (bfd *, asection *);
static bfd_boolean sh64_elf_copy_private_data static bfd_boolean sh64_elf_copy_private_data
PARAMS ((bfd *, bfd *)); (bfd *, bfd *);
static bfd_boolean sh64_elf_merge_private_data static bfd_boolean sh64_elf_merge_private_data
PARAMS ((bfd *, bfd *)); (bfd *, bfd *);
static bfd_boolean sh64_elf_fake_sections static bfd_boolean sh64_elf_fake_sections
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); (bfd *, Elf_Internal_Shdr *, asection *);
static bfd_boolean sh64_elf_set_private_flags static bfd_boolean sh64_elf_set_private_flags
PARAMS ((bfd *, flagword)); (bfd *, flagword);
static bfd_boolean sh64_elf_set_mach_from_flags static bfd_boolean sh64_elf_set_mach_from_flags
PARAMS ((bfd *)); (bfd *);
static bfd_boolean shmedia_prepare_reloc static bfd_boolean shmedia_prepare_reloc
PARAMS ((struct bfd_link_info *, bfd *, asection *, (struct bfd_link_info *, bfd *, asection *, bfd_byte *,
bfd_byte *, const Elf_Internal_Rela *, bfd_vma *)); const Elf_Internal_Rela *, bfd_vma *);
static int sh64_elf_get_symbol_type static int sh64_elf_get_symbol_type
PARAMS ((Elf_Internal_Sym *, int)); (Elf_Internal_Sym *, int);
static bfd_boolean sh64_elf_add_symbol_hook static bfd_boolean sh64_elf_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **,
const char **, flagword *, asection **, bfd_vma *)); flagword *, asection **, bfd_vma *);
static bfd_boolean sh64_elf_link_output_symbol_hook static bfd_boolean sh64_elf_link_output_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *)); asection *);
static bfd_boolean sh64_backend_section_from_shdr static bfd_boolean sh64_backend_section_from_shdr
PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); (bfd *, Elf_Internal_Shdr *, const char *);
static void sh64_elf_final_write_processing static void sh64_elf_final_write_processing
PARAMS ((bfd *, bfd_boolean)); (bfd *, bfd_boolean);
static bfd_boolean sh64_bfd_elf_copy_private_section_data static bfd_boolean sh64_bfd_elf_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *)); (bfd *, asection *, bfd *, asection *);
static void sh64_find_section_for_address static void sh64_find_section_for_address
PARAMS ((bfd *, asection *, PTR)); (bfd *, asection *, void *);
/* Let elf32-sh.c handle the "bfd_" definitions, so we only have to /* Let elf32-sh.c handle the "bfd_" definitions, so we only have to
intrude with an #ifndef around the function definition. */ intrude with an #ifndef around the function definition. */
@ -108,9 +108,7 @@ static void sh64_find_section_for_address
/* Tack some extra info on struct bfd_elf_section_data. */ /* Tack some extra info on struct bfd_elf_section_data. */
static bfd_boolean static bfd_boolean
sh64_elf_new_section_hook (abfd, sec) sh64_elf_new_section_hook (bfd *abfd, asection *sec)
bfd *abfd;
asection *sec;
{ {
struct _sh64_elf_section_data *sdata; struct _sh64_elf_section_data *sdata;
bfd_size_type amt = sizeof (*sdata); bfd_size_type amt = sizeof (*sdata);
@ -118,7 +116,7 @@ sh64_elf_new_section_hook (abfd, sec)
sdata = (struct _sh64_elf_section_data *) bfd_zalloc (abfd, amt); sdata = (struct _sh64_elf_section_data *) bfd_zalloc (abfd, amt);
if (sdata == NULL) if (sdata == NULL)
return FALSE; return FALSE;
sec->used_by_bfd = (PTR) sdata; sec->used_by_bfd = sdata;
return _bfd_elf_new_section_hook (abfd, sec); return _bfd_elf_new_section_hook (abfd, sec);
} }
@ -127,10 +125,9 @@ sh64_elf_new_section_hook (abfd, sec)
through SHT_SH5_CR_SORTED on a sorted .cranges section. */ through SHT_SH5_CR_SORTED on a sorted .cranges section. */
bfd_boolean bfd_boolean
sh64_elf_fake_sections (output_bfd, elf_section_hdr, asect) sh64_elf_fake_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED; Elf_Internal_Shdr *elf_section_hdr,
Elf_Internal_Shdr *elf_section_hdr; asection *asect)
asection *asect;
{ {
if (sh64_elf_section_data (asect)->sh64_info != NULL) if (sh64_elf_section_data (asect)->sh64_info != NULL)
elf_section_hdr->sh_flags elf_section_hdr->sh_flags
@ -147,8 +144,7 @@ sh64_elf_fake_sections (output_bfd, elf_section_hdr, asect)
} }
static bfd_boolean static bfd_boolean
sh64_elf_set_mach_from_flags (abfd) sh64_elf_set_mach_from_flags (bfd *abfd)
bfd *abfd;
{ {
flagword flags = elf_elfheader (abfd)->e_flags; flagword flags = elf_elfheader (abfd)->e_flags;
asection *cranges; asection *cranges;
@ -182,9 +178,7 @@ sh64_elf_set_mach_from_flags (abfd)
} }
static bfd_boolean static bfd_boolean
sh64_elf_copy_private_data (ibfd, obfd) sh64_elf_copy_private_data (bfd * ibfd, bfd * obfd)
bfd * ibfd;
bfd * obfd;
{ {
if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour if ( bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour) || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
@ -199,9 +193,7 @@ sh64_elf_copy_private_data (ibfd, obfd)
} }
static bfd_boolean static bfd_boolean
sh64_elf_merge_private_data (ibfd, obfd) sh64_elf_merge_private_data (bfd *ibfd, bfd *obfd)
bfd *ibfd;
bfd *obfd;
{ {
flagword old_flags, new_flags; flagword old_flags, new_flags;
@ -261,10 +253,8 @@ sh64_elf_merge_private_data (ibfd, obfd)
We only recognize SHT_SH5_CR_SORTED, on the .cranges section. */ We only recognize SHT_SH5_CR_SORTED, on the .cranges section. */
bfd_boolean bfd_boolean
sh64_backend_section_from_shdr (abfd, hdr, name) sh64_backend_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr,
bfd *abfd; const char *name)
Elf_Internal_Shdr *hdr;
const char *name;
{ {
flagword flags = 0; flagword flags = 0;
@ -308,11 +298,8 @@ sh64_backend_section_from_shdr (abfd, hdr, name)
structure for the SH64 ELF section flags to be copied correctly. */ structure for the SH64 ELF section flags to be copied correctly. */
bfd_boolean bfd_boolean
sh64_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) sh64_bfd_elf_copy_private_section_data (bfd *ibfd, asection *isec,
bfd *ibfd; bfd *obfd, asection *osec)
asection *isec;
bfd *obfd;
asection *osec;
{ {
struct sh64_section_data *sh64_sec_data; struct sh64_section_data *sh64_sec_data;
@ -344,9 +331,7 @@ sh64_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)
/* Function to keep SH64 specific file flags. */ /* Function to keep SH64 specific file flags. */
static bfd_boolean static bfd_boolean
sh64_elf_set_private_flags (abfd, flags) sh64_elf_set_private_flags (bfd *abfd, flagword flags)
bfd * abfd;
flagword flags;
{ {
BFD_ASSERT (! elf_flags_init (abfd) BFD_ASSERT (! elf_flags_init (abfd)
|| elf_elfheader (abfd)->e_flags == flags); || elf_elfheader (abfd)->e_flags == flags);
@ -359,9 +344,7 @@ sh64_elf_set_private_flags (abfd, flags)
/* Called when writing out an object file to decide the type of a symbol. */ /* Called when writing out an object file to decide the type of a symbol. */
static int static int
sh64_elf_get_symbol_type (elf_sym, type) sh64_elf_get_symbol_type (Elf_Internal_Sym *elf_sym, int type)
Elf_Internal_Sym * elf_sym;
int type;
{ {
if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL) if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL)
return STT_DATALABEL; return STT_DATALABEL;
@ -388,14 +371,10 @@ sh64_elf_get_symbol_type (elf_sym, type)
(not so good). */ (not so good). */
static bfd_boolean static bfd_boolean
sh64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
bfd *abfd; const Elf_Internal_Sym *sym, const char **namep,
struct bfd_link_info *info; flagword *flagsp ATTRIBUTE_UNUSED,
const Elf_Internal_Sym *sym; asection **secp, bfd_vma *valp)
const char **namep;
flagword *flagsp ATTRIBUTE_UNUSED;
asection **secp;
bfd_vma *valp;
{ {
/* We want to do this for relocatable as well as final linking. */ /* We want to do this for relocatable as well as final linking. */
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
@ -489,12 +468,11 @@ sh64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
DataLabel symbol. */ DataLabel symbol. */
bfd_boolean bfd_boolean
sh64_elf_link_output_symbol_hook (abfd, info, cname, sym, input_sec) sh64_elf_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *info,
struct bfd_link_info *info; const char *cname,
const char *cname; Elf_Internal_Sym *sym,
Elf_Internal_Sym *sym; asection *input_sec ATTRIBUTE_UNUSED)
asection *input_sec ATTRIBUTE_UNUSED;
{ {
char *name = (char *) cname; char *name = (char *) cname;
@ -512,14 +490,9 @@ sh64_elf_link_output_symbol_hook (abfd, info, cname, sym, input_sec)
bad value, TRUE if ok. */ bad value, TRUE if ok. */
static bfd_boolean static bfd_boolean
shmedia_prepare_reloc (info, abfd, input_section, shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd,
contents, rel, relocation) asection *input_section, bfd_byte *contents,
struct bfd_link_info *info; const Elf_Internal_Rela *rel, bfd_vma *relocation)
bfd *abfd;
asection *input_section;
bfd_byte *contents;
const Elf_Internal_Rela *rel;
bfd_vma *relocation;
{ {
bfd_vma disp, dropped; bfd_vma disp, dropped;
@ -624,10 +597,8 @@ shmedia_prepare_reloc (info, abfd, input_section,
is called via bfd_map_over_sections. */ is called via bfd_map_over_sections. */
static void static void
sh64_find_section_for_address (abfd, section, data) sh64_find_section_for_address (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; asection *section, void *data)
asection *section;
PTR data;
{ {
bfd_vma vma; bfd_vma vma;
bfd_size_type size; bfd_size_type size;
@ -663,9 +634,8 @@ sh64_find_section_for_address (abfd, section, data)
executables (final linking and objcopy). */ executables (final linking and objcopy). */
static void static void
sh64_elf_final_write_processing (abfd, linker) sh64_elf_final_write_processing (bfd *abfd,
bfd *abfd; bfd_boolean linker ATTRIBUTE_UNUSED)
bfd_boolean linker ATTRIBUTE_UNUSED;
{ {
bfd_vma ld_generated_cranges_size; bfd_vma ld_generated_cranges_size;
asection *cranges asection *cranges
@ -717,7 +687,7 @@ sh64_elf_final_write_processing (abfd, linker)
fsec_data.section = NULL; fsec_data.section = NULL;
bfd_map_over_sections (abfd, sh64_find_section_for_address, bfd_map_over_sections (abfd, sh64_find_section_for_address,
(PTR) &fsec_data); &fsec_data);
if (fsec_data.section if (fsec_data.section
&& (sh64_get_contents_type (fsec_data.section, && (sh64_get_contents_type (fsec_data.section,
elf_elfheader (abfd)->e_entry, elf_elfheader (abfd)->e_entry,

View file

@ -51,16 +51,21 @@ typedef struct {
/* Get the contents type of an arbitrary address, or return CRT_NONE. */ /* Get the contents type of an arbitrary address, or return CRT_NONE. */
extern enum sh64_elf_cr_type sh64_get_contents_type extern enum sh64_elf_cr_type sh64_get_contents_type
PARAMS ((asection *, bfd_vma, sh64_elf_crange *)); (asection *, bfd_vma, sh64_elf_crange *);
/* Simpler interface. /* Simpler interface.
FIXME: This seems redundant now that we export the interface above. */ FIXME: This seems redundant now that we export the interface above. */
extern bfd_boolean sh64_address_is_shmedia PARAMS ((asection *, bfd_vma)); extern bfd_boolean sh64_address_is_shmedia
(asection *, bfd_vma);
extern int _bfd_sh64_crange_qsort_cmpb PARAMS ((const void *, const void *)); extern int _bfd_sh64_crange_qsort_cmpb
extern int _bfd_sh64_crange_qsort_cmpl PARAMS ((const void *, const void *)); (const void *, const void *);
extern int _bfd_sh64_crange_bsearch_cmpb PARAMS ((const void *, const void *)); extern int _bfd_sh64_crange_qsort_cmpl
extern int _bfd_sh64_crange_bsearch_cmpl PARAMS ((const void *, const void *)); (const void *, const void *);
extern int _bfd_sh64_crange_bsearch_cmpb
(const void *, const void *);
extern int _bfd_sh64_crange_bsearch_cmpl
(const void *, const void *);
struct sh64_section_data struct sh64_section_data
{ {

View file

@ -99,7 +99,7 @@ struct elf_sh64_link_hash_table
#define sh64_elf64_link_hash_traverse(table, func, info) \ #define sh64_elf64_link_hash_traverse(table, func, info) \
(elf_link_hash_traverse \ (elf_link_hash_traverse \
(&(table)->root, \ (&(table)->root, \
(bfd_boolean (*) PARAMS ((struct elf_link_hash_entry *, PTR))) (func), \ (bfd_boolean (*) (struct elf_link_hash_entry *, void *)) (func), \
(info))) (info)))
/* Get the sh ELF linker hash table from a link_info structure. */ /* Get the sh ELF linker hash table from a link_info structure. */
@ -108,71 +108,69 @@ struct elf_sh64_link_hash_table
((struct elf_sh64_link_hash_table *) ((p)->hash)) ((struct elf_sh64_link_hash_table *) ((p)->hash))
static bfd_boolean sh_elf64_copy_private_data static bfd_boolean sh_elf64_copy_private_data
PARAMS ((bfd *, bfd *)); (bfd *, bfd *);
static bfd_boolean sh_elf64_copy_private_data_internal static bfd_boolean sh_elf64_copy_private_data_internal
PARAMS ((bfd *, bfd *)); (bfd *, bfd *);
static bfd_boolean sh_elf64_merge_private_data static bfd_boolean sh_elf64_merge_private_data
PARAMS ((bfd *, bfd *)); (bfd *, bfd *);
static bfd_reloc_status_type sh_elf64_ignore_reloc static bfd_reloc_status_type sh_elf64_ignore_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type sh_elf64_reloc static bfd_reloc_status_type sh_elf64_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static reloc_howto_type *sh_elf64_reloc_type_lookup static reloc_howto_type *sh_elf64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type)); (bfd *, bfd_reloc_code_real_type);
static void sh_elf64_info_to_howto static void sh_elf64_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); (bfd *, arelent *, Elf_Internal_Rela *);
static bfd_boolean sh_elf64_relocate_section static bfd_boolean sh_elf64_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); Elf_Internal_Rela *, Elf_Internal_Sym *, asection **);
static bfd_byte *sh_elf64_get_relocated_section_contents static bfd_byte *sh_elf64_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *, (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *,
bfd_byte *, bfd_boolean, asymbol **)); bfd_boolean, asymbol **);
static bfd_boolean sh_elf64_set_mach_from_flags static bfd_boolean sh_elf64_set_mach_from_flags
PARAMS ((bfd *)); (bfd *);
static bfd_boolean sh_elf64_set_private_flags static bfd_boolean sh_elf64_set_private_flags
PARAMS ((bfd *, flagword)); (bfd *, flagword);
static asection *sh_elf64_gc_mark_hook static asection *sh_elf64_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, (asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *)); struct elf_link_hash_entry *, Elf_Internal_Sym *);
static bfd_boolean sh_elf64_gc_sweep_hook static bfd_boolean sh_elf64_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *, (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
const Elf_Internal_Rela *));
static bfd_boolean sh_elf64_check_relocs static bfd_boolean sh_elf64_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *, (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
const Elf_Internal_Rela *));
static int sh64_elf64_get_symbol_type static int sh64_elf64_get_symbol_type
PARAMS ((Elf_Internal_Sym *, int)); (Elf_Internal_Sym *, int);
static bfd_boolean sh64_elf64_add_symbol_hook static bfd_boolean sh64_elf64_add_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, (bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **,
const char **, flagword *, asection **, bfd_vma *)); flagword *, asection **, bfd_vma *);
static bfd_boolean sh64_elf64_link_output_symbol_hook static bfd_boolean sh64_elf64_link_output_symbol_hook
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *, (bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
asection *)); asection *);
static bfd_boolean sh64_elf64_fake_sections static bfd_boolean sh64_elf64_fake_sections
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); (bfd *, Elf_Internal_Shdr *, asection *);
static void sh64_elf64_final_write_processing static void sh64_elf64_final_write_processing
PARAMS ((bfd *, bfd_boolean)); (bfd *, bfd_boolean);
static struct bfd_hash_entry *sh64_elf64_link_hash_newfunc static struct bfd_hash_entry *sh64_elf64_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); (struct bfd_hash_entry *, struct bfd_hash_table *, const char *);
static struct bfd_link_hash_table *sh64_elf64_link_hash_table_create static struct bfd_link_hash_table *sh64_elf64_link_hash_table_create
PARAMS ((bfd *)); (bfd *);
inline static void movi_shori_putval inline static void movi_shori_putval
PARAMS ((bfd *, unsigned long, char *)); (bfd *, unsigned long, char *);
inline static void movi_3shori_putval inline static void movi_3shori_putval
PARAMS ((bfd *, bfd_vma, char *)); (bfd *, bfd_vma, char *);
static bfd_boolean sh64_elf64_create_dynamic_sections static bfd_boolean sh64_elf64_create_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *)); (bfd *, struct bfd_link_info *);
static bfd_boolean sh64_elf64_adjust_dynamic_symbol static bfd_boolean sh64_elf64_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *info, struct elf_link_hash_entry *)); (struct bfd_link_info *info, struct elf_link_hash_entry *);
static bfd_boolean sh64_elf64_discard_copies static bfd_boolean sh64_elf64_discard_copies
PARAMS ((struct elf_sh64_link_hash_entry *, PTR)); (struct elf_sh64_link_hash_entry *, void *);
static bfd_boolean sh64_elf64_size_dynamic_sections static bfd_boolean sh64_elf64_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *)); (bfd *, struct bfd_link_info *);
static bfd_boolean sh64_elf64_finish_dynamic_symbol static bfd_boolean sh64_elf64_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *)); Elf_Internal_Sym *);
static bfd_boolean sh64_elf64_finish_dynamic_sections static bfd_boolean sh64_elf64_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *)); (bfd *, struct bfd_link_info *);
static reloc_howto_type sh_elf64_howto_table[] = { static reloc_howto_type sh_elf64_howto_table[] = {
/* No relocation. */ /* No relocation. */
@ -1300,15 +1298,11 @@ static reloc_howto_type sh_elf64_howto_table[] = {
which the linker should otherwise ignore. */ which the linker should otherwise ignore. */
static bfd_reloc_status_type static bfd_reloc_status_type
sh_elf64_ignore_reloc (abfd, reloc_entry, symbol, data, input_section, sh_elf64_ignore_reloc (bfd *abfd ATTRIBUTE_UNUSED, arelent *reloc_entry,
output_bfd, error_message) asymbol *symbol ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; void *data ATTRIBUTE_UNUSED, asection *input_section,
arelent *reloc_entry; bfd *output_bfd,
asymbol *symbol ATTRIBUTE_UNUSED; char **error_message ATTRIBUTE_UNUSED)
PTR data ATTRIBUTE_UNUSED;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{ {
if (output_bfd != NULL) if (output_bfd != NULL)
reloc_entry->address += input_section->output_offset; reloc_entry->address += input_section->output_offset;
@ -1321,15 +1315,9 @@ sh_elf64_ignore_reloc (abfd, reloc_entry, symbol, data, input_section,
See sh_elf_reloc in elf32-sh.c for the original. */ See sh_elf_reloc in elf32-sh.c for the original. */
static bfd_reloc_status_type static bfd_reloc_status_type
sh_elf64_reloc (abfd, reloc_entry, symbol_in, data, input_section, output_bfd, sh_elf64_reloc (bfd *abfd, arelent *reloc_entry, asymbol *symbol_in,
error_message) void *data, asection *input_section, bfd *output_bfd,
bfd *abfd; char **error_message ATTRIBUTE_UNUSED)
arelent *reloc_entry;
asymbol *symbol_in;
PTR data;
asection *input_section;
bfd *output_bfd;
char **error_message ATTRIBUTE_UNUSED;
{ {
unsigned long insn; unsigned long insn;
bfd_vma sym_value; bfd_vma sym_value;
@ -1449,9 +1437,8 @@ static const struct elf_reloc_map sh64_reloc_map[] =
corresponding SH ELf reloc. */ corresponding SH ELf reloc. */
static reloc_howto_type * static reloc_howto_type *
sh_elf64_reloc_type_lookup (abfd, code) sh_elf64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type code)
bfd_reloc_code_real_type code;
{ {
unsigned int i; unsigned int i;
@ -1469,10 +1456,8 @@ sh_elf64_reloc_type_lookup (abfd, code)
See sh_elf_info_to_howto in elf32-sh.c for the original. */ See sh_elf_info_to_howto in elf32-sh.c for the original. */
static void static void
sh_elf64_info_to_howto (abfd, cache_ptr, dst) sh_elf64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
bfd *abfd ATTRIBUTE_UNUSED; Elf_Internal_Rela *dst)
arelent *cache_ptr;
Elf_Internal_Rela *dst;
{ {
unsigned int r; unsigned int r;
@ -1492,16 +1477,12 @@ sh_elf64_info_to_howto (abfd, cache_ptr, dst)
See sh_elf_info_to_howto in elf32-sh.c for the original. */ See sh_elf_info_to_howto in elf32-sh.c for the original. */
static bfd_boolean static bfd_boolean
sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section, sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
contents, relocs, local_syms, local_sections) struct bfd_link_info *info, bfd *input_bfd,
bfd *output_bfd ATTRIBUTE_UNUSED; asection *input_section, bfd_byte *contents,
struct bfd_link_info *info; Elf_Internal_Rela *relocs,
bfd *input_bfd; Elf_Internal_Sym *local_syms,
asection *input_section; asection **local_sections)
bfd_byte *contents;
Elf_Internal_Rela *relocs;
Elf_Internal_Sym *local_syms;
asection **local_sections;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **sym_hashes;
@ -2177,14 +2158,12 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
See sh_elf_relocate_section in elf32-sh.c for the original. */ See sh_elf_relocate_section in elf32-sh.c for the original. */
static bfd_byte * static bfd_byte *
sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order, sh_elf64_get_relocated_section_contents (bfd *output_bfd,
data, relocatable, symbols) struct bfd_link_info *link_info,
bfd *output_bfd; struct bfd_link_order *link_order,
struct bfd_link_info *link_info; bfd_byte *data,
struct bfd_link_order *link_order; bfd_boolean relocatable,
bfd_byte *data; asymbol **symbols)
bfd_boolean relocatable;
asymbol **symbols;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
asection *input_section = link_order->u.indirect.section; asection *input_section = link_order->u.indirect.section;
@ -2227,7 +2206,7 @@ sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order,
} }
internal_relocs = (_bfd_elf_link_read_relocs internal_relocs = (_bfd_elf_link_read_relocs
(input_bfd, input_section, (PTR) NULL, (input_bfd, input_section, NULL,
(Elf_Internal_Rela *) NULL, FALSE)); (Elf_Internal_Rela *) NULL, FALSE));
if (internal_relocs == NULL) if (internal_relocs == NULL)
goto error_return; goto error_return;
@ -2291,10 +2270,9 @@ sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order,
/* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections. */ /* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections. */
bfd_boolean bfd_boolean
sh64_elf64_fake_sections (output_bfd, elf_section_hdr, asect) sh64_elf64_fake_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED; Elf_Internal_Shdr *elf_section_hdr,
Elf_Internal_Shdr *elf_section_hdr; asection *asect)
asection *asect;
{ {
/* Code sections can only contain SH64 code, so mark them as such. */ /* Code sections can only contain SH64 code, so mark them as such. */
if (bfd_get_section_flags (output_bfd, asect) & SEC_CODE) if (bfd_get_section_flags (output_bfd, asect) & SEC_CODE)
@ -2304,8 +2282,7 @@ sh64_elf64_fake_sections (output_bfd, elf_section_hdr, asect)
} }
static bfd_boolean static bfd_boolean
sh_elf64_set_mach_from_flags (abfd) sh_elf64_set_mach_from_flags (bfd *abfd)
bfd *abfd;
{ {
flagword flags = elf_elfheader (abfd)->e_flags; flagword flags = elf_elfheader (abfd)->e_flags;
@ -2328,9 +2305,7 @@ sh_elf64_set_mach_from_flags (abfd)
See sh64_elf_set_private_flags in elf32-sh64.c for the original. */ See sh64_elf_set_private_flags in elf32-sh64.c for the original. */
static bfd_boolean static bfd_boolean
sh_elf64_set_private_flags (abfd, flags) sh_elf64_set_private_flags (bfd *abfd, flagword flags)
bfd * abfd;
flagword flags;
{ {
BFD_ASSERT (! elf_flags_init (abfd) BFD_ASSERT (! elf_flags_init (abfd)
|| elf_elfheader (abfd)->e_flags == flags); || elf_elfheader (abfd)->e_flags == flags);
@ -2344,9 +2319,7 @@ sh_elf64_set_private_flags (abfd, flags)
code, to keep attributes the same as for SHmedia in 32-bit ELF. */ code, to keep attributes the same as for SHmedia in 32-bit ELF. */
static bfd_boolean static bfd_boolean
sh_elf64_copy_private_data_internal (ibfd, obfd) sh_elf64_copy_private_data_internal (bfd *ibfd, bfd *obfd)
bfd * ibfd;
bfd * obfd;
{ {
Elf_Internal_Shdr **o_shdrp; Elf_Internal_Shdr **o_shdrp;
asection *isec; asection *isec;
@ -2377,17 +2350,13 @@ sh_elf64_copy_private_data_internal (ibfd, obfd)
} }
static bfd_boolean static bfd_boolean
sh_elf64_copy_private_data (ibfd, obfd) sh_elf64_copy_private_data (bfd *ibfd, bfd *obfd)
bfd * ibfd;
bfd * obfd;
{ {
return sh_elf64_copy_private_data_internal (ibfd, obfd); return sh_elf64_copy_private_data_internal (ibfd, obfd);
} }
static bfd_boolean static bfd_boolean
sh_elf64_merge_private_data (ibfd, obfd) sh_elf64_merge_private_data (bfd *ibfd, bfd *obfd)
bfd *ibfd;
bfd *obfd;
{ {
flagword old_flags, new_flags; flagword old_flags, new_flags;
@ -2450,12 +2419,11 @@ sh_elf64_merge_private_data (ibfd, obfd)
relocation. */ relocation. */
static asection * static asection *
sh_elf64_gc_mark_hook (sec, info, rel, h, sym) sh_elf64_gc_mark_hook (asection *sec,
asection *sec; struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct bfd_link_info *info ATTRIBUTE_UNUSED; Elf_Internal_Rela *rel,
Elf_Internal_Rela *rel; struct elf_link_hash_entry *h,
struct elf_link_hash_entry *h; Elf_Internal_Sym *sym)
Elf_Internal_Sym *sym;
{ {
if (h != NULL) if (h != NULL)
{ {
@ -2492,11 +2460,10 @@ sh_elf64_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */ /* Update the got entry reference counts for the section being removed. */
static bfd_boolean static bfd_boolean
sh_elf64_gc_sweep_hook (abfd, info, sec, relocs) sh_elf64_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct bfd_link_info *info ATTRIBUTE_UNUSED; asection *sec ATTRIBUTE_UNUSED,
asection *sec ATTRIBUTE_UNUSED; const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED)
const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
{ {
/* No got and plt entries for 64-bit SH at present. */ /* No got and plt entries for 64-bit SH at present. */
return TRUE; return TRUE;
@ -2507,11 +2474,8 @@ sh_elf64_gc_sweep_hook (abfd, info, sec, relocs)
virtual table relocs for gc. */ virtual table relocs for gc. */
static bfd_boolean static bfd_boolean
sh_elf64_check_relocs (abfd, info, sec, relocs) sh_elf64_check_relocs (bfd *abfd, struct bfd_link_info *info,
bfd *abfd; asection *sec, const Elf_Internal_Rela *relocs)
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes, **sym_hashes_end; struct elf_link_hash_entry **sym_hashes, **sym_hashes_end;
@ -2884,9 +2848,7 @@ sh_elf64_check_relocs (abfd, info, sec, relocs)
} }
static int static int
sh64_elf64_get_symbol_type (elf_sym, type) sh64_elf64_get_symbol_type (Elf_Internal_Sym * elf_sym, int type)
Elf_Internal_Sym * elf_sym;
int type;
{ {
if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL) if (ELF_ST_TYPE (elf_sym->st_info) == STT_DATALABEL)
return STT_DATALABEL; return STT_DATALABEL;
@ -2917,14 +2879,10 @@ sh64_elf64_get_symbol_type (elf_sym, type)
(not so good). */ (not so good). */
static bfd_boolean static bfd_boolean
sh64_elf64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
bfd *abfd; const Elf_Internal_Sym *sym, const char **namep,
struct bfd_link_info *info; flagword *flagsp ATTRIBUTE_UNUSED,
const Elf_Internal_Sym *sym; asection **secp, bfd_vma *valp)
const char **namep;
flagword *flagsp ATTRIBUTE_UNUSED;
asection **secp;
bfd_vma *valp;
{ {
/* We want to do this for relocatable as well as final linking. */ /* We want to do this for relocatable as well as final linking. */
if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL if (ELF_ST_TYPE (sym->st_info) == STT_DATALABEL
@ -3018,12 +2976,11 @@ sh64_elf64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
DataLabel symbol. */ DataLabel symbol. */
static bfd_boolean static bfd_boolean
sh64_elf64_link_output_symbol_hook (abfd, info, cname, sym, input_sec) sh64_elf64_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; struct bfd_link_info *info,
struct bfd_link_info *info; const char *cname,
const char *cname; Elf_Internal_Sym *sym,
Elf_Internal_Sym *sym; asection *input_sec ATTRIBUTE_UNUSED)
asection *input_sec ATTRIBUTE_UNUSED;
{ {
char *name = (char *) cname; char *name = (char *) cname;
@ -3044,9 +3001,8 @@ sh64_elf64_link_output_symbol_hook (abfd, info, cname, sym, input_sec)
before jumping to the program entry. */ before jumping to the program entry. */
static void static void
sh64_elf64_final_write_processing (abfd, linker) sh64_elf64_final_write_processing (bfd *abfd,
bfd *abfd; bfd_boolean linker ATTRIBUTE_UNUSED)
bfd_boolean linker ATTRIBUTE_UNUSED;
{ {
/* FIXME: Perhaps we shouldn't do this if the entry address was supplied /* FIXME: Perhaps we shouldn't do this if the entry address was supplied
numerically, but we currently lack the infrastructure to recognize numerically, but we currently lack the infrastructure to recognize
@ -3190,10 +3146,9 @@ static const bfd_byte *elf_sh64_pic_plt_entry;
/* Create an entry in an sh ELF linker hash table. */ /* Create an entry in an sh ELF linker hash table. */
static struct bfd_hash_entry * static struct bfd_hash_entry *
sh64_elf64_link_hash_newfunc (entry, table, string) sh64_elf64_link_hash_newfunc (struct bfd_hash_entry *entry,
struct bfd_hash_entry *entry; struct bfd_hash_table *table,
struct bfd_hash_table *table; const char *string)
const char *string;
{ {
struct elf_sh64_link_hash_entry *ret = struct elf_sh64_link_hash_entry *ret =
(struct elf_sh64_link_hash_entry *) entry; (struct elf_sh64_link_hash_entry *) entry;
@ -3223,8 +3178,7 @@ sh64_elf64_link_hash_newfunc (entry, table, string)
/* Create an sh64 ELF linker hash table. */ /* Create an sh64 ELF linker hash table. */
static struct bfd_link_hash_table * static struct bfd_link_hash_table *
sh64_elf64_link_hash_table_create (abfd) sh64_elf64_link_hash_table_create (bfd *abfd)
bfd *abfd;
{ {
struct elf_sh64_link_hash_table *ret; struct elf_sh64_link_hash_table *ret;
@ -3244,10 +3198,7 @@ sh64_elf64_link_hash_table_create (abfd)
} }
inline static void inline static void
movi_shori_putval (output_bfd, value, addr) movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr)
bfd *output_bfd;
unsigned long value;
char *addr;
{ {
bfd_put_32 (output_bfd, bfd_put_32 (output_bfd,
bfd_get_32 (output_bfd, addr) bfd_get_32 (output_bfd, addr)
@ -3260,10 +3211,7 @@ movi_shori_putval (output_bfd, value, addr)
} }
inline static void inline static void
movi_3shori_putval (output_bfd, value, addr) movi_3shori_putval (bfd *output_bfd, bfd_vma value, char *addr)
bfd *output_bfd;
bfd_vma value;
char *addr;
{ {
bfd_put_32 (output_bfd, bfd_put_32 (output_bfd,
bfd_get_32 (output_bfd, addr) bfd_get_32 (output_bfd, addr)
@ -3286,9 +3234,7 @@ movi_3shori_putval (output_bfd, value, addr)
/* Create dynamic sections when linking against a dynamic object. */ /* Create dynamic sections when linking against a dynamic object. */
static bfd_boolean static bfd_boolean
sh64_elf64_create_dynamic_sections (abfd, info) sh64_elf64_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
bfd *abfd;
struct bfd_link_info *info;
{ {
flagword flags, pltflags; flagword flags, pltflags;
register asection *s; register asection *s;
@ -3430,9 +3376,8 @@ sh64_elf64_create_dynamic_sections (abfd, info)
understand. */ understand. */
static bfd_boolean static bfd_boolean
sh64_elf64_adjust_dynamic_symbol (info, h) sh64_elf64_adjust_dynamic_symbol (struct bfd_link_info *info,
struct bfd_link_info *info; struct elf_link_hash_entry *h)
struct elf_link_hash_entry *h;
{ {
bfd *dynobj; bfd *dynobj;
asection *s; asection *s;
@ -3605,9 +3550,8 @@ sh64_elf64_adjust_dynamic_symbol (info, h)
relocate_section routine. */ relocate_section routine. */
static bfd_boolean static bfd_boolean
sh64_elf64_discard_copies (h, ignore) sh64_elf64_discard_copies (struct elf_sh64_link_hash_entry *h,
struct elf_sh64_link_hash_entry *h; void *ignore ATTRIBUTE_UNUSED)
PTR ignore ATTRIBUTE_UNUSED;
{ {
struct elf_sh64_pcrel_relocs_copied *s; struct elf_sh64_pcrel_relocs_copied *s;
@ -3627,9 +3571,8 @@ sh64_elf64_discard_copies (h, ignore)
/* Set the sizes of the dynamic sections. */ /* Set the sizes of the dynamic sections. */
static bfd_boolean static bfd_boolean
sh64_elf64_size_dynamic_sections (output_bfd, info) sh64_elf64_size_dynamic_sections (bfd *output_bfd,
bfd *output_bfd; struct bfd_link_info *info)
struct bfd_link_info *info;
{ {
bfd *dynobj; bfd *dynobj;
asection *s; asection *s;
@ -3669,8 +3612,7 @@ sh64_elf64_size_dynamic_sections (output_bfd, info)
will not fill them in in the relocate_section routine. */ will not fill them in in the relocate_section routine. */
if (info->shared && info->symbolic) if (info->shared && info->symbolic)
sh64_elf64_link_hash_traverse (sh64_elf64_hash_table (info), sh64_elf64_link_hash_traverse (sh64_elf64_hash_table (info),
sh64_elf64_discard_copies, sh64_elf64_discard_copies, NULL);
(PTR) NULL);
/* The check_relocs and adjust_dynamic_symbol entry points have /* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate determined the sizes of the various dynamic sections. Allocate
@ -3815,11 +3757,10 @@ sh64_elf64_size_dynamic_sections (output_bfd, info)
dynamic sections here. */ dynamic sections here. */
static bfd_boolean static bfd_boolean
sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym) sh64_elf64_finish_dynamic_symbol (bfd *output_bfd,
bfd *output_bfd; struct bfd_link_info *info,
struct bfd_link_info *info; struct elf_link_hash_entry *h,
struct elf_link_hash_entry *h; Elf_Internal_Sym *sym)
Elf_Internal_Sym *sym;
{ {
bfd *dynobj; bfd *dynobj;
@ -4015,9 +3956,8 @@ sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym)
/* Finish up the dynamic sections. */ /* Finish up the dynamic sections. */
static bfd_boolean static bfd_boolean
sh64_elf64_finish_dynamic_sections (output_bfd, info) sh64_elf64_finish_dynamic_sections (bfd *output_bfd,
bfd *output_bfd; struct bfd_link_info *info)
struct bfd_link_info *info;
{ {
bfd *dynobj; bfd *dynobj;
asection *sgot; asection *sgot;