diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 34506538d0..773210c28f 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,20 @@ +2005-02-24 Alan Modra + + * coffcode.h (coff_print_aux): Warning fix. + * elf-m10300.c (mn10300_elf_relax_section): Use section->id + instead of section pointer to identify. + * coff-h8300.c (h8300_reloc16_extra_cases): Likewise. Allocate + the correct size buffer for local sym mangling too. + (h8300_bfd_link_add_symbols): Likewise. + * elf32-sh-symbian.c (sh_symbian_process_embedded_commands): Fix + warning. + * elf32-sh64.c (shmedia_prepare_reloc): Use %B and %p in error message + * elf32-xtensa.c (literal_value_hash): Warning fix. + * versados.c (process_otr): Warning fix. + (versados_canonicalize_reloc): Likewise. + * vms-gsd.c (_bfd_vms_slurp_gsd): Warning fix. + * vms.c (fill_section_ptr): Warning fix. + 2005-02-23 H.J. Lu * coff-tic54x.c (SWAP_OUT_RELOC_EXTRA): Defined. diff --git a/bfd/coff-h8300.c b/bfd/coff-h8300.c index 0dfbd8b0a8..d216f97c12 100644 --- a/bfd/coff-h8300.c +++ b/bfd/coff-h8300.c @@ -1,6 +1,6 @@ /* BFD back-end for Renesas H8/300 COFF binaries. 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, . @@ -1175,14 +1175,12 @@ h8300_reloc16_extra_cases (bfd *abfd, struct bfd_link_info *link_info, name = symbol->name; if (symbol->flags & BSF_LOCAL) { - char *new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9); + char *new_name = bfd_malloc ((bfd_size_type) strlen (name) + 10); if (new_name == NULL) abort (); - strcpy (new_name, name); - sprintf (new_name + strlen (name), "_%08x", - (int) symbol->section); + sprintf (new_name, "%s_%08x", name, symbol->section->id); name = new_name; } @@ -1365,13 +1363,11 @@ h8300_bfd_link_add_symbols (bfd *abfd, struct bfd_link_info *info) { char *new_name; - new_name = bfd_malloc ((bfd_size_type) strlen (name) + 9); + new_name = bfd_malloc ((bfd_size_type) strlen (name) + 10); if (new_name == NULL) abort (); - strcpy (new_name, name); - sprintf (new_name + strlen (name), "_%08x", - (int) symbol->section); + sprintf (new_name, "%s_%08x", name, symbol->section->id); name = new_name; } diff --git a/bfd/coffcode.h b/bfd/coffcode.h index fd3743577e..0548b103ee 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1,6 +1,6 @@ /* Support for the generic parts of most COFF variants, 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. @@ -2406,7 +2406,8 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux) { BFD_ASSERT (! aux->fix_scnlen); #ifdef XCOFF64 - fprintf (file, "val %5lld", aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "val %5lld", + (long long) aux->u.auxent.x_csect.x_scnlen.l); #else fprintf (file, "val %5ld", (long) aux->u.auxent.x_csect.x_scnlen.l); #endif @@ -2416,7 +2417,8 @@ coff_print_aux (abfd, file, table_base, symbol, aux, indaux) fprintf (file, "indx "); if (! aux->fix_scnlen) #ifdef XCOFF64 - fprintf (file, "%4lld", aux->u.auxent.x_csect.x_scnlen.l); + fprintf (file, "%4lld", + (long long) aux->u.auxent.x_csect.x_scnlen.l); #else fprintf (file, "%4ld", (long) aux->u.auxent.x_csect.x_scnlen.l); #endif diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 4470387890..5faa0e2b39 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -1,5 +1,5 @@ /* Matsushita 10300 specific support for 32-bit ELF - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1800,8 +1800,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) if (new_name == 0) goto error_return; - sprintf (new_name, "%s_%08x", - sym_name, (int) sym_sec); + sprintf (new_name, "%s_%08x", sym_name, sym_sec->id); sym_name = new_name; elftab = &hash_table->static_hash_table->root; @@ -1906,8 +1905,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) if (new_name == 0) goto error_return; - sprintf (new_name, "%s_%08x", - sym_name, (int) sym_sec); + sprintf (new_name, "%s_%08x", sym_name, sym_sec->id); sym_name = new_name; elftab = &hash_table->static_hash_table->root; @@ -2078,7 +2076,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) new_name = bfd_malloc (amt); if (new_name == 0) goto error_return; - sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec); + sprintf (new_name, "%s_%08x", sym_name, sym_sec->id); sym_name = new_name; elftab = &hash_table->static_hash_table->root; @@ -2330,7 +2328,7 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) new_name = bfd_malloc ((bfd_size_type) strlen (sym_name) + 10); if (new_name == 0) goto error_return; - sprintf (new_name, "%s_%08x", sym_name, (int) sym_sec); + sprintf (new_name, "%s_%08x", sym_name, sym_sec->id); sym_name = new_name; h = (struct elf32_mn10300_link_hash_entry *) diff --git a/bfd/elf32-sh-symbian.c b/bfd/elf32-sh-symbian.c index 549da3a605..8b15606dde 100644 --- a/bfd/elf32-sh-symbian.c +++ b/bfd/elf32-sh-symbian.c @@ -374,8 +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 - (char *) contents); + fprintf (stderr, "offset into .directive section: %ld\n", + (long) (directive - (char *) contents)); bfd_set_error (bfd_error_invalid_operation); _bfd_error_handler (_("%B: Unrecognised .directive command: %s"), diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c index f7d8949fe3..b63b4b31d0 100644 --- a/bfd/elf32-sh64.c +++ b/bfd/elf32-sh64.c @@ -588,9 +588,9 @@ shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd, if (dropped != 0) { (*_bfd_error_handler) - (_("%s: error: unaligned relocation type %d at %08x reloc %08x\n"), - bfd_get_filename (input_section->owner), ELF32_R_TYPE (rel->r_info), - (unsigned)rel->r_offset, (unsigned)relocation); + (_("%B: error: unaligned relocation type %d at %08x reloc %p\n"), + input_section->owner, ELF32_R_TYPE (rel->r_info), + (unsigned) rel->r_offset, relocation); return FALSE; } diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index b6b3727253..f63603a7d2 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -4471,7 +4471,7 @@ literal_value_hash (const literal_value *src) sec_or_hash = r_reloc_get_section (&src->r_rel); else sec_or_hash = r_reloc_get_hash_entry (&src->r_rel); - hash_val += hash_bfd_vma ((bfd_vma) (unsigned) sec_or_hash); + hash_val += hash_bfd_vma ((bfd_vma) (size_t) sec_or_hash); } return hash_val; } diff --git a/bfd/versados.c b/bfd/versados.c index 68678c860d..e22a97f746 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -457,7 +457,7 @@ process_otr (abfd, otr, pass) EDATA (abfd, otr->esdid - 1).section->relocation + rn; n->address = dst_idx; - n->sym_ptr_ptr = (asymbol **) esdid; + n->sym_ptr_ptr = (asymbol **) (size_t) esdid; n->addend = 0; n->howto = versados_howto_table + ((j & 1) * 2) + (sizeinwords - 1); } @@ -819,7 +819,7 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols) /* translate from indexes to symptr ptrs */ for (count = 0; count < section->reloc_count; count++) { - int esdid = (int) src[count].sym_ptr_ptr; + int esdid = (int) (size_t) src[count].sym_ptr_ptr; if (esdid == 0) { diff --git a/bfd/vms-gsd.c b/bfd/vms-gsd.c index 5a107e18c7..dbf6200eb1 100644 --- a/bfd/vms-gsd.c +++ b/bfd/vms-gsd.c @@ -1,6 +1,6 @@ /* vms-gsd.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. go and read the openVMS linker manual (esp. appendix B) @@ -520,7 +520,7 @@ _bfd_vms_slurp_gsd (abfd, objtype) else psect = vms_rec[value_offset-1]; - symbol->section = (asection *)psect; + symbol->section = (asection *) (size_t) psect; #if VMS_DEBUG vms_debug(4, "gsd sym def #%d (%s, %d [%p], %04x=%s)\n", abfd->symcount, symbol->name, (int)symbol->section, symbol->section, old_flags, flag2str(gsyflagdesc, old_flags)); diff --git a/bfd/vms.c b/bfd/vms.c index 15ab5b08ce..06162084e0 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -1,6 +1,6 @@ /* vms.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -365,10 +365,10 @@ fill_section_ptr (entry, sections) /* fill forward references (these contain section number, not section ptr). */ - if ((unsigned int) sec < priv_section_count) + if ((unsigned int) (size_t) sec < priv_section_count) { - sec = ((vms_symbol_entry *)entry)->symbol->section = - ((asection **)sections)[(int)sec]; + sec = ((vms_symbol_entry *) entry)->symbol->section = + ((asection **) sections)[(unsigned int) (size_t) sec]; } if (strcmp (sym->name, sec->name) == 0)