From 4164a9f68ca1abc213243df4cd53dd97009e7454 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 30 Jul 2003 02:08:06 +0000 Subject: [PATCH] * elf.c: Convert to C90, remove unnecessary prototypes and casts. Replace PTR with void *. Formatting. (_bfd_elf_assign_file_position_for_section): Remove INLINE. (make_mapping): Likewise. --- bfd/ChangeLog | 7 + bfd/elf.c | 1036 +++++++++++++++++++++------------------------------------ 2 files changed, 386 insertions(+), 657 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1f3b785c57..69e9a10cdf 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2003-07-30 Alan Modra + + * elf.c: Convert to C90, remove unnecessary prototypes and casts. + Replace PTR with void *. Formatting. + (_bfd_elf_assign_file_position_for_section): Remove INLINE. + (make_mapping): Likewise. + 2003-07-29 Alan Modra * elf64-ppc.c (func_desc_adjust): Give linker created function diff --git a/bfd/elf.c b/bfd/elf.c index b6f80240f5..b03e7edb5e 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -40,69 +40,11 @@ #include "elf-bfd.h" #include "libiberty.h" -static INLINE struct elf_segment_map *make_mapping - PARAMS ((bfd *, asection **, unsigned int, unsigned int, bfd_boolean)); -static bfd_boolean map_sections_to_segments - PARAMS ((bfd *)); -static int elf_sort_sections - PARAMS ((const PTR, const PTR)); -static bfd_boolean assign_file_positions_for_segments - PARAMS ((bfd *)); -static bfd_boolean assign_file_positions_except_relocs - PARAMS ((bfd *)); -static bfd_boolean prep_headers - PARAMS ((bfd *)); -static bfd_boolean swap_out_syms - PARAMS ((bfd *, struct bfd_strtab_hash **, int)); -static bfd_boolean copy_private_bfd_data - PARAMS ((bfd *, bfd *)); -static char *elf_read - PARAMS ((bfd *, file_ptr, bfd_size_type)); -static const char *group_signature - PARAMS ((bfd *, Elf_Internal_Shdr *)); -static bfd_boolean setup_group - PARAMS ((bfd *, Elf_Internal_Shdr *, asection *)); -static void merge_sections_remove_hook - PARAMS ((bfd *, asection *)); -static void elf_fake_sections - PARAMS ((bfd *, asection *, PTR)); -static bfd_boolean assign_section_numbers - PARAMS ((bfd *)); -static INLINE int sym_is_global - PARAMS ((bfd *, asymbol *)); -static bfd_boolean elf_map_symbols - PARAMS ((bfd *)); -static bfd_size_type get_program_header_size - PARAMS ((bfd *)); -static bfd_boolean elfcore_read_notes - PARAMS ((bfd *, file_ptr, bfd_size_type)); -static bfd_boolean elf_find_function - PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **, - const char **)); -static int elfcore_make_pid - PARAMS ((bfd *)); -static bfd_boolean elfcore_maybe_make_sect - PARAMS ((bfd *, char *, asection *)); -static bfd_boolean elfcore_make_note_pseudosection - PARAMS ((bfd *, char *, Elf_Internal_Note *)); -static bfd_boolean elfcore_grok_prfpreg - PARAMS ((bfd *, Elf_Internal_Note *)); -static bfd_boolean elfcore_grok_prxfpreg - PARAMS ((bfd *, Elf_Internal_Note *)); -static bfd_boolean elfcore_grok_note - PARAMS ((bfd *, Elf_Internal_Note *)); -static bfd_boolean elfcore_netbsd_get_lwpid - PARAMS ((Elf_Internal_Note *, int *)); -static bfd_boolean elfcore_grok_netbsd_procinfo - PARAMS ((bfd *, Elf_Internal_Note *)); -static bfd_boolean elfcore_grok_netbsd_note - PARAMS ((bfd *, Elf_Internal_Note *)); -static bfd_boolean elfcore_grok_nto_gregs - PARAMS ((bfd *, Elf_Internal_Note *, pid_t)); -static bfd_boolean elfcore_grok_nto_status - PARAMS ((bfd *, Elf_Internal_Note *, pid_t *)); -static bfd_boolean elfcore_grok_nto_note - PARAMS ((bfd *, Elf_Internal_Note *)); +static int elf_sort_sections (const void *, const void *); +static bfd_boolean assign_file_positions_except_relocs (bfd *); +static bfd_boolean prep_headers (bfd *); +static bfd_boolean swap_out_syms (bfd *, struct bfd_strtab_hash **, int) ; +static bfd_boolean elfcore_read_notes (bfd *, file_ptr, bfd_size_type) ; /* Swap version information in and out. The version information is currently size independent. If that ever changes, this code will @@ -111,10 +53,9 @@ static bfd_boolean elfcore_grok_nto_note /* Swap in a Verdef structure. */ void -_bfd_elf_swap_verdef_in (abfd, src, dst) - bfd *abfd; - const Elf_External_Verdef *src; - Elf_Internal_Verdef *dst; +_bfd_elf_swap_verdef_in (bfd *abfd, + const Elf_External_Verdef *src, + Elf_Internal_Verdef *dst) { dst->vd_version = H_GET_16 (abfd, src->vd_version); dst->vd_flags = H_GET_16 (abfd, src->vd_flags); @@ -128,10 +69,9 @@ _bfd_elf_swap_verdef_in (abfd, src, dst) /* Swap out a Verdef structure. */ void -_bfd_elf_swap_verdef_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Verdef *src; - Elf_External_Verdef *dst; +_bfd_elf_swap_verdef_out (bfd *abfd, + const Elf_Internal_Verdef *src, + Elf_External_Verdef *dst) { H_PUT_16 (abfd, src->vd_version, dst->vd_version); H_PUT_16 (abfd, src->vd_flags, dst->vd_flags); @@ -145,10 +85,9 @@ _bfd_elf_swap_verdef_out (abfd, src, dst) /* Swap in a Verdaux structure. */ void -_bfd_elf_swap_verdaux_in (abfd, src, dst) - bfd *abfd; - const Elf_External_Verdaux *src; - Elf_Internal_Verdaux *dst; +_bfd_elf_swap_verdaux_in (bfd *abfd, + const Elf_External_Verdaux *src, + Elf_Internal_Verdaux *dst) { dst->vda_name = H_GET_32 (abfd, src->vda_name); dst->vda_next = H_GET_32 (abfd, src->vda_next); @@ -157,10 +96,9 @@ _bfd_elf_swap_verdaux_in (abfd, src, dst) /* Swap out a Verdaux structure. */ void -_bfd_elf_swap_verdaux_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Verdaux *src; - Elf_External_Verdaux *dst; +_bfd_elf_swap_verdaux_out (bfd *abfd, + const Elf_Internal_Verdaux *src, + Elf_External_Verdaux *dst) { H_PUT_32 (abfd, src->vda_name, dst->vda_name); H_PUT_32 (abfd, src->vda_next, dst->vda_next); @@ -169,10 +107,9 @@ _bfd_elf_swap_verdaux_out (abfd, src, dst) /* Swap in a Verneed structure. */ void -_bfd_elf_swap_verneed_in (abfd, src, dst) - bfd *abfd; - const Elf_External_Verneed *src; - Elf_Internal_Verneed *dst; +_bfd_elf_swap_verneed_in (bfd *abfd, + const Elf_External_Verneed *src, + Elf_Internal_Verneed *dst) { dst->vn_version = H_GET_16 (abfd, src->vn_version); dst->vn_cnt = H_GET_16 (abfd, src->vn_cnt); @@ -184,10 +121,9 @@ _bfd_elf_swap_verneed_in (abfd, src, dst) /* Swap out a Verneed structure. */ void -_bfd_elf_swap_verneed_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Verneed *src; - Elf_External_Verneed *dst; +_bfd_elf_swap_verneed_out (bfd *abfd, + const Elf_Internal_Verneed *src, + Elf_External_Verneed *dst) { H_PUT_16 (abfd, src->vn_version, dst->vn_version); H_PUT_16 (abfd, src->vn_cnt, dst->vn_cnt); @@ -199,10 +135,9 @@ _bfd_elf_swap_verneed_out (abfd, src, dst) /* Swap in a Vernaux structure. */ void -_bfd_elf_swap_vernaux_in (abfd, src, dst) - bfd *abfd; - const Elf_External_Vernaux *src; - Elf_Internal_Vernaux *dst; +_bfd_elf_swap_vernaux_in (bfd *abfd, + const Elf_External_Vernaux *src, + Elf_Internal_Vernaux *dst) { dst->vna_hash = H_GET_32 (abfd, src->vna_hash); dst->vna_flags = H_GET_16 (abfd, src->vna_flags); @@ -214,10 +149,9 @@ _bfd_elf_swap_vernaux_in (abfd, src, dst) /* Swap out a Vernaux structure. */ void -_bfd_elf_swap_vernaux_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Vernaux *src; - Elf_External_Vernaux *dst; +_bfd_elf_swap_vernaux_out (bfd *abfd, + const Elf_Internal_Vernaux *src, + Elf_External_Vernaux *dst) { H_PUT_32 (abfd, src->vna_hash, dst->vna_hash); H_PUT_16 (abfd, src->vna_flags, dst->vna_flags); @@ -229,10 +163,9 @@ _bfd_elf_swap_vernaux_out (abfd, src, dst) /* Swap in a Versym structure. */ void -_bfd_elf_swap_versym_in (abfd, src, dst) - bfd *abfd; - const Elf_External_Versym *src; - Elf_Internal_Versym *dst; +_bfd_elf_swap_versym_in (bfd *abfd, + const Elf_External_Versym *src, + Elf_Internal_Versym *dst) { dst->vs_vers = H_GET_16 (abfd, src->vs_vers); } @@ -240,10 +173,9 @@ _bfd_elf_swap_versym_in (abfd, src, dst) /* Swap out a Versym structure. */ void -_bfd_elf_swap_versym_out (abfd, src, dst) - bfd *abfd; - const Elf_Internal_Versym *src; - Elf_External_Versym *dst; +_bfd_elf_swap_versym_out (bfd *abfd, + const Elf_Internal_Versym *src, + Elf_External_Versym *dst) { H_PUT_16 (abfd, src->vs_vers, dst->vs_vers); } @@ -252,8 +184,7 @@ _bfd_elf_swap_versym_out (abfd, src, dst) cause invalid hash tables to be generated. */ unsigned long -bfd_elf_hash (namearg) - const char *namearg; +bfd_elf_hash (const char *namearg) { const unsigned char *name = (const unsigned char *) namearg; unsigned long h = 0; @@ -279,10 +210,7 @@ bfd_elf_hash (namearg) buffer. */ static char * -elf_read (abfd, offset, size) - bfd *abfd; - file_ptr offset; - bfd_size_type size; +elf_read (bfd *abfd, file_ptr offset, bfd_size_type size) { char *buf; @@ -290,7 +218,7 @@ elf_read (abfd, offset, size) return NULL; if (bfd_seek (abfd, offset, SEEK_SET) != 0) return NULL; - if (bfd_bread ((PTR) buf, size, abfd) != size) + if (bfd_bread (buf, size, abfd) != size) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_file_truncated); @@ -300,13 +228,11 @@ elf_read (abfd, offset, size) } bfd_boolean -bfd_elf_mkobject (abfd) - bfd *abfd; +bfd_elf_mkobject (bfd *abfd) { /* This just does initialization. */ /* coff_mkobject zalloc's space for tdata.coff_obj_data ... */ - bfd_size_type amt = sizeof (struct elf_obj_tdata); - elf_tdata (abfd) = (struct elf_obj_tdata *) bfd_zalloc (abfd, amt); + elf_tdata (abfd) = bfd_zalloc (abfd, sizeof (struct elf_obj_tdata)); if (elf_tdata (abfd) == 0) return FALSE; /* Since everything is done at close time, do we need any @@ -316,17 +242,14 @@ bfd_elf_mkobject (abfd) } bfd_boolean -bfd_elf_mkcorefile (abfd) - bfd *abfd; +bfd_elf_mkcorefile (bfd *abfd) { /* I think this can be done just like an object file. */ return bfd_elf_mkobject (abfd); } char * -bfd_elf_get_str_section (abfd, shindex) - bfd *abfd; - unsigned int shindex; +bfd_elf_get_str_section (bfd *abfd, unsigned int shindex) { Elf_Internal_Shdr **i_shdrp; char *shstrtab = NULL; @@ -344,16 +267,15 @@ bfd_elf_get_str_section (abfd, shindex) offset = i_shdrp[shindex]->sh_offset; shstrtabsize = i_shdrp[shindex]->sh_size; shstrtab = elf_read (abfd, offset, shstrtabsize); - i_shdrp[shindex]->contents = (PTR) shstrtab; + i_shdrp[shindex]->contents = shstrtab; } return shstrtab; } char * -bfd_elf_string_from_elf_section (abfd, shindex, strindex) - bfd *abfd; - unsigned int shindex; - unsigned int strindex; +bfd_elf_string_from_elf_section (bfd *abfd, + unsigned int shindex, + unsigned int strindex) { Elf_Internal_Shdr *hdr; @@ -388,18 +310,16 @@ bfd_elf_string_from_elf_section (abfd, shindex, strindex) symbols, and symbol section index extensions, respectively. */ Elf_Internal_Sym * -bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset, - intsym_buf, extsym_buf, extshndx_buf) - bfd *ibfd; - Elf_Internal_Shdr *symtab_hdr; - size_t symcount; - size_t symoffset; - Elf_Internal_Sym *intsym_buf; - PTR extsym_buf; - Elf_External_Sym_Shndx *extshndx_buf; +bfd_elf_get_elf_syms (bfd *ibfd, + Elf_Internal_Shdr *symtab_hdr, + size_t symcount, + size_t symoffset, + Elf_Internal_Sym *intsym_buf, + void *extsym_buf, + Elf_External_Sym_Shndx *extshndx_buf) { Elf_Internal_Shdr *shndx_hdr; - PTR alloc_ext; + void *alloc_ext; const bfd_byte *esym; Elf_External_Sym_Shndx *alloc_extshndx; Elf_External_Sym_Shndx *shndx; @@ -446,7 +366,7 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset, pos = shndx_hdr->sh_offset + symoffset * sizeof (Elf_External_Sym_Shndx); if (extshndx_buf == NULL) { - alloc_extshndx = (Elf_External_Sym_Shndx *) bfd_malloc (amt); + alloc_extshndx = bfd_malloc (amt); extshndx_buf = alloc_extshndx; } if (extshndx_buf == NULL @@ -461,7 +381,7 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset, if (intsym_buf == NULL) { bfd_size_type amt = symcount * sizeof (Elf_Internal_Sym); - intsym_buf = (Elf_Internal_Sym *) bfd_malloc (amt); + intsym_buf = bfd_malloc (amt); if (intsym_buf == NULL) goto out; } @@ -471,7 +391,7 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset, for (esym = extsym_buf, isym = intsym_buf, shndx = extshndx_buf; isym < isymend; esym += extsym_size, isym++, shndx = shndx != NULL ? shndx + 1 : NULL) - (*bed->s->swap_symbol_in) (ibfd, esym, (const PTR) shndx, isym); + (*bed->s->swap_symbol_in) (ibfd, esym, shndx, isym); out: if (alloc_ext != NULL) @@ -484,9 +404,7 @@ bfd_elf_get_elf_syms (ibfd, symtab_hdr, symcount, symoffset, /* Look up a symbol name. */ const char * -bfd_elf_local_sym_name (abfd, isym) - bfd *abfd; - Elf_Internal_Sym *isym; +bfd_elf_local_sym_name (bfd *abfd, Elf_Internal_Sym *isym) { unsigned int iname = isym->st_name; unsigned int shindex = elf_tdata (abfd)->symtab_hdr.sh_link; @@ -512,9 +430,7 @@ typedef union elf_internal_group { signature just a string? */ static const char * -group_signature (abfd, ghdr) - bfd *abfd; - Elf_Internal_Shdr *ghdr; +group_signature (bfd *abfd, Elf_Internal_Shdr *ghdr) { Elf_Internal_Shdr *hdr; unsigned char esym[sizeof (Elf64_External_Sym)]; @@ -537,10 +453,7 @@ group_signature (abfd, ghdr) /* Set next_in_group list pointer, and group name for NEWSECT. */ static bfd_boolean -setup_group (abfd, hdr, newsect) - bfd *abfd; - Elf_Internal_Shdr *hdr; - asection *newsect; +setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) { unsigned int num_group = elf_tdata (abfd)->num_group; @@ -699,9 +612,7 @@ setup_group (abfd, hdr, newsect) } bfd_boolean -bfd_elf_discard_group (abfd, group) - bfd *abfd ATTRIBUTE_UNUSED; - asection *group; +bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group) { asection *first = elf_next_in_group (group); asection *s = first; @@ -721,10 +632,9 @@ bfd_elf_discard_group (abfd, group) BFD section in the bfd_section field of the header. */ bfd_boolean -_bfd_elf_make_section_from_shdr (abfd, hdr, name) - bfd *abfd; - Elf_Internal_Shdr *hdr; - const char *name; +_bfd_elf_make_section_from_shdr (bfd *abfd, + Elf_Internal_Shdr *hdr, + const char *name) { asection *newsect; flagword flags; @@ -909,9 +819,7 @@ DESCRIPTION */ struct elf_internal_shdr * -bfd_elf_find_section (abfd, name) - bfd *abfd; - char *name; +bfd_elf_find_section (bfd *abfd, char *name) { Elf_Internal_Shdr **i_shdrp; char *shstrtab; @@ -951,22 +859,15 @@ const char *const bfd_elf_section_type_names[] = { relocatable output against an external symbol. */ bfd_reloc_status_type -bfd_elf_generic_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; -{ - if (output_bfd != (bfd *) NULL +bfd_elf_generic_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) +{ + if (output_bfd != NULL && (symbol->flags & BSF_SECTION_SYM) == 0 && (! reloc_entry->howto->partial_inplace || reloc_entry->addend == 0)) @@ -981,9 +882,8 @@ bfd_elf_generic_reloc (abfd, /* Make sure sec_info_type is cleared if sec_info is cleared too. */ static void -merge_sections_remove_hook (abfd, sec) - bfd *abfd ATTRIBUTE_UNUSED; - asection *sec; +merge_sections_remove_hook (bfd *abfd ATTRIBUTE_UNUSED, + asection *sec) { BFD_ASSERT (sec->sec_info_type == ELF_INFO_TYPE_MERGE); sec->sec_info_type = ELF_INFO_TYPE_NONE; @@ -992,9 +892,7 @@ merge_sections_remove_hook (abfd, sec) /* Finish SHF_MERGE section merging. */ bfd_boolean -_bfd_elf_merge_sections (abfd, info) - bfd *abfd; - struct bfd_link_info *info; +_bfd_elf_merge_sections (bfd *abfd, struct bfd_link_info *info) { if (!is_elf_hash_table (info)) return FALSE; @@ -1005,9 +903,7 @@ _bfd_elf_merge_sections (abfd, info) } void -_bfd_elf_link_just_syms (sec, info) - asection *sec; - struct bfd_link_info *info; +_bfd_elf_link_just_syms (asection *sec, struct bfd_link_info *info) { sec->output_section = bfd_abs_section_ptr; sec->output_offset = sec->vma; @@ -1021,9 +917,7 @@ _bfd_elf_link_just_syms (sec, info) another. */ bfd_boolean -_bfd_elf_copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +_bfd_elf_copy_private_bfd_data (bfd *ibfd, bfd *obfd) { if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour || bfd_get_flavour (obfd) != bfd_target_elf_flavour) @@ -1042,11 +936,9 @@ _bfd_elf_copy_private_bfd_data (ibfd, obfd) /* Print out the program headers. */ bfd_boolean -_bfd_elf_print_private_bfd_data (abfd, farg) - bfd *abfd; - PTR farg; +_bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) { - FILE *f = (FILE *) farg; + FILE *f = farg; Elf_Internal_Phdr *p; asection *s; bfd_byte *dynbuf = NULL; @@ -1105,15 +997,14 @@ _bfd_elf_print_private_bfd_data (abfd, farg) unsigned long shlink; bfd_byte *extdyn, *extdynend; size_t extdynsize; - void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); + void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *); fprintf (f, _("\nDynamic Section:\n")); - dynbuf = (bfd_byte *) bfd_malloc (s->_raw_size); + dynbuf = bfd_malloc (s->_raw_size); if (dynbuf == NULL) goto error_return; - if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf, (file_ptr) 0, - s->_raw_size)) + if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size)) goto error_return; elfsec = _bfd_elf_section_from_bfd_section (abfd, s); @@ -1133,7 +1024,7 @@ _bfd_elf_print_private_bfd_data (abfd, farg) char ab[20]; bfd_boolean stringp; - (*swap_dyn_in) (abfd, (PTR) extdyn, &dyn); + (*swap_dyn_in) (abfd, extdyn, &dyn); if (dyn.d_tag == DT_NULL) break; @@ -1282,13 +1173,12 @@ _bfd_elf_print_private_bfd_data (abfd, farg) /* Display ELF-specific fields of a symbol. */ void -bfd_elf_print_symbol (abfd, filep, symbol, how) - bfd *abfd; - PTR filep; - asymbol *symbol; - bfd_print_symbol_type how; +bfd_elf_print_symbol (bfd *abfd, + void *filep, + asymbol *symbol, + bfd_print_symbol_type how) { - FILE *file = (FILE *) filep; + FILE *file = filep; switch (how) { case bfd_print_symbol_name: @@ -1316,7 +1206,7 @@ bfd_elf_print_symbol (abfd, filep, symbol, how) if (name == NULL) { name = symbol->name; - bfd_print_symbol_vandf (abfd, (PTR) file, symbol); + bfd_print_symbol_vandf (abfd, file, symbol); } fprintf (file, " %s\t", section_name); @@ -1405,10 +1295,9 @@ bfd_elf_print_symbol (abfd, filep, symbol, how) /* Create an entry in an ELF linker hash table. */ struct bfd_hash_entry * -_bfd_elf_link_hash_newfunc (entry, table, string) - struct bfd_hash_entry *entry; - struct bfd_hash_table *table; - const char *string; +_bfd_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. */ @@ -1455,9 +1344,9 @@ _bfd_elf_link_hash_newfunc (entry, table, string) old indirect symbol. Also used for copying flags to a weakdef. */ void -_bfd_elf_link_hash_copy_indirect (bed, dir, ind) - struct elf_backend_data *bed; - struct elf_link_hash_entry *dir, *ind; +_bfd_elf_link_hash_copy_indirect (struct elf_backend_data *bed, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) { bfd_signed_vma tmp; bfd_signed_vma lowest_valid = bed->can_refcount; @@ -1507,10 +1396,9 @@ _bfd_elf_link_hash_copy_indirect (bed, dir, ind) } void -_bfd_elf_link_hash_hide_symbol (info, h, force_local) - struct bfd_link_info *info; - struct elf_link_hash_entry *h; - bfd_boolean force_local; +_bfd_elf_link_hash_hide_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h, + bfd_boolean force_local) { h->plt = elf_hash_table (info)->init_offset; h->elf_link_hash_flags &= ~ELF_LINK_HASH_NEEDS_PLT; @@ -1529,12 +1417,12 @@ _bfd_elf_link_hash_hide_symbol (info, h, force_local) /* Initialize an ELF linker hash table. */ bfd_boolean -_bfd_elf_link_hash_table_init (table, abfd, newfunc) - struct elf_link_hash_table *table; - bfd *abfd; - struct bfd_hash_entry *(*newfunc) - PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, - const char *)); +_bfd_elf_link_hash_table_init + (struct elf_link_hash_table *table, + bfd *abfd, + struct bfd_hash_entry *(*newfunc) (struct bfd_hash_entry *, + struct bfd_hash_table *, + const char *)) { bfd_boolean ret; @@ -1568,14 +1456,13 @@ _bfd_elf_link_hash_table_init (table, abfd, newfunc) /* Create an ELF linker hash table. */ struct bfd_link_hash_table * -_bfd_elf_link_hash_table_create (abfd) - bfd *abfd; +_bfd_elf_link_hash_table_create (bfd *abfd) { struct elf_link_hash_table *ret; bfd_size_type amt = sizeof (struct elf_link_hash_table); - ret = (struct elf_link_hash_table *) bfd_malloc (amt); - if (ret == (struct elf_link_hash_table *) NULL) + ret = bfd_malloc (amt); + if (ret == NULL) return NULL; if (! _bfd_elf_link_hash_table_init (ret, abfd, _bfd_elf_link_hash_newfunc)) @@ -1593,9 +1480,7 @@ _bfd_elf_link_hash_table_create (abfd) empty string to indicate that no DT_NEEDED entry should be made. */ void -bfd_elf_set_dt_needed_name (abfd, name) - bfd *abfd; - const char *name; +bfd_elf_set_dt_needed_name (bfd *abfd, const char *name) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && bfd_get_format (abfd) == bfd_object) @@ -1603,9 +1488,7 @@ bfd_elf_set_dt_needed_name (abfd, name) } void -bfd_elf_set_dt_needed_soname (abfd, name) - bfd *abfd; - const char *name; +bfd_elf_set_dt_needed_soname (bfd *abfd, const char *name) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && bfd_get_format (abfd) == bfd_object) @@ -1616,9 +1499,8 @@ bfd_elf_set_dt_needed_soname (abfd, name) the linker ELF emulation code. */ struct bfd_link_needed_list * -bfd_elf_get_needed_list (abfd, info) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; +bfd_elf_get_needed_list (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { if (! is_elf_hash_table (info)) return NULL; @@ -1629,9 +1511,8 @@ bfd_elf_get_needed_list (abfd, info) hook for the linker ELF emulation code. */ struct bfd_link_needed_list * -bfd_elf_get_runpath_list (abfd, info) - bfd *abfd ATTRIBUTE_UNUSED; - struct bfd_link_info *info; +bfd_elf_get_runpath_list (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) { if (! is_elf_hash_table (info)) return NULL; @@ -1643,8 +1524,7 @@ bfd_elf_get_runpath_list (abfd, info) passed to bfd_elf_set_dt_needed_name, or it is the filename. */ const char * -bfd_elf_get_dt_soname (abfd) - bfd *abfd; +bfd_elf_get_dt_soname (bfd *abfd) { if (bfd_get_flavour (abfd) == bfd_target_elf_flavour && bfd_get_format (abfd) == bfd_object) @@ -1656,9 +1536,8 @@ bfd_elf_get_dt_soname (abfd) the ELF linker emulation code. */ bfd_boolean -bfd_elf_get_bfd_needed_list (abfd, pneeded) - bfd *abfd; - struct bfd_link_needed_list **pneeded; +bfd_elf_get_bfd_needed_list (bfd *abfd, + struct bfd_link_needed_list **pneeded) { asection *s; bfd_byte *dynbuf = NULL; @@ -1666,7 +1545,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded) unsigned long shlink; bfd_byte *extdyn, *extdynend; size_t extdynsize; - void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *)); + void (*swap_dyn_in) (bfd *, const void *, Elf_Internal_Dyn *); *pneeded = NULL; @@ -1678,12 +1557,11 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded) if (s == NULL || s->_raw_size == 0) return TRUE; - dynbuf = (bfd_byte *) bfd_malloc (s->_raw_size); + dynbuf = bfd_malloc (s->_raw_size); if (dynbuf == NULL) goto error_return; - if (! bfd_get_section_contents (abfd, s, (PTR) dynbuf, (file_ptr) 0, - s->_raw_size)) + if (! bfd_get_section_contents (abfd, s, dynbuf, 0, s->_raw_size)) goto error_return; elfsec = _bfd_elf_section_from_bfd_section (abfd, s); @@ -1701,7 +1579,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded) { Elf_Internal_Dyn dyn; - (*swap_dyn_in) (abfd, (PTR) extdyn, &dyn); + (*swap_dyn_in) (abfd, extdyn, &dyn); if (dyn.d_tag == DT_NULL) break; @@ -1718,7 +1596,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded) goto error_return; amt = sizeof *l; - l = (struct bfd_link_needed_list *) bfd_alloc (abfd, amt); + l = bfd_alloc (abfd, amt); if (l == NULL) goto error_return; @@ -1742,7 +1620,7 @@ bfd_elf_get_bfd_needed_list (abfd, pneeded) /* Allocate an ELF string table--force the first byte to be zero. */ struct bfd_strtab_hash * -_bfd_elf_stringtab_init () +_bfd_elf_stringtab_init (void) { struct bfd_strtab_hash *ret; @@ -1767,9 +1645,7 @@ _bfd_elf_stringtab_init () /* Create a new bfd section from an ELF section header. */ bfd_boolean -bfd_section_from_shdr (abfd, shindex) - bfd *abfd; - unsigned int shindex; +bfd_section_from_shdr (bfd *abfd, unsigned int shindex) { Elf_Internal_Shdr *hdr = elf_elfsections (abfd)[shindex]; Elf_Internal_Ehdr *ehdr = elf_elfheader (abfd); @@ -2009,7 +1885,7 @@ bfd_section_from_shdr (abfd, shindex) bfd_size_type amt; BFD_ASSERT (elf_section_data (target_sect)->rel_hdr2 == NULL); amt = sizeof (*hdr2); - hdr2 = (Elf_Internal_Shdr *) bfd_alloc (abfd, amt); + hdr2 = bfd_alloc (abfd, amt); elf_section_data (target_sect)->rel_hdr2 = hdr2; } *hdr2 = *hdr; @@ -2093,11 +1969,10 @@ bfd_section_from_shdr (abfd, shindex) Return SEC for sections that have no elf section, and NULL on error. */ asection * -bfd_section_from_r_symndx (abfd, cache, sec, r_symndx) - bfd *abfd; - struct sym_sec_cache *cache; - asection *sec; - unsigned long r_symndx; +bfd_section_from_r_symndx (bfd *abfd, + struct sym_sec_cache *cache, + asection *sec, + unsigned long r_symndx) { Elf_Internal_Shdr *symtab_hdr; unsigned char esym[sizeof (Elf64_External_Sym)]; @@ -2134,9 +2009,7 @@ bfd_section_from_r_symndx (abfd, cache, sec, r_symndx) section. */ asection * -bfd_section_from_elf_index (abfd, index) - bfd *abfd; - unsigned int index; +bfd_section_from_elf_index (bfd *abfd, unsigned int index) { if (index >= elf_numsections (abfd)) return NULL; @@ -2246,8 +2119,7 @@ get_special_section (const char *name, } bfd_boolean -_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name, - int *type, int *attr) +_bfd_elf_get_sec_type_attr (bfd *abfd, const char *name, int *type, int *attr) { bfd_boolean found = FALSE; struct elf_backend_data *bed = get_elf_backend_data (abfd); @@ -2276,9 +2148,7 @@ _bfd_elf_get_sec_type_attr (bfd *abfd, const char *name, } bfd_boolean -_bfd_elf_new_section_hook (abfd, sec) - bfd *abfd; - asection *sec; +_bfd_elf_new_section_hook (bfd *abfd, asection *sec) { struct bfd_elf_section_data *sdata; int type, attr; @@ -2286,11 +2156,10 @@ _bfd_elf_new_section_hook (abfd, sec) sdata = (struct bfd_elf_section_data *) sec->used_by_bfd; if (sdata == NULL) { - bfd_size_type amt = sizeof (*sdata); - sdata = (struct bfd_elf_section_data *) bfd_zalloc (abfd, amt); + sdata = bfd_zalloc (abfd, sizeof (*sdata)); if (sdata == NULL) return FALSE; - sec->used_by_bfd = (PTR) sdata; + sec->used_by_bfd = sdata; } elf_section_type (sec) = SHT_NULL; @@ -2330,11 +2199,10 @@ _bfd_elf_new_section_hook (abfd, sec) */ bfd_boolean -_bfd_elf_make_section_from_phdr (abfd, hdr, index, typename) - bfd *abfd; - Elf_Internal_Phdr *hdr; - int index; - const char *typename; +_bfd_elf_make_section_from_phdr (bfd *abfd, + Elf_Internal_Phdr *hdr, + int index, + const char *typename) { asection *newsect; char *name; @@ -2347,7 +2215,7 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename) && (hdr->p_memsz > hdr->p_filesz)); sprintf (namebuf, "%s%d%s", typename, index, split ? "a" : ""); len = strlen (namebuf) + 1; - name = bfd_alloc (abfd, (bfd_size_type) len); + name = bfd_alloc (abfd, len); if (!name) return FALSE; memcpy (name, namebuf, len); @@ -2379,7 +2247,7 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename) { sprintf (namebuf, "%s%db", typename, index); len = strlen (namebuf) + 1; - name = bfd_alloc (abfd, (bfd_size_type) len); + name = bfd_alloc (abfd, len); if (!name) return FALSE; memcpy (name, namebuf, len); @@ -2403,10 +2271,7 @@ _bfd_elf_make_section_from_phdr (abfd, hdr, index, typename) } bfd_boolean -bfd_section_from_phdr (abfd, hdr, index) - bfd *abfd; - Elf_Internal_Phdr *hdr; - int index; +bfd_section_from_phdr (bfd *abfd, Elf_Internal_Phdr *hdr, int index) { struct elf_backend_data *bed; @@ -2427,7 +2292,7 @@ bfd_section_from_phdr (abfd, hdr, index) case PT_NOTE: if (! _bfd_elf_make_section_from_phdr (abfd, hdr, index, "note")) return FALSE; - if (! elfcore_read_notes (abfd, (file_ptr) hdr->p_offset, hdr->p_filesz)) + if (! elfcore_read_notes (abfd, hdr->p_offset, hdr->p_filesz)) return FALSE; return TRUE; @@ -2460,11 +2325,10 @@ bfd_section_from_phdr (abfd, hdr, index) relocations; otherwise, we use REL relocations. */ bfd_boolean -_bfd_elf_init_reloc_shdr (abfd, rel_hdr, asect, use_rela_p) - bfd *abfd; - Elf_Internal_Shdr *rel_hdr; - asection *asect; - bfd_boolean use_rela_p; +_bfd_elf_init_reloc_shdr (bfd *abfd, + Elf_Internal_Shdr *rel_hdr, + asection *asect, + bfd_boolean use_rela_p) { char *name; struct elf_backend_data *bed = get_elf_backend_data (abfd); @@ -2495,13 +2359,10 @@ _bfd_elf_init_reloc_shdr (abfd, rel_hdr, asect, use_rela_p) /* Set up an ELF internal section header for a section. */ static void -elf_fake_sections (abfd, asect, failedptrarg) - bfd *abfd; - asection *asect; - PTR failedptrarg; +elf_fake_sections (bfd *abfd, asection *asect, void *failedptrarg) { struct elf_backend_data *bed = get_elf_backend_data (abfd); - bfd_boolean *failedptr = (bfd_boolean *) failedptrarg; + bfd_boolean *failedptr = failedptrarg; Elf_Internal_Shdr *this_hdr; if (*failedptr) @@ -2671,12 +2532,9 @@ elf_fake_sections (abfd, asect, failedptrarg) /* Fill in the contents of a SHT_GROUP section. */ void -bfd_elf_set_group_contents (abfd, sec, failedptrarg) - bfd *abfd; - asection *sec; - PTR failedptrarg; +bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg) { - bfd_boolean *failedptr = (bfd_boolean *) failedptrarg; + bfd_boolean *failedptr = failedptrarg; unsigned long symindx; asection *elt, *first; unsigned char *loc; @@ -2780,8 +2638,7 @@ bfd_elf_set_group_contents (abfd, sec, failedptrarg) in here too, while we're at it. */ static bfd_boolean -assign_section_numbers (abfd) - bfd *abfd; +assign_section_numbers (bfd *abfd) { struct elf_obj_tdata *t = elf_tdata (abfd); asection *sec; @@ -2862,12 +2719,12 @@ assign_section_numbers (abfd) /* Set up the list of section header pointers, in agreement with the indices. */ amt = section_number * sizeof (Elf_Internal_Shdr *); - i_shdrp = (Elf_Internal_Shdr **) bfd_zalloc (abfd, amt); + i_shdrp = bfd_zalloc (abfd, amt); if (i_shdrp == NULL) return FALSE; amt = sizeof (Elf_Internal_Shdr); - i_shdrp[0] = (Elf_Internal_Shdr *) bfd_zalloc (abfd, amt); + i_shdrp[0] = bfd_zalloc (abfd, amt); if (i_shdrp[0] == NULL) { bfd_release (abfd, i_shdrp); @@ -2953,7 +2810,7 @@ assign_section_numbers (abfd) char *alc; len = strlen (sec->name); - alc = (char *) bfd_malloc ((bfd_size_type) (len - 2)); + alc = bfd_malloc (len - 2); if (alc == NULL) return FALSE; memcpy (alc, sec->name, len - 3); @@ -3011,14 +2868,12 @@ assign_section_numbers (abfd) all local symbols to be at the head of the list. */ static INLINE int -sym_is_global (abfd, sym) - bfd *abfd; - asymbol *sym; +sym_is_global (bfd *abfd, asymbol *sym) { /* If the backend has a special mapping, use it. */ - if (get_elf_backend_data (abfd)->elf_backend_sym_is_global) - return ((*get_elf_backend_data (abfd)->elf_backend_sym_is_global) - (abfd, sym)); + struct elf_backend_data *bed = get_elf_backend_data (abfd); + if (bed->elf_backend_sym_is_global) + return (*bed->elf_backend_sym_is_global) (abfd, sym); return ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0 || bfd_is_und_section (bfd_get_section (sym)) @@ -3026,8 +2881,7 @@ sym_is_global (abfd, sym) } static bfd_boolean -elf_map_symbols (abfd) - bfd *abfd; +elf_map_symbols (bfd *abfd) { unsigned int symcount = bfd_get_symcount (abfd); asymbol **syms = bfd_get_outsymbols (abfd); @@ -3055,7 +2909,7 @@ elf_map_symbols (abfd) max_index++; amt = max_index * sizeof (asymbol *); - sect_syms = (asymbol **) bfd_zalloc (abfd, amt); + sect_syms = bfd_zalloc (abfd, amt); if (sect_syms == NULL) return FALSE; elf_section_syms (abfd) = sect_syms; @@ -3129,7 +2983,7 @@ elf_map_symbols (abfd) /* Now sort the symbols so the local symbols are first. */ amt = (num_locals + num_globals) * sizeof (asymbol *); - new_syms = (asymbol **) bfd_alloc (abfd, amt); + new_syms = bfd_alloc (abfd, amt); if (new_syms == NULL) return FALSE; @@ -3173,12 +3027,8 @@ elf_map_symbols (abfd) /* Align to the maximum file alignment that could be required for any ELF data structure. */ -static INLINE file_ptr align_file_position - PARAMS ((file_ptr, int)); static INLINE file_ptr -align_file_position (off, align) - file_ptr off; - int align; +align_file_position (file_ptr off, int align) { return (off + align - 1) & ~(align - 1); } @@ -3186,11 +3036,10 @@ align_file_position (off, align) /* Assign a file position to a section, optionally aligning to the required section alignment. */ -INLINE file_ptr -_bfd_elf_assign_file_position_for_section (i_shdrp, offset, align) - Elf_Internal_Shdr *i_shdrp; - file_ptr offset; - bfd_boolean align; +file_ptr +_bfd_elf_assign_file_position_for_section (Elf_Internal_Shdr *i_shdrp, + file_ptr offset, + bfd_boolean align) { if (align) { @@ -3213,9 +3062,8 @@ _bfd_elf_assign_file_position_for_section (i_shdrp, offset, align) is not NULL, this is being called by the ELF backend linker. */ bfd_boolean -_bfd_elf_compute_section_file_positions (abfd, link_info) - bfd *abfd; - struct bfd_link_info *link_info; +_bfd_elf_compute_section_file_positions (bfd *abfd, + struct bfd_link_info *link_info) { struct elf_backend_data *bed = get_elf_backend_data (abfd); bfd_boolean failed; @@ -3310,13 +3158,12 @@ _bfd_elf_compute_section_file_positions (abfd, link_info) /* Create a mapping from a set of sections to a program segment. */ -static INLINE struct elf_segment_map * -make_mapping (abfd, sections, from, to, phdr) - bfd *abfd; - asection **sections; - unsigned int from; - unsigned int to; - bfd_boolean phdr; +static struct elf_segment_map * +make_mapping (bfd *abfd, + asection **sections, + unsigned int from, + unsigned int to, + bfd_boolean phdr) { struct elf_segment_map *m; unsigned int i; @@ -3325,7 +3172,7 @@ make_mapping (abfd, sections, from, to, phdr) amt = sizeof (struct elf_segment_map); amt += (to - from - 1) * sizeof (asection *); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) return NULL; m->next = NULL; @@ -3347,8 +3194,7 @@ make_mapping (abfd, sections, from, to, phdr) /* Set up a mapping from BFD sections to program segments. */ static bfd_boolean -map_sections_to_segments (abfd) - bfd *abfd; +map_sections_to_segments (bfd *abfd) { asection **sections = NULL; asection *s; @@ -3377,7 +3223,7 @@ map_sections_to_segments (abfd) /* Select the allocated sections, and sort them. */ amt = bfd_count_sections (abfd) * sizeof (asection *); - sections = (asection **) bfd_malloc (amt); + sections = bfd_malloc (amt); if (sections == NULL) goto error_return; @@ -3407,7 +3253,7 @@ map_sections_to_segments (abfd) if (s != NULL && (s->flags & SEC_LOAD) != 0) { amt = sizeof (struct elf_segment_map); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -3421,7 +3267,7 @@ map_sections_to_segments (abfd) pm = &m->next; amt = sizeof (struct elf_segment_map); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -3570,7 +3416,7 @@ map_sections_to_segments (abfd) if (dynsec != NULL) { amt = sizeof (struct elf_segment_map); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -3593,7 +3439,7 @@ map_sections_to_segments (abfd) && strncmp (s->name, ".note", 5) == 0) { amt = sizeof (struct elf_segment_map); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -3619,7 +3465,7 @@ map_sections_to_segments (abfd) amt = sizeof (struct elf_segment_map); amt += (tls_count - 1) * sizeof (asection *); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -3646,7 +3492,7 @@ map_sections_to_segments (abfd) && (eh_frame_hdr->output_section->flags & SEC_LOAD) != 0) { amt = sizeof (struct elf_segment_map); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -3661,7 +3507,7 @@ map_sections_to_segments (abfd) if (elf_tdata (abfd)->stack_flags) { amt = sizeof (struct elf_segment_map); - m = (struct elf_segment_map *) bfd_zalloc (abfd, amt); + m = bfd_zalloc (abfd, amt); if (m == NULL) goto error_return; m->next = NULL; @@ -3688,9 +3534,7 @@ map_sections_to_segments (abfd) /* Sort sections by address. */ static int -elf_sort_sections (arg1, arg2) - const PTR arg1; - const PTR arg2; +elf_sort_sections (const void *arg1, const void *arg2) { const asection *sec1 = *(const asection **) arg1; const asection *sec2 = *(const asection **) arg2; @@ -3750,8 +3594,7 @@ elf_sort_sections (arg1, arg2) the file header, and writes out the program headers. */ static bfd_boolean -assign_file_positions_for_segments (abfd) - bfd *abfd; +assign_file_positions_for_segments (bfd *abfd) { const struct elf_backend_data *bed = get_elf_backend_data (abfd); unsigned int count; @@ -3835,7 +3678,7 @@ assign_file_positions_for_segments (abfd) alloc = count; amt = alloc * sizeof (Elf_Internal_Phdr); - phdrs = (Elf_Internal_Phdr *) bfd_alloc (abfd, amt); + phdrs = bfd_alloc (abfd, amt); if (phdrs == NULL) return FALSE; @@ -4211,8 +4054,7 @@ Error: First section in segment (%s) starts at 0x%x whereas the segment starts a will be two segments. */ static bfd_size_type -get_program_header_size (abfd) - bfd *abfd; +get_program_header_size (bfd *abfd) { size_t segs; asection *s; @@ -4312,8 +4154,7 @@ get_program_header_size (abfd) We also don't set the positions of the .symtab and .strtab here. */ static bfd_boolean -assign_file_positions_except_relocs (abfd) - bfd *abfd; +assign_file_positions_except_relocs (bfd *abfd) { struct elf_obj_tdata * const tdata = elf_tdata (abfd); Elf_Internal_Ehdr * const i_ehdrp = elf_elfheader (abfd); @@ -4421,8 +4262,7 @@ assign_file_positions_except_relocs (abfd) } static bfd_boolean -prep_headers (abfd) - bfd *abfd; +prep_headers (bfd *abfd) { Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */ Elf_Internal_Phdr *i_phdrp = 0; /* Program header table, internal form */ @@ -4530,8 +4370,7 @@ prep_headers (abfd) of the loadable file image. */ void -_bfd_elf_assign_file_positions_for_relocs (abfd) - bfd *abfd; +_bfd_elf_assign_file_positions_for_relocs (bfd *abfd) { file_ptr off; unsigned int i, num_sec; @@ -4554,8 +4393,7 @@ _bfd_elf_assign_file_positions_for_relocs (abfd) } bfd_boolean -_bfd_elf_write_object_contents (abfd) - bfd *abfd; +_bfd_elf_write_object_contents (bfd *abfd) { struct elf_backend_data *bed = get_elf_backend_data (abfd); Elf_Internal_Ehdr *i_ehdrp; @@ -4564,8 +4402,7 @@ _bfd_elf_write_object_contents (abfd) unsigned int count, num_sec; if (! abfd->output_has_begun - && ! _bfd_elf_compute_section_file_positions - (abfd, (struct bfd_link_info *) NULL)) + && ! _bfd_elf_compute_section_file_positions (abfd, NULL)) return FALSE; i_shdrp = elf_elfsections (abfd); @@ -4609,8 +4446,7 @@ _bfd_elf_write_object_contents (abfd) } bfd_boolean -_bfd_elf_write_corefile_contents (abfd) - bfd *abfd; +_bfd_elf_write_corefile_contents (bfd *abfd) { /* Hopefully this can be done just like an object file. */ return _bfd_elf_write_object_contents (abfd); @@ -4619,9 +4455,7 @@ _bfd_elf_write_corefile_contents (abfd) /* Given a section, search the header to find them. */ int -_bfd_elf_section_from_bfd_section (abfd, asect) - bfd *abfd; - struct sec *asect; +_bfd_elf_section_from_bfd_section (bfd *abfd, struct sec *asect) { struct elf_backend_data *bed; int index; @@ -4670,9 +4504,7 @@ _bfd_elf_section_from_bfd_section (abfd, asect) on error. */ int -_bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr) - bfd *abfd; - asymbol **asym_ptr_ptr; +_bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr) { asymbol *asym_ptr = *asym_ptr_ptr; int idx; @@ -4727,9 +4559,7 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr) /* Copy private BFD data. This copies any program header information. */ static bfd_boolean -copy_private_bfd_data (ibfd, obfd) - bfd *ibfd; - bfd *obfd; +copy_private_bfd_data (bfd *ibfd, bfd *obfd) { Elf_Internal_Ehdr *iehdr; struct elf_segment_map *map; @@ -4953,7 +4783,7 @@ copy_private_bfd_data (ibfd, obfd) all of the sections we have selected. */ amt = sizeof (struct elf_segment_map); amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); - map = (struct elf_segment_map *) bfd_alloc (obfd, amt); + map = bfd_alloc (obfd, amt); if (map == NULL) return FALSE; @@ -5034,7 +4864,7 @@ copy_private_bfd_data (ibfd, obfd) /* Gcc 2.96 miscompiles this code on mips. Don't do casting here to work around this long long bug. */ amt = section_count * sizeof (asection *); - sections = (asection **) bfd_malloc (amt); + sections = bfd_malloc (amt); if (sections == NULL) return FALSE; @@ -5236,7 +5066,7 @@ copy_private_bfd_data (ibfd, obfd) and carry on looping. */ amt = sizeof (struct elf_segment_map); amt += ((bfd_size_type) section_count - 1) * sizeof (asection *); - map = (struct elf_segment_map *) bfd_alloc (obfd, amt); + map = bfd_alloc (obfd, amt); if (map == NULL) { free (sections); @@ -5330,11 +5160,10 @@ copy_private_bfd_data (ibfd, obfd) field, and sometimes the info field. */ bfd_boolean -_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) - bfd *ibfd; - asection *isec; - bfd *obfd; - asection *osec; +_bfd_elf_copy_private_section_data (bfd *ibfd, + asection *isec, + bfd *obfd, + asection *osec) { Elf_Internal_Shdr *ihdr, *ohdr; @@ -5395,11 +5224,10 @@ _bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec) #define MAP_SYM_SHNDX (SHN_HIOS + 5) bfd_boolean -_bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg) - bfd *ibfd; - asymbol *isymarg; - bfd *obfd; - asymbol *osymarg; +_bfd_elf_copy_private_symbol_data (bfd *ibfd, + asymbol *isymarg, + bfd *obfd, + asymbol *osymarg) { elf_symbol_type *isym, *osym; @@ -5436,10 +5264,9 @@ _bfd_elf_copy_private_symbol_data (ibfd, isymarg, obfd, osymarg) /* Swap out the symbols. */ static bfd_boolean -swap_out_syms (abfd, sttp, relocatable_p) - bfd *abfd; - struct bfd_strtab_hash **sttp; - int relocatable_p; +swap_out_syms (bfd *abfd, + struct bfd_strtab_hash **sttp, + int relocatable_p) { struct elf_backend_data *bed; int symcount; @@ -5480,7 +5307,7 @@ swap_out_syms (abfd, sttp, relocatable_p) _bfd_stringtab_free (stt); return FALSE; } - symtab_hdr->contents = (PTR) outbound_syms; + symtab_hdr->contents = outbound_syms; outbound_shndx = NULL; symtab_shndx_hdr = &elf_tdata (abfd)->symtab_shndx_hdr; @@ -5721,8 +5548,7 @@ Unable to find equivalent output section for symbol '%s' from section '%s'"), always has a dummy entry as symbol #0, so it ends up even. */ long -_bfd_elf_get_symtab_upper_bound (abfd) - bfd *abfd; +_bfd_elf_get_symtab_upper_bound (bfd *abfd) { long symcount; long symtab_size; @@ -5737,8 +5563,7 @@ _bfd_elf_get_symtab_upper_bound (abfd) } long -_bfd_elf_get_dynamic_symtab_upper_bound (abfd) - bfd *abfd; +_bfd_elf_get_dynamic_symtab_upper_bound (bfd *abfd) { long symcount; long symtab_size; @@ -5759,9 +5584,8 @@ _bfd_elf_get_dynamic_symtab_upper_bound (abfd) } long -_bfd_elf_get_reloc_upper_bound (abfd, asect) - bfd *abfd ATTRIBUTE_UNUSED; - sec_ptr asect; +_bfd_elf_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, + sec_ptr asect) { return (asect->reloc_count + 1) * sizeof (arelent *); } @@ -5769,11 +5593,10 @@ _bfd_elf_get_reloc_upper_bound (abfd, asect) /* Canonicalize the relocs. */ long -_bfd_elf_canonicalize_reloc (abfd, section, relptr, symbols) - bfd *abfd; - sec_ptr section; - arelent **relptr; - asymbol **symbols; +_bfd_elf_canonicalize_reloc (bfd *abfd, + sec_ptr section, + arelent **relptr, + asymbol **symbols) { arelent *tblptr; unsigned int i; @@ -5792,12 +5615,10 @@ _bfd_elf_canonicalize_reloc (abfd, section, relptr, symbols) } long -_bfd_elf_get_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; +_bfd_elf_get_symtab (bfd *abfd, asymbol **allocation) { struct elf_backend_data *bed = get_elf_backend_data (abfd); - long symcount = bed->s->slurp_symbol_table (abfd, alocation, FALSE); + long symcount = bed->s->slurp_symbol_table (abfd, allocation, FALSE); if (symcount >= 0) bfd_get_symcount (abfd) = symcount; @@ -5805,12 +5626,11 @@ _bfd_elf_get_symtab (abfd, alocation) } long -_bfd_elf_canonicalize_dynamic_symtab (abfd, alocation) - bfd *abfd; - asymbol **alocation; +_bfd_elf_canonicalize_dynamic_symtab (bfd *abfd, + asymbol **allocation) { struct elf_backend_data *bed = get_elf_backend_data (abfd); - long symcount = bed->s->slurp_symbol_table (abfd, alocation, TRUE); + long symcount = bed->s->slurp_symbol_table (abfd, allocation, TRUE); if (symcount >= 0) bfd_get_dynamic_symcount (abfd) = symcount; @@ -5823,8 +5643,7 @@ _bfd_elf_canonicalize_dynamic_symtab (abfd, alocation) considered to be a dynamic reloc section. */ long -_bfd_elf_get_dynamic_reloc_upper_bound (abfd) - bfd *abfd; +_bfd_elf_get_dynamic_reloc_upper_bound (bfd *abfd) { long ret; asection *s; @@ -5856,13 +5675,11 @@ _bfd_elf_get_dynamic_reloc_upper_bound (abfd) section. */ long -_bfd_elf_canonicalize_dynamic_reloc (abfd, storage, syms) - bfd *abfd; - arelent **storage; - asymbol **syms; +_bfd_elf_canonicalize_dynamic_reloc (bfd *abfd, + arelent **storage, + asymbol **syms) { - bfd_boolean (*slurp_relocs) - PARAMS ((bfd *, asection *, asymbol **, bfd_boolean)); + bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean); asection *s; long ret; @@ -5901,8 +5718,7 @@ _bfd_elf_canonicalize_dynamic_reloc (abfd, storage, syms) /* Read in the version information. */ bfd_boolean -_bfd_elf_slurp_version_tables (abfd) - bfd *abfd; +_bfd_elf_slurp_version_tables (bfd *abfd) { bfd_byte *contents = NULL; bfd_size_type amt; @@ -5919,11 +5735,11 @@ _bfd_elf_slurp_version_tables (abfd) hdr = &elf_tdata (abfd)->dynverdef_hdr; - contents = (bfd_byte *) bfd_malloc (hdr->sh_size); + contents = bfd_malloc (hdr->sh_size); if (contents == NULL) goto error_return; if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size) + || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size) goto error_return; /* We know the number of entries in the section but not the maximum @@ -5943,7 +5759,7 @@ _bfd_elf_slurp_version_tables (abfd) } amt = (bfd_size_type) maxidx * sizeof (Elf_Internal_Verdef); - elf_tdata (abfd)->verdef = (Elf_Internal_Verdef *) bfd_zalloc (abfd, amt); + elf_tdata (abfd)->verdef = bfd_zalloc (abfd, amt); if (elf_tdata (abfd)->verdef == NULL) goto error_return; @@ -5965,7 +5781,7 @@ _bfd_elf_slurp_version_tables (abfd) iverdef->vd_bfd = abfd; amt = (bfd_size_type) iverdef->vd_cnt * sizeof (Elf_Internal_Verdaux); - iverdef->vd_auxptr = (Elf_Internal_Verdaux *) bfd_alloc (abfd, amt); + iverdef->vd_auxptr = bfd_alloc (abfd, amt); if (iverdef->vd_auxptr == NULL) goto error_return; @@ -6016,18 +5832,17 @@ _bfd_elf_slurp_version_tables (abfd) hdr = &elf_tdata (abfd)->dynverref_hdr; amt = (bfd_size_type) hdr->sh_info * sizeof (Elf_Internal_Verneed); - elf_tdata (abfd)->verref = - (Elf_Internal_Verneed *) bfd_zalloc (abfd, amt); + elf_tdata (abfd)->verref = bfd_zalloc (abfd, amt); if (elf_tdata (abfd)->verref == NULL) goto error_return; elf_tdata (abfd)->cverrefs = hdr->sh_info; - contents = (bfd_byte *) bfd_malloc (hdr->sh_size); + contents = bfd_malloc (hdr->sh_size); if (contents == NULL) goto error_return; if (bfd_seek (abfd, hdr->sh_offset, SEEK_SET) != 0 - || bfd_bread ((PTR) contents, hdr->sh_size, abfd) != hdr->sh_size) + || bfd_bread (contents, hdr->sh_size, abfd) != hdr->sh_size) goto error_return; everneed = (Elf_External_Verneed *) contents; @@ -6050,7 +5865,7 @@ _bfd_elf_slurp_version_tables (abfd) amt = iverneed->vn_cnt; amt *= sizeof (Elf_Internal_Vernaux); - iverneed->vn_auxptr = (Elf_Internal_Vernaux *) bfd_alloc (abfd, amt); + iverneed->vn_auxptr = bfd_alloc (abfd, amt); evernaux = ((Elf_External_Vernaux *) ((bfd_byte *) everneed + iverneed->vn_aux)); @@ -6096,13 +5911,12 @@ _bfd_elf_slurp_version_tables (abfd) } asymbol * -_bfd_elf_make_empty_symbol (abfd) - bfd *abfd; +_bfd_elf_make_empty_symbol (bfd *abfd) { elf_symbol_type *newsym; bfd_size_type amt = sizeof (elf_symbol_type); - newsym = (elf_symbol_type *) bfd_zalloc (abfd, amt); + newsym = bfd_zalloc (abfd, amt); if (!newsym) return NULL; else @@ -6113,10 +5927,9 @@ _bfd_elf_make_empty_symbol (abfd) } void -_bfd_elf_get_symbol_info (ignore_abfd, symbol, ret) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol; - symbol_info *ret; +_bfd_elf_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, + asymbol *symbol, + symbol_info *ret) { bfd_symbol_info (symbol, ret); } @@ -6126,9 +5939,8 @@ _bfd_elf_get_symbol_info (ignore_abfd, symbol, ret) override it. */ bfd_boolean -_bfd_elf_is_local_label_name (abfd, name) - bfd *abfd ATTRIBUTE_UNUSED; - const char *name; +_bfd_elf_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED, + const char *name) { /* Normal local symbols start with ``.L''. */ if (name[0] == '.' && name[1] == 'L') @@ -6152,19 +5964,17 @@ _bfd_elf_is_local_label_name (abfd, name) } alent * -_bfd_elf_get_lineno (ignore_abfd, symbol) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - asymbol *symbol ATTRIBUTE_UNUSED; +_bfd_elf_get_lineno (bfd *abfd ATTRIBUTE_UNUSED, + asymbol *symbol ATTRIBUTE_UNUSED) { abort (); return NULL; } bfd_boolean -_bfd_elf_set_arch_mach (abfd, arch, machine) - bfd *abfd; - enum bfd_architecture arch; - unsigned long machine; +_bfd_elf_set_arch_mach (bfd *abfd, + enum bfd_architecture arch, + unsigned long machine) { /* If this isn't the right architecture for this backend, and this isn't the generic backend, fail. */ @@ -6180,14 +5990,12 @@ _bfd_elf_set_arch_mach (abfd, arch, machine) for error reporting. */ static bfd_boolean -elf_find_function (abfd, section, symbols, offset, - filename_ptr, functionname_ptr) - bfd *abfd ATTRIBUTE_UNUSED; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; +elf_find_function (bfd *abfd ATTRIBUTE_UNUSED, + asection *section, + asymbol **symbols, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr) { const char *filename; asymbol *func; @@ -6242,15 +6050,13 @@ elf_find_function (abfd, section, symbols, offset, for error reporting. */ bfd_boolean -_bfd_elf_find_nearest_line (abfd, section, symbols, offset, - filename_ptr, functionname_ptr, line_ptr) - bfd *abfd; - asection *section; - asymbol **symbols; - bfd_vma offset; - const char **filename_ptr; - const char **functionname_ptr; - unsigned int *line_ptr; +_bfd_elf_find_nearest_line (bfd *abfd, + asection *section, + asymbol **symbols, + bfd_vma offset, + const char **filename_ptr, + const char **functionname_ptr, + unsigned int *line_ptr) { bfd_boolean found; @@ -6299,9 +6105,7 @@ _bfd_elf_find_nearest_line (abfd, section, symbols, offset, } int -_bfd_elf_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc; +_bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc) { int ret; @@ -6312,19 +6116,17 @@ _bfd_elf_sizeof_headers (abfd, reloc) } bfd_boolean -_bfd_elf_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - PTR location; - file_ptr offset; - bfd_size_type count; +_bfd_elf_set_section_contents (bfd *abfd, + sec_ptr section, + void *location, + file_ptr offset, + bfd_size_type count) { Elf_Internal_Shdr *hdr; bfd_signed_vma pos; if (! abfd->output_has_begun - && ! (_bfd_elf_compute_section_file_positions - (abfd, (struct bfd_link_info *) NULL))) + && ! _bfd_elf_compute_section_file_positions (abfd, NULL)) return FALSE; hdr = &elf_section_data (section)->this_hdr; @@ -6337,10 +6139,9 @@ _bfd_elf_set_section_contents (abfd, section, location, offset, count) } void -_bfd_elf_no_info_to_howto (abfd, cache_ptr, dst) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *cache_ptr ATTRIBUTE_UNUSED; - Elf_Internal_Rela *dst ATTRIBUTE_UNUSED; +_bfd_elf_no_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, + arelent *cache_ptr ATTRIBUTE_UNUSED, + Elf_Internal_Rela *dst ATTRIBUTE_UNUSED) { abort (); } @@ -6348,9 +6149,7 @@ _bfd_elf_no_info_to_howto (abfd, cache_ptr, dst) /* Try to convert a non-ELF reloc into an ELF one. */ bfd_boolean -_bfd_elf_validate_reloc (abfd, areloc) - bfd *abfd; - arelent *areloc; +_bfd_elf_validate_reloc (bfd *abfd, arelent *areloc) { /* Check whether we really have an ELF howto. */ @@ -6444,8 +6243,7 @@ _bfd_elf_validate_reloc (abfd, areloc) } bfd_boolean -_bfd_elf_close_and_cleanup (abfd) - bfd *abfd; +_bfd_elf_close_and_cleanup (bfd *abfd) { if (bfd_get_format (abfd) == bfd_object) { @@ -6462,14 +6260,11 @@ _bfd_elf_close_and_cleanup (abfd) this reloc. */ bfd_reloc_status_type -_bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg) - bfd *abfd ATTRIBUTE_UNUSED; - arelent *re ATTRIBUTE_UNUSED; - struct symbol_cache_entry *symbol ATTRIBUTE_UNUSED; - PTR data ATTRIBUTE_UNUSED; - asection *is ATTRIBUTE_UNUSED; - bfd *obfd ATTRIBUTE_UNUSED; - char **errmsg ATTRIBUTE_UNUSED; +_bfd_elf_rel_vtable_reloc_fn + (bfd *abfd ATTRIBUTE_UNUSED, arelent *re ATTRIBUTE_UNUSED, + struct symbol_cache_entry *symbol ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, asection *is ATTRIBUTE_UNUSED, + bfd *obfd ATTRIBUTE_UNUSED, char **errmsg ATTRIBUTE_UNUSED) { return bfd_reloc_ok; } @@ -6486,8 +6281,7 @@ _bfd_elf_rel_vtable_reloc_fn (abfd, re, symbol, data, is, obfd, errmsg) /* FIXME: this is kinda wrong, but it's what gdb wants. */ static int -elfcore_make_pid (abfd) - bfd *abfd; +elfcore_make_pid (bfd *abfd) { return ((elf_tdata (abfd)->core_lwpid << 16) + (elf_tdata (abfd)->core_pid)); @@ -6499,10 +6293,7 @@ elfcore_make_pid (abfd) overwrite it. */ static bfd_boolean -elfcore_maybe_make_sect (abfd, name, sect) - bfd *abfd; - char *name; - asection *sect; +elfcore_maybe_make_sect (bfd *abfd, char *name, asection *sect) { asection *sect2; @@ -6528,11 +6319,10 @@ elfcore_maybe_make_sect (abfd, name, sect) PID is elfcore_make_pid (abfd). Both pseudosections have identical contents. */ bfd_boolean -_bfd_elfcore_make_pseudosection (abfd, name, size, filepos) - bfd *abfd; - char *name; - size_t size; - ufile_ptr filepos; +_bfd_elfcore_make_pseudosection (bfd *abfd, + char *name, + size_t size, + ufile_ptr filepos) { char buf[100]; char *threaded_name; @@ -6543,7 +6333,7 @@ _bfd_elfcore_make_pseudosection (abfd, name, size, filepos) sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd)); len = strlen (buf) + 1; - threaded_name = bfd_alloc (abfd, (bfd_size_type) len); + threaded_name = bfd_alloc (abfd, len); if (threaded_name == NULL) return FALSE; memcpy (threaded_name, buf, len); @@ -6566,13 +6356,9 @@ _bfd_elfcore_make_pseudosection (abfd, name, size, filepos) */ #if defined (HAVE_PRSTATUS_T) -static bfd_boolean elfcore_grok_prstatus - PARAMS ((bfd *, Elf_Internal_Note *)); static bfd_boolean -elfcore_grok_prstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) { size_t raw_size; int offset; @@ -6643,10 +6429,9 @@ elfcore_grok_prstatus (abfd, note) /* Create a pseudosection containing the exact contents of NOTE. */ static bfd_boolean -elfcore_make_note_pseudosection (abfd, name, note) - bfd *abfd; - char *name; - Elf_Internal_Note *note; +elfcore_make_note_pseudosection (bfd *abfd, + char *name, + Elf_Internal_Note *note) { return _bfd_elfcore_make_pseudosection (abfd, name, note->descsz, note->descpos); @@ -6657,9 +6442,7 @@ elfcore_make_note_pseudosection (abfd, name, note) data structure apart. */ static bfd_boolean -elfcore_grok_prfpreg (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_prfpreg (bfd *abfd, Elf_Internal_Note *note) { return elfcore_make_note_pseudosection (abfd, ".reg2", note); } @@ -6669,9 +6452,7 @@ elfcore_grok_prfpreg (abfd, note) literally. */ static bfd_boolean -elfcore_grok_prxfpreg (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_prxfpreg (bfd *abfd, Elf_Internal_Note *note) { return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note); } @@ -6695,10 +6476,7 @@ typedef psinfo32_t elfcore_psinfo32_t; the copy will always have a terminating '\0'. */ char * -_bfd_elfcore_strndup (abfd, start, max) - bfd *abfd; - char *start; - size_t max; +_bfd_elfcore_strndup (bfd *abfd, char *start, size_t max) { char *dups; char *end = memchr (start, '\0', max); @@ -6709,7 +6487,7 @@ _bfd_elfcore_strndup (abfd, start, max) else len = end - start; - dups = bfd_alloc (abfd, (bfd_size_type) len + 1); + dups = bfd_alloc (abfd, len + 1); if (dups == NULL) return NULL; @@ -6720,13 +6498,8 @@ _bfd_elfcore_strndup (abfd, start, max) } #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) -static bfd_boolean elfcore_grok_psinfo - PARAMS ((bfd *, Elf_Internal_Note *)); - static bfd_boolean -elfcore_grok_psinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) { if (note->descsz == sizeof (elfcore_psinfo_t)) { @@ -6784,13 +6557,8 @@ elfcore_grok_psinfo (abfd, note) #endif /* defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) */ #if defined (HAVE_PSTATUS_T) -static bfd_boolean elfcore_grok_pstatus - PARAMS ((bfd *, Elf_Internal_Note *)); - static bfd_boolean -elfcore_grok_pstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_pstatus (bfd *abfd, Elf_Internal_Note *note) { if (note->descsz == sizeof (pstatus_t) #if defined (HAVE_PXSTATUS_T) @@ -6824,13 +6592,8 @@ elfcore_grok_pstatus (abfd, note) #endif /* defined (HAVE_PSTATUS_T) */ #if defined (HAVE_LWPSTATUS_T) -static bfd_boolean elfcore_grok_lwpstatus - PARAMS ((bfd *, Elf_Internal_Note *)); - static bfd_boolean -elfcore_grok_lwpstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_lwpstatus (bfd *abfd, Elf_Internal_Note *note) { lwpstatus_t lwpstat; char buf[100]; @@ -6854,7 +6617,7 @@ elfcore_grok_lwpstatus (abfd, note) sprintf (buf, ".reg/%d", elfcore_make_pid (abfd)); len = strlen (buf) + 1; - name = bfd_alloc (abfd, (bfd_size_type) len); + name = bfd_alloc (abfd, len); if (name == NULL) return FALSE; memcpy (name, buf, len); @@ -6884,7 +6647,7 @@ elfcore_grok_lwpstatus (abfd, note) sprintf (buf, ".reg2/%d", elfcore_make_pid (abfd)); len = strlen (buf) + 1; - name = bfd_alloc (abfd, (bfd_size_type) len); + name = bfd_alloc (abfd, len); if (name == NULL) return FALSE; memcpy (name, buf, len); @@ -6913,9 +6676,7 @@ elfcore_grok_lwpstatus (abfd, note) #if defined (HAVE_WIN32_PSTATUS_T) static bfd_boolean -elfcore_grok_win32pstatus (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note) { char buf[30]; char *name; @@ -6941,7 +6702,7 @@ elfcore_grok_win32pstatus (abfd, note) sprintf (buf, ".reg/%d", pstatus.data.thread_info.tid); len = strlen (buf) + 1; - name = bfd_alloc (abfd, (bfd_size_type) len); + name = bfd_alloc (abfd, len); if (name == NULL) return FALSE; @@ -6968,7 +6729,7 @@ elfcore_grok_win32pstatus (abfd, note) sprintf (buf, ".module/%08x", pstatus.data.module_info.base_address); len = strlen (buf) + 1; - name = bfd_alloc (abfd, (bfd_size_type) len); + name = bfd_alloc (abfd, len); if (name == NULL) return FALSE; @@ -6994,9 +6755,7 @@ elfcore_grok_win32pstatus (abfd, note) #endif /* HAVE_WIN32_PSTATUS_T */ static bfd_boolean -elfcore_grok_note (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) { struct elf_backend_data *bed = get_elf_backend_data (abfd); @@ -7068,9 +6827,7 @@ elfcore_grok_note (abfd, note) } static bfd_boolean -elfcore_netbsd_get_lwpid (note, lwpidp) - Elf_Internal_Note *note; - int *lwpidp; +elfcore_netbsd_get_lwpid (Elf_Internal_Note *note, int *lwpidp) { char *cp; @@ -7084,9 +6841,7 @@ elfcore_netbsd_get_lwpid (note, lwpidp) } static bfd_boolean -elfcore_grok_netbsd_procinfo (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_netbsd_procinfo (bfd *abfd, Elf_Internal_Note *note) { /* Signal number at offset 0x08. */ @@ -7105,9 +6860,7 @@ elfcore_grok_netbsd_procinfo (abfd, note) } static bfd_boolean -elfcore_grok_netbsd_note (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_netbsd_note (bfd *abfd, Elf_Internal_Note *note) { int lwp; @@ -7172,10 +6925,7 @@ elfcore_grok_netbsd_note (abfd, note) } static bfd_boolean -elfcore_grok_nto_status (abfd, note, tid) - bfd *abfd; - Elf_Internal_Note *note; - pid_t *tid; +elfcore_grok_nto_status (bfd *abfd, Elf_Internal_Note *note, pid_t *tid) { void *ddata = note->descdata; char buf[100]; @@ -7209,7 +6959,7 @@ elfcore_grok_nto_status (abfd, note, tid) /* Make a ".qnx_core_status/%d" section. */ sprintf (buf, ".qnx_core_status/%d", *tid); - name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1); + name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return FALSE; strcpy (name, buf); @@ -7227,10 +6977,7 @@ elfcore_grok_nto_status (abfd, note, tid) } static bfd_boolean -elfcore_grok_nto_gregs (abfd, note, tid) - bfd *abfd; - Elf_Internal_Note *note; - pid_t tid; +elfcore_grok_nto_gregs (bfd *abfd, Elf_Internal_Note *note, pid_t tid) { char buf[100]; char *name; @@ -7239,7 +6986,7 @@ elfcore_grok_nto_gregs (abfd, note, tid) /* Make a ".reg/%d" section. */ sprintf (buf, ".reg/%d", tid); - name = bfd_alloc (abfd, (bfd_size_type) strlen (buf) + 1); + name = bfd_alloc (abfd, strlen (buf) + 1); if (name == NULL) return FALSE; strcpy (name, buf); @@ -7266,9 +7013,7 @@ elfcore_grok_nto_gregs (abfd, note, tid) #define BFD_QNT_CORE_FPREG 10 static bfd_boolean -elfcore_grok_nto_note (abfd, note) - bfd *abfd; - Elf_Internal_Note *note; +elfcore_grok_nto_note (bfd *abfd, Elf_Internal_Note *note) { /* Every GREG section has a STATUS section before it. Store the tid from the previous call to pass down to the next gregs @@ -7298,14 +7043,13 @@ elfcore_grok_nto_note (abfd, note) End of buffer containing note. */ char * -elfcore_write_note (abfd, buf, bufsiz, name, type, input, size) - bfd *abfd; - char *buf; - int *bufsiz; - const char *name; - int type; - const PTR input; - int size; +elfcore_write_note (bfd *abfd, + char *buf, + int *bufsiz, + const char *name, + int type, + const void *input, + int size) { Elf_External_Note *xnp; size_t namesz; @@ -7350,12 +7094,11 @@ elfcore_write_note (abfd, buf, bufsiz, name, type, input, size) #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) char * -elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs) - bfd *abfd; - char *buf; - int *bufsiz; - const char *fname; - const char *psargs; +elfcore_write_prpsinfo (bfd *abfd, + char *buf, + int *bufsiz, + const char *fname, + const char *psargs) { int note_type; char *note_name = "CORE"; @@ -7378,13 +7121,12 @@ elfcore_write_prpsinfo (abfd, buf, bufsiz, fname, psargs) #if defined (HAVE_PRSTATUS_T) char * -elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs) - bfd *abfd; - char *buf; - int *bufsiz; - long pid; - int cursig; - const PTR gregs; +elfcore_write_prstatus (bfd *abfd, + char *buf, + int *bufsiz, + long pid, + int cursig, + const void *gregs) { prstatus_t prstat; char *note_name = "CORE"; @@ -7400,13 +7142,12 @@ elfcore_write_prstatus (abfd, buf, bufsiz, pid, cursig, gregs) #if defined (HAVE_LWPSTATUS_T) char * -elfcore_write_lwpstatus (abfd, buf, bufsiz, pid, cursig, gregs) - bfd *abfd; - char *buf; - int *bufsiz; - long pid; - int cursig; - const PTR gregs; +elfcore_write_lwpstatus (bfd *abfd, + char *buf, + int *bufsiz, + long pid, + int cursig, + const void *gregs) { lwpstatus_t lwpstat; char *note_name = "CORE"; @@ -7432,13 +7173,12 @@ elfcore_write_lwpstatus (abfd, buf, bufsiz, pid, cursig, gregs) #if defined (HAVE_PSTATUS_T) char * -elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs) - bfd *abfd; - char *buf; - int *bufsiz; - long pid; - int cursig; - const PTR gregs; +elfcore_write_pstatus (bfd *abfd, + char *buf, + int *bufsiz, + long pid, + int cursig, + const void *gregs) { pstatus_t pstat; char *note_name = "CORE"; @@ -7452,12 +7192,11 @@ elfcore_write_pstatus (abfd, buf, bufsiz, pid, cursig, gregs) #endif /* HAVE_PSTATUS_T */ char * -elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size) - bfd *abfd; - char *buf; - int *bufsiz; - const PTR fpregs; - int size; +elfcore_write_prfpreg (bfd *abfd, + char *buf, + int *bufsiz, + const void *fpregs, + int size) { char *note_name = "CORE"; return elfcore_write_note (abfd, buf, bufsiz, @@ -7465,12 +7204,11 @@ elfcore_write_prfpreg (abfd, buf, bufsiz, fpregs, size) } char * -elfcore_write_prxfpreg (abfd, buf, bufsiz, xfpregs, size) - bfd *abfd; - char *buf; - int *bufsiz; - const PTR xfpregs; - int size; +elfcore_write_prxfpreg (bfd *abfd, + char *buf, + int *bufsiz, + const void *xfpregs, + int size) { char *note_name = "LINUX"; return elfcore_write_note (abfd, buf, bufsiz, @@ -7478,10 +7216,7 @@ elfcore_write_prxfpreg (abfd, buf, bufsiz, xfpregs, size) } static bfd_boolean -elfcore_read_notes (abfd, offset, size) - bfd *abfd; - file_ptr offset; - bfd_size_type size; +elfcore_read_notes (bfd *abfd, file_ptr offset, bfd_size_type size) { char *buf; char *p; @@ -7549,8 +7284,7 @@ elfcore_read_notes (abfd, offset, size) occurs; bfd_get_error will return an appropriate code. */ long -bfd_get_elf_phdr_upper_bound (abfd) - bfd *abfd; +bfd_get_elf_phdr_upper_bound (bfd *abfd) { if (abfd->xvec->flavour != bfd_target_elf_flavour) { @@ -7570,9 +7304,7 @@ bfd_get_elf_phdr_upper_bound (abfd) error occurs; bfd_get_error will return an appropriate code. */ int -bfd_get_elf_phdrs (abfd, phdrs) - bfd *abfd; - void *phdrs; +bfd_get_elf_phdrs (bfd *abfd, void *phdrs) { int num_phdrs; @@ -7590,10 +7322,7 @@ bfd_get_elf_phdrs (abfd, phdrs) } void -_bfd_elf_sprintf_vma (abfd, buf, value) - bfd *abfd ATTRIBUTE_UNUSED; - char *buf; - bfd_vma value; +_bfd_elf_sprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, char *buf, bfd_vma value) { #ifdef BFD64 Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */ @@ -7621,10 +7350,7 @@ _bfd_elf_sprintf_vma (abfd, buf, value) } void -_bfd_elf_fprintf_vma (abfd, stream, value) - bfd *abfd ATTRIBUTE_UNUSED; - PTR stream; - bfd_vma value; +_bfd_elf_fprintf_vma (bfd *abfd ATTRIBUTE_UNUSED, void *stream, bfd_vma value) { #ifdef BFD64 Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */ @@ -7653,8 +7379,7 @@ _bfd_elf_fprintf_vma (abfd, stream, value) } enum elf_reloc_type_class -_bfd_elf_reloc_type_class (rela) - const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED; +_bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED) { return reloc_class_normal; } @@ -7663,11 +7388,10 @@ _bfd_elf_reloc_type_class (rela) relocation against a local symbol. */ bfd_vma -_bfd_elf_rela_local_sym (abfd, sym, sec, rel) - bfd *abfd; - Elf_Internal_Sym *sym; - asection *sec; - Elf_Internal_Rela *rel; +_bfd_elf_rela_local_sym (bfd *abfd, + Elf_Internal_Sym *sym, + asection *sec, + Elf_Internal_Rela *rel) { bfd_vma relocation; @@ -7685,7 +7409,7 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel) _bfd_merged_section_offset (abfd, &msec, elf_section_data (sec)->sec_info, sym->st_value + rel->r_addend, - (bfd_vma) 0) + 0) - relocation; rel->r_addend += msec->output_section->vma + msec->output_offset; } @@ -7693,11 +7417,10 @@ _bfd_elf_rela_local_sym (abfd, sym, sec, rel) } bfd_vma -_bfd_elf_rel_local_sym (abfd, sym, psec, addend) - bfd *abfd; - Elf_Internal_Sym *sym; - asection **psec; - bfd_vma addend; +_bfd_elf_rel_local_sym (bfd *abfd, + Elf_Internal_Sym *sym, + asection **psec, + bfd_vma addend) { asection *sec = *psec; @@ -7706,15 +7429,14 @@ _bfd_elf_rel_local_sym (abfd, sym, psec, addend) return _bfd_merged_section_offset (abfd, psec, elf_section_data (sec)->sec_info, - sym->st_value + addend, (bfd_vma) 0); + sym->st_value + addend, 0); } bfd_vma -_bfd_elf_section_offset (abfd, info, sec, offset) - bfd *abfd; - struct bfd_link_info *info; - asection *sec; - bfd_vma offset; +_bfd_elf_section_offset (bfd *abfd, + struct bfd_link_info *info, + asection *sec, + bfd_vma offset) { struct bfd_elf_section_data *sec_data; @@ -7746,11 +7468,11 @@ _bfd_elf_section_offset (abfd, info, sec, offset) the remote memory. */ bfd * -bfd_elf_bfd_from_remote_memory (templ, ehdr_vma, loadbasep, target_read_memory) - bfd *templ; - bfd_vma ehdr_vma; - bfd_vma *loadbasep; - int (*target_read_memory) PARAMS ((bfd_vma vma, char *myaddr, int len)); +bfd_elf_bfd_from_remote_memory + (bfd *templ, + bfd_vma ehdr_vma, + bfd_vma *loadbasep, + int (*target_read_memory) (bfd_vma, char *, int)) { return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory) (templ, ehdr_vma, loadbasep, target_read_memory); -- 2.11.0