From f075ee0c61d4b9982a7390d3760f764185f5d36e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Sun, 20 Feb 2005 14:59:07 +0000 Subject: [PATCH] include/ * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. include/coff/ * xcoff.h (struct xcoff_loader_info): Warning fix. bfd/ * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove useless assignments. (xcoff_write_archive_contents_big): Likewise. (_bfd_xcoff_put_ldsymbol_name): Likewise. * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. * cofflink.c (process_embedded_commands): Warning fixes. * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. Warning fixes. * dwarf2.c: Warning fixes. * elf-bfd.h: Likewise. * elf-eh-frame.c: Likewise. * elf-strtab.c: Likewise. * elf.c: Likewise. * elf32-m68k.c: Likewise. * elf32-ppc.c: Likewise. * elf32-sh-symbian.c: Likewise. * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. * elf64-sh64.c: Likewise. * peicode.h: Likewise. * elf64-mmix.c: Warning fixes. * elfcode.h: Likewise. * elfxx-mips.c: Likewise. * libbfd-in.h: Likewise. * libbfd.c: Likewise. * mach-o.c: Likewise. * merge.c: Likewise. * mmo.c: Likewise. * opncls.c: Likewise. * pef.c: Likewise. * srec.c: Likewise. * vms-hdr.c: Likewise. * vms-tir.c: Likewise. * xtensa-isa.c: Likewise. * xtensa-modules.c: Likewise. * xsym.c: Likewise. (pstrcmp): Use correct choice of string lengths. Fix return value. (bfd_sym_module_name): Correct string length. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. --- bfd/ChangeLog | 49 ++++++++++++++ bfd/bfd-in.h | 2 +- bfd/bfd-in2.h | 2 +- bfd/coff-m68k.c | 4 +- bfd/coff-rs6000.c | 29 ++++----- bfd/coff64-rs6000.c | 7 +- bfd/coffgen.c | 4 +- bfd/cofflink.c | 10 +-- bfd/cpu-arm.c | 46 +++++-------- bfd/dwarf2.c | 118 +++++++++++++++++----------------- bfd/elf-bfd.h | 8 +-- bfd/elf-eh-frame.c | 16 ++--- bfd/elf-strtab.c | 6 +- bfd/elf.c | 18 +++--- bfd/elf32-m68k.c | 2 +- bfd/elf32-ppc.c | 2 +- bfd/elf32-sh-symbian.c | 41 ++++++------ bfd/elf32-sh.c | 71 +------------------- bfd/elf64-mmix.c | 4 +- bfd/elf64-sh64.c | 69 ++------------------ bfd/elfcode.h | 8 +-- bfd/elfxx-mips.c | 2 +- bfd/libbfd-in.h | 7 +- bfd/libbfd.c | 20 +++--- bfd/libbfd.h | 7 +- bfd/mach-o.c | 4 +- bfd/merge.c | 19 +++--- bfd/mmo.c | 10 +-- bfd/opncls.c | 12 ++-- bfd/pef.c | 7 +- bfd/peicode.h | 38 +++++------ bfd/srec.c | 5 +- bfd/vms-hdr.c | 5 +- bfd/vms-tir.c | 8 +-- bfd/xsym.c | 33 +++++----- bfd/xtensa-isa.c | 12 ++-- bfd/xtensa-modules.c | 4 +- include/ChangeLog | 6 ++ include/coff/ChangeLog | 4 ++ include/coff/xcoff.h | 4 +- include/xtensa-isa-internal.h | 4 +- include/xtensa-isa.h | 8 +-- 42 files changed, 325 insertions(+), 410 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0b2e704ca22..7729e55868c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,52 @@ +2005-02-21 Alan Modra + + * bfd-in.h (bfd_elf_bfd_from_remote_memory): Warning fix. + * coff-m68k.c (bfd_m68k_coff_create_embedded_relocs): Likewise. + * coff-rs6000.c (xcoff_write_armap_big): Warning fixes. Remove + useless assignments. + (xcoff_write_archive_contents_big): Likewise. + (_bfd_xcoff_put_ldsymbol_name): Likewise. + * coff64-rs6000.c (_bfd_xcoff64_put_ldsymbol_name): Likewise. + * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. + * cofflink.c (process_embedded_commands): Warning fixes. + * cpu-arm.c: Delete unnecessary prototypes. Convert to C90. + Warning fixes. + * dwarf2.c: Warning fixes. + * elf-bfd.h: Likewise. + * elf-eh-frame.c: Likewise. + * elf-strtab.c: Likewise. + * elf.c: Likewise. + * elf32-m68k.c: Likewise. + * elf32-ppc.c: Likewise. + * elf32-sh-symbian.c: Likewise. + * elf32-sh.c: Delete unnecessary prototypes. Warning fixes. + * elf64-sh64.c: Likewise. + * peicode.h: Likewise. + * elf64-mmix.c: Warning fixes. + * elfcode.h: Likewise. + * elfxx-mips.c: Likewise. + * libbfd-in.h: Likewise. + * libbfd.c: Likewise. + * mach-o.c: Likewise. + * merge.c: Likewise. + * mmo.c: Likewise. + * opncls.c: Likewise. + * pef.c: Likewise. + * srec.c: Likewise. + * vms-hdr.c: Likewise. + * vms-tir.c: Likewise. + * xtensa-isa.c: Likewise. + * xtensa-modules.c: Likewise. + * xsym.c: Likewise. + (pstrcmp): Use correct choice of string lengths. Fix return value. + (bfd_sym_module_name): Correct string length. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + +2005-02-18 Alan Modra + + * coffgen.c (coff_write_symbols): Make "written" a bfd_vma. + 2005-02-17 Alexandre Oliva * elf32-frv.c (elf32_frv_relocate_section): Remove warning from diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h index 033db48d820..37c6386632e 100644 --- a/bfd/bfd-in.h +++ b/bfd/bfd-in.h @@ -681,7 +681,7 @@ extern int bfd_get_elf_phdrs the remote memory. */ extern bfd *bfd_elf_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); + int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ extern int bfd_get_arch_size diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index c05e7d7f251..930c2427ec2 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -688,7 +688,7 @@ extern int bfd_get_elf_phdrs the remote memory. */ extern bfd *bfd_elf_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); + int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len)); /* Return the arch_size field of an elf bfd, or -1 if not elf. */ extern int bfd_get_arch_size diff --git a/bfd/coff-m68k.c b/bfd/coff-m68k.c index 0947811687a..c1be3eea9ae 100644 --- a/bfd/coff-m68k.c +++ b/bfd/coff-m68k.c @@ -1,6 +1,6 @@ /* BFD back-end for Motorola 68000 COFF binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -510,7 +510,7 @@ bfd_m68k_coff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) (irel->r_vaddr - datasec->vma + datasec->output_offset), p); memset (p + 4, 0, 8); if (targetsec != NULL) - strncpy (p + 4, targetsec->output_section->name, 8); + strncpy ((char *) p + 4, targetsec->output_section->name, 8); } return TRUE; diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 1257fbb1436..7b2b16bc935 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -1849,8 +1849,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) if (sym_32) { struct xcoff_ar_hdr_big *hdr; - bfd_byte *symbol_table; - bfd_byte *st; + char *symbol_table; + char *st; file_ptr fileoff; bfd_vma symbol_table_size = @@ -1860,8 +1860,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + 8 * sym_32 + str_32 + (str_32 & 1); - symbol_table = NULL; - symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size); + symbol_table = bfd_zmalloc (symbol_table_size); if (symbol_table == NULL) return FALSE; @@ -1941,7 +1940,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) bfd_bwrite (symbol_table, symbol_table_size, abfd); free (symbol_table); - symbol_table = NULL; prevoff = nextoff; nextoff = nextoff + symbol_table_size; @@ -1952,8 +1950,8 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) if (sym_64) { struct xcoff_ar_hdr_big *hdr; - bfd_byte *symbol_table; - bfd_byte *st; + char *symbol_table; + char *st; file_ptr fileoff; bfd_vma symbol_table_size = @@ -1963,8 +1961,7 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) + 8 * sym_64 + str_64 + (str_64 & 1); - symbol_table = NULL; - symbol_table = (bfd_byte *) bfd_zmalloc (symbol_table_size); + symbol_table = bfd_zmalloc (symbol_table_size); if (symbol_table == NULL) return FALSE; @@ -2039,7 +2036,6 @@ xcoff_write_armap_big (abfd, elength, map, orl_count, stridx) bfd_bwrite (symbol_table, symbol_table_size, abfd); free (symbol_table); - symbol_table = NULL; PRINT20 (fhdr->symoff64, nextoff); } @@ -2311,7 +2307,7 @@ xcoff_write_archive_contents_big (abfd) size_t i; struct xcoff_ar_hdr_big *hdr, ahdr; bfd_size_type size; - bfd_byte *member_table, *mt; + char *member_table, *mt; bfd_vma member_table_size; memset (&fhdr, 0, SIZEOF_AR_FILE_HDR_BIG); @@ -2476,8 +2472,7 @@ xcoff_write_archive_contents_big (abfd) + total_namlen); member_table_size += member_table_size & 1; - member_table = NULL; - member_table = (bfd_byte *) bfd_zmalloc (member_table_size); + member_table = bfd_zmalloc (member_table_size); if (member_table == NULL) return FALSE; @@ -2530,7 +2525,6 @@ xcoff_write_archive_contents_big (abfd) return FALSE; free (member_table); - member_table = NULL; PRINT20 (fhdr.memoff, nextoff); @@ -3530,7 +3524,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name) if (ldinfo->string_size + len + 3 > ldinfo->string_alc) { bfd_size_type newalc; - bfd_byte *newstrings; + char *newstrings; newalc = ldinfo->string_alc * 2; if (newalc == 0) @@ -3538,8 +3532,7 @@ _bfd_xcoff_put_ldsymbol_name (abfd, ldinfo, ldsym, name) while (ldinfo->string_size + len + 3 > newalc) newalc *= 2; - newstrings = ((bfd_byte *) - bfd_realloc ((PTR) ldinfo->strings, newalc)); + newstrings = bfd_realloc (ldinfo->strings, newalc); if (newstrings == NULL) { ldinfo->failed = TRUE; diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index c4dd1d8e15a..0e14b3499b8 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002, 2003, 2004 + Copyright 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -564,7 +564,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name) if (ldinfo->string_size + len + 3 > ldinfo->string_alc) { bfd_size_type newalc; - bfd_byte *newstrings; + char *newstrings; newalc = ldinfo->string_alc * 2; if (newalc == 0) @@ -572,8 +572,7 @@ _bfd_xcoff64_put_ldsymbol_name (abfd, ldinfo, ldsym, name) while (ldinfo->string_size + len + 3 > newalc) newalc *= 2; - newstrings = ((bfd_byte *) - bfd_realloc ((PTR) ldinfo->strings, newalc)); + newstrings = bfd_realloc (ldinfo->strings, newalc); if (newstrings == NULL) { ldinfo->failed = TRUE; diff --git a/bfd/coffgen.c b/bfd/coffgen.c index 4b87b9bd402..4e76b2f5767 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1,6 +1,6 @@ /* Support for the generic parts of COFF, for BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -1155,7 +1155,7 @@ coff_write_symbols (abfd) bfd_size_type debug_string_size; unsigned int i; unsigned int limit = bfd_get_symcount (abfd); - bfd_signed_vma written = 0; + bfd_vma written = 0; asymbol **p; string_size = 0; diff --git a/bfd/cofflink.c b/bfd/cofflink.c index 46770d8901c..19cb54fcce8 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -1,6 +1,6 @@ /* COFF specific linker code. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004 Free Software Foundation, Inc. + 2004, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -1221,16 +1221,16 @@ process_embedded_commands (bfd *output_bfd, free (copy); return 0; } - e = copy + sec->size; + e = (char *) copy + sec->size; - for (s = copy; s < e ; ) + for (s = (char *) copy; s < e ; ) { - if (s[0]!= '-') + if (s[0] != '-') { s++; continue; } - if (strncmp (s,"-attr", 5) == 0) + if (strncmp (s, "-attr", 5) == 0) { char *name; char *attribs; diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c index ea923c3409f..cd7c7a65575 100644 --- a/bfd/cpu-arm.c +++ b/bfd/cpu-arm.c @@ -1,5 +1,5 @@ /* BFD support for the ARM processor - Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004 + Copyright 1994, 1997, 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) @@ -24,21 +24,12 @@ #include "libbfd.h" #include "libiberty.h" -static const bfd_arch_info_type * compatible - PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); -static bfd_boolean scan - PARAMS ((const struct bfd_arch_info *, const char *)); -static bfd_boolean arm_check_note - PARAMS ((bfd *, char *, bfd_size_type, const char *, char **)); - /* This routine is provided two arch_infos and works out which ARM machine which would be compatible with both and returns a pointer to its info structure. */ static const bfd_arch_info_type * -compatible (a,b) - const bfd_arch_info_type * a; - const bfd_arch_info_type * b; +compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) { /* If a & b are for different architecture we can do nothing. */ if (a->arch != b->arch) @@ -105,9 +96,7 @@ processors[] = }; static bfd_boolean -scan (info, string) - const struct bfd_arch_info * info; - const char * string; +scan (const struct bfd_arch_info *info, const char *string) { int i; @@ -162,9 +151,7 @@ const bfd_arch_info_type bfd_arm_arch = Returns TRUE if they were merged successfully or FALSE otherwise. */ bfd_boolean -bfd_arm_merge_machines (ibfd, obfd) - bfd * ibfd; - bfd * obfd; +bfd_arm_merge_machines (bfd *ibfd, bfd *obfd) { unsigned int in = bfd_get_mach (ibfd); unsigned int out = bfd_get_mach (obfd); @@ -226,12 +213,11 @@ typedef struct } arm_Note; static bfd_boolean -arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) - bfd * abfd; - char * buffer; - bfd_size_type buffer_size; - const char * expected_name; - char ** description_return; +arm_check_note (bfd *abfd, + bfd_byte *buffer, + bfd_size_type buffer_size, + const char *expected_name, + char **description_return) { unsigned long namesz; unsigned long descsz; @@ -246,7 +232,7 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) namesz = bfd_get_32 (abfd, buffer); descsz = bfd_get_32 (abfd, buffer + offsetof (arm_Note, descsz)); type = bfd_get_32 (abfd, buffer + offsetof (arm_Note, type)); - descr = buffer + offsetof (arm_Note, name); + descr = (char *) buffer + offsetof (arm_Note, name); /* Check for buffer overflow. */ if (namesz + descsz + offsetof (arm_Note, name) > buffer_size) @@ -279,9 +265,7 @@ arm_check_note (abfd, buffer, buffer_size, expected_name, description_return) #define NOTE_ARCH_STRING "arch: " bfd_boolean -bfd_arm_update_notes (abfd, note_section) - bfd * abfd; - const char * note_section; +bfd_arm_update_notes (bfd *abfd, const char *note_section) { asection * arm_arch_section; bfd_size_type buffer_size; @@ -329,7 +313,9 @@ bfd_arm_update_notes (abfd, note_section) if (strcmp (arch_string, expected) != 0) { - strcpy (buffer + offsetof (arm_Note, name) + ((strlen (NOTE_ARCH_STRING) + 3) & ~3), expected); + strcpy ((char *) buffer + (offsetof (arm_Note, name) + + ((strlen (NOTE_ARCH_STRING) + 3) & ~3)), + expected); if (! bfd_set_section_contents (abfd, arm_arch_section, buffer, (file_ptr) 0, buffer_size)) @@ -374,9 +360,7 @@ architectures[] = /* Extract the machine number stored in a note section. */ unsigned int -bfd_arm_get_mach_from_notes (abfd, note_section) - bfd * abfd; - const char * note_section; +bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section) { asection * arm_arch_section; bfd_size_type buffer_size; diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index d5544d9caa4..be8ba389706 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1,6 +1,6 @@ /* DWARF 2 support. Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004 Free Software Foundation, Inc. + 2004, 2005 Free Software Foundation, Inc. Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions (gavin@cygnus.com). @@ -71,44 +71,44 @@ struct attribute struct dwarf_block { unsigned int size; - char *data; + bfd_byte *data; }; struct dwarf2_debug { /* A list of all previously read comp_units. */ - struct comp_unit* all_comp_units; + struct comp_unit *all_comp_units; /* The next unread compilation unit within the .debug_info section. Zero indicates that the .debug_info section has not been loaded into a buffer yet. */ - char* info_ptr; + bfd_byte *info_ptr; /* Pointer to the end of the .debug_info section memory buffer. */ - char* info_ptr_end; + bfd_byte *info_ptr_end; /* Pointer to the section and address of the beginning of the section. */ - asection* sec; - char* sec_info_ptr; + asection *sec; + bfd_byte *sec_info_ptr; /* Pointer to the symbol table. */ - asymbol** syms; + asymbol **syms; /* Pointer to the .debug_abbrev section loaded into memory. */ - char* dwarf_abbrev_buffer; + bfd_byte *dwarf_abbrev_buffer; /* Length of the loaded .debug_abbrev section. */ unsigned long dwarf_abbrev_size; /* Buffer for decode_line_info. */ - char *dwarf_line_buffer; + bfd_byte *dwarf_line_buffer; /* Length of the loaded .debug_line section. */ unsigned long dwarf_line_size; /* Pointer to the .debug_str section loaded into memory. */ - char* dwarf_str_buffer; + bfd_byte *dwarf_str_buffer; /* Length of the loaded .debug_str section. */ unsigned long dwarf_str_size; @@ -127,48 +127,48 @@ struct arange struct comp_unit { /* Chain the previously read compilation units. */ - struct comp_unit* next_unit; + struct comp_unit *next_unit; /* Keep the bdf convenient (for memory allocation). */ - bfd* abfd; + bfd *abfd; /* The lowest and higest addresses contained in this compilation unit as specified in the compilation unit header. */ struct arange arange; /* The DW_AT_name attribute (for error messages). */ - char* name; + char *name; /* The abbrev hash table. */ - struct abbrev_info** abbrevs; + struct abbrev_info **abbrevs; /* Note that an error was found by comp_unit_find_nearest_line. */ int error; /* The DW_AT_comp_dir attribute. */ - char* comp_dir; + char *comp_dir; /* TRUE if there is a line number table associated with this comp. unit. */ int stmtlist; /* Pointer to the current comp_unit so that we can find a given entry by its reference. */ - char *info_ptr_unit; + bfd_byte *info_ptr_unit; /* The offset into .debug_line of the line number table. */ unsigned long line_offset; /* Pointer to the first child die for the comp unit. */ - char *first_child_die_ptr; + bfd_byte *first_child_die_ptr; /* The end of the comp unit. */ - char *end_ptr; + bfd_byte *end_ptr; /* The decoded line number, NULL if not yet decoded. */ - struct line_info_table* line_table; + struct line_info_table *line_table; /* A list of the functions found in this comp. unit. */ - struct funcinfo* function_table; + struct funcinfo *function_table; /* Pointer to dwarf2_debug structure. */ struct dwarf2_debug *stash; @@ -211,38 +211,38 @@ struct attr_abbrev /* Read dwarf information from a buffer. */ static unsigned int -read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf) +read_1_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) { return bfd_get_8 (abfd, buf); } static int -read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, char *buf) +read_1_signed_byte (bfd *abfd ATTRIBUTE_UNUSED, bfd_byte *buf) { return bfd_get_signed_8 (abfd, buf); } static unsigned int -read_2_bytes (bfd *abfd, char *buf) +read_2_bytes (bfd *abfd, bfd_byte *buf) { return bfd_get_16 (abfd, buf); } static unsigned int -read_4_bytes (bfd *abfd, char *buf) +read_4_bytes (bfd *abfd, bfd_byte *buf) { return bfd_get_32 (abfd, buf); } static bfd_uint64_t -read_8_bytes (bfd *abfd, char *buf) +read_8_bytes (bfd *abfd, bfd_byte *buf) { return bfd_get_64 (abfd, buf); } -static char * +static bfd_byte * read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, + bfd_byte *buf, unsigned int size ATTRIBUTE_UNUSED) { /* If the size of a host char is 8 bits, we can return a pointer @@ -253,27 +253,29 @@ read_n_bytes (bfd *abfd ATTRIBUTE_UNUSED, static char * read_string (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, + bfd_byte *buf, unsigned int *bytes_read_ptr) { /* Return a pointer to the embedded string. */ - if (*buf == '\0') + char *str = (char *) buf; + if (*str == '\0') { *bytes_read_ptr = 1; return NULL; } - *bytes_read_ptr = strlen (buf) + 1; - return buf; + *bytes_read_ptr = strlen (str) + 1; + return str; } static char * read_indirect_string (struct comp_unit* unit, - char *buf, + bfd_byte *buf, unsigned int *bytes_read_ptr) { bfd_uint64_t offset; struct dwarf2_debug *stash = unit->stash; + char *str; if (unit->offset_size == 4) offset = read_4_bytes (unit->abfd, buf); @@ -315,16 +317,16 @@ read_indirect_string (struct comp_unit* unit, return NULL; } - buf = stash->dwarf_str_buffer + offset; - if (*buf == '\0') + str = (char *) stash->dwarf_str_buffer + offset; + if (*str == '\0') return NULL; - return buf; + return str; } /* END VERBATIM */ static bfd_uint64_t -read_address (struct comp_unit *unit, char *buf) +read_address (struct comp_unit *unit, bfd_byte *buf) { switch (unit->addr_size) { @@ -370,7 +372,7 @@ static struct abbrev_info** read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) { struct abbrev_info **abbrevs; - char *abbrev_ptr; + bfd_byte *abbrev_ptr; struct abbrev_info *cur_abbrev; unsigned int abbrev_number, bytes_read, abbrev_name; unsigned int abbrev_form, hash_number; @@ -477,11 +479,11 @@ read_abbrevs (bfd *abfd, bfd_uint64_t offset, struct dwarf2_debug *stash) /* Read an attribute value described by an attribute form. */ -static char * +static bfd_byte * read_attribute_value (struct attribute *attr, unsigned form, struct comp_unit *unit, - char *info_ptr) + bfd_byte *info_ptr) { bfd *abfd = unit->abfd; unsigned int bytes_read; @@ -605,11 +607,11 @@ read_attribute_value (struct attribute *attr, /* Read an attribute described by an abbreviated attribute. */ -static char * +static bfd_byte * read_attribute (struct attribute *attr, struct attr_abbrev *abbrev, struct comp_unit *unit, - char *info_ptr) + bfd_byte *info_ptr) { attr->name = abbrev->name; info_ptr = read_attribute_value (attr, abbrev->form, unit, info_ptr); @@ -625,7 +627,7 @@ struct line_info { struct line_info* prev_line; bfd_vma address; - char* filename; + char *filename; unsigned int line; unsigned int column; int end_sequence; /* End of (sequential) code sequence. */ @@ -644,8 +646,8 @@ struct line_info_table bfd* abfd; unsigned int num_files; unsigned int num_dirs; - char* comp_dir; - char** dirs; + char *comp_dir; + char **dirs; struct fileinfo* files; struct line_info* last_line; /* largest VMA */ struct line_info* lcl_head; /* local head; used in 'add_line_info' */ @@ -654,7 +656,7 @@ struct line_info_table struct funcinfo { struct funcinfo *prev_func; - char* name; + char *name; bfd_vma low; bfd_vma high; }; @@ -763,7 +765,7 @@ add_line_info (struct line_info_table *table, static char * concat_filename (struct line_info_table *table, unsigned int file) { - char* filename; + char *filename; if (file - 1 >= table->num_files) { @@ -776,7 +778,7 @@ concat_filename (struct line_info_table *table, unsigned int file) if (! IS_ABSOLUTE_PATH (filename)) { - char* dirname = (table->files[file - 1].dir + char *dirname = (table->files[file - 1].dir ? table->dirs[table->files[file - 1].dir - 1] : table->comp_dir); @@ -846,8 +848,8 @@ decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash) { bfd *abfd = unit->abfd; struct line_info_table* table; - char *line_ptr; - char *line_end; + bfd_byte *line_ptr; + bfd_byte *line_end; struct line_head lh; unsigned int i, bytes_read, offset_size; char *cur_file, *cur_dir; @@ -1265,7 +1267,7 @@ static char * find_abstract_instance_name (struct comp_unit *unit, bfd_uint64_t die_ref) { bfd *abfd = unit->abfd; - char *info_ptr; + bfd_byte *info_ptr; unsigned int abbrev_number, bytes_read, i; struct abbrev_info *abbrev; struct attribute attr; @@ -1306,7 +1308,7 @@ static bfd_boolean scan_unit_for_functions (struct comp_unit *unit) { bfd *abfd = unit->abfd; - char *info_ptr = unit->first_child_die_ptr; + bfd_byte *info_ptr = unit->first_child_die_ptr; int nesting_level = 1; while (nesting_level) @@ -1315,7 +1317,7 @@ scan_unit_for_functions (struct comp_unit *unit) struct abbrev_info *abbrev; struct attribute attr; struct funcinfo *func; - char* name = 0; + char *name = 0; abbrev_number = read_unsigned_leb128 (abfd, info_ptr, &bytes_read); info_ptr += bytes_read; @@ -1417,7 +1419,7 @@ static struct comp_unit * parse_comp_unit (bfd *abfd, struct dwarf2_debug *stash, bfd_vma unit_length, - char *info_ptr_unit, + bfd_byte *info_ptr_unit, unsigned int offset_size) { struct comp_unit* unit; @@ -1428,8 +1430,8 @@ parse_comp_unit (bfd *abfd, unsigned int abbrev_number, bytes_read, i; struct abbrev_info *abbrev; struct attribute attr; - char *info_ptr = stash->info_ptr; - char *end_ptr = info_ptr + unit_length; + bfd_byte *info_ptr = stash->info_ptr; + bfd_byte *end_ptr = info_ptr + unit_length; bfd_size_type amt; version = read_2_bytes (abfd, info_ptr); @@ -1527,7 +1529,7 @@ parse_comp_unit (bfd *abfd, case DW_AT_comp_dir: { - char* comp_dir = attr.u.str; + char *comp_dir = attr.u.str; if (comp_dir) { /* Irix 6.2 native cc prepends .: to the compilation @@ -1791,7 +1793,7 @@ _bfd_dwarf2_find_nearest_line (bfd *abfd, bfd_vma length; bfd_boolean found; unsigned int offset_size = addr_size; - char *info_ptr_unit = stash->info_ptr; + bfd_byte *info_ptr_unit = stash->info_ptr; length = read_4_bytes (abfd, stash->info_ptr); /* A 0xffffff length is the DWARF3 way of indicating we use diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 4676a272d80..4c93e808912 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -269,7 +269,7 @@ struct cie { struct cie_header hdr; unsigned char version; - unsigned char augmentation[20]; + char augmentation[20]; bfd_vma code_align; bfd_signed_vma data_align; bfd_vma ra_column; @@ -955,7 +955,7 @@ struct elf_backend_data see elf.c, elfcode.h. */ bfd *(*elf_backend_bfd_from_remote_memory) (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma vma, char *myaddr, int len)); + int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr, int len)); /* This function is used by `_bfd_elf_get_synthetic_symtab'; see elf.c. */ @@ -1780,10 +1780,10 @@ extern char *elfcore_write_lwpstatus extern bfd *_bfd_elf32_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)); + int (*target_read_memory) (bfd_vma, bfd_byte *, int)); extern bfd *_bfd_elf64_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)); + int (*target_read_memory) (bfd_vma, bfd_byte *, int)); /* SH ELF specific routine. */ diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c index deea1e3c497..5a01ab3ba39 100644 --- a/bfd/elf-eh-frame.c +++ b/bfd/elf-eh-frame.c @@ -453,7 +453,7 @@ _bfd_elf_discard_section_eh_frame for (;;) { - unsigned char *aug; + char *aug; bfd_byte *start, *end, *insns; bfd_size_type length; @@ -563,10 +563,10 @@ _bfd_elf_discard_section_eh_frame /* Cannot handle unknown versions. */ REQUIRE (cie.version == 1 || cie.version == 3); - REQUIRE (strlen (buf) < sizeof (cie.augmentation)); + REQUIRE (strlen ((char *) buf) < sizeof (cie.augmentation)); - strcpy (cie.augmentation, buf); - buf = strchr (buf, '\0') + 1; + strcpy (cie.augmentation, (char *) buf); + buf = (bfd_byte *) strchr ((char *) buf, '\0') + 1; ENSURE_NO_RELOCS (buf); if (buf[0] == 'e' && buf[1] == 'h') { @@ -1088,7 +1088,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, || ent->need_lsda_relative || ent->per_encoding_relative) { - unsigned char *aug; + char *aug; unsigned int action, extra_string, extra_data; unsigned int per_width, per_encoding; @@ -1102,8 +1102,8 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, /* Skip length, id and version. */ buf += 9; - aug = buf; - buf = strchr (buf, '\0') + 1; + aug = (char *) buf; + buf += strlen (aug) + 1; skip_leb128 (&buf, end); skip_leb128 (&buf, end); skip_leb128 (&buf, end); @@ -1117,7 +1117,7 @@ _bfd_elf_write_section_eh_frame (bfd *abfd, /* Make room for the new augmentation string and data bytes. */ memmove (buf + extra_string + extra_data, buf, end - buf); - memmove (aug + extra_string, aug, buf - aug); + memmove (aug + extra_string, aug, buf - (bfd_byte *) aug); buf += extra_string; end += extra_string + extra_data; diff --git a/bfd/elf-strtab.c b/bfd/elf-strtab.c index 673b9d77ac9..460d26b16b7 100644 --- a/bfd/elf-strtab.c +++ b/bfd/elf-strtab.c @@ -1,5 +1,5 @@ /* ELF strtab with GC and suffix merging support. - Copyright 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Jakub Jelinek . This file is part of BFD, the Binary File Descriptor library. @@ -263,8 +263,8 @@ strrevcmp (const void *a, const void *b) struct elf_strtab_hash_entry *B = *(struct elf_strtab_hash_entry **) b; unsigned int lenA = A->len; unsigned int lenB = B->len; - const unsigned char *s = A->root.string + lenA - 1; - const unsigned char *t = B->root.string + lenB - 1; + const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1; + const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1; int l = lenA < lenB ? lenA : lenB; while (l) diff --git a/bfd/elf.c b/bfd/elf.c index 2ab84e4581f..dd76dadc717 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -210,10 +210,10 @@ bfd_elf_hash (const char *namearg) file, into a newly allocated buffer, and return a pointer to the buffer. */ -static char * +static bfd_byte * elf_read (bfd *abfd, file_ptr offset, bfd_size_type size) { - char *buf; + bfd_byte *buf; if ((buf = bfd_alloc (abfd, size)) == NULL) return NULL; @@ -253,15 +253,15 @@ char * bfd_elf_get_str_section (bfd *abfd, unsigned int shindex) { Elf_Internal_Shdr **i_shdrp; - char *shstrtab = NULL; + bfd_byte *shstrtab = NULL; file_ptr offset; bfd_size_type shstrtabsize; i_shdrp = elf_elfsections (abfd); if (i_shdrp == 0 || i_shdrp[shindex] == 0) - return 0; + return NULL; - shstrtab = (char *) i_shdrp[shindex]->contents; + shstrtab = i_shdrp[shindex]->contents; if (shstrtab == NULL) { /* No cached one, attempt to read, and cache what we read. */ @@ -270,7 +270,7 @@ bfd_elf_get_str_section (bfd *abfd, unsigned int shindex) shstrtab = elf_read (abfd, offset, shstrtabsize); i_shdrp[shindex]->contents = shstrtab; } - return shstrtab; + return (char *) shstrtab; } char * @@ -5576,8 +5576,8 @@ swap_out_syms (bfd *abfd, Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_shndx_hdr; Elf_Internal_Shdr *symstrtab_hdr; - char *outbound_syms; - char *outbound_shndx; + bfd_byte *outbound_syms; + bfd_byte *outbound_shndx; int idx; bfd_size_type amt; bfd_boolean name_local_sections; @@ -7866,7 +7866,7 @@ bfd_elf_bfd_from_remote_memory (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)) + int (*target_read_memory) (bfd_vma, bfd_byte *, int)) { return (*get_elf_backend_data (templ)->elf_backend_bfd_from_remote_memory) (templ, ehdr_vma, loadbasep, target_read_memory); diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 53ea5878ae6..c98674ddcbd 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -2170,7 +2170,7 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) bfd_put_32 (abfd, irel->r_offset + datasec->output_offset, p); memset (p + 4, 0, 8); if (targetsec != NULL) - strncpy (p + 4, targetsec->output_section->name, 8); + strncpy ((char *) p + 4, targetsec->output_section->name, 8); } if (isymbuf != NULL && symtab_hdr->contents != (unsigned char *) isymbuf) diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index 6a1c4e59126..b38a48ab28d 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -6110,7 +6110,7 @@ ppc_elf_final_write_processing (bfd *abfd, bfd_boolean linker ATTRIBUTE_UNUSED) bfd_put_32 (abfd, sizeof APUINFO_LABEL, buffer); bfd_put_32 (abfd, num_entries * 4, buffer + 4); bfd_put_32 (abfd, 0x2, buffer + 8); - strcpy (buffer + 12, APUINFO_LABEL); + strcpy ((char *) buffer + 12, APUINFO_LABEL); length = 20; for (i = 0; i < num_entries; i++) diff --git a/bfd/elf32-sh-symbian.c b/bfd/elf32-sh-symbian.c index adce088cc4d..549da3a605f 100644 --- a/bfd/elf32-sh-symbian.c +++ b/bfd/elf32-sh-symbian.c @@ -1,5 +1,5 @@ /* Renesas / SuperH specific support for Symbian 32-bit ELF files - Copyright 2004 + Copyright 2004, 2005 Free Software Foundation, Inc. Contributed by Red Hat @@ -96,8 +96,8 @@ typedef struct symbol_rename { struct symbol_rename * next; - bfd_byte * current_name; - bfd_byte * new_name; + char * current_name; + char * new_name; struct elf_link_hash_entry * current_hash; unsigned long new_symndx; } @@ -109,7 +109,7 @@ static symbol_rename * rename_list = NULL; static bfd_boolean sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd, - bfd_byte * current_name, bfd_byte * new_name) + char * current_name, char * new_name) { struct elf_link_hash_entry * new_hash; symbol_rename * node; @@ -173,7 +173,7 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd, static bfd_boolean -sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, bfd_byte * name) +sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, char * name) { if (DEBUG) fprintf (stderr, "IMPORT '%s'\n", name); @@ -184,7 +184,7 @@ sh_symbian_import (bfd * abfd ATTRIBUTE_UNUSED, bfd_byte * name) } static bfd_boolean -sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, bfd_byte * name) +sh_symbian_export (bfd * abfd ATTRIBUTE_UNUSED, char * name) { if (DEBUG) fprintf (stderr, "EXPORT '%s'\n", name); @@ -202,14 +202,14 @@ static bfd_boolean sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd, asection * sec, bfd_byte * contents) { - bfd_byte *s; - bfd_byte *e; + char *s; + char *e; bfd_boolean result = TRUE; bfd_size_type sz = sec->rawsize ? sec->rawsize : sec->size; - for (s = contents, e = s + sz; s < e;) + for (s = (char *) contents, e = s + sz; s < e;) { - bfd_byte * directive = s; + char * directive = s; switch (*s) { @@ -229,9 +229,9 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd, result = FALSE; else { - bfd_byte * new_name; - bfd_byte * new_name_end; - bfd_byte name_end_char; + char * new_name; + char * new_name_end; + char name_end_char; /* Skip the IMPORT directive. */ s += strlen (DIRECTIVE_IMPORT); @@ -282,9 +282,9 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd, } else { - bfd_byte * current_name; - bfd_byte * current_name_end; - bfd_byte current_name_end_char; + char * current_name; + char * current_name_end; + char current_name_end_char; /* Skip the 'AS '. */ s += strlen (DIRECTIVE_AS); @@ -331,9 +331,9 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd, result = FALSE; else { - bfd_byte * name; - bfd_byte * name_end; - bfd_byte name_end_char; + char * name; + char * name_end; + char name_end_char; /* Skip the directive. */ s += strlen (DIRECTIVE_EXPORT); @@ -374,7 +374,8 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd, if (! result) { if (DEBUG) - fprintf (stderr, "offset into .directive section: %d\n", directive - contents); + fprintf (stderr, "offset into .directive section: %d\n", + directive - (char *) contents); bfd_set_error (bfd_error_invalid_operation); _bfd_error_handler (_("%B: Unrecognised .directive command: %s"), diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 149ef9fed2d..05b0665a7f3 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -32,20 +32,6 @@ static bfd_reloc_status_type sh_elf_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type sh_elf_ignore_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static reloc_howto_type *sh_elf_reloc_type_lookup - (bfd *, bfd_reloc_code_real_type); -static void sh_elf_info_to_howto - (bfd *, arelent *, Elf_Internal_Rela *); -static bfd_boolean sh_elf_set_private_flags - (bfd *, flagword); -static bfd_boolean sh_elf_copy_private_data - (bfd *, bfd *); -static bfd_boolean sh_elf_merge_private_data - (bfd *, bfd *); -static bfd_boolean sh_elf_set_mach_from_flags - (bfd *); -static bfd_boolean sh_elf_relax_section - (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); static bfd_boolean sh_elf_relax_delete_bytes (bfd *, asection *, bfd_vma, int); static bfd_boolean sh_elf_align_loads @@ -54,67 +40,12 @@ static bfd_boolean sh_elf_align_loads static bfd_boolean sh_elf_swap_insns (bfd *, asection *, void *, bfd_byte *, bfd_vma); #endif -static bfd_boolean sh_elf_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); -static bfd_byte *sh_elf_get_relocated_section_contents - (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, - bfd_boolean, asymbol **); -static void sh_elf_copy_indirect_symbol - (const struct elf_backend_data *, struct elf_link_hash_entry *, - struct elf_link_hash_entry *); static int sh_elf_optimized_tls_reloc (struct bfd_link_info *, int, int); -static bfd_boolean sh_elf_mkobject - (bfd *); -static bfd_boolean sh_elf_object_p - (bfd *); -static bfd_boolean sh_elf_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); -static struct bfd_hash_entry *sh_elf_link_hash_newfunc - (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); -static struct bfd_link_hash_table *sh_elf_link_hash_table_create - (bfd *); -static bfd_boolean sh_elf_adjust_dynamic_symbol - (struct bfd_link_info *, struct elf_link_hash_entry *); -static bfd_boolean sh_elf_size_dynamic_sections - (bfd *, struct bfd_link_info *); -static bfd_boolean sh_elf_finish_dynamic_symbol - (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *); -static bfd_boolean sh_elf_finish_dynamic_sections - (bfd *, struct bfd_link_info *); -static bfd_reloc_status_type sh_elf_reloc_loop - (int, bfd *, asection *, bfd_byte *, bfd_vma, asection *, bfd_vma, - bfd_vma); -static bfd_boolean create_got_section - (bfd *, struct bfd_link_info *); -static bfd_boolean sh_elf_create_dynamic_sections - (bfd *, struct bfd_link_info *); static bfd_vma dtpoff_base (struct bfd_link_info *); static bfd_vma tpoff (struct bfd_link_info *, bfd_vma); -static asection * sh_elf_gc_mark_hook - (asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *); -static bfd_boolean sh_elf_gc_sweep_hook - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); -static bfd_boolean allocate_dynrelocs - (struct elf_link_hash_entry *, void *); -static bfd_boolean readonly_dynrelocs - (struct elf_link_hash_entry *, void *); -static enum elf_reloc_type_class sh_elf_reloc_type_class - (const Elf_Internal_Rela *); -#ifdef INCLUDE_SHMEDIA -inline static void movi_shori_putval (bfd *, unsigned long, char *); -#endif -#if !defined SH_TARGET_ALREADY_DEFINED -static bfd_boolean elf32_shlin_grok_prstatus - (bfd *abfd, Elf_Internal_Note *note); -static bfd_boolean elf32_shlin_grok_psinfo - (bfd *abfd, Elf_Internal_Note *note); -#endif /* The name of the dynamic interpreter. This is put in the .interp section. */ @@ -3369,7 +3300,7 @@ static const bfd_byte *elf_sh_pic_plt_entry; #define elf_sh_plt_reloc_offset(info) (info->shared ? 52 : 44) inline static void -movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) +movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr) { bfd_put_32 (output_bfd, bfd_get_32 (output_bfd, addr) diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index 8a4bea251f2..c831d9fbe64 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -1,5 +1,5 @@ /* MMIX-specific support for 64-bit ELF. - Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Hans-Peter Nilsson This file is part of BFD, the Binary File Descriptor library. @@ -993,7 +993,7 @@ mmix_elf_perform_relocation (isec, howto, datap, addr, value) position for the stub. There's supposed to be room allocated for the stub. */ bfd_byte *stubcontents - = ((char *) datap + = ((bfd_byte *) datap - (addr - (isec->output_section->vma + isec->output_offset)) + size + mmix_elf_section_data (isec)->pjs.stub_offset); diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index 15f7a43857d..7bd6a043ee6 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1,5 +1,6 @@ /* SuperH SH64-specific support for 64-bit ELF - Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -107,70 +108,10 @@ struct elf_sh64_link_hash_table #define sh64_elf64_hash_table(p) \ ((struct elf_sh64_link_hash_table *) ((p)->hash)) -static bfd_boolean sh_elf64_copy_private_data - (bfd *, bfd *); -static bfd_boolean sh_elf64_copy_private_data_internal - (bfd *, bfd *); -static bfd_boolean sh_elf64_merge_private_data - (bfd *, bfd *); static bfd_reloc_status_type sh_elf64_ignore_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); static bfd_reloc_status_type sh_elf64_reloc (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **); -static reloc_howto_type *sh_elf64_reloc_type_lookup - (bfd *, bfd_reloc_code_real_type); -static void sh_elf64_info_to_howto - (bfd *, arelent *, Elf_Internal_Rela *); -static bfd_boolean sh_elf64_relocate_section - (bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, - Elf_Internal_Rela *, Elf_Internal_Sym *, asection **); -static bfd_byte *sh_elf64_get_relocated_section_contents - (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, - bfd_boolean, asymbol **); -static bfd_boolean sh_elf64_set_mach_from_flags - (bfd *); -static bfd_boolean sh_elf64_set_private_flags - (bfd *, flagword); -static asection *sh_elf64_gc_mark_hook - (asection *, struct bfd_link_info *, Elf_Internal_Rela *, - struct elf_link_hash_entry *, Elf_Internal_Sym *); -static bfd_boolean sh_elf64_gc_sweep_hook - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); -static bfd_boolean sh_elf64_check_relocs - (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *); -static int sh64_elf64_get_symbol_type - (Elf_Internal_Sym *, int); -static bfd_boolean sh64_elf64_add_symbol_hook - (bfd *, struct bfd_link_info *, Elf_Internal_Sym *, const char **, - flagword *, asection **, bfd_vma *); -static bfd_boolean sh64_elf64_link_output_symbol_hook - (struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *, - struct elf_link_hash_entry *); -static bfd_boolean sh64_elf64_fake_sections - (bfd *, Elf_Internal_Shdr *, asection *); -static void sh64_elf64_final_write_processing - (bfd *, bfd_boolean); -static struct bfd_hash_entry *sh64_elf64_link_hash_newfunc - (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); -static struct bfd_link_hash_table *sh64_elf64_link_hash_table_create - (bfd *); -inline static void movi_shori_putval - (bfd *, unsigned long, char *); -inline static void movi_3shori_putval - (bfd *, bfd_vma, char *); -static bfd_boolean sh64_elf64_create_dynamic_sections - (bfd *, struct bfd_link_info *); -static bfd_boolean sh64_elf64_adjust_dynamic_symbol - (struct bfd_link_info *info, struct elf_link_hash_entry *); -static bfd_boolean sh64_elf64_discard_copies - (struct elf_sh64_link_hash_entry *, void *); -static bfd_boolean sh64_elf64_size_dynamic_sections - (bfd *, struct bfd_link_info *); -static bfd_boolean sh64_elf64_finish_dynamic_symbol - (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, - Elf_Internal_Sym *); -static bfd_boolean sh64_elf64_finish_dynamic_sections - (bfd *, struct bfd_link_info *); static reloc_howto_type sh_elf64_howto_table[] = { /* No relocation. */ @@ -2271,7 +2212,7 @@ sh_elf64_get_relocated_section_contents (bfd *output_bfd, /* Set the SHF_SH5_ISA32 flag for ISA SHmedia code sections. */ -bfd_boolean +static bfd_boolean sh64_elf64_fake_sections (bfd *output_bfd ATTRIBUTE_UNUSED, Elf_Internal_Shdr *elf_section_hdr, asection *asect) @@ -3199,7 +3140,7 @@ sh64_elf64_link_hash_table_create (bfd *abfd) } inline static void -movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) +movi_shori_putval (bfd *output_bfd, unsigned long value, bfd_byte *addr) { bfd_put_32 (output_bfd, bfd_get_32 (output_bfd, addr) @@ -3212,7 +3153,7 @@ movi_shori_putval (bfd *output_bfd, unsigned long value, char *addr) } inline static void -movi_3shori_putval (bfd *output_bfd, bfd_vma value, char *addr) +movi_3shori_putval (bfd *output_bfd, bfd_vma value, bfd_byte *addr) { bfd_put_32 (output_bfd, bfd_get_32 (output_bfd, addr) diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 87b2663551b..fd0dacad5c6 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1499,7 +1499,7 @@ NAME(_bfd_elf,bfd_from_remote_memory) (bfd *templ, bfd_vma ehdr_vma, bfd_vma *loadbasep, - int (*target_read_memory) (bfd_vma, char *, int)) + int (*target_read_memory) (bfd_vma, bfd_byte *, int)) { Elf_External_Ehdr x_ehdr; /* Elf file header, external form */ Elf_Internal_Ehdr i_ehdr; /* Elf file header, internal form */ @@ -1508,13 +1508,13 @@ NAME(_bfd_elf,bfd_from_remote_memory) bfd *nbfd; struct bfd_in_memory *bim; int contents_size; - char *contents; + bfd_byte *contents; int err; unsigned int i; bfd_vma loadbase; /* Read in the ELF header in external format. */ - err = target_read_memory (ehdr_vma, (char *) &x_ehdr, sizeof x_ehdr); + err = target_read_memory (ehdr_vma, (bfd_byte *) &x_ehdr, sizeof x_ehdr); if (err) { bfd_set_error (bfd_error_system_call); @@ -1574,7 +1574,7 @@ NAME(_bfd_elf,bfd_from_remote_memory) bfd_set_error (bfd_error_no_memory); return NULL; } - err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (char *) x_phdrs, + err = target_read_memory (ehdr_vma + i_ehdr.e_phoff, (bfd_byte *) x_phdrs, i_ehdr.e_phnum * sizeof x_phdrs[0]); if (err) { diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 9c14ffe20ff..4d73239b3a1 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -818,7 +818,7 @@ mips_elf_create_procedure_table (void *handle, bfd *abfd, ss = bfd_malloc (count); if (ss == NULL) goto error_return; - if (! _bfd_ecoff_get_accumulated_ss (handle, ss)) + if (! _bfd_ecoff_get_accumulated_ss (handle, (bfd_byte *) ss)) goto error_return; count = hdr->ipdMax; diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 65d5d8214fe..396ece3adc1 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -2,7 +2,8 @@ (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Written by Cygnus Support. @@ -686,6 +687,6 @@ extern void bfd_section_already_linked_table_traverse (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *, void *), void *); -extern bfd_vma read_unsigned_leb128 (bfd *, char *, unsigned int *); -extern bfd_signed_vma read_signed_leb128 (bfd *, char *, unsigned int *); +extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *); +extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *); diff --git a/bfd/libbfd.c b/bfd/libbfd.c index ec1864c68fa..26ab4042132 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -1,6 +1,6 @@ /* Assorted BFD support routines, only used internally. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -865,12 +865,12 @@ warn_deprecated (const char *what, bfd_vma read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, + bfd_byte *buf, unsigned int *bytes_read_ptr) { bfd_vma result; unsigned int num_read; - int shift; + unsigned int shift; unsigned char byte; result = 0; @@ -878,7 +878,7 @@ read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, num_read = 0; do { - byte = bfd_get_8 (abfd, (bfd_byte *) buf); + byte = bfd_get_8 (abfd, buf); buf++; num_read++; result |= (((bfd_vma) byte & 0x7f) << shift); @@ -893,12 +893,12 @@ read_unsigned_leb128 (bfd *abfd ATTRIBUTE_UNUSED, bfd_signed_vma read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED, - char *buf, - unsigned int * bytes_read_ptr) + bfd_byte *buf, + unsigned int *bytes_read_ptr) { bfd_vma result; - unsigned shift; - int num_read; + unsigned int shift; + unsigned int num_read; unsigned char byte; result = 0; @@ -906,14 +906,14 @@ read_signed_leb128 (bfd *abfd ATTRIBUTE_UNUSED, num_read = 0; do { - byte = bfd_get_8 (abfd, (bfd_byte *) buf); + byte = bfd_get_8 (abfd, buf); buf ++; num_read ++; result |= (((bfd_vma) byte & 0x7f) << shift); shift += 7; } while (byte & 0x80); - if ((shift < 8 * sizeof (result)) && (byte & 0x40)) + if (shift < 8 * sizeof (result) && (byte & 0x40)) result |= (((bfd_vma) -1) << shift); *bytes_read_ptr = num_read; return result; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index f021a9781bc..2f475aa9700 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -7,7 +7,8 @@ (This include file is not for users of the library.) Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. Written by Cygnus Support. @@ -691,8 +692,8 @@ extern void bfd_section_already_linked_table_traverse (bfd_boolean (*) (struct bfd_section_already_linked_hash_entry *, void *), void *); -extern bfd_vma read_unsigned_leb128 (bfd *, char *, unsigned int *); -extern bfd_signed_vma read_signed_leb128 (bfd *, char *, unsigned int *); +extern bfd_vma read_unsigned_leb128 (bfd *, bfd_byte *, unsigned int *); +extern bfd_signed_vma read_signed_leb128 (bfd *, bfd_byte *, unsigned int *); /* Extracted from init.c. */ /* Extracted from libbfd.c. */ diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 8337f190f70..b8c6ecb682a 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -798,7 +798,7 @@ bfd_mach_o_scan_read_symtab_strtab (abfd, sym) bfd_set_error (bfd_error_file_truncated); return -1; } - sym->strtab = b->buffer + sym->stroff; + sym->strtab = (char *) b->buffer + sym->stroff; return 0; } @@ -2120,7 +2120,7 @@ bfd_mach_o_core_file_failing_command (abfd) if (ret < 0) return NULL; - return buf; + return (char *) buf; } int diff --git a/bfd/merge.c b/bfd/merge.c index eb8ec667ead..3efbd43773e 100644 --- a/bfd/merge.c +++ b/bfd/merge.c @@ -1,5 +1,5 @@ /* SEC_MERGE support. - Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Jakub Jelinek . This file is part of BFD, the Binary File Descriptor library. @@ -446,7 +446,8 @@ record_section (struct sec_merge_info *sinfo, eltalign = ((eltalign ^ (eltalign - 1)) + 1) >> 1; if (!eltalign || eltalign > mask) eltalign = mask + 1; - entry = sec_merge_add (sinfo->htab, p, (unsigned) eltalign, secinfo); + entry = sec_merge_add (sinfo->htab, (char *) p, (unsigned) eltalign, + secinfo); if (! entry) goto error_return; p += entry->len; @@ -477,7 +478,7 @@ record_section (struct sec_merge_info *sinfo, if (!nul && !((p - secinfo->contents) & mask)) { nul = TRUE; - entry = sec_merge_add (sinfo->htab, p, + entry = sec_merge_add (sinfo->htab, (char *) p, (unsigned) mask + 1, secinfo); if (! entry) goto error_return; @@ -491,7 +492,7 @@ record_section (struct sec_merge_info *sinfo, { for (p = secinfo->contents; p < end; p += sec->entsize) { - entry = sec_merge_add (sinfo->htab, p, 1, secinfo); + entry = sec_merge_add (sinfo->htab, (char *) p, 1, secinfo); if (! entry) goto error_return; } @@ -512,8 +513,8 @@ strrevcmp (const void *a, const void *b) struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b; unsigned int lenA = A->len; unsigned int lenB = B->len; - const unsigned char *s = A->root.string + lenA - 1; - const unsigned char *t = B->root.string + lenB - 1; + const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1; + const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1; int l = lenA < lenB ? lenA : lenB; while (l) @@ -537,8 +538,8 @@ strrevcmp_align (const void *a, const void *b) struct sec_merge_hash_entry *B = *(struct sec_merge_hash_entry **) b; unsigned int lenA = A->len; unsigned int lenB = B->len; - const unsigned char *s = A->root.string + lenA - 1; - const unsigned char *t = B->root.string + lenB - 1; + const unsigned char *s = (const unsigned char *) A->root.string + lenA - 1; + const unsigned char *t = (const unsigned char *) B->root.string + lenB - 1; int l = lenA < lenB ? lenA : lenB; int tail_align = (lenA & (A->alignment - 1)) - (lenB & (A->alignment - 1)); @@ -829,7 +830,7 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec, { p = secinfo->contents + (offset / sec->entsize) * sec->entsize; } - entry = sec_merge_hash_lookup (secinfo->htab, p, 0, FALSE); + entry = sec_merge_hash_lookup (secinfo->htab, (char *) p, 0, FALSE); if (!entry) { if (! secinfo->htab->strings) diff --git a/bfd/mmo.c b/bfd/mmo.c index 03b4e2e0b91..b24988f3a7f 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -1,5 +1,5 @@ /* BFD back-end for mmo objects (MMIX-specific object-format). - Copyright 2001, 2002, 2003, 2004 + Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Hans-Peter Nilsson (hp@bitrange.com). Infrastructure and other bits originally copied from srec.c and @@ -424,7 +424,7 @@ static bfd_boolean mmo_has_leading_or_trailing_zero_tetra_p (bfd *, particular input or caller; put such things into the bfd or elsewhere. Look ma, no static per-invocation data! */ -static unsigned +static char valid_mmo_symbol_character_set[/* A-Z a-z (we assume consecutive codes; sorry EBCDIC:ers!). */ + 'Z' - 'A' + 1 + 'z' - 'a' + 1 @@ -947,7 +947,7 @@ mmo_get_generic_spec_data_section (bfd *abfd, int spec_data_number) static asection * mmo_get_spec_section (bfd *abfd, int spec_data_number) { - bfd_byte *secname; + char *secname; asection *sec; bfd_byte buf[4]; unsigned int secname_length; @@ -996,7 +996,7 @@ mmo_get_spec_section (bfd *abfd, int spec_data_number) if (bfd_bread (secname + i * 4, 4, abfd) != 4) goto format_error_free; - if (secname[i * 4] == LOP) + if (secname[i * 4] == (char) LOP) { /* A bit of overkill, but we handle char 0x98 in a section name, and recognize misparsing. */ @@ -2547,7 +2547,7 @@ EXAMPLE mmo_write_tetra_raw (abfd, LOP_SPEC_SECTION); mmo_write_tetra (abfd, (strlen (sec->name) + 3) / 4); - mmo_write_chunk (abfd, sec->name, strlen (sec->name)); + mmo_write_chunk (abfd, (bfd_byte *) sec->name, strlen (sec->name)); mmo_flush_chunk (abfd); /* FIXME: We can get debug sections (.debug_line & Co.) with a section flag still having SEC_RELOC set. Investigate. This might be true diff --git a/bfd/opncls.c b/bfd/opncls.c index 7358cf3093b..ffbf65d55fe 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -1,6 +1,6 @@ /* opncls.c -- open and close a BFD. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002, 2003, 2004 + 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Cygnus Support. @@ -980,6 +980,7 @@ get_debug_link_info (bfd *abfd, unsigned long *crc32_out) unsigned long crc32; bfd_byte *contents; int crc_offset; + char *name; BFD_ASSERT (abfd); BFD_ASSERT (crc32_out); @@ -997,13 +998,14 @@ get_debug_link_info (bfd *abfd, unsigned long *crc32_out) } /* Crc value is stored after the filename, aligned up to 4 bytes. */ - crc_offset = strlen (contents) + 1; + name = (char *) contents; + crc_offset = strlen (name) + 1; crc_offset = (crc_offset + 3) & ~3; crc32 = bfd_get_32 (abfd, contents + crc_offset); *crc32_out = crc32; - return contents; + return name; } /* @@ -1022,7 +1024,7 @@ DESCRIPTION static bfd_boolean separate_debug_file_exists (const char *name, const unsigned long crc) { - static char buffer [8 * 1024]; + static unsigned char buffer [8 * 1024]; unsigned long file_crc = 0; int fd; bfd_size_type count; @@ -1286,7 +1288,7 @@ bfd_fill_in_gnu_debuglink_section (bfd *abfd, char * contents; bfd_size_type crc_offset; FILE * handle; - static char buffer[8 * 1024]; + static unsigned char buffer[8 * 1024]; size_t count; if (abfd == NULL || sect == NULL || filename == NULL) diff --git a/bfd/pef.c b/bfd/pef.c index 22d302f3196..450bddae1c5 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -106,7 +106,7 @@ bfd_pef_print_symbol (abfd, afile, symbol, how) fprintf (file, " %-5s %s", symbol->section->name, symbol->name); if (strncmp (symbol->name, "__traceback_", strlen ("__traceback_")) == 0) { - char *buf = alloca (symbol->udata.i); + unsigned char *buf = alloca (symbol->udata.i); size_t offset = symbol->value + 4; size_t len = symbol->udata.i; int ret; @@ -884,7 +884,8 @@ static int bfd_pef_parse_function_stubs (abfd, codesec, codebuf, codelen, goto error; max = loaderlen - (header.loader_strings_offset + imports[index].name); - symname = loaderbuf + header.loader_strings_offset + imports[index].name; + symname = (char *) loaderbuf; + symname += header.loader_strings_offset + imports[index].name; namelen = 0; for (s = symname; s < (symname + max); s++) { @@ -978,7 +979,7 @@ static long bfd_pef_parse_symbols (abfd, csym) count = 0; if (codesec != NULL) { - unsigned long ncount = 0; + long ncount = 0; bfd_pef_parse_traceback_tables (abfd, codesec, codebuf, codelen, &ncount, csym); count += ncount; diff --git a/bfd/peicode.h b/bfd/peicode.h index 8f4179351eb..1282bb9b1c8 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -1,6 +1,6 @@ /* Support for the generic parts of PE/PEI, for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. Written by Cygnus Solutions. This file is part of BFD, the Binary File Descriptor library. @@ -130,15 +130,6 @@ typedef struct struct internal_reloc * int_reltab; } pe_ILF_vars; - -static asection_ptr pe_ILF_make_a_section PARAMS ((pe_ILF_vars *, const char *, unsigned int, flagword)); -static void pe_ILF_make_a_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, asection_ptr)); -static void pe_ILF_make_a_symbol PARAMS ((pe_ILF_vars *, const char *, const char *, asection_ptr, flagword)); -static void pe_ILF_save_relocs PARAMS ((pe_ILF_vars *, asection_ptr)); -static void pe_ILF_make_a_symbol_reloc PARAMS ((pe_ILF_vars *, bfd_vma, bfd_reloc_code_real_type, struct bfd_symbol **, unsigned int)); -static bfd_boolean pe_ILF_build_a_bfd PARAMS ((bfd *, unsigned int, bfd_byte *, bfd_byte *, unsigned int, unsigned int)); -static const bfd_target * pe_ILF_object_p PARAMS ((bfd *)); -static const bfd_target * pe_bfd_object_p PARAMS ((bfd *)); #endif /* COFF_IMAGE_WITH_PE */ /**********************************************************************/ @@ -740,8 +731,8 @@ static jump_table jtab[] = static bfd_boolean pe_ILF_build_a_bfd (bfd * abfd, unsigned int magic, - bfd_byte * symbol_name, - bfd_byte * source_dll, + char * symbol_name, + char * source_dll, unsigned int ordinal, unsigned int types) { @@ -837,10 +828,10 @@ pe_ILF_build_a_bfd (bfd * abfd, vars.int_reltab = (struct internal_reloc *) ptr; ptr += SIZEOF_ILF_INT_RELOCS; - vars.string_table = ptr; - vars.string_ptr = ptr + STRING_SIZE_SIZE; + vars.string_table = (char *) ptr; + vars.string_ptr = (char *) ptr + STRING_SIZE_SIZE; ptr += SIZEOF_ILF_STRINGS; - vars.end_string_ptr = ptr; + vars.end_string_ptr = (char *) ptr; /* The remaining space in bim->buffer is used by the pe_ILF_make_a_section() function. */ @@ -930,7 +921,7 @@ pe_ILF_build_a_bfd (bfd * abfd, id6->contents[0] = ordinal & 0xff; id6->contents[1] = ordinal >> 8; - strcpy (id6->contents + 2, symbol); + strcpy ((char *) id6->contents + 2, symbol); } if (import_name_type != IMPORT_ORDINAL) @@ -1042,7 +1033,7 @@ pe_ILF_build_a_bfd (bfd * abfd, /* Create an import symbol for the DLL, without the .dll suffix. */ - ptr = strrchr (source_dll, '.'); + ptr = (bfd_byte *) strrchr (source_dll, '.'); if (ptr) * ptr = 0; pe_ILF_make_a_symbol (& vars, "__IMPORT_DESCRIPTOR_", source_dll, NULL, 0); @@ -1087,8 +1078,8 @@ pe_ILF_object_p (bfd * abfd) { bfd_byte buffer[16]; bfd_byte * ptr; - bfd_byte * symbol_name; - bfd_byte * source_dll; + char * symbol_name; + char * source_dll; unsigned int machine; bfd_size_type size; unsigned int ordinal; @@ -1225,11 +1216,12 @@ pe_ILF_object_p (bfd * abfd) return NULL; } - symbol_name = ptr; - source_dll = ptr + strlen (ptr) + 1; + symbol_name = (char *) ptr; + source_dll = symbol_name + strlen (symbol_name) + 1; /* Verify that the strings are null terminated. */ - if (ptr[size - 1] != 0 || ((unsigned long) (source_dll - ptr) >= size)) + if (ptr[size - 1] != 0 + || (bfd_size_type) ((bfd_byte *) source_dll - ptr) >= size) { _bfd_error_handler (_("%B: string not null terminated in ILF object file."), abfd); diff --git a/bfd/srec.c b/bfd/srec.c index e184a20eaa3..93480c767f8 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1,6 +1,6 @@ /* BFD back-end for s-record objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004 + 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . @@ -1014,7 +1014,8 @@ srec_write_header (abfd) len = 40; return srec_write_record (abfd, 0, (bfd_vma) 0, - abfd->filename, abfd->filename + len); + (bfd_byte *) abfd->filename, + (bfd_byte *) abfd->filename + len); } static bfd_boolean diff --git a/bfd/vms-hdr.c b/bfd/vms-hdr.c index c2611115a90..35b94ef14c8 100644 --- a/bfd/vms-hdr.c +++ b/bfd/vms-hdr.c @@ -1,6 +1,6 @@ /* vms-hdr.c -- BFD back-end for VMS/VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. HDR record handling functions @@ -225,7 +225,8 @@ get_vms_time_string () pnt[10] = 0; pnt[16] = 0; pnt[24] = 0; - sprintf (tbuf, "%2s-%3s-%s %s", pnt + 8, pnt + 4, pnt + 20, pnt + 11); + sprintf ((char *) tbuf, "%2s-%3s-%s %s", + pnt + 8, pnt + 4, pnt + 20, pnt + 11); #else #include struct diff --git a/bfd/vms-tir.c b/bfd/vms-tir.c index 2a4908b2d36..7c0f9b64cc4 100644 --- a/bfd/vms-tir.c +++ b/bfd/vms-tir.c @@ -1,6 +1,6 @@ /* vms-tir.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. TIR record handling functions @@ -1598,7 +1598,7 @@ tir_ctl (bfd *abfd, unsigned char *ptr) case TIR_S_C_CTL_SETRB: /* Set relocation base: pop stack, set image location counter arg: none. */ - dummy = _bfd_vms_pop (abfd, &psect); + dummy = _bfd_vms_pop (abfd, (int *) &psect); if (psect >= PRIV (section_count)) alloc_section (abfd, psect); image_set_ptr (abfd, (int) psect, (uquad) dummy); @@ -1622,7 +1622,7 @@ tir_ctl (bfd *abfd, unsigned char *ptr) case TIR_S_C_CTL_STLOC: /* Set location: pop index, restore location counter from index arg: none. */ - dummy = _bfd_vms_pop (abfd, &psect); + dummy = _bfd_vms_pop (abfd, (int *) &psect); (*_bfd_error_handler) (_("%s: not fully implemented"), tir_cmd_name (ptr[-1])); break; @@ -1630,7 +1630,7 @@ tir_ctl (bfd *abfd, unsigned char *ptr) case TIR_S_C_CTL_STKDL: /* Stack defined location: pop index, push location counter from index arg: none. */ - dummy = _bfd_vms_pop (abfd, &psect); + dummy = _bfd_vms_pop (abfd, (int *) &psect); (*_bfd_error_handler) (_("%s: not fully implemented"), tir_cmd_name (ptr[-1])); break; diff --git a/bfd/xsym.c b/bfd/xsym.c index 247e5c352c0..6b80dcf4094 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -1,5 +1,5 @@ /* xSYM symbol-file support for BFD. - Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -55,21 +55,20 @@ #define bfd_sym_bfd_link_split_section _bfd_generic_link_split_section #define bfd_sym_get_section_contents_in_window _bfd_generic_get_section_contents_in_window -static int pstrcmp PARAMS ((unsigned char *, unsigned char *)); static unsigned long compute_offset PARAMS ((unsigned long, unsigned long, unsigned long, unsigned long)); extern const bfd_target sym_vec; static int -pstrcmp (a, b) - unsigned char *a; - unsigned char *b; +pstrcmp (const char *as, const char *bs) { + const unsigned char *a = (const unsigned char *) as; + const unsigned char *b = (const unsigned char *) bs; unsigned char clen; int ret; - clen = (a[0] > b[0]) ? a[0] : b[0]; + clen = (a[0] > b[0]) ? b[0] : a[0]; ret = memcmp (a + 1, b + 1, clen); if (ret != 0) return ret; @@ -79,7 +78,7 @@ pstrcmp (a, b) else if (a[0] < b[0]) return -1; else - return 0; + return 1; } static unsigned long @@ -255,7 +254,7 @@ bfd_sym_read_version (abfd, version) bfd *abfd; bfd_sym_version *version; { - unsigned char version_string[32]; + char version_string[32]; long ret; ret = bfd_bread (version_string, sizeof (version_string), abfd); @@ -1207,12 +1206,12 @@ bfd_sym_symbol_name (abfd, index) sdata = abfd->tdata.sym_data; if (index == 0) - return ""; + return (const unsigned char *) ""; index *= 2; if ((index / sdata->header.dshb_page_size) > sdata->header.dshb_nte.dti_page_count) - return "\009[INVALID]"; + return (const unsigned char *) "\09[INVALID]"; return (const unsigned char *) sdata->name_table + index; } @@ -1225,7 +1224,7 @@ bfd_sym_module_name (abfd, index) bfd_sym_modules_table_entry entry; if (bfd_sym_fetch_modules_table_entry (abfd, &entry, index) < 0) - return "\011[INVALID]"; + return (const unsigned char *) "\09[INVALID]"; return bfd_sym_symbol_name (abfd, entry.mte_nte_index); } @@ -1727,26 +1726,28 @@ bfd_sym_print_type_information (abfd, f, buf, len, offset, offsetptr) case 3: { - unsigned long value; + long value; fprintf (f, "scalar (0x%x) of ", type); bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); bfd_sym_fetch_long (buf, len, offset, &offset, &value); - fprintf (f, " (%lu)", value); + fprintf (f, " (%lu)", (unsigned long) value); break; } case 5: { - unsigned long lower, upper, nelem; - unsigned long i; + long lower, upper, nelem; + int i; fprintf (f, "enumeration (0x%x) of ", type); bfd_sym_print_type_information (abfd, f, buf, len, offset, &offset); bfd_sym_fetch_long (buf, len, offset, &offset, &lower); bfd_sym_fetch_long (buf, len, offset, &offset, &upper); bfd_sym_fetch_long (buf, len, offset, &offset, &nelem); - fprintf (f, " from %lu to %lu with %lu elements: ", lower, upper, nelem); + fprintf (f, " from %lu to %lu with %lu elements: ", + (unsigned long) lower, (unsigned long) upper, + (unsigned long) nelem); for (i = 0; i < nelem; i++) { diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c index f5fa3c2111c..68d33c699a0 100644 --- a/bfd/xtensa-isa.c +++ b/bfd/xtensa-isa.c @@ -1,5 +1,5 @@ /* Configurable Xtensa ISA support. - Copyright 2003, 2004 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -120,7 +120,9 @@ byte_to_bit_index (int byte_index) both. */ int -xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn, char *cp, +xtensa_insnbuf_to_chars (xtensa_isa isa, + const xtensa_insnbuf insn, + unsigned char *cp, int num_chars) { xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; @@ -178,7 +180,9 @@ xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn, char *cp, by endianness. */ void -xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn, const char *cp, +xtensa_insnbuf_from_chars (xtensa_isa isa, + xtensa_insnbuf insn, + const unsigned char *cp, int num_chars) { xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; @@ -392,7 +396,7 @@ xtensa_isa_maxlength (xtensa_isa isa) int -xtensa_isa_length_from_chars (xtensa_isa isa, const char *cp) +xtensa_isa_length_from_chars (xtensa_isa isa, const unsigned char *cp) { xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; return (intisa->length_decode_fn) (cp); diff --git a/bfd/xtensa-modules.c b/bfd/xtensa-modules.c index bc0cf734c4c..5fe58d49bf0 100644 --- a/bfd/xtensa-modules.c +++ b/bfd/xtensa-modules.c @@ -1,5 +1,5 @@ /* Xtensa configuration-specific ISA information. - Copyright 2003, 2004 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -9074,7 +9074,7 @@ static int length_table[16] = { }; static int -length_decoder (const char *insn) +length_decoder (const unsigned char *insn) { int op0 = (insn[0] >> 4) & 0xf; return length_table[op0]; diff --git a/include/ChangeLog b/include/ChangeLog index 2d85bd3b3db..90e1d6f1f22 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2005-02-21 Alan Modra + + * xtensa-isa-internal.h (xtensa_length_decode_fn): Warning fix. + * xtensa-isa.h (xtensa_insnbuf_to_chars): Likewise. + (xtensa_insnbuf_from_chars, xtensa_isa_length_from_chars): Likewise. + 2005-02-14 Paolo Bonzini PR bootstrap/19818 diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index 3d2c66d4e39..88cf310935f 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,7 @@ +2005-02-21 Alan Modra + + * xcoff.h (struct xcoff_loader_info): Warning fix. + 2005-01-10 Inderpreet Singh * maxq.h (F_MAXQ10, F_MAXQ20): Define. diff --git a/include/coff/xcoff.h b/include/coff/xcoff.h index 64a9ee164ce..a70449eb7f3 100644 --- a/include/coff/xcoff.h +++ b/include/coff/xcoff.h @@ -1,6 +1,6 @@ /* Internal format of XCOFF object file data structures for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. Written by Ian Lance Taylor , Cygnus Support. @@ -409,7 +409,7 @@ struct xcoff_loader_info size_t string_size; /* String table. */ - bfd_byte *strings; + char *strings; /* Allocated size of string table. */ size_t string_alc; diff --git a/include/xtensa-isa-internal.h b/include/xtensa-isa-internal.h index 44e53f95b30..7ec2b9e72ae 100644 --- a/include/xtensa-isa-internal.h +++ b/include/xtensa-isa-internal.h @@ -1,5 +1,5 @@ /* Internal definitions for configurable Xtensa ISA support. - Copyright 2003, 2004 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -49,7 +49,7 @@ typedef int (*xtensa_do_reloc_fn) (uint32 *, uint32); typedef int (*xtensa_undo_reloc_fn) (uint32 *, uint32); typedef void (*xtensa_opcode_encode_fn) (xtensa_insnbuf); typedef int (*xtensa_format_decode_fn) (const xtensa_insnbuf); -typedef int (*xtensa_length_decode_fn) (const char *); +typedef int (*xtensa_length_decode_fn) (const unsigned char *); typedef struct xtensa_format_internal_struct { diff --git a/include/xtensa-isa.h b/include/xtensa-isa.h index 025e3175075..5c22902ee13 100644 --- a/include/xtensa-isa.h +++ b/include/xtensa-isa.h @@ -1,5 +1,5 @@ /* Interface definition for configurable Xtensa ISA support. - Copyright 2003, 2004 Free Software Foundation, Inc. + Copyright 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -209,11 +209,11 @@ xtensa_insnbuf_free (xtensa_isa isa, xtensa_insnbuf buf); extern int xtensa_insnbuf_to_chars (xtensa_isa isa, const xtensa_insnbuf insn, - char *cp, int num_chars); + unsigned char *cp, int num_chars); extern void xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn, - const char *cp, int num_chars); + const unsigned char *cp, int num_chars); /* ISA information. */ @@ -242,7 +242,7 @@ xtensa_isa_maxlength (xtensa_isa isa); XTENSA_UNDEFINED on error. */ extern int -xtensa_isa_length_from_chars (xtensa_isa isa, const char *cp); +xtensa_isa_length_from_chars (xtensa_isa isa, const unsigned char *cp); /* Get the number of stages in the processor's pipeline. The pipeline -- 2.30.2