From: Alan Modra Date: Thu, 9 Aug 2001 14:38:04 +0000 (+0000) Subject: * coff-rs6000.c: Add missing prototypes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a7b97311da9b9cef66a6aec0e7a17eb2770144b3;p=binutils-gdb.git * coff-rs6000.c: Add missing prototypes. (xcoff_ppc_relocate_section, xcoff_is_lineno_count_overflow, xcoff_is_reloc_count_overflow, xcoff_loader_symbol_offset, xcoff_loader_reloc_offset): Make static. * dwarf1.c: Add missing prototypes. * dwarf2.c: Add missing prototypes. (struct abbrev_info): Move definition. (struct attr_abbrev, ABBREV_HASH_SIZE, ATTR_ALLOC_CHUNK): Likewise. * elf.c: Add missing prototypes. * elf32-gen.c: Likewise. * elf32-i386.c: Likewise. * elf32-ppc.c: Likewise. (ppc_elf_sort_rela): Use PTR instead of "void *". * elflink.h: Add missing prototypes. Formatting fixes. * merge.c: Add missing prototypes. (last4_eq): Use PTR instead of "void *". (last_eq): Likewise. * syms.c: Add missing prototypes. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2472e759d0f..bbc1169cae6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,24 @@ +2001-08-09 Alan Modra + + * coff-rs6000.c: Add missing prototypes. + (xcoff_ppc_relocate_section, xcoff_is_lineno_count_overflow, + xcoff_is_reloc_count_overflow, xcoff_loader_symbol_offset, + xcoff_loader_reloc_offset): Make static. + * dwarf1.c: Add missing prototypes. + * dwarf2.c: Add missing prototypes. + (struct abbrev_info): Move definition. + (struct attr_abbrev, ABBREV_HASH_SIZE, ATTR_ALLOC_CHUNK): Likewise. + * elf.c: Add missing prototypes. + * elf32-gen.c: Likewise. + * elf32-i386.c: Likewise. + * elf32-ppc.c: Likewise. + (ppc_elf_sort_rela): Use PTR instead of "void *". + * elflink.h: Add missing prototypes. Formatting fixes. + * merge.c: Add missing prototypes. + (last4_eq): Use PTR instead of "void *". + (last_eq): Likewise. + * syms.c: Add missing prototypes. + 2001-08-09 Nick Clifton * bfd.c: Fix formatting. diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 3f2a81415bc..8a956839a0f 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -111,6 +111,41 @@ extern int rs6000coff_core_file_failing_signal PARAMS ((bfd *abfd)); /* The main body of code is in coffcode.h. */ static const char *normalize_filename PARAMS ((bfd *)); +static boolean xcoff_write_armap_old + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); +static boolean xcoff_write_one_armap_big + PARAMS ((bfd *, struct orl *, unsigned int, unsigned int, unsigned int, + int, const char *, char *)); +static boolean xcoff_write_armap_big + PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int)); +static boolean xcoff_write_archive_contents_old PARAMS ((bfd *)); +static boolean xcoff_write_archive_contents_big PARAMS ((bfd *)); +static void xcoff_swap_ldhdr_in + PARAMS ((bfd *, const struct external_ldhdr *, struct internal_ldhdr *)); +static void xcoff_swap_ldhdr_out + PARAMS ((bfd *, const struct internal_ldhdr *, struct external_ldhdr *)); +static void xcoff_swap_ldsym_in + PARAMS ((bfd *, const struct external_ldsym *, struct internal_ldsym *)); +static void xcoff_swap_ldsym_out + PARAMS ((bfd *, const struct internal_ldsym *, struct external_ldsym *)); +static void xcoff_swap_ldrel_in + PARAMS ((bfd *, const struct external_ldrel *, struct internal_ldrel *)); +static void xcoff_swap_ldrel_out + PARAMS ((bfd *, const struct internal_ldrel *, struct external_ldrel *)); +static boolean xcoff_ppc_relocate_section + PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, + struct internal_reloc *, struct internal_syment *, asection **)); +static boolean _bfd_xcoff_put_ldsymbol_name + PARAMS ((bfd *, struct xcoff_loader_info *, struct internal_ldsym *, + const char *)); +static asection *xcoff_create_csect_from_smclas + PARAMS ((bfd *, union internal_auxent *, char *)); +static boolean xcoff_is_lineno_count_overflow PARAMS ((bfd *, bfd_vma)); +static boolean xcoff_is_reloc_count_overflow PARAMS ((bfd *, bfd_vma)); +static bfd_vma xcoff_loader_symbol_offset + PARAMS ((bfd *, struct internal_ldhdr *)); +static bfd_vma xcoff_loader_reloc_offset + PARAMS ((bfd *, struct internal_ldhdr *)); /* We use our own tdata type. Its first field is the COFF tdata type, so the COFF routines are compatible. */ @@ -2350,7 +2385,7 @@ xcoff_swap_ldrel_out (abfd, src, dst) This is currently the only processor which uses XCOFF; I hope that will never change. */ -boolean +static boolean xcoff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, contents, relocs, syms, sections) @@ -2814,7 +2849,7 @@ xcoff_create_csect_from_smclas (abfd, aux, symbol_name) return return_value; } -boolean +static boolean xcoff_is_lineno_count_overflow (abfd, value) bfd *abfd ATTRIBUTE_UNUSED; bfd_vma value; @@ -2825,7 +2860,7 @@ xcoff_is_lineno_count_overflow (abfd, value) return false; } -boolean +static boolean xcoff_is_reloc_count_overflow (abfd, value) bfd *abfd ATTRIBUTE_UNUSED; bfd_vma value; @@ -2836,7 +2871,7 @@ xcoff_is_reloc_count_overflow (abfd, value) return false; } -bfd_vma +static bfd_vma xcoff_loader_symbol_offset (abfd, ldhdr) bfd *abfd; struct internal_ldhdr *ldhdr ATTRIBUTE_UNUSED; @@ -2844,7 +2879,7 @@ xcoff_loader_symbol_offset (abfd, ldhdr) return bfd_xcoff_ldhdrsz(abfd); } -bfd_vma +static bfd_vma xcoff_loader_reloc_offset (abfd, ldhdr) bfd *abfd; struct internal_ldhdr *ldhdr; @@ -3393,4 +3428,3 @@ const bfd_target pmac_xcoff_vec = /* back end data */ (void *) &bfd_pmac_xcoff_backend_data, }; - diff --git a/bfd/dwarf1.c b/bfd/dwarf1.c index 2fef2ef5189..80fc242d381 100644 --- a/bfd/dwarf1.c +++ b/bfd/dwarf1.c @@ -1,5 +1,5 @@ /* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line). - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com). @@ -126,6 +126,18 @@ struct linenumber { /* Find the form of an attr, from the attr field. */ #define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */ +static struct dwarf1_unit *alloc_dwarf1_unit PARAMS ((struct dwarf1_debug *)); +static struct dwarf1_func *alloc_dwarf1_func + PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); +static boolean parse_die PARAMS ((bfd *, struct die_info *, char *)); +static boolean parse_line_table + PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); +static boolean parse_functions_in_unit + PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *)); +static boolean dwarf1_unit_find_nearest_line + PARAMS ((struct dwarf1_debug *, struct dwarf1_unit *, unsigned long, + const char **, const char **, unsigned int *)); + /* Return a newly allocated dwarf1_unit. It should be cleared and then attached into the 'stash' at 'stash->lastUnit'. */ diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index 23a51fa98c3..4be6acfe266 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -173,6 +173,72 @@ struct comp_unit unsigned char addr_size; }; +/* This data structure holds the information of an abbrev. */ +struct abbrev_info +{ + unsigned int number; /* Number identifying abbrev. */ + enum dwarf_tag tag; /* DWARF tag. */ + int has_children; /* Boolean. */ + unsigned int num_attrs; /* Number of attributes. */ + struct attr_abbrev *attrs; /* An array of attribute descriptions. */ + struct abbrev_info *next; /* Next in chain. */ +}; + +struct attr_abbrev +{ + enum dwarf_attribute name; + enum dwarf_form form; +}; + +#ifndef ABBREV_HASH_SIZE +#define ABBREV_HASH_SIZE 121 +#endif +#ifndef ATTR_ALLOC_CHUNK +#define ATTR_ALLOC_CHUNK 4 +#endif + +static unsigned int read_1_byte PARAMS ((bfd *, char *)); +static int read_1_signed_byte PARAMS ((bfd *, char *)); +static unsigned int read_2_bytes PARAMS ((bfd *, char *)); +static unsigned int read_4_bytes PARAMS ((bfd *, char *)); +static unsigned int read_8_bytes PARAMS ((bfd *, char *)); +static char *read_n_bytes PARAMS ((bfd *, char *, unsigned int)); +static char *read_string PARAMS ((bfd *, char *, unsigned int *)); +static unsigned int read_unsigned_leb128 + PARAMS ((bfd *, char *, unsigned int *)); +static int read_signed_leb128 + PARAMS ((bfd *, char *, unsigned int *)); +static bfd_vma read_address PARAMS ((struct comp_unit *, char *)); +static struct abbrev_info *lookup_abbrev + PARAMS ((unsigned int, struct abbrev_info **)); +static struct abbrev_info **read_abbrevs + PARAMS ((bfd *, unsigned int, struct dwarf2_debug *)); +static char *read_attribute + PARAMS ((struct attribute *, struct attr_abbrev *, + struct comp_unit *, char *)); +static void add_line_info + PARAMS ((struct line_info_table *, bfd_vma, char *, + unsigned int, unsigned int, int)); +static char *concat_filename PARAMS ((struct line_info_table *, unsigned int)); +static void arange_add PARAMS ((struct comp_unit *, bfd_vma, bfd_vma)); +static struct line_info_table *decode_line_info + PARAMS ((struct comp_unit *, struct dwarf2_debug *)); +static boolean lookup_address_in_line_info_table + PARAMS ((struct line_info_table *, bfd_vma, const char **, unsigned int *)); +static boolean lookup_address_in_function_table + PARAMS ((struct funcinfo *, bfd_vma, const char **)); +static boolean scan_unit_for_functions PARAMS ((struct comp_unit *)); +static bfd_vma find_rela_addend + PARAMS ((bfd *, asection *, bfd_size_type, asymbol**)); +static struct comp_unit *parse_comp_unit + PARAMS ((bfd *, struct dwarf2_debug *, bfd_vma, unsigned int)); +static boolean comp_unit_contains_address + PARAMS ((struct comp_unit *, bfd_vma)); +static boolean comp_unit_find_nearest_line + PARAMS ((struct comp_unit *, bfd_vma, const char **, const char **, + unsigned int *, struct dwarf2_debug *)); +static asection *find_debug_info PARAMS ((bfd *, asection *)); + /* VERBATIM The following function up to the END VERBATIM mark are copied directly from dwarf2read.c. */ @@ -357,30 +423,6 @@ read_address (unit, buf) } } -/* This data structure holds the information of an abbrev. */ -struct abbrev_info -{ - unsigned int number; /* Number identifying abbrev. */ - enum dwarf_tag tag; /* DWARF tag. */ - int has_children; /* Boolean. */ - unsigned int num_attrs; /* Number of attributes. */ - struct attr_abbrev *attrs; /* An array of attribute descriptions. */ - struct abbrev_info *next; /* Next in chain. */ -}; - -struct attr_abbrev -{ - enum dwarf_attribute name; - enum dwarf_form form; -}; - -#ifndef ABBREV_HASH_SIZE -#define ABBREV_HASH_SIZE 121 -#endif -#ifndef ATTR_ALLOC_CHUNK -#define ATTR_ALLOC_CHUNK 4 -#endif - /* Lookup an abbrev_info structure in the abbrev hash table. */ static struct abbrev_info * diff --git a/bfd/elf.c b/bfd/elf.c index 8dc2f314544..60e70b6f9cc 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -57,10 +57,16 @@ static INLINE int sym_is_global PARAMS ((bfd *, asymbol *)); static boolean elf_map_symbols PARAMS ((bfd *)); static bfd_size_type get_program_header_size PARAMS ((bfd *)); static boolean elfcore_read_notes PARAMS ((bfd *, bfd_vma, bfd_vma)); -static boolean elf_find_function PARAMS ((bfd *, asection *, - asymbol **, - bfd_vma, const char **, - const char **)); +static boolean elf_find_function PARAMS ((bfd *, asection *, asymbol **, + bfd_vma, const char **, + const char **)); +static int elfcore_make_pid PARAMS ((bfd *)); +static boolean elfcore_maybe_make_sect PARAMS ((bfd *, char *, asection *)); +static boolean elfcore_make_note_pseudosection PARAMS ((bfd *, char *, + Elf_Internal_Note *)); +static boolean elfcore_grok_prfpreg PARAMS ((bfd *, Elf_Internal_Note *)); +static boolean elfcore_grok_prxfpreg PARAMS ((bfd *, Elf_Internal_Note *)); +static boolean elfcore_grok_note PARAMS ((bfd *, Elf_Internal_Note *)); /* Swap version information in and out. The version information is currently size independent. If that ever changes, this code will @@ -5424,6 +5430,8 @@ _bfd_elfcore_make_pseudosection (abfd, name, size, filepos) */ #if defined (HAVE_PRSTATUS_T) +static boolean elfcore_grok_prstatus PARAMS ((bfd *, Elf_Internal_Note *)); + static boolean elfcore_grok_prstatus (abfd, note) bfd *abfd; @@ -5569,6 +5577,7 @@ _bfd_elfcore_strndup (abfd, start, max) } #if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T) +static boolean elfcore_grok_psinfo PARAMS ((bfd *, Elf_Internal_Note *)); static boolean elfcore_grok_psinfo (abfd, note) diff --git a/bfd/elf32-gen.c b/bfd/elf32-gen.c index 7a39f4778ef..bbef97a0c0f 100644 --- a/bfd/elf32-gen.c +++ b/bfd/elf32-gen.c @@ -1,5 +1,5 @@ /* Generic support for 32-bit ELF - Copyright 1993, 1995, 1998, 1999 Free Software Foundation, Inc. + Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -40,6 +40,13 @@ static reloc_howto_type dummy = 0, /* dst_mask */ false); /* pcrel_offset */ +static void elf_generic_info_to_howto + PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); +static void elf_generic_info_to_howto_rel + PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); +static boolean elf32_generic_link_add_symbols + PARAMS ((bfd *, struct bfd_link_info *)); + static void elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc) bfd *abfd ATTRIBUTE_UNUSED; diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 02a08f77d37..00ca1850042 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -41,6 +41,12 @@ static boolean elf_i386_create_dynamic_sections static boolean elf_i386_check_relocs PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *)); +static asection *elf_i386_gc_mark_hook + PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *, + struct elf_link_hash_entry *, Elf_Internal_Sym *)); +static boolean elf_i386_gc_sweep_hook + PARAMS ((bfd *, struct bfd_link_info *, asection *, + const Elf_Internal_Rela *)); static boolean elf_i386_adjust_dynamic_symbol PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); static boolean allocate_plt_and_got_and_discard_relocs @@ -55,6 +61,8 @@ static boolean elf_i386_finish_dynamic_symbol Elf_Internal_Sym *)); static boolean elf_i386_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *)); +static boolean elf_i386_fake_sections + PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *)); #define USE_REL 1 /* 386 uses REL relocations instead of RELA */ diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index ab803f44f44..87a07b57e7c 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -38,6 +38,9 @@ static reloc_howto_type *ppc_elf_reloc_type_lookup static void ppc_elf_info_to_howto PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst)); static void ppc_elf_howto_init PARAMS ((void)); +static int ppc_elf_sort_rela PARAMS ((const PTR, const PTR)); +static boolean ppc_elf_relax_section + PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *)); static bfd_reloc_status_type ppc_elf_addr16_ha_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); static boolean ppc_elf_set_private_flags PARAMS ((bfd *, flagword)); @@ -989,8 +992,8 @@ ppc_elf_howto_init () static int ppc_elf_sort_rela (arg1, arg2) - const void *arg1; - const void *arg2; + const PTR arg1; + const PTR arg2; { const Elf_Internal_Rela **rela1 = (const Elf_Internal_Rela**) arg1; const Elf_Internal_Rela **rela2 = (const Elf_Internal_Rela**) arg2; diff --git a/bfd/elflink.h b/bfd/elflink.h index 082abd36b16..1a6399bf6b7 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -30,6 +30,10 @@ struct elf_info_failed struct bfd_elf_version_tree *verdefs; }; +static boolean is_global_data_symbol_definition + PARAMS ((bfd *, Elf_Internal_Sym *)); +static boolean elf_link_is_defined_archive_symbol + PARAMS ((bfd *, carsym *)); static boolean elf_link_add_object_symbols PARAMS ((bfd *, struct bfd_link_info *)); static boolean elf_link_add_archive_symbols @@ -54,6 +58,8 @@ static boolean elf_collect_hash_codes PARAMS ((struct elf_link_hash_entry *, PTR)); static boolean elf_link_read_relocs_from_section PARAMS ((bfd *, Elf_Internal_Shdr *, PTR, Elf_Internal_Rela *)); +static size_t compute_bucket_count + PARAMS ((struct bfd_link_info *)); static void elf_link_output_relocs PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *)); static boolean elf_link_size_reloc_section @@ -1933,8 +1939,7 @@ elf_link_add_object_symbols (abfd, info) && ! new_weakdef && h->weakdef->dynindx == -1) { - if (! _bfd_elf_link_record_dynamic_symbol (info, - h->weakdef)) + if (! _bfd_elf_link_record_dynamic_symbol (info, h->weakdef)) goto error_return; } } @@ -2603,7 +2608,6 @@ NAME(_bfd_elf,link_read_relocs) (abfd, o, external_relocs, internal_relocs, /* Record an assignment to a symbol made by a linker script. We need this in case some dynamic object refers to this symbol. */ -/*ARGSUSED*/ boolean NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide) bfd *output_bfd ATTRIBUTE_UNUSED; @@ -2621,7 +2625,7 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide) return false; if (h->root.type == bfd_link_hash_new) - h->elf_link_hash_flags &=~ ELF_LINK_NON_ELF; + h->elf_link_hash_flags &= ~ELF_LINK_NON_ELF; /* If this symbol is being provided by the linker script, and it is currently defined by a dynamic object, but not by a regular @@ -2643,7 +2647,7 @@ NAME(bfd_elf,record_link_assignment) (output_bfd, info, name, provide) h->elf_link_hash_flags |= ELF_LINK_HASH_DEF_REGULAR; - /* When possible, keep the original type of the symbol */ + /* When possible, keep the original type of the symbol. */ if (h->type == STT_NOTYPE) h->type = STT_OBJECT; @@ -3139,7 +3143,7 @@ NAME(bfd_elf,size_dynamic_sections) (output_bfd, soname, rpath, defaux.vda_next = 0; _bfd_elf_swap_verdef_out (output_bfd, &def, - (Elf_External_Verdef *)p); + (Elf_External_Verdef *) p); p += sizeof (Elf_External_Verdef); _bfd_elf_swap_verdaux_out (output_bfd, &defaux, (Elf_External_Verdaux *) p); @@ -4723,7 +4727,7 @@ elf_bfd_final_link (abfd, info) { Elf_Internal_Sym sym; Elf_External_Sym *dynsym = - (Elf_External_Sym *)finfo.dynsym_sec->contents; + (Elf_External_Sym *) finfo.dynsym_sec->contents; long last_local = 0; /* Write out the section symbols for the output sections. */ @@ -5113,8 +5117,7 @@ elf_link_output_sym (finfo, name, elfsym, input_sec) else { elfsym->st_name = (unsigned long) _bfd_stringtab_add (finfo->symstrtab, - name, true, - false); + name, true, false); if (elfsym->st_name == (unsigned long) -1) return false; } @@ -5385,8 +5388,8 @@ elf_link_output_extsym (h, data) finish_dynamic_symbol routine gets through with it. */ if (sym.st_shndx == SHN_UNDEF && (h->elf_link_hash_flags & ELF_LINK_HASH_REF_REGULAR) != 0 - && (ELF_ST_BIND(sym.st_info) == STB_GLOBAL - || ELF_ST_BIND(sym.st_info) == STB_WEAK)) + && (ELF_ST_BIND (sym.st_info) == STB_GLOBAL + || ELF_ST_BIND (sym.st_info) == STB_WEAK)) { int bindtype; @@ -5400,7 +5403,7 @@ elf_link_output_extsym (h, data) /* If a symbol is not defined locally, we clear the visibility field. */ if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) - sym.st_other ^= ELF_ST_VISIBILITY(sym.st_other); + sym.st_other ^= ELF_ST_VISIBILITY (sym.st_other); /* If this symbol should be put in the .dynsym section, then put it there now. We have already know the symbol index. We also fill @@ -6012,9 +6015,8 @@ elf_link_input_bfd (finfo, input_bfd) since it is needed by a reloc, we must output it now. */ link = symtab_hdr->sh_link; - name = bfd_elf_string_from_elf_section (input_bfd, - link, - isym->st_name); + name = (bfd_elf_string_from_elf_section + (input_bfd, link, isym->st_name)); if (name == NULL) return false; @@ -6029,7 +6031,8 @@ elf_link_input_bfd (finfo, input_bfd) if (! finfo->info->relocateable) isym->st_value += osec->vma; - finfo->indices[r_symndx] = bfd_get_symcount (output_bfd); + finfo->indices[r_symndx] + = bfd_get_symcount (output_bfd); if (! elf_link_output_sym (finfo, name, isym, sec)) return false; @@ -6044,7 +6047,8 @@ elf_link_input_bfd (finfo, input_bfd) /* Swap out the relocs. */ if (bed->elf_backend_emit_relocs - && ! (finfo->info->relocateable || finfo->info->emitrelocations)) + && !(finfo->info->relocateable + || finfo->info->emitrelocations)) reloc_emitter = bed->elf_backend_emit_relocs; else reloc_emitter = elf_link_output_relocs; @@ -6296,10 +6300,10 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel) BFD_ASSERT (lsect != NULL); - /* Is this a global symbol? */ + /* Is this a global symbol? */ if (h != NULL) { - /* Has this symbol already been allocated, if so, our work is done */ + /* Has this symbol already been allocated? If so, our work is done. */ if (_bfd_elf_find_pointer_linker_section (h->linker_section_pointer, rel->r_addend, lsect->which)) @@ -6316,29 +6320,30 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel) if (lsect->rel_section) lsect->rel_section->_raw_size += sizeof (Elf_External_Rela); } - - else /* Allocation of a pointer to a local symbol */ + else { + /* Allocation of a pointer to a local symbol. */ elf_linker_section_pointers_t **ptr = elf_local_ptr_offsets (abfd); - /* Allocate a table to hold the local symbols if first time */ + /* Allocate a table to hold the local symbols if first time. */ if (!ptr) { unsigned int num_symbols = elf_tdata (abfd)->symtab_hdr.sh_info; register unsigned int i; ptr = (elf_linker_section_pointers_t **) - bfd_alloc (abfd, num_symbols * sizeof (elf_linker_section_pointers_t *)); + bfd_alloc (abfd, + num_symbols * sizeof (elf_linker_section_pointers_t *)); if (!ptr) return false; elf_local_ptr_offsets (abfd) = ptr; for (i = 0; i < num_symbols; i++) - ptr[i] = (elf_linker_section_pointers_t *)0; + ptr[i] = (elf_linker_section_pointers_t *) 0; } - /* Has this symbol already been allocated, if so, our work is done */ + /* Has this symbol already been allocated? If so, our work is done. */ if (_bfd_elf_find_pointer_linker_section (ptr[r_symndx], rel->r_addend, lsect->which)) @@ -6356,8 +6361,8 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel) } } - /* Allocate space for a pointer in the linker section, and allocate a new pointer record - from internal memory. */ + /* Allocate space for a pointer in the linker section, and allocate + a new pointer record from internal memory. */ BFD_ASSERT (ptr_linker_section_ptr != NULL); linker_section_ptr = (elf_linker_section_pointers_t *) bfd_alloc (abfd, sizeof (elf_linker_section_pointers_t)); @@ -6374,17 +6379,19 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel) #if 0 if (lsect->hole_size && lsect->hole_offset < lsect->max_hole_offset) { - linker_section_ptr->offset = lsect->section->_raw_size - lsect->hole_size + (ARCH_SIZE / 8); + linker_section_ptr->offset = (lsect->section->_raw_size + - lsect->hole_size + (ARCH_SIZE / 8)); lsect->hole_offset += ARCH_SIZE / 8; lsect->sym_offset += ARCH_SIZE / 8; - if (lsect->sym_hash) /* Bump up symbol value if needed */ + if (lsect->sym_hash) { + /* Bump up symbol value if needed. */ lsect->sym_hash->root.u.def.value += ARCH_SIZE / 8; #ifdef DEBUG fprintf (stderr, "Bump up %s by %ld, current value = %ld\n", lsect->sym_hash->root.root.string, - (long)ARCH_SIZE / 8, - (long)lsect->sym_hash->root.u.def.value); + (long) ARCH_SIZE / 8, + (long) lsect->sym_hash->root.u.def.value); #endif } } @@ -6395,8 +6402,10 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel) lsect->section->_raw_size += ARCH_SIZE / 8; #ifdef DEBUG - fprintf (stderr, "Create pointer in linker section %s, offset = %ld, section size = %ld\n", - lsect->name, (long)linker_section_ptr->offset, (long)lsect->section->_raw_size); + fprintf (stderr, + "Create pointer in linker section %s, offset = %ld, section size = %ld\n", + lsect->name, (long) linker_section_ptr->offset, + (long) lsect->section->_raw_size); #endif return true; @@ -6412,7 +6421,8 @@ elf_create_pointer_linker_section (abfd, info, lsect, h, rel) /* Fill in the address for a pointer generated in a linker section. */ bfd_vma -elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, relocation, rel, relative_reloc) +elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, + relocation, rel, relative_reloc) bfd *output_bfd; bfd *input_bfd; struct bfd_link_info *info; @@ -6426,11 +6436,13 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca BFD_ASSERT (lsect != NULL); - if (h != NULL) /* global symbol */ + if (h != NULL) { - linker_section_ptr = _bfd_elf_find_pointer_linker_section (h->linker_section_pointer, - rel->r_addend, - lsect->which); + /* Handle global symbol. */ + linker_section_ptr = (_bfd_elf_find_pointer_linker_section + (h->linker_section_pointer, + rel->r_addend, + lsect->which)); BFD_ASSERT (linker_section_ptr != NULL); @@ -6450,23 +6462,27 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca if (!linker_section_ptr->written_address_p) { linker_section_ptr->written_address_p = true; - bfd_put_ptr (output_bfd, relocation + linker_section_ptr->addend, - lsect->section->contents + linker_section_ptr->offset); + bfd_put_ptr (output_bfd, + relocation + linker_section_ptr->addend, + (lsect->section->contents + + linker_section_ptr->offset)); } } } - else /* local symbol */ + else { + /* Handle local symbol. */ unsigned long r_symndx = ELF_R_SYM (rel->r_info); BFD_ASSERT (elf_local_ptr_offsets (input_bfd) != NULL); BFD_ASSERT (elf_local_ptr_offsets (input_bfd)[r_symndx] != NULL); - linker_section_ptr = _bfd_elf_find_pointer_linker_section (elf_local_ptr_offsets (input_bfd)[r_symndx], - rel->r_addend, - lsect->which); + linker_section_ptr = (_bfd_elf_find_pointer_linker_section + (elf_local_ptr_offsets (input_bfd)[r_symndx], + rel->r_addend, + lsect->which)); BFD_ASSERT (linker_section_ptr != NULL); - /* Write out pointer if it hasn't been rewritten out before */ + /* Write out pointer if it hasn't been rewritten out before. */ if (!linker_section_ptr->written_address_p) { linker_section_ptr->written_address_p = true; @@ -6480,18 +6496,23 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca struct elf_backend_data *bed = get_elf_backend_data (output_bfd); unsigned int i; - outrel = (Elf_Internal_Rela *) bfd_zmalloc (sizeof (Elf_Internal_Rela) - * bed->s->int_rels_per_ext_rel); + outrel = (Elf_Internal_Rela *) + bfd_zmalloc (sizeof (Elf_Internal_Rela) + * bed->s->int_rels_per_ext_rel); if (outrel == NULL) { (*_bfd_error_handler) (_("Error: out of memory")); return 0; } - /* We need to generate a relative reloc for the dynamic linker. */ + /* We need to generate a relative reloc for the dynamic + linker. */ if (!srel) - lsect->rel_section = srel = bfd_get_section_by_name (elf_hash_table (info)->dynobj, - lsect->rel_name); + { + srel = bfd_get_section_by_name (elf_hash_table (info)->dynobj, + lsect->rel_name); + lsect->rel_section = srel; + } BFD_ASSERT (srel != NULL); @@ -6504,7 +6525,8 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca elf_swap_reloca_out (output_bfd, outrel, (((Elf_External_Rela *) lsect->section->contents) - + elf_section_data (lsect->section)->rel_count)); + + (elf_section_data (lsect->section) + ->rel_count))); ++elf_section_data (lsect->section)->rel_count; free (outrel); @@ -6518,8 +6540,9 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h, reloca - lsect->sym_offset); #ifdef DEBUG - fprintf (stderr, "Finish pointer in linker section %s, offset = %ld (0x%lx)\n", - lsect->name, (long)relocation, (long)relocation); + fprintf (stderr, + "Finish pointer in linker section %s, offset = %ld (0x%lx)\n", + lsect->name, (long) relocation, (long) relocation); #endif /* Subtract out the addend, because it will get added back in by the normal @@ -6806,7 +6829,6 @@ elf_gc_propagate_vtable_entries_used (h, okp) size_t n; boolean *cu, *pu; - /* Or the parent's entries into ours. */ cu = h->vtable_entries_used; cu[-1] = true; @@ -6855,7 +6877,7 @@ elf_gc_smash_unused_vtentry_relocs (h, okp) relstart = (NAME(_bfd_elf,link_read_relocs) (sec->owner, sec, NULL, (Elf_Internal_Rela *) NULL, true)); if (!relstart) - return *(boolean *)okp = false; + return *(boolean *) okp = false; bed = get_elf_backend_data (sec->owner); file_align = bed->s->file_align; @@ -6930,7 +6952,7 @@ elf_gc_sections (abfd, info) } /* ... and mark SEC_EXCLUDE for those that go. */ - if (!elf_gc_sweep(info, get_elf_backend_data (abfd)->gc_sweep_hook)) + if (!elf_gc_sweep (info, get_elf_backend_data (abfd)->gc_sweep_hook)) return false; return true; @@ -6973,7 +6995,7 @@ elf_gc_record_vtinherit (abfd, sec, h, offset) (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT", bfd_get_filename (abfd), sec->name, - (unsigned long)offset); + (unsigned long) offset); bfd_set_error (bfd_error_invalid_operation); return false; @@ -7037,8 +7059,9 @@ elf_gc_record_vtentry (abfd, sec, h, addend) { size_t oldbytes; - oldbytes = (h->vtable_entries_size/file_align + 1) * sizeof (boolean); - memset (((char *)ptr) + oldbytes, 0, bytes - oldbytes); + oldbytes = ((h->vtable_entries_size / file_align + 1) + * sizeof (boolean)); + memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes); } } else diff --git a/bfd/merge.c b/bfd/merge.c index 3d0904153eb..49074ece028 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -108,6 +108,12 @@ static struct sec_merge_hash_entry *sec_merge_add struct sec_merge_sec_info *)); static boolean sec_merge_emit PARAMS ((bfd *, struct sec_merge_hash_entry *)); +static int cmplengthentry PARAMS ((const PTR, const PTR)); +static int last4_eq PARAMS ((const PTR, const PTR)); +static int last_eq PARAMS ((const PTR, const PTR)); +static boolean record_section + PARAMS ((struct sec_merge_info *, struct sec_merge_sec_info *)); +static void merge_strings PARAMS ((struct sec_merge_info *)); /* Routine to create an entry in a section merge hashtab. */ @@ -475,7 +481,8 @@ cmplengthentry (a, b) static int last4_eq (a, b) - const void *a, *b; + const PTR a; + const PTR b; { struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a; struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b; @@ -502,7 +509,8 @@ last4_eq (a, b) static int last_eq (a, b) - const void *a, *b; + const PTR a; + const PTR b; { struct sec_merge_hash_entry * A = (struct sec_merge_hash_entry *) a; struct sec_merge_hash_entry * B = (struct sec_merge_hash_entry *) b; diff --git a/bfd/syms.c b/bfd/syms.c index d8489188576..27303b1e0a9 100644 --- a/bfd/syms.c +++ b/bfd/syms.c @@ -1,6 +1,6 @@ /* Generic symbol-table support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000 + 2000, 2001 Free Software Foundation, Inc. Written by Cygnus Support. @@ -312,6 +312,7 @@ CODE_FRAGMENT #include "aout/stab_gnu.h" static char coff_section_type PARAMS ((const char *)); +static int cmpindexentry PARAMS ((const PTR, const PTR)); /* DOCDD