From 55fd94b056a2db8d1a530ed2db648579bb8c586c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 24 Jun 2003 14:03:53 +0000 Subject: [PATCH] * elf32-i386.c: Convert to C90 function definitions, remove unnecessary prototypes and casts. Replace PTR with void *. Formatting. * elf32-ppc.c: Likewise. Break long strings too. (ppc_elf_relax_section): Use enum elf_ppc_reloc_type for r_type. (ppc_elf_unhandled_reloc): Internationalize error message. * elf32-ppc.h: Remove PARAMS. --- bfd/ChangeLog | 9 + bfd/elf32-i386.c | 352 +++++++++++++----------------------- bfd/elf32-ppc.c | 536 ++++++++++++++++++++----------------------------------- bfd/elf32-ppc.h | 6 +- 4 files changed, 332 insertions(+), 571 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 012f8f6..f2e1e85 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,12 @@ +2003-06-24 Alan Modra + + * elf32-i386.c: Convert to C90 function definitions, remove unnecessary + prototypes and casts. Replace PTR with void *. Formatting. + * elf32-ppc.c: Likewise. Break long strings too. + (ppc_elf_relax_section): Use enum elf_ppc_reloc_type for r_type. + (ppc_elf_unhandled_reloc): Internationalize error message. + * elf32-ppc.h: Remove PARAMS. + 2003-06-23 Mark Mitchell * elf32-ppc.c (ppc_elf_begin_write_processing): Use bytes to count diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index cd3dc9a..16ef09f 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -24,69 +24,8 @@ #include "libbfd.h" #include "elf-bfd.h" -static reloc_howto_type *elf_i386_reloc_type_lookup - PARAMS ((bfd *, bfd_reloc_code_real_type)); -static void elf_i386_info_to_howto_rel - PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); -static bfd_boolean elf_i386_is_local_label_name - PARAMS ((bfd *, const char *)); -static bfd_boolean elf_i386_grok_prstatus - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); -static bfd_boolean elf_i386_grok_psinfo - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); -static struct bfd_hash_entry *link_hash_newfunc - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static struct bfd_link_hash_table *elf_i386_link_hash_table_create - PARAMS ((bfd *)); -static bfd_boolean create_got_section - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean elf_i386_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static void elf_i386_copy_indirect_symbol - PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *, - struct elf_link_hash_entry *)); -static int elf_i386_tls_transition - PARAMS ((struct bfd_link_info *, int, int)); - -static bfd_boolean elf_i386_mkobject - PARAMS ((bfd *)); -static bfd_boolean elf_i386_object_p - PARAMS ((bfd *)); -static bfd_boolean elf_i386_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static asection *elf_i386_gc_mark_hook - PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static bfd_boolean elf_i386_gc_sweep_hook - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static bfd_boolean elf_i386_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -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 elf_i386_fake_sections - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); -static bfd_boolean elf_i386_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_vma dtpoff_base - PARAMS ((struct bfd_link_info *)); -static bfd_vma tpoff - PARAMS ((struct bfd_link_info *, bfd_vma)); -static bfd_boolean elf_i386_relocate_section - PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); -static bfd_boolean elf_i386_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static enum elf_reloc_type_class elf_i386_reloc_type_class - PARAMS ((const Elf_Internal_Rela *)); -static bfd_boolean elf_i386_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); - -#define USE_REL 1 /* 386 uses REL relocations instead of RELA. */ +/* 386 uses REL relocations instead of RELA. */ +#define USE_REL 1 #include "elf/i386.h" @@ -130,8 +69,8 @@ static reloc_howto_type elf_howto_table[]= R_386_standard counts the number up to this point, and R_386_ext_offset is the value to subtract from a reloc type of R_386_16 thru R_386_PC8 to form an index into this table. */ -#define R_386_standard ((unsigned int) R_386_GOTPC + 1) -#define R_386_ext_offset ((unsigned int) R_386_TLS_TPOFF - R_386_standard) +#define R_386_standard (R_386_GOTPC + 1) +#define R_386_ext_offset (R_386_TLS_TPOFF - R_386_standard) /* These relocs are a GNU extension. */ HOWTO(R_386_TLS_TPOFF, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, @@ -165,8 +104,8 @@ static reloc_howto_type elf_howto_table[]= bfd_elf_generic_reloc, "R_386_PC8", TRUE, 0xff, 0xff, TRUE), -#define R_386_ext ((unsigned int) R_386_PC8 + 1 - R_386_ext_offset) -#define R_386_tls_offset ((unsigned int) R_386_TLS_LDO_32 - R_386_ext) +#define R_386_ext (R_386_PC8 + 1 - R_386_ext_offset) +#define R_386_tls_offset (R_386_TLS_LDO_32 - R_386_ext) /* These are common with Solaris TLS implementation. */ HOWTO(R_386_TLS_LDO_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_386_TLS_LDO_32", @@ -188,8 +127,8 @@ static reloc_howto_type elf_howto_table[]= TRUE, 0xffffffff, 0xffffffff, FALSE), /* Another gap. */ -#define R_386_tls ((unsigned int) R_386_TLS_TPOFF32 + 1 - R_386_tls_offset) -#define R_386_vt_offset ((unsigned int) R_386_GNU_VTINHERIT - R_386_tls) +#define R_386_tls (R_386_TLS_TPOFF32 + 1 - R_386_tls_offset) +#define R_386_vt_offset (R_386_GNU_VTINHERIT - R_386_tls) /* GNU extension to record C++ vtable hierarchy. */ HOWTO (R_386_GNU_VTINHERIT, /* type */ @@ -221,146 +160,144 @@ static reloc_howto_type elf_howto_table[]= 0, /* dst_mask */ FALSE) /* pcrel_offset */ -#define R_386_vt ((unsigned int) R_386_GNU_VTENTRY + 1 - R_386_vt_offset) +#define R_386_vt (R_386_GNU_VTENTRY + 1 - R_386_vt_offset) }; #ifdef DEBUG_GEN_RELOC -#define TRACE(str) fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str) +#define TRACE(str) \ + fprintf (stderr, "i386 bfd reloc lookup %d (%s)\n", code, str) #else #define TRACE(str) #endif static reloc_howto_type * -elf_i386_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +elf_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { switch (code) { case BFD_RELOC_NONE: TRACE ("BFD_RELOC_NONE"); - return &elf_howto_table[(unsigned int) R_386_NONE ]; + return &elf_howto_table[R_386_NONE]; case BFD_RELOC_32: TRACE ("BFD_RELOC_32"); - return &elf_howto_table[(unsigned int) R_386_32 ]; + return &elf_howto_table[R_386_32]; case BFD_RELOC_CTOR: TRACE ("BFD_RELOC_CTOR"); - return &elf_howto_table[(unsigned int) R_386_32 ]; + return &elf_howto_table[R_386_32]; case BFD_RELOC_32_PCREL: TRACE ("BFD_RELOC_PC32"); - return &elf_howto_table[(unsigned int) R_386_PC32 ]; + return &elf_howto_table[R_386_PC32]; case BFD_RELOC_386_GOT32: TRACE ("BFD_RELOC_386_GOT32"); - return &elf_howto_table[(unsigned int) R_386_GOT32 ]; + return &elf_howto_table[R_386_GOT32]; case BFD_RELOC_386_PLT32: TRACE ("BFD_RELOC_386_PLT32"); - return &elf_howto_table[(unsigned int) R_386_PLT32 ]; + return &elf_howto_table[R_386_PLT32]; case BFD_RELOC_386_COPY: TRACE ("BFD_RELOC_386_COPY"); - return &elf_howto_table[(unsigned int) R_386_COPY ]; + return &elf_howto_table[R_386_COPY]; case BFD_RELOC_386_GLOB_DAT: TRACE ("BFD_RELOC_386_GLOB_DAT"); - return &elf_howto_table[(unsigned int) R_386_GLOB_DAT ]; + return &elf_howto_table[R_386_GLOB_DAT]; case BFD_RELOC_386_JUMP_SLOT: TRACE ("BFD_RELOC_386_JUMP_SLOT"); - return &elf_howto_table[(unsigned int) R_386_JUMP_SLOT ]; + return &elf_howto_table[R_386_JUMP_SLOT]; case BFD_RELOC_386_RELATIVE: TRACE ("BFD_RELOC_386_RELATIVE"); - return &elf_howto_table[(unsigned int) R_386_RELATIVE ]; + return &elf_howto_table[R_386_RELATIVE]; case BFD_RELOC_386_GOTOFF: TRACE ("BFD_RELOC_386_GOTOFF"); - return &elf_howto_table[(unsigned int) R_386_GOTOFF ]; + return &elf_howto_table[R_386_GOTOFF]; case BFD_RELOC_386_GOTPC: TRACE ("BFD_RELOC_386_GOTPC"); - return &elf_howto_table[(unsigned int) R_386_GOTPC ]; + return &elf_howto_table[R_386_GOTPC]; /* These relocs are a GNU extension. */ case BFD_RELOC_386_TLS_TPOFF: TRACE ("BFD_RELOC_386_TLS_TPOFF"); - return &elf_howto_table[(unsigned int) R_386_TLS_TPOFF - R_386_ext_offset]; + return &elf_howto_table[R_386_TLS_TPOFF - R_386_ext_offset]; case BFD_RELOC_386_TLS_IE: TRACE ("BFD_RELOC_386_TLS_IE"); - return &elf_howto_table[(unsigned int) R_386_TLS_IE - R_386_ext_offset]; + return &elf_howto_table[R_386_TLS_IE - R_386_ext_offset]; case BFD_RELOC_386_TLS_GOTIE: TRACE ("BFD_RELOC_386_TLS_GOTIE"); - return &elf_howto_table[(unsigned int) R_386_TLS_GOTIE - R_386_ext_offset]; + return &elf_howto_table[R_386_TLS_GOTIE - R_386_ext_offset]; case BFD_RELOC_386_TLS_LE: TRACE ("BFD_RELOC_386_TLS_LE"); - return &elf_howto_table[(unsigned int) R_386_TLS_LE - R_386_ext_offset]; + return &elf_howto_table[R_386_TLS_LE - R_386_ext_offset]; case BFD_RELOC_386_TLS_GD: TRACE ("BFD_RELOC_386_TLS_GD"); - return &elf_howto_table[(unsigned int) R_386_TLS_GD - R_386_ext_offset]; + return &elf_howto_table[R_386_TLS_GD - R_386_ext_offset]; case BFD_RELOC_386_TLS_LDM: TRACE ("BFD_RELOC_386_TLS_LDM"); - return &elf_howto_table[(unsigned int) R_386_TLS_LDM - R_386_ext_offset]; + return &elf_howto_table[R_386_TLS_LDM - R_386_ext_offset]; case BFD_RELOC_16: TRACE ("BFD_RELOC_16"); - return &elf_howto_table[(unsigned int) R_386_16 - R_386_ext_offset]; + return &elf_howto_table[R_386_16 - R_386_ext_offset]; case BFD_RELOC_16_PCREL: TRACE ("BFD_RELOC_16_PCREL"); - return &elf_howto_table[(unsigned int) R_386_PC16 - R_386_ext_offset]; + return &elf_howto_table[R_386_PC16 - R_386_ext_offset]; case BFD_RELOC_8: TRACE ("BFD_RELOC_8"); - return &elf_howto_table[(unsigned int) R_386_8 - R_386_ext_offset]; + return &elf_howto_table[R_386_8 - R_386_ext_offset]; case BFD_RELOC_8_PCREL: TRACE ("BFD_RELOC_8_PCREL"); - return &elf_howto_table[(unsigned int) R_386_PC8 - R_386_ext_offset]; + return &elf_howto_table[R_386_PC8 - R_386_ext_offset]; /* Common with Sun TLS implementation. */ case BFD_RELOC_386_TLS_LDO_32: TRACE ("BFD_RELOC_386_TLS_LDO_32"); - return &elf_howto_table[(unsigned int) R_386_TLS_LDO_32 - R_386_tls_offset]; + return &elf_howto_table[R_386_TLS_LDO_32 - R_386_tls_offset]; case BFD_RELOC_386_TLS_IE_32: TRACE ("BFD_RELOC_386_TLS_IE_32"); - return &elf_howto_table[(unsigned int) R_386_TLS_IE_32 - R_386_tls_offset]; + return &elf_howto_table[R_386_TLS_IE_32 - R_386_tls_offset]; case BFD_RELOC_386_TLS_LE_32: TRACE ("BFD_RELOC_386_TLS_LE_32"); - return &elf_howto_table[(unsigned int) R_386_TLS_LE_32 - R_386_tls_offset]; + return &elf_howto_table[R_386_TLS_LE_32 - R_386_tls_offset]; case BFD_RELOC_386_TLS_DTPMOD32: TRACE ("BFD_RELOC_386_TLS_DTPMOD32"); - return &elf_howto_table[(unsigned int) R_386_TLS_DTPMOD32 - R_386_tls_offset]; + return &elf_howto_table[R_386_TLS_DTPMOD32 - R_386_tls_offset]; case BFD_RELOC_386_TLS_DTPOFF32: TRACE ("BFD_RELOC_386_TLS_DTPOFF32"); - return &elf_howto_table[(unsigned int) R_386_TLS_DTPOFF32 - R_386_tls_offset]; + return &elf_howto_table[R_386_TLS_DTPOFF32 - R_386_tls_offset]; case BFD_RELOC_386_TLS_TPOFF32: TRACE ("BFD_RELOC_386_TLS_TPOFF32"); - return &elf_howto_table[(unsigned int) R_386_TLS_TPOFF32 - R_386_tls_offset]; + return &elf_howto_table[R_386_TLS_TPOFF32 - R_386_tls_offset]; case BFD_RELOC_VTABLE_INHERIT: TRACE ("BFD_RELOC_VTABLE_INHERIT"); - return &elf_howto_table[(unsigned int) R_386_GNU_VTINHERIT - - R_386_vt_offset]; + return &elf_howto_table[R_386_GNU_VTINHERIT - R_386_vt_offset]; case BFD_RELOC_VTABLE_ENTRY: TRACE ("BFD_RELOC_VTABLE_ENTRY"); - return &elf_howto_table[(unsigned int) R_386_GNU_VTENTRY - - R_386_vt_offset]; + return &elf_howto_table[R_386_GNU_VTENTRY - R_386_vt_offset]; default: break; @@ -371,10 +308,9 @@ elf_i386_reloc_type_lookup (abfd, code) } static void -elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, + Elf_Internal_Rela *dst) { unsigned int r_type = ELF32_R_TYPE (dst->r_info); unsigned int indx; @@ -389,7 +325,7 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) { (*_bfd_error_handler) (_("%s: invalid relocation type %d"), bfd_archive_filename (abfd), (int) r_type); - indx = (unsigned int) R_386_NONE; + indx = R_386_NONE; } cache_ptr->howto = &elf_howto_table[indx]; } @@ -401,9 +337,7 @@ elf_i386_info_to_howto_rel (abfd, cache_ptr, dst) _bfd_elf_is_local_label_name. */ static bfd_boolean -elf_i386_is_local_label_name (abfd, name) - bfd *abfd; - const char *name; +elf_i386_is_local_label_name (bfd *abfd, const char *name) { if (name[0] == '.' && name[1] == 'X') return TRUE; @@ -413,9 +347,7 @@ elf_i386_is_local_label_name (abfd, name) /* Support for core dump NOTE sections. */ static bfd_boolean -elf_i386_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf_i386_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; size_t raw_size; @@ -445,9 +377,7 @@ elf_i386_grok_prstatus (abfd, note) } static bfd_boolean -elf_i386_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elf_i386_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -456,9 +386,9 @@ elf_i386_grok_psinfo (abfd, note) case 124: /* Linux/i386 elf_prpsinfo */ elf_tdata (abfd)->core_program - = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); + = _bfd_elfcore_strndup (abfd, note->descdata + 28, 16); elf_tdata (abfd)->core_command - = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); + = _bfd_elfcore_strndup (abfd, note->descdata + 44, 80); } /* Note that for some reason, a spurious space is tacked @@ -607,8 +537,7 @@ struct elf_i386_obj_tdata (elf_i386_tdata (abfd)->local_got_tls_type) static bfd_boolean -elf_i386_mkobject (abfd) - bfd *abfd; +elf_i386_mkobject (bfd *abfd) { bfd_size_type amt = sizeof (struct elf_i386_obj_tdata); abfd->tdata.any = bfd_zalloc (abfd, amt); @@ -618,8 +547,7 @@ elf_i386_mkobject (abfd) } static bfd_boolean -elf_i386_object_p (abfd) - bfd *abfd; +elf_i386_object_p (bfd *abfd) { /* Allocate our special target data. */ struct elf_i386_obj_tdata *new_tdata; @@ -664,10 +592,9 @@ struct elf_i386_link_hash_table /* Create an entry in an i386 ELF linker hash table. */ static struct bfd_hash_entry * -link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +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. */ @@ -696,13 +623,12 @@ link_hash_newfunc (entry, table, string) /* Create an i386 ELF linker hash table. */ static struct bfd_link_hash_table * -elf_i386_link_hash_table_create (abfd) - bfd *abfd; +elf_i386_link_hash_table_create (bfd *abfd) { struct elf_i386_link_hash_table *ret; bfd_size_type amt = sizeof (struct elf_i386_link_hash_table); - ret = (struct elf_i386_link_hash_table *) bfd_malloc (amt); + ret = bfd_malloc (amt); if (ret == NULL) return NULL; @@ -729,9 +655,7 @@ elf_i386_link_hash_table_create (abfd) shortcuts to them in our hash table. */ static bfd_boolean -create_got_section (dynobj, info) - bfd *dynobj; - struct bfd_link_info *info; +create_got_section (bfd *dynobj, struct bfd_link_info *info) { struct elf_i386_link_hash_table *htab; @@ -760,9 +684,7 @@ create_got_section (dynobj, info) hash table. */ static bfd_boolean -elf_i386_create_dynamic_sections (dynobj, info) - bfd *dynobj; - struct bfd_link_info *info; +elf_i386_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info) { struct elf_i386_link_hash_table *htab; @@ -789,9 +711,9 @@ elf_i386_create_dynamic_sections (dynobj, info) /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void -elf_i386_copy_indirect_symbol (bed, dir, ind) - struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; +elf_i386_copy_indirect_symbol (struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) { struct elf_i386_link_hash_entry *edir, *eind; @@ -854,10 +776,7 @@ elf_i386_copy_indirect_symbol (bed, dir, ind) } static int -elf_i386_tls_transition (info, r_type, is_local) - struct bfd_link_info *info; - int r_type; - int is_local; +elf_i386_tls_transition (struct bfd_link_info *info, int r_type, int is_local) { if (info->shared) return r_type; @@ -886,11 +805,10 @@ elf_i386_tls_transition (info, r_type, is_local) table, and dynamic reloc sections. */ static bfd_boolean -elf_i386_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +elf_i386_check_relocs (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const Elf_Internal_Rela *relocs) { struct elf_i386_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; @@ -1004,8 +922,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs) size = symtab_hdr->sh_info; size *= (sizeof (bfd_signed_vma) + sizeof(char)); - 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; @@ -1029,7 +946,8 @@ elf_i386_check_relocs (abfd, info, sec, relocs) else { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), + (_("%s: `%s' accessed both as normal and " + "thread local symbol"), bfd_archive_filename (abfd), h ? h->root.root.string : ""); return FALSE; @@ -1195,8 +1113,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs) if (p == NULL || p->sec != sec) { bfd_size_type amt = sizeof *p; - p = ((struct elf_i386_dyn_relocs *) - bfd_alloc (htab->elf.dynobj, amt)); + p = bfd_alloc (htab->elf.dynobj, amt); if (p == NULL) return FALSE; p->next = *head; @@ -1238,12 +1155,11 @@ elf_i386_check_relocs (abfd, info, sec, relocs) relocation. */ static asection * -elf_i386_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; +elf_i386_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) { @@ -1277,11 +1193,10 @@ elf_i386_gc_mark_hook (sec, info, rel, h, sym) /* Update the got entry reference counts for the section being removed. */ static bfd_boolean -elf_i386_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +elf_i386_gc_sweep_hook (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; @@ -1375,9 +1290,8 @@ elf_i386_gc_sweep_hook (abfd, info, sec, relocs) understand. */ static bfd_boolean -elf_i386_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; +elf_i386_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) { struct elf_i386_link_hash_table *htab; asection *s; @@ -1534,9 +1448,7 @@ elf_i386_adjust_dynamic_symbol (info, h) dynamic relocs. */ 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 elf_i386_link_hash_table *htab; @@ -1748,9 +1660,7 @@ allocate_dynrelocs (h, inf) /* 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 elf_i386_link_hash_entry *eh; struct elf_i386_dyn_relocs *p; @@ -1779,9 +1689,8 @@ readonly_dynrelocs (h, inf) /* Set the sizes of the dynamic sections. */ static bfd_boolean -elf_i386_size_dynamic_sections (output_bfd, info) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; +elf_i386_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { struct elf_i386_link_hash_table *htab; bfd *dynobj; @@ -1948,7 +1857,7 @@ elf_i386_size_dynamic_sections (output_bfd, info) section's contents are written out. This should not happen, but this way if it does, we get a R_386_NONE reloc instead of garbage. */ - s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->_raw_size); + s->contents = bfd_zalloc (dynobj, s->_raw_size); if (s->contents == NULL) return FALSE; } @@ -1961,7 +1870,7 @@ elf_i386_size_dynamic_sections (output_bfd, info) the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ #define add_dynamic_entry(TAG, VAL) \ - bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + bfd_elf32_add_dynamic_entry (info, (TAG), (VAL)) if (info->executable) { @@ -2007,10 +1916,9 @@ elf_i386_size_dynamic_sections (output_bfd, info) section name, which is a hack, but ought to work. */ static bfd_boolean -elf_i386_fake_sections (abfd, hdr, sec) - bfd *abfd ATTRIBUTE_UNUSED; - Elf_Internal_Shdr *hdr; - asection *sec; +elf_i386_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr *hdr, + asection *sec) { register const char *name; @@ -2043,8 +1951,7 @@ elf_i386_fake_sections (abfd, hdr, sec) This is PT_TLS segment p_vaddr. */ static bfd_vma -dtpoff_base (info) - struct bfd_link_info *info; +dtpoff_base (struct bfd_link_info *info) { /* If tls_segment is NULL, we should have signalled an error already. */ if (elf_hash_table (info)->tls_segment == NULL) @@ -2056,9 +1963,7 @@ dtpoff_base (info) if STT_TLS virtual address is ADDRESS. */ static bfd_vma -tpoff (info, address) - struct bfd_link_info *info; - bfd_vma address; +tpoff (struct bfd_link_info *info, bfd_vma address) { struct elf_link_tls_segment *tls_segment = elf_hash_table (info)->tls_segment; @@ -2073,16 +1978,14 @@ tpoff (info, address) /* Relocate an i386 ELF section. */ static bfd_boolean -elf_i386_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; +elf_i386_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) { struct elf_i386_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; @@ -2114,11 +2017,11 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, int tls_type; r_type = ELF32_R_TYPE (rel->r_info); - if (r_type == (int) R_386_GNU_VTINHERIT - || r_type == (int) R_386_GNU_VTENTRY) + if (r_type == R_386_GNU_VTINHERIT + || r_type == R_386_GNU_VTENTRY) continue; - if ((indx = (unsigned) r_type) >= R_386_standard + if ((indx = r_type) >= R_386_standard && ((indx = r_type - R_386_ext_offset) - R_386_standard >= R_386_ext - R_386_standard) && ((indx = r_type - R_386_tls_offset) - R_386_ext @@ -2633,12 +2536,14 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, if (val == 0xa1) { /* movl foo, %eax. */ - bfd_put_8 (output_bfd, 0xb8, contents + rel->r_offset - 1); + bfd_put_8 (output_bfd, 0xb8, + contents + rel->r_offset - 1); } else { BFD_ASSERT (rel->r_offset >= 2); - type = bfd_get_8 (input_bfd, contents + rel->r_offset - 2); + type = bfd_get_8 (input_bfd, + contents + rel->r_offset - 2); switch (type) { case 0x8b: @@ -3010,7 +2915,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, r = _bfd_final_link_relocate (howto, input_bfd, input_section, contents, rel->r_offset, - relocation, (bfd_vma) 0); + relocation, 0); if (r != bfd_reloc_ok) { @@ -3032,7 +2937,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, if (r == bfd_reloc_overflow) { if (! ((*info->callbacks->reloc_overflow) - (info, name, howto->name, (bfd_vma) 0, + (info, name, howto->name, 0, input_bfd, input_section, rel->r_offset))) return FALSE; } @@ -3055,11 +2960,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section, dynamic sections here. */ static bfd_boolean -elf_i386_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; +elf_i386_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { struct elf_i386_link_hash_table *htab; @@ -3218,10 +3122,9 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym) dynamic linker, before writing them out. */ static enum elf_reloc_type_class -elf_i386_reloc_type_class (rela) - const Elf_Internal_Rela *rela; +elf_i386_reloc_type_class (const Elf_Internal_Rela *rela) { - switch ((int) ELF32_R_TYPE (rela->r_info)) + switch (ELF32_R_TYPE (rela->r_info)) { case R_386_RELATIVE: return reloc_class_relative; @@ -3237,9 +3140,8 @@ elf_i386_reloc_type_class (rela) /* Finish up the dynamic sections. */ static bfd_boolean -elf_i386_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +elf_i386_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { struct elf_i386_link_hash_table *htab; bfd *dynobj; @@ -3348,11 +3250,11 @@ elf_i386_finish_dynamic_sections (output_bfd, info) if (htab->sgotplt->_raw_size > 0) { bfd_put_32 (output_bfd, - (sdyn == NULL ? (bfd_vma) 0 + (sdyn == NULL ? 0 : sdyn->output_section->vma + sdyn->output_offset), htab->sgotplt->contents); - bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 4); - bfd_put_32 (output_bfd, (bfd_vma) 0, htab->sgotplt->contents + 8); + bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 4); + bfd_put_32 (output_bfd, 0, htab->sgotplt->contents + 8); } elf_section_data (htab->sgotplt->output_section)->this_hdr.sh_entsize = 4; @@ -3413,13 +3315,9 @@ elf_i386_finish_dynamic_sections (output_bfd, info) "FreeBSD" label in the ELF header. So we put this label on all executables and (for simplicity) also all other object files. */ -static void elf_i386_post_process_headers - PARAMS ((bfd *, struct bfd_link_info *)); - static void -elf_i386_post_process_headers (abfd, link_info) - bfd *abfd; - struct bfd_link_info *link_info ATTRIBUTE_UNUSED; +elf_i386_post_process_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { Elf_Internal_Ehdr *i_ehdrp; diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index a60015d..90f9b22 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -35,88 +35,10 @@ /* RELA relocations are used here. */ -static struct bfd_hash_entry *ppc_elf_link_hash_newfunc - PARAMS ((struct bfd_hash_entry *entry, struct bfd_hash_table *table, - const char *string)); -static struct bfd_link_hash_table *ppc_elf_link_hash_table_create - PARAMS ((bfd *abfd)); -static void ppc_elf_copy_indirect_symbol - PARAMS ((struct elf_backend_data *bed, struct elf_link_hash_entry *dir, - struct elf_link_hash_entry *ind)); -static reloc_howto_type *ppc_elf_reloc_type_lookup - PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); -static void ppc_elf_info_to_howto - PARAMS ((bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst)); -static void ppc_elf_howto_init - PARAMS ((void)); -static int ppc_elf_sort_rela - PARAMS ((const PTR, const PTR)); -static bfd_boolean ppc_elf_relax_section - PARAMS ((bfd *, asection *, struct bfd_link_info *, bfd_boolean *)); static bfd_reloc_status_type ppc_elf_addr16_ha_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type ppc_elf_unhandled_reloc - PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); -static bfd_boolean ppc_elf_object_p - PARAMS ((bfd *)); -static bfd_boolean ppc_elf_set_private_flags - PARAMS ((bfd *, flagword)); -static bfd_boolean ppc_elf_merge_private_bfd_data - PARAMS ((bfd *, bfd *)); -static int ppc_elf_additional_program_headers - PARAMS ((bfd *)); -static bfd_boolean ppc_elf_modify_segment_map - PARAMS ((bfd *)); -static bfd_boolean ppc_elf_create_got - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean ppc_elf_create_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean ppc_elf_section_from_shdr - PARAMS ((bfd *, Elf_Internal_Shdr *, const char *)); -static bfd_boolean ppc_elf_fake_sections - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); -static elf_linker_section_t *ppc_elf_create_linker_section - PARAMS ((bfd *abfd, struct bfd_link_info *info, - enum elf_linker_section_enum)); -static bfd_boolean update_local_sym_info - PARAMS ((bfd *, Elf_Internal_Shdr *, unsigned long, int)); -static void bad_shared_reloc - PARAMS ((bfd *, enum elf_ppc_reloc_type)); -static bfd_boolean ppc_elf_check_relocs - PARAMS ((bfd *, struct bfd_link_info *, asection *, - const Elf_Internal_Rela *)); -static asection *ppc_elf_gc_mark_hook - PARAMS ((asection *sec, struct bfd_link_info *info, Elf_Internal_Rela *rel, - struct elf_link_hash_entry *h, Elf_Internal_Sym *sym)); -static bfd_boolean ppc_elf_gc_sweep_hook - PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *sec, - const Elf_Internal_Rela *relocs)); -static bfd_boolean ppc_elf_adjust_dynamic_symbol - PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); -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 ppc_elf_size_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static bfd_boolean ppc_elf_relocate_section - PARAMS ((bfd *, struct bfd_link_info *info, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *relocs, Elf_Internal_Sym *local_syms, - asection **)); -static bfd_boolean ppc_elf_add_symbol_hook - PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, - const char **, flagword *, asection **, bfd_vma *)); -static bfd_boolean ppc_elf_finish_dynamic_symbol - PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *)); -static bfd_boolean ppc_elf_finish_dynamic_sections - PARAMS ((bfd *, struct bfd_link_info *)); -static enum elf_reloc_type_class ppc_elf_reloc_type_class - PARAMS ((const Elf_Internal_Rela *)); -static bfd_boolean ppc_elf_grok_prstatus - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); -static bfd_boolean ppc_elf_grok_psinfo - PARAMS ((bfd *abfd, Elf_Internal_Note *note)); + (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); /* Branch prediction bit for branch taken relocs. */ #define BRANCH_PREDICT_BIT 0x200000 @@ -235,10 +157,9 @@ struct ppc_elf_link_hash_table /* Create an entry in a PPC ELF linker hash table. */ static struct bfd_hash_entry * -ppc_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +ppc_elf_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. */ @@ -264,13 +185,11 @@ ppc_elf_link_hash_newfunc (entry, table, string) /* Create a PPC ELF linker hash table. */ static struct bfd_link_hash_table * -ppc_elf_link_hash_table_create (abfd) - bfd *abfd; +ppc_elf_link_hash_table_create (bfd *abfd) { struct ppc_elf_link_hash_table *ret; - ret = ((struct ppc_elf_link_hash_table *) - bfd_malloc (sizeof (struct ppc_elf_link_hash_table))); + ret = bfd_malloc (sizeof (struct ppc_elf_link_hash_table)); if (ret == NULL) return NULL; @@ -308,9 +227,9 @@ ppc_elf_link_hash_table_create (abfd) /* Copy the extra info we tack onto an elf_link_hash_entry. */ static void -ppc_elf_copy_indirect_symbol (bed, dir, ind) - struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; +ppc_elf_copy_indirect_symbol (struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) { struct ppc_elf_link_hash_entry *edir, *eind; @@ -1606,7 +1525,7 @@ static reloc_howto_type ppc_elf_howto_raw[] = { /* Initialize the ppc_elf_howto_table, so that linear accesses can be done. */ static void -ppc_elf_howto_init () +ppc_elf_howto_init (void) { unsigned int i, type; @@ -1647,23 +1566,20 @@ ppc_elf_howto_init () /* Sort sections by address. */ static int -ppc_elf_sort_rela (arg1, arg2) - const PTR arg1; - const PTR arg2; +ppc_elf_sort_rela (const void *arg1, const void *arg2) { - const Elf_Internal_Rela **rela1 = (const Elf_Internal_Rela**) arg1; - const Elf_Internal_Rela **rela2 = (const Elf_Internal_Rela**) arg2; + const Elf_Internal_Rela * const *rela1 = arg1; + const Elf_Internal_Rela * const *rela2 = arg2; /* Sort by offset. */ return ((*rela1)->r_offset - (*rela2)->r_offset); } static bfd_boolean -ppc_elf_relax_section (abfd, isec, link_info, again) - bfd *abfd; - asection *isec; - struct bfd_link_info *link_info; - bfd_boolean *again; +ppc_elf_relax_section (bfd *abfd, + asection *isec, + struct bfd_link_info *link_info, + bfd_boolean *again) { #define PAGESIZE 0x1000 @@ -1695,7 +1611,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again) else { /* Go get them off disk. */ - contents = (bfd_byte *) bfd_malloc (isec->_raw_size); + contents = bfd_malloc (isec->_raw_size); if (contents == NULL) goto error_return; free_contents = contents; @@ -1714,8 +1630,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again) /* Get a copy of the native relocations. */ internal_relocs - = _bfd_elf_link_read_relocs (abfd, isec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + = _bfd_elf_link_read_relocs (abfd, isec, NULL, NULL, link_info->keep_memory); if (internal_relocs == NULL) goto error_return; @@ -1725,15 +1640,15 @@ ppc_elf_relax_section (abfd, isec, link_info, again) /* Setup a faster access method for the reloc info we need. */ amt = isec->reloc_count; amt *= sizeof (Elf_Internal_Rela*); - rela_comb = (Elf_Internal_Rela**) bfd_malloc (amt); + rela_comb = bfd_malloc (amt); if (rela_comb == NULL) goto error_return; for (n = 0; n < isec->reloc_count; ++n) { - long r_type; + enum elf_ppc_reloc_type r_type; r_type = ELF32_R_TYPE (internal_relocs[n].r_info); - if (r_type < 0 || r_type >= (int) R_PPC_max) + if (r_type >= R_PPC_max) goto error_return; /* Prologue constants are sometimes present in the ".text" @@ -1861,7 +1776,7 @@ ppc_elf_relax_section (abfd, isec, link_info, again) #undef BO4 if (modified) { - bfd_put_32 (abfd, (bfd_vma) insn, contents + isec_offset); + bfd_put_32 (abfd, insn, contents + isec_offset); section_modified = TRUE; } } @@ -1910,9 +1825,8 @@ ppc_elf_relax_section (abfd, isec, link_info, again) } static reloc_howto_type * -ppc_elf_reloc_type_lookup (abfd, code) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_reloc_code_real_type code; +ppc_elf_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) { enum elf_ppc_reloc_type r; @@ -1920,10 +1834,10 @@ ppc_elf_reloc_type_lookup (abfd, code) /* Initialize howto table if needed. */ ppc_elf_howto_init (); - switch ((int) code) + switch (code) { default: - return (reloc_howto_type *) NULL; + return NULL; case BFD_RELOC_NONE: r = R_PPC_NONE; break; case BFD_RELOC_32: r = R_PPC_ADDR32; break; @@ -2008,16 +1922,15 @@ ppc_elf_reloc_type_lookup (abfd, code) case BFD_RELOC_VTABLE_ENTRY: r = R_PPC_GNU_VTENTRY; break; } - return ppc_elf_howto_table[(int) r]; + return ppc_elf_howto_table[r]; }; /* Set the howto pointer for a PowerPC ELF reloc. */ static void -ppc_elf_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr; - Elf_Internal_Rela *dst; +ppc_elf_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr, + Elf_Internal_Rela *dst) { if (!ppc_elf_howto_table[R_PPC_ADDR32]) /* Initialize howto table if needed. */ @@ -2030,15 +1943,13 @@ ppc_elf_info_to_howto (abfd, cache_ptr, dst) /* Handle the R_PPC_ADDR16_HA reloc. */ static bfd_reloc_status_type -ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section, - output_bfd, error_message) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *reloc_entry; - asymbol *symbol; - PTR data ATTRIBUTE_UNUSED; - asection *input_section; - bfd *output_bfd; - char **error_message ATTRIBUTE_UNUSED; +ppc_elf_addr16_ha_reloc (bfd *abfd ATTRIBUTE_UNUSED, + arelent *reloc_entry, + asymbol *symbol, + void *data ATTRIBUTE_UNUSED, + asection *input_section, + bfd *output_bfd, + char **error_message ATTRIBUTE_UNUSED) { bfd_vma relocation; @@ -2066,15 +1977,13 @@ ppc_elf_addr16_ha_reloc (abfd, reloc_entry, symbol, data, input_section, } static bfd_reloc_status_type -ppc_elf_unhandled_reloc (abfd, reloc_entry, symbol, data, - input_section, output_bfd, error_message) - bfd *abfd; - arelent *reloc_entry; - asymbol *symbol; - PTR data; - asection *input_section; - bfd *output_bfd; - char **error_message; +ppc_elf_unhandled_reloc (bfd *abfd, + arelent *reloc_entry, + asymbol *symbol, + void *data, + asection *input_section, + bfd *output_bfd, + char **error_message) { /* If this is a relocatable link (output_bfd test tells us), just call the generic function. Any adjustment will be done at final @@ -2086,7 +1995,7 @@ ppc_elf_unhandled_reloc (abfd, reloc_entry, symbol, data, if (error_message != NULL) { static char buf[60]; - sprintf (buf, "generic linker can't handle %s", + sprintf (buf, _("generic linker can't handle %s"), reloc_entry->howto->name); *error_message = buf; } @@ -2097,8 +2006,7 @@ ppc_elf_unhandled_reloc (abfd, reloc_entry, symbol, data, default is 64 bit. */ static bfd_boolean -ppc_elf_object_p (abfd) - bfd *abfd; +ppc_elf_object_p (bfd *abfd) { if (abfd->arch_info->the_default && abfd->arch_info->bits_per_word == 64) { @@ -2117,9 +2025,7 @@ ppc_elf_object_p (abfd) /* Function to set whether a module needs the -mrelocatable bit set. */ static bfd_boolean -ppc_elf_set_private_flags (abfd, flags) - bfd *abfd; - flagword flags; +ppc_elf_set_private_flags (bfd *abfd, flagword flags) { BFD_ASSERT (!elf_flags_init (abfd) || elf_elfheader (abfd)->e_flags == flags); @@ -2133,9 +2039,7 @@ ppc_elf_set_private_flags (abfd, flags) object file when linking. */ static bfd_boolean -ppc_elf_merge_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { flagword old_flags; flagword new_flags; @@ -2173,7 +2077,8 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: compiled with -mrelocatable and linked with modules compiled normally"), + (_("%s: compiled with -mrelocatable and linked with " + "modules compiled normally"), bfd_archive_filename (ibfd)); } else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0 @@ -2181,7 +2086,8 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: compiled normally and linked with modules compiled with -mrelocatable"), + (_("%s: compiled normally and linked with " + "modules compiled with -mrelocatable"), bfd_archive_filename (ibfd)); } @@ -2208,7 +2114,8 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + (_("%s: uses different e_flags (0x%lx) fields " + "than previous modules (0x%lx)"), bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); } @@ -2226,10 +2133,7 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd) is called when elfcode.h finds a section with an unknown type. */ static bfd_boolean -ppc_elf_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - const char *name; +ppc_elf_section_from_shdr (bfd *abfd, Elf_Internal_Shdr *hdr, const char *name) { asection *newsect; flagword flags; @@ -2252,10 +2156,9 @@ ppc_elf_section_from_shdr (abfd, hdr, name) /* Set up any other section flags and such that may be necessary. */ static bfd_boolean -ppc_elf_fake_sections (abfd, shdr, asect) - bfd *abfd ATTRIBUTE_UNUSED; - Elf_Internal_Shdr *shdr; - asection *asect; +ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, + Elf_Internal_Shdr *shdr, + asection *asect) { if ((asect->flags & SEC_EXCLUDE) != 0) shdr->sh_flags |= SHF_EXCLUDE; @@ -2268,10 +2171,9 @@ ppc_elf_fake_sections (abfd, shdr, asect) /* Create a special linker section */ static elf_linker_section_t * -ppc_elf_create_linker_section (abfd, info, which) - bfd *abfd; - struct bfd_link_info *info; - enum elf_linker_section_enum which; +ppc_elf_create_linker_section (bfd *abfd, + struct bfd_link_info *info, + enum elf_linker_section_enum which) { bfd *dynobj = elf_hash_table (info)->dynobj; elf_linker_section_t *lsect; @@ -2311,7 +2213,7 @@ ppc_elf_create_linker_section (abfd, info, which) (int) which); bfd_set_error (bfd_error_bad_value); - return (elf_linker_section_t *) 0; + return NULL; case LINKER_SECTION_SDATA: /* .sdata/.sbss section */ defaults.name = ".sdata"; @@ -2341,8 +2243,7 @@ ppc_elf_create_linker_section (abfd, info, which) need to bump up the number of section headers. */ static int -ppc_elf_additional_program_headers (abfd) - bfd *abfd; +ppc_elf_additional_program_headers (bfd *abfd) { asection *s; int ret; @@ -2367,8 +2268,7 @@ ppc_elf_additional_program_headers (abfd) /* Modify the segment map if needed. */ static bfd_boolean -ppc_elf_modify_segment_map (abfd) - bfd *abfd ATTRIBUTE_UNUSED; +ppc_elf_modify_segment_map (bfd *abfd ATTRIBUTE_UNUSED) { return TRUE; } @@ -2376,9 +2276,7 @@ ppc_elf_modify_segment_map (abfd) /* The powerpc .got has a blrl instruction in it. Mark it executable. */ static bfd_boolean -ppc_elf_create_got (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +ppc_elf_create_got (bfd *abfd, struct bfd_link_info *info) { struct ppc_elf_link_hash_table *htab; asection *s; @@ -2414,9 +2312,7 @@ ppc_elf_create_got (abfd, info) to create .dynbss and .rela.bss). */ static bfd_boolean -ppc_elf_create_dynamic_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +ppc_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info) { struct ppc_elf_link_hash_table *htab; asection *s; @@ -2464,9 +2360,8 @@ ppc_elf_create_dynamic_sections (abfd, info) understand. */ static bfd_boolean -ppc_elf_adjust_dynamic_symbol (info, h) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; +ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) { struct ppc_elf_link_hash_table *htab; asection *s; @@ -2655,11 +2550,9 @@ ppc_elf_adjust_dynamic_symbol (info, h) /* Allocate space in associated reloc sections for dynamic relocs. */ 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 bfd_link_info *) inf; + struct bfd_link_info *info = inf; struct ppc_elf_link_hash_entry *eh; struct ppc_elf_link_hash_table *htab; struct ppc_elf_dyn_relocs *p; @@ -2804,7 +2697,7 @@ allocate_dynrelocs (h, inf) generated via assembly. We want calls to protected symbols to resolve directly to the function rather than going via the plt. If people want function pointer comparisons to work as expected - then they should avoid writing weird assembly. */ + then they should avoid writing weird assembly. */ if (SYMBOL_CALLS_LOCAL (info, h)) { struct ppc_elf_dyn_relocs **pp; @@ -2869,9 +2762,7 @@ allocate_dynrelocs (h, inf) /* Find any dynamic relocs that apply to read-only sections. */ static bfd_boolean -readonly_dynrelocs (h, info) - struct elf_link_hash_entry *h; - PTR info; +readonly_dynrelocs (struct elf_link_hash_entry *h, void *info) { struct ppc_elf_dyn_relocs *p; @@ -2901,9 +2792,8 @@ readonly_dynrelocs (h, info) /* Set the sizes of the dynamic sections. */ static bfd_boolean -ppc_elf_size_dynamic_sections (output_bfd, info) - bfd *output_bfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; +ppc_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { struct ppc_elf_link_hash_table *htab; asection *s; @@ -3087,7 +2977,7 @@ ppc_elf_size_dynamic_sections (output_bfd, info) } /* Allocate memory for the section contents. */ - s->contents = (bfd_byte *) bfd_zalloc (htab->elf.dynobj, s->_raw_size); + s->contents = bfd_zalloc (htab->elf.dynobj, s->_raw_size); if (s->contents == NULL) return FALSE; } @@ -3100,7 +2990,7 @@ ppc_elf_size_dynamic_sections (output_bfd, info) the .dynamic section. The DT_DEBUG entry is filled in by the dynamic linker and used by the debugger. */ #define add_dynamic_entry(TAG, VAL) \ - bfd_elf32_add_dynamic_entry (info, (bfd_vma) (TAG), (bfd_vma) (VAL)) + bfd_elf32_add_dynamic_entry (info, (TAG), (VAL)) if (info->executable) { @@ -3129,7 +3019,7 @@ ppc_elf_size_dynamic_sections (output_bfd, info) need a DT_TEXTREL entry. */ if ((info->flags & DF_TEXTREL) == 0) elf_link_hash_traverse (elf_hash_table (info), readonly_dynrelocs, - (PTR) info); + info); if ((info->flags & DF_TEXTREL) != 0) { @@ -3143,11 +3033,10 @@ ppc_elf_size_dynamic_sections (output_bfd, info) } static bfd_boolean -update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type) - bfd *abfd; - Elf_Internal_Shdr *symtab_hdr; - unsigned long r_symndx; - int tls_type; +update_local_sym_info (bfd *abfd, + Elf_Internal_Shdr *symtab_hdr, + unsigned long r_symndx, + int tls_type) { bfd_signed_vma *local_got_refcounts = elf_local_got_refcounts (abfd); char *local_got_tls_masks; @@ -3157,7 +3046,7 @@ update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type) bfd_size_type size = symtab_hdr->sh_info; size *= sizeof (*local_got_refcounts) + sizeof (*local_got_tls_masks); - 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; @@ -3170,14 +3059,12 @@ update_local_sym_info (abfd, symtab_hdr, r_symndx, tls_type) } static void -bad_shared_reloc (abfd, r_type) - bfd *abfd; - enum elf_ppc_reloc_type r_type; +bad_shared_reloc (bfd *abfd, enum elf_ppc_reloc_type r_type) { (*_bfd_error_handler) (_("%s: relocation %s cannot be used when making a shared object"), bfd_archive_filename (abfd), - ppc_elf_howto_table[(int) r_type]->name); + ppc_elf_howto_table[r_type]->name); bfd_set_error (bfd_error_bad_value); } @@ -3186,11 +3073,10 @@ bad_shared_reloc (abfd, r_type) table. */ static bfd_boolean -ppc_elf_check_relocs (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +ppc_elf_check_relocs (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const Elf_Internal_Rela *relocs) { struct ppc_elf_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; @@ -3264,7 +3150,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) } } - r_type = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); switch (r_type) { case R_PPC_GOT_TLSLD16: @@ -3540,7 +3426,9 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) struct ppc_elf_dyn_relocs **head; #ifdef DEBUG - fprintf (stderr, "ppc_elf_check_relocs need to create relocation for %s\n", + fprintf (stderr, + "ppc_elf_check_relocs needs to " + "create relocation for %s\n", (h && h->root.root.string ? h->root.root.string : "")); #endif @@ -3604,8 +3492,7 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) p = *head; if (p == NULL || p->sec != sec) { - p = ((struct ppc_elf_dyn_relocs *) - bfd_alloc (htab->elf.dynobj, sizeof *p)); + p = bfd_alloc (htab->elf.dynobj, sizeof *p); if (p == NULL) return FALSE; p->next = *head; @@ -3631,12 +3518,11 @@ ppc_elf_check_relocs (abfd, info, sec, relocs) relocation. */ static asection * -ppc_elf_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; +ppc_elf_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) { @@ -3671,11 +3557,10 @@ ppc_elf_gc_mark_hook (sec, info, rel, h, sym) section being removed. */ static bfd_boolean -ppc_elf_gc_sweep_hook (abfd, info, sec, relocs) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - const Elf_Internal_Rela *relocs; +ppc_elf_gc_sweep_hook (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + const Elf_Internal_Rela *relocs) { struct ppc_elf_link_hash_table *htab; Elf_Internal_Shdr *symtab_hdr; @@ -3715,7 +3600,7 @@ ppc_elf_gc_sweep_hook (abfd, info, sec, relocs) } } - r_type = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); switch (r_type) { case R_PPC_GOT_TLSLD16: @@ -3796,9 +3681,7 @@ ppc_elf_gc_sweep_hook (abfd, info, sec, relocs) /* Set htab->tls_sec and htab->tls_get_addr. */ bfd_boolean -ppc_elf_tls_setup (obfd, info) - bfd *obfd; - struct bfd_link_info *info; +ppc_elf_tls_setup (bfd *obfd, struct bfd_link_info *info) { asection *tls; struct ppc_elf_link_hash_table *htab; @@ -3820,9 +3703,8 @@ ppc_elf_tls_setup (obfd, info) opportunities. */ bfd_boolean -ppc_elf_tls_optimize (obfd, info) - bfd *obfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; +ppc_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { bfd *ibfd; asection *sec; @@ -3844,8 +3726,7 @@ ppc_elf_tls_optimize (obfd, info) int expecting_tls_get_addr; /* Read the relocations. */ - relstart = _bfd_elf_link_read_relocs (ibfd, sec, (PTR) NULL, - (Elf_Internal_Rela *) NULL, + relstart = _bfd_elf_link_read_relocs (ibfd, sec, NULL, NULL, info->keep_memory); if (relstart == NULL) return FALSE; @@ -3878,7 +3759,7 @@ ppc_elf_tls_optimize (obfd, info) || !(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC)) is_local = TRUE; - r_type = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel->r_info); + r_type = ELF32_R_TYPE (rel->r_info); switch (r_type) { case R_PPC_GOT_TLSLD16: @@ -4015,14 +3896,13 @@ ppc_elf_tls_optimize (obfd, info) file. We use it to put .comm items in .sbss, and not .bss. */ static bfd_boolean -ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) - bfd *abfd; - struct bfd_link_info *info; - const Elf_Internal_Sym *sym; - const char **namep ATTRIBUTE_UNUSED; - flagword *flagsp ATTRIBUTE_UNUSED; - asection **secp; - bfd_vma *valp; +ppc_elf_add_symbol_hook (bfd *abfd, + struct bfd_link_info *info, + const Elf_Internal_Sym *sym, + const char **namep ATTRIBUTE_UNUSED, + flagword *flagsp ATTRIBUTE_UNUSED, + asection **secp, + bfd_vma *valp) { if (sym->st_shndx == SHN_COMMON && !info->relocateable @@ -4043,17 +3923,16 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) will move the symbols to the appropriate output section when it defines common symbols. */ amt = sizeof (asection); - sdata->bss_section = (asection *) bfd_zalloc (abfd, amt); + sdata->bss_section = bfd_zalloc (abfd, amt); if (sdata->bss_section == NULL) return FALSE; sdata->bss_section->name = sdata->bss_name; sdata->bss_section->flags = SEC_IS_COMMON; sdata->bss_section->output_section = sdata->bss_section; amt = sizeof (asymbol); - sdata->bss_section->symbol = (asymbol *) bfd_zalloc (abfd, amt); + sdata->bss_section->symbol = bfd_zalloc (abfd, amt); amt = sizeof (asymbol *); - sdata->bss_section->symbol_ptr_ptr = - (asymbol **) bfd_zalloc (abfd, amt); + sdata->bss_section->symbol_ptr_ptr = bfd_zalloc (abfd, amt); if (sdata->bss_section->symbol == NULL || sdata->bss_section->symbol_ptr_ptr == NULL) return FALSE; @@ -4074,11 +3953,10 @@ ppc_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) dynamic sections here. */ static bfd_boolean -ppc_elf_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; +ppc_elf_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) { struct ppc_elf_link_hash_table *htab; @@ -4183,9 +4061,8 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym) /* Finish up the dynamic sections. */ static bfd_boolean -ppc_elf_finish_dynamic_sections (output_bfd, info) - bfd *output_bfd; - struct bfd_link_info *info; +ppc_elf_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) { asection *sdyn; struct ppc_elf_link_hash_table *htab; @@ -4241,10 +4118,10 @@ ppc_elf_finish_dynamic_sections (output_bfd, info) if (htab->got) { unsigned char *contents = htab->got->contents; - bfd_put_32 (output_bfd, (bfd_vma) 0x4e800021 /* blrl */, contents); + bfd_put_32 (output_bfd, 0x4e800021 /* blrl */, contents); if (sdyn == NULL) - bfd_put_32 (output_bfd, (bfd_vma) 0, contents + 4); + bfd_put_32 (output_bfd, 0, contents + 4); else bfd_put_32 (output_bfd, sdyn->output_section->vma + sdyn->output_offset, @@ -4286,16 +4163,14 @@ ppc_elf_finish_dynamic_sections (output_bfd, info) accordingly. */ static bfd_boolean -ppc_elf_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; +ppc_elf_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) { Elf_Internal_Shdr *symtab_hdr; struct elf_link_hash_entry **sym_hashes; @@ -4309,7 +4184,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_boolean ret = TRUE; #ifdef DEBUG - fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, %ld relocations%s\n", + fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, " + "%ld relocations%s\n", bfd_archive_filename (input_bfd), bfd_section_name(input_bfd, input_section), (long) input_section->reloc_count, @@ -4346,10 +4222,10 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_boolean warned; unsigned int tls_type, tls_mask, tls_gd; - r_type = (enum elf_ppc_reloc_type)ELF32_R_TYPE (rel->r_info); - sym = (Elf_Internal_Sym *) 0; - sec = (asection *) 0; - h = (struct elf_link_hash_entry *) 0; + r_type = ELF32_R_TYPE (rel->r_info); + sym = NULL; + sec = NULL; + h = NULL; unresolved_reloc = FALSE; warned = FALSE; r_symndx = ELF32_R_SYM (rel->r_info); @@ -4542,8 +4418,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* The next instruction should be a call to __tls_get_addr. Peek at the reloc to be sure. */ - r_type2 - = (enum elf_ppc_reloc_type) ELF32_R_TYPE (rel[1].r_info); + r_type2 = ELF32_R_TYPE (rel[1].r_info); r_symndx2 = ELF32_R_SYM (rel[1].r_info); if (r_symndx2 < symtab_hdr->sh_info || (r_type2 != R_PPC_REL14 @@ -4642,8 +4517,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, addend = rel->r_addend; tls_type = 0; howto = NULL; - if ((unsigned) r_type < (unsigned) R_PPC_max) - howto = ppc_elf_howto_table[(int) r_type]; + if (r_type < R_PPC_max) + howto = ppc_elf_howto_table[r_type]; switch (r_type) { default: @@ -5010,7 +4885,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, int skip; #ifdef DEBUG - fprintf (stderr, "ppc_elf_relocate_section need to create relocation for %s\n", + fprintf (stderr, "ppc_elf_relocate_section needs to " + "create relocation for %s\n", (h && h->root.root.string ? h->root.root.string : "")); #endif @@ -5089,11 +4965,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, BFD_ASSERT (indx > 0); #ifdef DEBUG if (indx <= 0) - { - printf ("indx=%d section=%s flags=%08x name=%s\n", - indx, osec->name, osec->flags, - h->root.root.string); - } + printf ("indx=%d section=%s flags=%08x name=%s\n", + indx, osec->name, osec->flags, + h->root.root.string); #endif } @@ -5146,7 +5020,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, an embedded ELF object, for which the .got section acts like the AIX .toc section. */ case R_PPC_TOC16: /* phony GOT16 relocations */ - BFD_ASSERT (sec != (asection *) 0); + BFD_ASSERT (sec != NULL); BFD_ASSERT (bfd_is_und_section (sec) || strcmp (bfd_get_section_name (abfd, sec), ".got") == 0 || strcmp (bfd_get_section_name (abfd, sec), ".cgot") == 0) @@ -5180,18 +5054,20 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, const char *name; const struct elf_link_hash_entry *sh; - BFD_ASSERT (sec != (asection *) 0); + BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); if (! ((strncmp (name, ".sdata", 6) == 0 && (name[6] == 0 || name[6] == '.')) || (strncmp (name, ".sbss", 5) == 0 && (name[5] == 0 || name[5] == '.')))) { - (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), - sym_name, - howto->name, - name); + (*_bfd_error_handler) + (_("%s: the target (%s) of a %s relocation is " + "in the wrong output section (%s)"), + bfd_archive_filename (input_bfd), + sym_name, + howto->name, + name); } sh = htab->sdata->sym_hash; addend -= (sh->root.u.def.value @@ -5206,16 +5082,18 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, const char *name; const struct elf_link_hash_entry *sh; - BFD_ASSERT (sec != (asection *) 0); + BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); if (! (strncmp (name, ".sdata2", 7) == 0 || strncmp (name, ".sbss2", 6) == 0)) { - (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), - sym_name, - howto->name, - name); + (*_bfd_error_handler) + (_("%s: the target (%s) of a %s relocation is " + "in the wrong output section (%s)"), + bfd_archive_filename (input_bfd), + sym_name, + howto->name, + name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -5236,7 +5114,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, const struct elf_link_hash_entry *sh; int reg; - BFD_ASSERT (sec != (asection *) 0); + BFD_ASSERT (sec != NULL); name = bfd_get_section_name (abfd, sec->output_section); if (((strncmp (name, ".sdata", 6) == 0 && (name[6] == 0 || name[6] == '.')) @@ -5268,11 +5146,13 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { - (*_bfd_error_handler) (_("%s: the target (%s) of a %s relocation is in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), - sym_name, - howto->name, - name); + (*_bfd_error_handler) + (_("%s: the target (%s) of a %s relocation is " + "in the wrong output section (%s)"), + bfd_archive_filename (input_bfd), + sym_name, + howto->name, + name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -5293,7 +5173,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, case R_PPC_SECTOFF_LO: case R_PPC_SECTOFF_HI: case R_PPC_SECTOFF_HA: - BFD_ASSERT (sec != (asection *) 0); + BFD_ASSERT (sec != NULL); addend -= sec->output_section->vma; break; @@ -5362,7 +5242,8 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, } #ifdef DEBUG - fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, offset = %ld, addend = %ld\n", + fprintf (stderr, "\ttype = %s (%d), name = %s, symbol index = %ld, " + "offset = %ld, addend = %ld\n", howto->name, (int) r_type, sym_name, @@ -5443,10 +5324,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section, } static enum elf_reloc_type_class -ppc_elf_reloc_type_class (rela) - const Elf_Internal_Rela *rela; +ppc_elf_reloc_type_class (const Elf_Internal_Rela *rela) { - switch ((int) ELF32_R_TYPE (rela->r_info)) + switch (ELF32_R_TYPE (rela->r_info)) { case R_PPC_RELATIVE: return reloc_class_relative; @@ -5464,9 +5344,7 @@ ppc_elf_reloc_type_class (rela) /* Support for core dump NOTE sections. */ static bfd_boolean -ppc_elf_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +ppc_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { int offset; unsigned int raw_size; @@ -5496,9 +5374,7 @@ ppc_elf_grok_prstatus (abfd, note) } static bfd_boolean -ppc_elf_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +ppc_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { switch (note->descsz) { @@ -5535,31 +5411,17 @@ typedef struct apuinfo_list } apuinfo_list; -static apuinfo_list * head; - -static void apuinfo_list_init PARAMS ((void)); -static void apuinfo_list_add PARAMS ((unsigned long)); -static unsigned apuinfo_list_length PARAMS ((void)); -static unsigned long apuinfo_list_element PARAMS ((unsigned long)); -static void apuinfo_list_finish PARAMS ((void)); - -extern void ppc_elf_begin_write_processing - PARAMS ((bfd *, struct bfd_link_info *)); -extern void ppc_elf_final_write_processing - PARAMS ((bfd *, bfd_boolean)); -extern bfd_boolean ppc_elf_write_section - PARAMS ((bfd *, asection *, bfd_byte *)); +static apuinfo_list *head; static void -apuinfo_list_init PARAMS ((void)) +apuinfo_list_init (void) { head = NULL; } static void -apuinfo_list_add (value) - unsigned long value; +apuinfo_list_add (unsigned long value) { apuinfo_list *entry = head; @@ -5580,7 +5442,7 @@ apuinfo_list_add (value) } static unsigned -apuinfo_list_length PARAMS ((void)) +apuinfo_list_length (void) { apuinfo_list *entry; unsigned long count; @@ -5594,8 +5456,7 @@ apuinfo_list_length PARAMS ((void)) } static inline unsigned long -apuinfo_list_element (number) - unsigned long number; +apuinfo_list_element (unsigned long number) { apuinfo_list * entry; @@ -5608,7 +5469,7 @@ apuinfo_list_element (number) } static void -apuinfo_list_finish PARAMS ((void)) +apuinfo_list_finish (void) { apuinfo_list *entry; @@ -5628,10 +5489,8 @@ apuinfo_list_finish PARAMS ((void)) /* Scan the input BFDs and create a linked list of the APUinfo values that will need to be emitted. */ -void -ppc_elf_begin_write_processing (abfd, link_info) - bfd *abfd; - struct bfd_link_info *link_info; +static void +ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) { bfd *ibfd; asection *asec; @@ -5762,11 +5621,10 @@ ppc_elf_begin_write_processing (abfd, link_info) /* Prevent the output section from accumulating the input sections' contents. We have already stored this in our linked list structure. */ -bfd_boolean -ppc_elf_write_section (abfd, asec, contents) - bfd *abfd ATTRIBUTE_UNUSED; - asection *asec; - bfd_byte *contents ATTRIBUTE_UNUSED; +static bfd_boolean +ppc_elf_write_section (bfd *abfd ATTRIBUTE_UNUSED, + asection *asec, + bfd_byte *contents ATTRIBUTE_UNUSED) { return (apuinfo_list_length () && strcmp (asec->name, APUINFO_SECTION_NAME) == 0); @@ -5775,10 +5633,8 @@ ppc_elf_write_section (abfd, asec, contents) /* Finally we can generate the output section. */ -void -ppc_elf_final_write_processing (abfd, linker) - bfd *abfd; - bfd_boolean linker ATTRIBUTE_UNUSED; +static void +ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) { bfd_byte *buffer; asection *asec; diff --git a/bfd/elf32-ppc.h b/bfd/elf32-ppc.h index ead9c94..72be813 100644 --- a/bfd/elf32-ppc.h +++ b/bfd/elf32-ppc.h @@ -17,7 +17,5 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -bfd_boolean ppc_elf_tls_setup - PARAMS ((bfd *, struct bfd_link_info *)); -bfd_boolean ppc_elf_tls_optimize - PARAMS ((bfd *, struct bfd_link_info *)); +bfd_boolean ppc_elf_tls_setup (bfd *, struct bfd_link_info *); +bfd_boolean ppc_elf_tls_optimize (bfd *, struct bfd_link_info *); -- 2.7.4