From d003868ea7bfa700dd91cbb6198b75f341a456e7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 13 Aug 2004 03:16:01 +0000 Subject: [PATCH] bfd/ * bfd.c (_bfd_default_error_handler): Handle %A and %B. (bfd_archive_filename, bfd_get_section_ident): Delete. * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call bfd_archive_filename. * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler to warn about symbols in discarded sections. Use _bfd_error_handler. * aout-adobe.c (aout_adobe_callback): See below. * aout-cris.c (swap_ext_reloc_in): .. * coff-arm.c (find_thumb_glue, find_arm_glue, coff_arm_relocate_section, bfd_arm_process_before_allocation, coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, coff_arm_copy_private_bfd_data): .. * coff-i860.c (i860_reloc_processing): .. * coff-mcore.c (mcore_coff_unsupported_reloc, coff_mcore_relocate_section): .. * coff-ppc.c (coff_ppc_relocate_section): .. * coff-rs6000.c (xcoff_create_csect_from_smclas * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, sh_swap_insns, sh_relocate_section): .. * coff-tic54x.c (tic54x_reloc_processing): .. * coff-tic80.c (coff_tic80_relocate_section): .. * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, coff_slurp_symbol_table, coff_classify_symbol, coff_slurp_reloc_table): .. * coffgen.c (_bfd_coff_read_string_table): .. * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, _bfd_coff_generic_relocate_section): .. * cpu-arm.c (bfd_arm_merge_machines): .. * cpu-sh.c (sh_merge_bfd_arch): .. * elf-hppa.h (elf_hppa_relocate_section): .. * elf.c (bfd_elf_string_from_elf_section, setup_group, _bfd_elf_setup_group_pointers, bfd_section_from_shdr, assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, copy_private_bfd_data, _bfd_elf_validate_reloc): .. * elf32-arm.h (find_thumb_glue, find_arm_glue, bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, elf32_arm_relocate_section, elf32_arm_set_private_flags, elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, cris_elf_merge_private_bfd_data * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. * elf32-gen.c (elf32_generic_link_add_symbols): .. * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, elf32_hppa_check_relocs, get_local_syms, final_link_relocate, elf32_hppa_relocate_section): .. * elf32-i370.c (i370_elf_merge_private_bfd_data, i370_elf_check_relocs, i370_elf_relocate_section): .. * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, elf_i386_relocate_section): .. * elf32-m32r.c (m32r_elf_relocate_section, m32r_elf_merge_private_bfd_data): .. * elf32-m68hc1x.c (m68hc12_add_stub, _bfd_m68hc11_elf_merge_private_bfd_data): .. * elf32-m68k.c (elf_m68k_relocate_section): .. * elf32-mcore.c (mcore_elf_unsupported_reloc, mcore_elf_relocate_section): .. * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, ppc_elf_check_relocs, ppc_elf_relocate_section, ppc_elf_begin_write_processing): .. * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf32-sh-symbian.c (sh_symbian_import_as, sh_symbian_process_embedded_commands, sh_symbian_relocate_section): .. * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, sh_elf_merge_private_data): .. * elf32-sparc.c (elf32_sparc_check_relocs, elf32_sparc_relocate_section, elf32_sparc_merge_private_bfd_data): .. * elf32-v850.c (v850_elf_check_relocs, v850_elf_merge_private_bfd_data): .. * elf32-xtensa.c (elf_xtensa_check_relocs, elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. * elf64-alpha.c (elf64_alpha_relax_with_lituse, elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. * elf64-gen.c (elf64_generic_link_add_symbols): .. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, ppc64_elf_check_relocs, ppc64_elf_edit_opd, ppc64_elf_relocate_section): .. * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, elf_s390_relocate_section): .. * elf64-sh64.c (sh_elf64_relocate_section): .. * elf64-sparc.c (sparc64_elf_check_relocs, sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, sparc64_elf_merge_private_bfd_data): .. * elf64-x86-64.c (elf64_x86_64_check_relocs, elf64_x86_64_relocate_section): .. * elflink.c (_bfd_elf_add_default_symbol, _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, _bfd_elf_link_output_relocs, elf_link_add_object_symbols, bfd_elf_size_dynamic_sections, elf_link_output_extsym, elf_get_linked_section_vma, elf_fixup_link_order, bfd_elf_final_link, bfd_elf_gc_record_vtinherit, bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. * elfxx-ia64.c (elfNN_ia64_relax_section, elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. * elfxx-mips.c (mips_elf_perform_relocation, _bfd_mips_elf_check_relocs, _bfd_mips_elf_merge_private_bfd_data): .. * ieee.c (ieee_slurp_external_symbols): .. * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. * libbfd.c (_bfd_generic_verify_endian_match): .. * linker.c (_bfd_generic_link_add_one_symbol, _bfd_generic_section_already_linked): .. * pdp11.c (translate_to_native_sym_flags): .. * pe-mips.c (coff_pe_mips_relocate_section): .. * peicode.h (pe_ILF_build_a_bfd): .. * srec.c (srec_bad_byte): .. * stabs.c (_bfd_link_section_stabs): .. * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. Replace all uses of bfd_archive_filename and bfd_get_section_ident with corresponding %B and %A in _bfd_error_handler format string. Replace occurrences of "fprintf (stderr," with _bfd_error_handler calls to use %A and %B. Fix "against symbol .. from section" and similar error messages. Combine multiple _bfd_error_handler calls where they were separated due to bfd_archive_filename deficiencies. * bfd-in2.h: Regenerate. include/ * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. ld/ * ldmain.c (link_callbacks): Remove "error_handler". * ldmisc.c: Include elf-bfd.h. (vfinfo): Sort comment. Handle %A. Use %A instead of bfd_get_section_indent. (error_handler): Delete. * ldmisc.h (error_handler): Delete declaration. --- bfd/ChangeLog | 124 ++++++++++++++++++++++ bfd/aout-adobe.c | 4 +- bfd/aout-cris.c | 11 +- bfd/bfd-in2.h | 6 +- bfd/bfd.c | 234 +++++++++++++++++++++++------------------ bfd/coff-arm.c | 92 +++++++--------- bfd/coff-i860.c | 8 +- bfd/coff-mcore.c | 30 +++--- bfd/coff-ppc.c | 30 +++--- bfd/coff-rs6000.c | 4 +- bfd/coff-sh.c | 45 ++++---- bfd/coff-tic54x.c | 7 +- bfd/coff-tic80.c | 6 +- bfd/coff64-rs6000.c | 4 +- bfd/coffcode.h | 37 +++---- bfd/coffgen.c | 3 +- bfd/cofflink.c | 21 ++-- bfd/cpu-arm.c | 10 +- bfd/cpu-sh.c | 4 +- bfd/ecofflink.c | 4 +- bfd/elf-hppa.h | 15 ++- bfd/elf.c | 43 ++++---- bfd/elf32-arm.h | 168 +++++++++++++---------------- bfd/elf32-cris.c | 72 +++++++------ bfd/elf32-frv.c | 9 +- bfd/elf32-gen.c | 4 +- bfd/elf32-hppa.c | 46 ++++---- bfd/elf32-i370.c | 31 +++--- bfd/elf32-i386.c | 35 +++--- bfd/elf32-m32r.c | 15 ++- bfd/elf32-m68hc1x.c | 25 ++--- bfd/elf32-m68k.c | 11 +- bfd/elf32-mcore.c | 25 +++-- bfd/elf32-ppc.c | 88 ++++++++-------- bfd/elf32-s390.c | 30 +++--- bfd/elf32-sh-symbian.c | 12 +-- bfd/elf32-sh.c | 87 ++++++++------- bfd/elf32-sparc.c | 26 ++--- bfd/elf32-v850.c | 9 +- bfd/elf32-xtensa.c | 15 ++- bfd/elf64-alpha.c | 61 ++++++----- bfd/elf64-gen.c | 5 +- bfd/elf64-ppc.c | 71 ++++++------- bfd/elf64-s390.c | 29 +++-- bfd/elf64-sh64.c | 5 +- bfd/elf64-sparc.c | 44 ++++---- bfd/elf64-x86-64.c | 37 +++---- bfd/elflink.c | 153 ++++++++++----------------- bfd/elfxx-ia64.c | 50 +++++---- bfd/elfxx-mips.c | 42 ++++---- bfd/ieee.c | 12 +-- bfd/ihex.c | 34 +++--- bfd/libbfd.c | 6 +- bfd/linker.c | 19 ++-- bfd/pdp11.c | 9 +- bfd/pe-mips.c | 18 ++-- bfd/peicode.h | 32 +++--- bfd/srec.c | 4 +- bfd/stabs.c | 6 +- bfd/xcofflink.c | 48 ++++----- include/ChangeLog | 5 + include/bfdlink.h | 8 -- ld/ChangeLog | 9 ++ ld/ldmain.c | 3 +- ld/ldmisc.c | 118 +++++++-------------- ld/ldmisc.h | 3 +- 66 files changed, 1112 insertions(+), 1169 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a64631e43d..8672286241 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,127 @@ +2004-08-13 Alan Modra + + * bfd.c (_bfd_default_error_handler): Handle %A and %B. + (bfd_archive_filename, bfd_get_section_ident): Delete. + * ecofflink.c (bfd_ecoff_debug_accumulate_other): Don't call + bfd_archive_filename. + * elflink.c (elf_link_input_bfd): Don't use callbacks->error_handler + to warn about symbols in discarded sections. Use _bfd_error_handler. + * aout-adobe.c (aout_adobe_callback): See below. + * aout-cris.c (swap_ext_reloc_in): .. + * coff-arm.c (find_thumb_glue, find_arm_glue, + coff_arm_relocate_section, bfd_arm_process_before_allocation, + coff_arm_merge_private_bfd_data, _bfd_coff_arm_set_private_flags, + coff_arm_copy_private_bfd_data): .. + * coff-i860.c (i860_reloc_processing): .. + * coff-mcore.c (mcore_coff_unsupported_reloc, + coff_mcore_relocate_section): .. + * coff-ppc.c (coff_ppc_relocate_section): .. + * coff-rs6000.c (xcoff_create_csect_from_smclas + * coff-sh.c (sh_relax_section, sh_relax_delete_bytes, + sh_swap_insns, sh_relocate_section): .. + * coff-tic54x.c (tic54x_reloc_processing): .. + * coff-tic80.c (coff_tic80_relocate_section): .. + * coff64-rs6000.c (xcoff64_create_csect_from_smclas): .. + * coffcode.h (styp_to_sec_flags, coff_slurp_line_table, + coff_slurp_symbol_table, coff_classify_symbol, + coff_slurp_reloc_table): .. + * coffgen.c (_bfd_coff_read_string_table): .. + * cofflink.c (coff_link_add_symbols, _bfd_coff_link_input_bfd, + _bfd_coff_generic_relocate_section): .. + * cpu-arm.c (bfd_arm_merge_machines): .. + * cpu-sh.c (sh_merge_bfd_arch): .. + * elf-hppa.h (elf_hppa_relocate_section): .. + * elf.c (bfd_elf_string_from_elf_section, setup_group, + _bfd_elf_setup_group_pointers, bfd_section_from_shdr, + assign_section_numbers, _bfd_elf_symbol_from_bfd_symbol, + copy_private_bfd_data, _bfd_elf_validate_reloc): .. + * elf32-arm.h (find_thumb_glue, find_arm_glue, + bfd_elf32_arm_process_before_allocation, elf32_thumb_to_arm_stub, + elf32_arm_to_thumb_stub, elf32_arm_final_link_relocate, + elf32_arm_relocate_section, elf32_arm_set_private_flags, + elf32_arm_copy_private_bfd_data, elf32_arm_merge_private_bfd_data): .. + * elf32-cris.c (cris_elf_relocate_section, cris_elf_check_relocs, + cris_elf_merge_private_bfd_data + * elf32-frv.c (elf32_frv_relocate_section, elf32_frv_check_relocs): .. + * elf32-gen.c (elf32_generic_link_add_symbols): .. + * elf32-hppa.c (hppa_add_stub, hppa_build_one_stub, + elf32_hppa_check_relocs, get_local_syms, final_link_relocate, + elf32_hppa_relocate_section): .. + * elf32-i370.c (i370_elf_merge_private_bfd_data, + i370_elf_check_relocs, i370_elf_relocate_section): .. + * elf32-i386.c (elf_i386_info_to_howto_rel, elf_i386_check_relocs, + elf_i386_relocate_section): .. + * elf32-m32r.c (m32r_elf_relocate_section, + m32r_elf_merge_private_bfd_data): .. + * elf32-m68hc1x.c (m68hc12_add_stub, + _bfd_m68hc11_elf_merge_private_bfd_data): .. + * elf32-m68k.c (elf_m68k_relocate_section): .. + * elf32-mcore.c (mcore_elf_unsupported_reloc, + mcore_elf_relocate_section): .. + * elf32-ppc.c (ppc_elf_merge_private_bfd_data, bad_shared_reloc, + ppc_elf_check_relocs, ppc_elf_relocate_section, + ppc_elf_begin_write_processing): .. + * elf32-s390.c (elf_s390_check_relocs, invalid_tls_insn, + elf_s390_relocate_section): .. + * elf32-sh-symbian.c (sh_symbian_import_as, + sh_symbian_process_embedded_commands, + sh_symbian_relocate_section): .. + * elf32-sh.c (sh_elf_relax_section, sh_elf_relax_delete_bytes, + sh_elf_swap_insns, sh_elf_relocate_section, sh_elf_check_relocs, + sh_elf_merge_private_data): .. + * elf32-sparc.c (elf32_sparc_check_relocs, + elf32_sparc_relocate_section, + elf32_sparc_merge_private_bfd_data): .. + * elf32-v850.c (v850_elf_check_relocs, + v850_elf_merge_private_bfd_data): .. + * elf32-xtensa.c (elf_xtensa_check_relocs, + elf_xtensa_relocate_section, elf_xtensa_merge_private_bfd_data): .. + * elf64-alpha.c (elf64_alpha_relax_with_lituse, + elf64_alpha_relax_got_load, elf64_alpha_size_got_sections, + elf64_alpha_relocate_section_r, elf64_alpha_relocate_section): .. + * elf64-gen.c (elf64_generic_link_add_symbols): .. + * elf64-ppc.c (ppc64_elf_merge_private_bfd_data, ppc_add_stub, + ppc64_elf_check_relocs, ppc64_elf_edit_opd, + ppc64_elf_relocate_section): .. + * elf64-s390.c (elf_s390_check_relocs, invalid_tls_insn, + elf_s390_relocate_section): .. + * elf64-sh64.c (sh_elf64_relocate_section): .. + * elf64-sparc.c (sparc64_elf_check_relocs, + sparc64_elf_add_symbol_hook, sparc64_elf_relocate_section, + sparc64_elf_merge_private_bfd_data): .. + * elf64-x86-64.c (elf64_x86_64_check_relocs, + elf64_x86_64_relocate_section): .. + * elflink.c (_bfd_elf_add_default_symbol, + _bfd_elf_link_assign_sym_version, elf_link_read_relocs_from_section, + _bfd_elf_link_output_relocs, elf_link_add_object_symbols, + bfd_elf_size_dynamic_sections, elf_link_output_extsym, + elf_get_linked_section_vma, elf_fixup_link_order, + bfd_elf_final_link, bfd_elf_gc_record_vtinherit, + bfd_elf_gc_record_vtinherit, _bfd_elf_section_already_linked): .. + * elfxx-ia64.c (elfNN_ia64_relax_section, + elfNN_ia64_relocate_section, elfNN_ia64_merge_private_bfd_data): .. + * elfxx-mips.c (mips_elf_perform_relocation, + _bfd_mips_elf_check_relocs, + _bfd_mips_elf_merge_private_bfd_data): .. + * ieee.c (ieee_slurp_external_symbols): .. + * ihex.c (ihex_bad_byte, ihex_scan, ihex_read_section): .. + * libbfd.c (_bfd_generic_verify_endian_match): .. + * linker.c (_bfd_generic_link_add_one_symbol, + _bfd_generic_section_already_linked): .. + * pdp11.c (translate_to_native_sym_flags): .. + * pe-mips.c (coff_pe_mips_relocate_section): .. + * peicode.h (pe_ILF_build_a_bfd): .. + * srec.c (srec_bad_byte): .. + * stabs.c (_bfd_link_section_stabs): .. + * xcofflink.c (xcoff_link_add_symbols, xcoff_link_input_bfd): .. + Replace all uses of bfd_archive_filename and bfd_get_section_ident + with corresponding %B and %A in _bfd_error_handler format string. + Replace occurrences of "fprintf (stderr," with _bfd_error_handler + calls to use %A and %B. Fix "against symbol .. from section" and + similar error messages. Combine multiple _bfd_error_handler calls + where they were separated due to bfd_archive_filename deficiencies. + * bfd-in2.h: Regenerate. + 2004-08-12 H.J. Lu * elf32-i386.c (elf_i386_relocate_section): Report unrecognized diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 6de2a31c75..9277bc086e 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -201,8 +201,8 @@ aout_adobe_callback (abfd) default: (*_bfd_error_handler) - (_("%s: Unknown section type in a.out.adobe file: %x\n"), - bfd_archive_filename (abfd), ext->e_type[0]); + (_("%B: Unknown section type in a.out.adobe file: %x\n"), + abfd, ext->e_type[0]); goto no_more_sections; } diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c index 4d1e48d7bf..26502a4369 100644 --- a/bfd/aout-cris.c +++ b/bfd/aout-cris.c @@ -1,5 +1,5 @@ /* BFD backend for CRIS a.out binaries. - Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Axis Communications AB. Written by Hans-Peter Nilsson. @@ -248,10 +248,10 @@ MY(swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) if (r_type > 2) { - (*_bfd_error_handler) (_("%s: Invalid relocation type imported: %d"), - bfd_archive_filename (abfd), r_type); + (*_bfd_error_handler) (_("%B: Invalid relocation type imported: %d"), + abfd, r_type); - bfd_set_error(bfd_error_wrong_format); + bfd_set_error (bfd_error_wrong_format); } cache_ptr->howto = howto_table_ext + r_type; @@ -259,8 +259,7 @@ MY(swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) if (r_extern && r_index > symcount) { (*_bfd_error_handler) - (_("%s: Bad relocation record imported: %d"), - bfd_archive_filename (abfd), r_index); + (_("%B: Bad relocation record imported: %d"), abfd, r_index); bfd_set_error (bfd_error_wrong_format); diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index f2ec29d71a..20b7b83cef 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -2639,7 +2639,7 @@ field in the instruction. */ BFD_RELOC_ARM_GOTOFF, BFD_RELOC_ARM_GOTPC, -/* PC-relative or absolute relocation depending on target. Used for +/* Pc-relative or absolute relocation depending on target. Used for entries in .init_array sections. */ BFD_RELOC_ARM_RELABS32, @@ -4001,8 +4001,6 @@ void bfd_set_error_program_name (const char *); bfd_error_handler_type bfd_get_error_handler (void); -const char *bfd_archive_filename (bfd *); - long bfd_get_reloc_upper_bound (bfd *abfd, asection *sect); long bfd_canonicalize_reloc @@ -4144,8 +4142,6 @@ void bfd_preserve_restore (bfd *, struct bfd_preserve *); void bfd_preserve_finish (bfd *, struct bfd_preserve *); -char *bfd_get_section_ident (asection *sec); - /* Extracted from archive.c. */ symindex bfd_get_next_mapent (bfd *abfd, symindex previous, carsym **sym); diff --git a/bfd/bfd.c b/bfd/bfd.c index f67e85c44b..b842027a66 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -406,23 +406,150 @@ CODE_FRAGMENT static const char *_bfd_error_program_name; -/* This is the default routine to handle BFD error messages. */ +/* This is the default routine to handle BFD error messages. + Like fprintf (stderr, ...), but also handles some extra format specifiers. + + %A section name from section. For group components, print group name too. + %B file name from bfd. For archive components, prints archive too. + */ void -_bfd_default_error_handler (const char *s, ...) +_bfd_default_error_handler (const char *fmt, ...) { - va_list p; + va_list ap; + char *bufp; + const char *new_fmt, *p; + size_t avail = 1000; + char buf[1000]; if (_bfd_error_program_name != NULL) fprintf (stderr, "%s: ", _bfd_error_program_name); else fprintf (stderr, "BFD: "); - va_start (p, s); - vfprintf (stderr, s, p); - va_end (p); + va_start (ap, fmt); + new_fmt = fmt; + bufp = buf; + + /* Reserve enough space for the existing format string. */ + avail -= strlen (fmt) + 1; + if (avail > 1000) + abort (); + + p = fmt; + while (*p != '\0') + { + char *q; + size_t len, extra, trim; + + p = strchr (p, '%'); + if (p == NULL || p[1] == '\0') + { + if (new_fmt == buf) + { + len = strlen (fmt); + memcpy (bufp, fmt, len + 1); + } + break; + } + + if (p[1] == 'A' || p[1] == 'B') + { + len = p - fmt; + memcpy (bufp, fmt, len); + bufp += len; + fmt = p + 2; + new_fmt = buf; + + /* If we run out of space, tough, you lose your ridiculously + long file or section name. It's not safe to try to alloc + memory here; We might be printing an out of memory message. */ + if (avail == 0) + { + *bufp++ = '*'; + *bufp++ = '*'; + *bufp = '\0'; + } + else + { + if (p[1] == 'B') + { + bfd *abfd = va_arg (ap, bfd *); + if (abfd->my_archive) + snprintf (bufp, avail, "%s(%s)", + abfd->my_archive->filename, abfd->filename); + else + snprintf (bufp, avail, "%s", abfd->filename); + } + else + { + asection *sec = va_arg (ap, asection *); + bfd *abfd = sec->owner; + const char *group = NULL; + struct coff_comdat_info *ci; + + if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_elf_flavour + && elf_next_in_group (sec) != NULL + && (sec->flags & SEC_GROUP) == 0) + group = elf_group_name (sec); + else if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_coff_flavour + && (ci = bfd_coff_get_comdat_section (sec->owner, + sec)) != NULL) + group = ci->name; + if (group != NULL) + snprintf (bufp, avail, "%s[%s]", sec->name, group); + else + snprintf (bufp, avail, "%s", sec->name); + } + len = strlen (bufp); + avail = avail - len + 2; + + /* We need to replace any '%' we printed by "%%". + First count how many. */ + q = bufp; + bufp += len; + extra = 0; + while ((q = strchr (q, '%')) != NULL) + { + ++q; + ++extra; + } + + /* If there isn't room, trim off the end of the string. */ + q = bufp; + bufp += extra; + if (extra > avail) + { + trim = extra - avail; + bufp -= trim; + do + { + if (*--q == '%') + --extra; + } + while (--trim != 0); + *q = '\0'; + } + + /* Now double all '%' chars, shuffling the string as we go. */ + while (extra != 0) + { + while ((q[extra] = *q) != '%') + --q; + q[--extra] = '%'; + --q; + } + } + } + p = p + 2; + } + + vfprintf (stderr, new_fmt, ap); + va_end (ap); - fprintf (stderr, "\n"); + putc ('\n', stderr); } /* This is a function pointer to the routine which should handle BFD @@ -491,56 +618,6 @@ bfd_get_error_handler (void) { return _bfd_error_handler; } - -/* -FUNCTION - bfd_archive_filename - -SYNOPSIS - const char *bfd_archive_filename (bfd *); - -DESCRIPTION - For a BFD that is a component of an archive, returns a string - with both the archive name and file name. For other BFDs, just - returns the file name. -*/ - -const char * -bfd_archive_filename (bfd *abfd) -{ - if (abfd == NULL) - return NULL; - - if (abfd->my_archive) - { - static size_t curr = 0; - static char *buf; - size_t needed; - - needed = (strlen (bfd_get_filename (abfd->my_archive)) - + strlen (bfd_get_filename (abfd)) + 3); - if (needed > curr) - { - if (curr) - free (buf); - curr = needed + (needed >> 1); - buf = bfd_malloc (curr); - /* If we can't malloc, fail safe by returning just the file - name. This function is only used when building error - messages. */ - if (!buf) - { - curr = 0; - return bfd_get_filename (abfd); - } - } - sprintf (buf, "%s(%s)", bfd_get_filename (abfd->my_archive), - bfd_get_filename (abfd)); - return buf; - } - else - return bfd_get_filename (abfd); -} /* SECTION @@ -1417,46 +1494,3 @@ bfd_preserve_finish (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_preserve *preserve) objalloc. */ bfd_hash_table_free (&preserve->section_htab); } - -/* -FUNCTION - bfd_get_section_ident - -SYNOPSIS - char *bfd_get_section_ident (asection *sec); - -DESCRIPTION - This function returns "section name[group name]" in a malloced - buffer if @var{sec} is a member of an ELF section group and - returns NULL otherwise. The caller should free the non-NULL - return after use. - -*/ - -char * -bfd_get_section_ident (asection *sec) -{ - char *buf; - bfd_size_type nlen; - bfd_size_type glen; - - if (sec->owner == NULL - || bfd_get_flavour (sec->owner) != bfd_target_elf_flavour - || elf_next_in_group (sec) == NULL - || (sec->flags & SEC_GROUP) != 0) - return NULL; - - nlen = strlen (sec->name); - glen = strlen (elf_group_name (sec)); - buf = bfd_malloc (nlen + glen + 2 + 1); - if (buf != NULL) - { - strcpy (buf, sec->name); - buf [nlen] = '['; - strcpy (&buf [nlen + 1], elf_group_name (sec)); - buf [nlen + 1 + glen] = ']'; - buf [nlen + 1 + glen + 1] = '\0'; - } - - return buf; -} diff --git a/bfd/coff-arm.c b/bfd/coff-arm.c index 3f3ab44567..1c3a7e3c39 100644 --- a/bfd/coff-arm.c +++ b/bfd/coff-arm.c @@ -1063,8 +1063,8 @@ find_thumb_glue (info, name, input_bfd) if (myh == NULL) /* xgettext:c-format */ - _bfd_error_handler (_("%s: unable to find THUMB glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); + _bfd_error_handler (_("%B: unable to find THUMB glue '%s' for `%s'"), + input_bfd, tmp_name, name); free (tmp_name); @@ -1093,8 +1093,8 @@ find_arm_glue (info, name, input_bfd) if (myh == NULL) /* xgettext:c-format */ - _bfd_error_handler (_("%s: unable to find ARM glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); + _bfd_error_handler (_("%B: unable to find ARM glue '%s' for `%s'"), + input_bfd, tmp_name, name); free (tmp_name); @@ -1395,16 +1395,11 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, if (h_sec->owner != NULL && INTERWORK_SET (h_sec->owner) && ! INTERWORK_FLAG (h_sec->owner)) - { - _bfd_error_handler - /* xgettext:c-format */ - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (h_sec->owner), name); - _bfd_error_handler - /* xgettext:c-format */ - (_(" first occurrence: %s: arm call to thumb"), - bfd_archive_filename (input_bfd)); - } + _bfd_error_handler + /* xgettext:c-format */ + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: arm call to thumb"), + h_sec->owner, input_bfd, name); --my_offset; myh->root.u.def.value = my_offset; @@ -1490,18 +1485,12 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, && INTERWORK_SET (h_sec->owner) && ! INTERWORK_FLAG (h_sec->owner) && ! globals->support_old_code) - { - _bfd_error_handler - /* xgettext:c-format */ - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (h_sec->owner), name); - _bfd_error_handler - /* xgettext:c-format */ - (_(" first occurrence: %s: thumb call to arm"), - bfd_archive_filename (input_bfd)); - _bfd_error_handler - (_(" consider relinking with --support-old-code enabled")); - } + _bfd_error_handler + /* xgettext:c-format */ + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: thumb call to arm\n" + " consider relinking with --support-old-code enabled"), + h_sec->owner, input_bfd, name); -- my_offset; myh->root.u.def.value = my_offset; @@ -1795,10 +1784,8 @@ coff_arm_relocate_section (output_bfd, info, input_bfd, input_section, break; case bfd_reloc_outofrange: (*_bfd_error_handler) - (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_archive_filename (input_bfd), - (unsigned long) rel->r_vaddr, - bfd_get_section_name (input_bfd, input_section)); + (_("%B: bad reloc address 0x%lx in section `%A'"), + input_bfd, input_section, (unsigned long) rel->r_vaddr); return FALSE; case bfd_reloc_overflow: { @@ -2139,8 +2126,8 @@ bfd_arm_process_before_allocation (abfd, info, support_old_code) /* If the index is outside of the range of our table, something has gone wrong. */ if (symndx >= obj_conv_table_size (abfd)) { - _bfd_error_handler (_("%s: illegal symbol index in reloc: %d"), - bfd_archive_filename (abfd), symndx); + _bfd_error_handler (_("%B: illegal symbol index in reloc: %d"), + abfd, symndx); continue; } @@ -2272,9 +2259,10 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) { _bfd_error_handler /* xgettext: c-format */ - (_("ERROR: %s is compiled for APCS-%d, whereas %s is compiled for APCS-%d"), - bfd_archive_filename (ibfd), APCS_26_FLAG (ibfd) ? 26 : 32, - bfd_get_filename (obfd), APCS_26_FLAG (obfd) ? 26 : 32 + (_("ERROR: %B is compiled for APCS-%d, whereas %B is compiled for APCS-%d"), + ibfd, obfd, + APCS_26_FLAG (ibfd) ? 26 : 32, + APCS_26_FLAG (obfd) ? 26 : 32 ); bfd_set_error (bfd_error_wrong_format); @@ -2287,13 +2275,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) if (APCS_FLOAT_FLAG (ibfd)) /* xgettext: c-format */ - msg = _("ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"); + msg = _("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers"); else /* xgettext: c-format */ - msg = _("ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"); + msg = _("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers"); - _bfd_error_handler (msg, bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler (msg, ibfd, obfd); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -2305,12 +2292,11 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) if (PIC_FLAG (ibfd)) /* xgettext: c-format */ - msg = _("ERROR: %s is compiled as position independent code, whereas target %s is absolute position"); + msg = _("ERROR: %B is compiled as position independent code, whereas target %B is absolute position"); else /* xgettext: c-format */ - msg = _("ERROR: %s is compiled as absolute position code, whereas target %s is position independent"); - _bfd_error_handler (msg, bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + msg = _("ERROR: %B is compiled as absolute position code, whereas target %B is position independent"); + _bfd_error_handler (msg, ibfd, obfd); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -2337,13 +2323,12 @@ coff_arm_merge_private_bfd_data (ibfd, obfd) if (INTERWORK_FLAG (ibfd)) /* xgettext: c-format */ - msg = _("Warning: %s supports interworking, whereas %s does not"); + msg = _("Warning: %B supports interworking, whereas %B does not"); else /* xgettext: c-format */ - msg = _("Warning: %s does not support interworking, whereas %s does"); + msg = _("Warning: %B does not support interworking, whereas %B does"); - _bfd_error_handler (msg, bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler (msg, ibfd, obfd); } } else @@ -2438,12 +2423,12 @@ _bfd_coff_arm_set_private_flags (abfd, flags) { if (flag) /* xgettext: c-format */ - _bfd_error_handler (_("Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"), - bfd_archive_filename (abfd)); + _bfd_error_handler (_("Warning: Not setting interworking flag of %B since it has already been specified as non-interworking"), + abfd); else /* xgettext: c-format */ - _bfd_error_handler (_("Warning: Clearing the interworking flag of %s due to outside request"), - bfd_archive_filename (abfd)); + _bfd_error_handler (_("Warning: Clearing the interworking flag of %B due to outside request"), + abfd); flag = 0; } @@ -2502,9 +2487,8 @@ coff_arm_copy_private_bfd_data (src, dest) { /* xgettext:c-format */ _bfd_error_handler (("\ -Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"), - bfd_get_filename (dest), - bfd_archive_filename (src)); +Warning: Clearing the interworking flag of %B because non-interworking code in %B has been linked with it"), + dest, src); } SET_INTERWORK_FLAG (dest, 0); diff --git a/bfd/coff-i860.c b/bfd/coff-i860.c index edc9f4e6a2..e18e30ba8a 100644 --- a/bfd/coff-i860.c +++ b/bfd/coff-i860.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel i860 COFF files. - Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, + 2003, 2004 Free Software Foundation, Inc. Created mostly by substituting "860" for "386" in coff-i386.c Harry Dolan , October 1995 @@ -607,8 +607,8 @@ i860_reloc_processing (arelent *cache_ptr, struct internal_reloc *dst, if (dst->r_symndx < 0 || dst->r_symndx >= obj_conv_table_size (abfd)) { (*_bfd_error_handler) - (_("%s: warning: illegal symbol index %ld in relocs"), - bfd_archive_filename (abfd), dst->r_symndx); + (_("%B: warning: illegal symbol index %ld in relocs"), + abfd, dst->r_symndx); cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; ptr = NULL; } diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index 25569e3f24..7e0b28c5b7 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c @@ -1,5 +1,6 @@ /* BFD back-end for Motorola MCore COFF/PE - Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -284,8 +285,8 @@ mcore_coff_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section, { BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0); - _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), - bfd_archive_filename (abfd), + _bfd_error_handler (_("%B: Relocation %s (%d) is not currently supported.\n"), + abfd, reloc_entry->howto->name, reloc_entry->howto->type); @@ -399,8 +400,8 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, && output_bfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN) { (*_bfd_error_handler) - (_("%s: compiled for a %s system and target is %s.\n"), - bfd_archive_filename (input_bfd), + (_("%B: compiled for a %s system and target is %s.\n"), + input_bfd, bfd_big_endian (input_bfd) ? _("big endian") : _("little endian"), bfd_big_endian (output_bfd) ? _("big endian") : _("little endian")); @@ -506,21 +507,18 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section, switch (r_type) { default: - _bfd_error_handler (_("%s: unsupported relocation type 0x%02x"), - bfd_archive_filename (input_bfd), r_type); + _bfd_error_handler (_("%B: unsupported relocation type 0x%02x"), + input_bfd, r_type); bfd_set_error (bfd_error_bad_value); return FALSE; case IMAGE_REL_MCORE_ABSOLUTE: - fprintf (stderr, - _("Warning: unsupported reloc %s \n"), - howto->name, - bfd_archive_filename (input_bfd), - input_section->name); - - fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", - rel->r_symndx, my_name, (long) rel->r_vaddr, - (unsigned long) rel->r_vaddr); + _bfd_error_handler + (_("Warning: unsupported reloc %s \n" + "sym %ld (%s), r_vaddr %ld (%lx)"), + input_bfd, input_section, howto->name, + rel->r_symndx, my_name, (long) rel->r_vaddr, + (unsigned long) rel->r_vaddr); break; case IMAGE_REL_MCORE_PCREL_IMM8BY4: diff --git a/bfd/coff-ppc.c b/bfd/coff-ppc.c index c1eca470c8..38d0099748 100644 --- a/bfd/coff-ppc.c +++ b/bfd/coff-ppc.c @@ -1188,8 +1188,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, { default: (*_bfd_error_handler) - (_("%s: unsupported relocation type 0x%02x"), - bfd_archive_filename (input_bfd), r_type); + (_("%B: unsupported relocation type 0x%02x"), input_bfd, r_type); bfd_set_error (bfd_error_bad_value); return FALSE; case IMAGE_REL_PPC_TOCREL16: @@ -1278,8 +1277,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, if ((bfd_vma) our_toc_offset >= 65535) { (*_bfd_error_handler) - (_("%s: Relocation for %s of %lx exceeds Toc size limit"), - bfd_archive_filename (input_bfd), name, + (_("%B: Relocation for %s of %lx exceeds Toc size limit"), + input_bfd, name, (unsigned long) our_toc_offset); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -1333,9 +1332,8 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, && (bfd_vma) our_toc_offset > toc_section->size) { (*_bfd_error_handler) - (_("%s: Relocation exceeds allocated TOC (%lx)"), - bfd_archive_filename (input_bfd), - (unsigned long) toc_section->size); + (_("%B: Relocation exceeds allocated TOC (%lx)"), + input_bfd, (unsigned long) toc_section->size); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1387,15 +1385,12 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, else my_name = h->root.root.root.string; - fprintf (stderr, - _("Warning: unsupported reloc %s \n"), - howto->name, - bfd_archive_filename(input_bfd), - input_section->name); - - fprintf (stderr,"sym %ld (%s), r_vaddr %ld (%lx)\n", - rel->r_symndx, my_name, (long) rel->r_vaddr, - (unsigned long) rel->r_vaddr); + (*_bfd_error_handler) + (_("Warning: unsupported reloc %s \n" + "sym %ld (%s), r_vaddr %ld (%lx)"), + input_bfd, input_section, howto->name, + rel->r_symndx, my_name, (long) rel->r_vaddr, + (unsigned long) rel->r_vaddr); } break; case IMAGE_REL_PPC_IMGLUE: @@ -1409,8 +1404,7 @@ coff_ppc_relocate_section (output_bfd, info, input_bfd, input_section, my_name = h->root.root.root.string; (*_bfd_error_handler) - (_("%s: Out of order IMGLUE reloc for %s"), - bfd_archive_filename (input_bfd), my_name); + (_("%B: Out of order IMGLUE reloc for %s"), input_bfd, my_name); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index ed4a242048..cb0474e407 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -3611,8 +3611,8 @@ xcoff_create_csect_from_smclas (abfd, aux, symbol_name) else { (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas); + (_("%B: symbol `%s' has unrecognized smclas %d"), + abfd, symbol_name, aux->x_csect.x_smclas); bfd_set_error (bfd_error_bad_value); } diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c index ade10fca02..ce9ae94aa1 100644 --- a/bfd/coff-sh.c +++ b/bfd/coff-sh.c @@ -762,9 +762,8 @@ sh_relax_section (abfd, sec, link_info, again) laddr += ((irel->r_offset & 0xffffffff) ^ 0x80000000) - 0x80000000; if (laddr >= sec->size) { - (*_bfd_error_handler) ("%s: 0x%lx: warning: bad R_SH_USES offset", - bfd_archive_filename (abfd), - (unsigned long) irel->r_vaddr); + (*_bfd_error_handler) ("%B: 0x%lx: warning: bad R_SH_USES offset", + abfd, (unsigned long) irel->r_vaddr); continue; } insn = bfd_get_16 (abfd, contents + laddr); @@ -773,8 +772,8 @@ sh_relax_section (abfd, sec, link_info, again) if ((insn & 0xf000) != 0xd000) { ((*_bfd_error_handler) - ("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", - bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr, insn)); + ("%B: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x", + abfd, (unsigned long) irel->r_vaddr, insn)); continue; } @@ -790,8 +789,8 @@ sh_relax_section (abfd, sec, link_info, again) if (paddr >= sec->size) { ((*_bfd_error_handler) - ("%s: 0x%lx: warning: bad R_SH_USES load offset", - bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); + ("%B: 0x%lx: warning: bad R_SH_USES load offset", + abfd, (unsigned long) irel->r_vaddr)); continue; } @@ -814,8 +813,8 @@ sh_relax_section (abfd, sec, link_info, again) if (irelfn >= irelend) { ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected reloc", - bfd_archive_filename (abfd), (unsigned long) paddr)); + ("%B: 0x%lx: warning: could not find expected reloc", + abfd, (unsigned long) paddr)); continue; } @@ -830,8 +829,8 @@ sh_relax_section (abfd, sec, link_info, again) if (sym.n_scnum != 0 && sym.n_scnum != sec->target_index) { ((*_bfd_error_handler) - ("%s: 0x%lx: warning: symbol in unexpected section", - bfd_archive_filename (abfd), (unsigned long) paddr)); + ("%B: 0x%lx: warning: symbol in unexpected section", + abfd, (unsigned long) paddr)); continue; } @@ -955,8 +954,8 @@ sh_relax_section (abfd, sec, link_info, again) if (irelcount >= irelend) { ((*_bfd_error_handler) - ("%s: 0x%lx: warning: could not find expected COUNT reloc", - bfd_archive_filename (abfd), (unsigned long) paddr)); + ("%B: 0x%lx: warning: could not find expected COUNT reloc", + abfd, (unsigned long) paddr)); continue; } @@ -964,9 +963,8 @@ sh_relax_section (abfd, sec, link_info, again) just deleted one. */ if (irelcount->r_offset == 0) { - ((*_bfd_error_handler) ("%s: 0x%lx: warning: bad count", - bfd_archive_filename (abfd), - (unsigned long) paddr)); + ((*_bfd_error_handler) ("%B: 0x%lx: warning: bad count", + abfd, (unsigned long) paddr)); continue; } @@ -1337,8 +1335,8 @@ sh_relax_delete_bytes (abfd, sec, addr, count) if (overflow) { ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); + ("%B: 0x%lx: fatal: reloc overflow while relaxing", + abfd, (unsigned long) irel->r_vaddr)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1432,8 +1430,7 @@ sh_relax_delete_bytes (abfd, sec, addr, count) || obj_raw_syments (abfd) != NULL) { ((*_bfd_error_handler) - ("%s: fatal: generic symbols retrieved before relaxing", - bfd_archive_filename (abfd))); + ("%B: fatal: generic symbols retrieved before relaxing", abfd)); bfd_set_error (bfd_error_invalid_operation); return FALSE; } @@ -2788,8 +2785,8 @@ sh_swap_insns (abfd, sec, relocs, contents, addr) if (overflow) { ((*_bfd_error_handler) - ("%s: 0x%lx: fatal: reloc overflow while relaxing", - bfd_archive_filename (abfd), (unsigned long) irel->r_vaddr)); + ("%B: 0x%lx: fatal: reloc overflow while relaxing", + abfd, (unsigned long) irel->r_vaddr)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -2852,8 +2849,8 @@ sh_relocate_section (output_bfd, info, input_bfd, input_section, contents, || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) { (*_bfd_error_handler) - ("%s: illegal symbol index %ld in relocs", - bfd_archive_filename (input_bfd), symndx); + ("%B: illegal symbol index %ld in relocs", + input_bfd, symndx); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/coff-tic54x.c b/bfd/coff-tic54x.c index 316768e2dc..133769cd80 100644 --- a/bfd/coff-tic54x.c +++ b/bfd/coff-tic54x.c @@ -1,5 +1,6 @@ /* BFD back-end for TMS320C54X coff binaries. - Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. Contributed by Timothy Wall (twall@cygnus.com) This file is part of BFD, the Binary File Descriptor library. @@ -363,8 +364,8 @@ tic54x_reloc_processing (relent, reloc, symbols, abfd, section) if (reloc->r_symndx < 0 || reloc->r_symndx >= obj_conv_table_size (abfd)) { (*_bfd_error_handler) - (_("%s: warning: illegal symbol index %ld in relocs"), - bfd_archive_filename (abfd), reloc->r_symndx); + (_("%B: warning: illegal symbol index %ld in relocs"), + abfd, reloc->r_symndx); relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; ptr = NULL; } diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c index c7ec9bd61f..50f43041ec 100644 --- a/bfd/coff-tic80.c +++ b/bfd/coff-tic80.c @@ -684,10 +684,8 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd, break; case bfd_reloc_outofrange: (*_bfd_error_handler) - (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_archive_filename (input_bfd), - (unsigned long) rel->r_vaddr, - bfd_get_section_name (input_bfd, input_section)); + (_("%B: bad reloc address 0x%lx in section `%A'"), + input_bfd, input_section, (unsigned long) rel->r_vaddr); return FALSE; case bfd_reloc_overflow: { diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index e8abaa1a0b..0e24adb151 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -2104,8 +2104,8 @@ xcoff64_create_csect_from_smclas (abfd, aux, symbol_name) else { (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized smclas %d"), - bfd_archive_filename (abfd), symbol_name, aux->x_csect.x_smclas); + (_("%B: symbol `%s' has unrecognized smclas %d"), + abfd, symbol_name, aux->x_csect.x_smclas); bfd_set_error (bfd_error_bad_value); } diff --git a/bfd/coffcode.h b/bfd/coffcode.h index c9773a67fe..b96e5f06e3 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1071,8 +1071,8 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) /* Generate a warning message rather using the 'unhandled' variable as this will allow some .sys files generate by other toolchains to be processed. See bugzilla issue 196. */ - _bfd_error_handler (_("%s: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section %s"), - bfd_archive_filename (abfd), name); + _bfd_error_handler (_("%B: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section %s"), + abfd, name); #endif break; case IMAGE_SCN_MEM_EXECUTE: @@ -1127,8 +1127,8 @@ styp_to_sec_flags (abfd, hdr, name, section, flags_ptr) if (unhandled != NULL) { (*_bfd_error_handler) - (_("%s (%s): Section flag %s (0x%x) ignored"), - bfd_archive_filename (abfd), name, unhandled, flag); + (_("%B (%s): Section flag %s (0x%x) ignored"), + abfd, name, unhandled, flag); result = FALSE; } } @@ -4445,8 +4445,7 @@ coff_slurp_line_table (abfd, asect) if (native_lineno == NULL) { (*_bfd_error_handler) - (_("%s: warning: line number table read failed"), - bfd_archive_filename (abfd)); + (_("%B: warning: line number table read failed"), abfd); return FALSE; } amt = ((bfd_size_type) asect->lineno_count + 1) * sizeof (alent); @@ -4478,8 +4477,8 @@ coff_slurp_line_table (abfd, asect) || (bfd_vma) symndx >= obj_raw_syment_count (abfd)) { (*_bfd_error_handler) - (_("%s: warning: illegal symbol index %ld in line numbers"), - bfd_archive_filename (abfd), dst.l_addr.l_symndx); + (_("%B: warning: illegal symbol index %ld in line numbers"), + abfd, dst.l_addr.l_symndx); symndx = 0; warned = TRUE; } @@ -4492,9 +4491,8 @@ coff_slurp_line_table (abfd, asect) if (sym->lineno != NULL && ! warned) { (*_bfd_error_handler) - (_("%s: warning: duplicate line number information for `%s'"), - bfd_archive_filename (abfd), - bfd_asymbol_name (&sym->symbol)); + (_("%B: warning: duplicate line number information for `%s'"), + abfd, bfd_asymbol_name (&sym->symbol)); } sym->lineno = cache_ptr; } @@ -4848,8 +4846,8 @@ coff_slurp_symbol_table (abfd) case C_HIDDEN: /* Ext symbol in dmert public lib. */ default: (*_bfd_error_handler) - (_("%s: Unrecognized storage class %d for %s symbol `%s'"), - bfd_archive_filename (abfd), src->u.syment.n_sclass, + (_("%B: Unrecognized storage class %d for %s symbol `%s'"), + abfd, src->u.syment.n_sclass, dst->symbol.section->name, dst->symbol.name); dst->symbol.flags = BSF_DEBUGGING; dst->symbol.value = (src->u.syment.n_value); @@ -4981,9 +4979,8 @@ coff_classify_symbol (abfd, syment) char buf[SYMNMLEN + 1]; (*_bfd_error_handler) - (_("warning: %s: local symbol `%s' has no section"), - bfd_archive_filename (abfd), - _bfd_coff_internal_syment_name (abfd, syment, buf)); + (_("warning: %B: local symbol `%s' has no section"), + abfd, _bfd_coff_internal_syment_name (abfd, syment, buf)); } return COFF_SYMBOL_LOCAL; @@ -5088,8 +5085,8 @@ coff_slurp_reloc_table (abfd, asect, symbols) if (dst.r_symndx < 0 || dst.r_symndx >= obj_conv_table_size (abfd)) { (*_bfd_error_handler) - (_("%s: warning: illegal symbol index %ld in relocs"), - bfd_archive_filename (abfd), dst.r_symndx); + (_("%B: warning: illegal symbol index %ld in relocs"), + abfd, dst.r_symndx); cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; ptr = NULL; } @@ -5126,8 +5123,8 @@ coff_slurp_reloc_table (abfd, asect, symbols) if (cache_ptr->howto == NULL) { (*_bfd_error_handler) - (_("%s: illegal relocation type %d at address 0x%lx"), - bfd_archive_filename (abfd), dst.r_type, (long) dst.r_vaddr); + (_("%B: illegal relocation type %d at address 0x%lx"), + abfd, dst.r_type, (long) dst.r_vaddr); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/coffgen.c b/bfd/coffgen.c index b6fa5ca055..a2b0d5d0dd 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -1663,8 +1663,7 @@ _bfd_coff_read_string_table (abfd) if (strsize < STRING_SIZE_SIZE) { (*_bfd_error_handler) - (_("%s: bad string table size %lu"), bfd_archive_filename (abfd), - (unsigned long) strsize); + (_("%B: bad string table size %lu"), abfd, (unsigned long) strsize); bfd_set_error (bfd_error_bad_value); return NULL; } diff --git a/bfd/cofflink.c b/bfd/cofflink.c index ddb56f4955..6520669f28 100644 --- a/bfd/cofflink.c +++ b/bfd/cofflink.c @@ -503,9 +503,8 @@ coff_link_add_symbols (bfd *abfd, && (BTYPE ((*sym_hash)->type) == T_NULL || BTYPE (sym.n_type) == T_NULL))) (*_bfd_error_handler) - (_("Warning: type of symbol `%s' changed from %d to %d in %s"), - name, (*sym_hash)->type, sym.n_type, - bfd_archive_filename (abfd)); + (_("Warning: type of symbol `%s' changed from %d to %d in %B"), + abfd, name, (*sym_hash)->type, sym.n_type); /* We don't want to change from a meaningful base type to a null one, but if we know @@ -2291,10 +2290,9 @@ _bfd_coff_link_input_bfd (struct coff_final_link_info *finfo, bfd *input_bfd) if ((o->flags & SEC_RELOC) != 0 && o->reloc_count != 0) { - ((*_bfd_error_handler) - (_("%s: relocs in section `%s', but it has no contents"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, o))); + (*_bfd_error_handler) + (_("%B: relocs in section `%A', but it has no contents"), + input_bfd, o); bfd_set_error (bfd_error_no_contents); return FALSE; } @@ -2861,8 +2859,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, || (unsigned long) symndx >= obj_raw_syment_count (input_bfd)) { (*_bfd_error_handler) - ("%s: illegal symbol index %ld in relocs", - bfd_archive_filename (input_bfd), symndx); + ("%B: illegal symbol index %ld in relocs", input_bfd, symndx); return FALSE; } else @@ -3007,10 +3004,8 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, break; case bfd_reloc_outofrange: (*_bfd_error_handler) - (_("%s: bad reloc address 0x%lx in section `%s'"), - bfd_archive_filename (input_bfd), - (unsigned long) rel->r_vaddr, - bfd_get_section_name (input_bfd, input_section)); + (_("%B: bad reloc address 0x%lx in section `%A'"), + input_bfd, input_section, (unsigned long) rel->r_vaddr); return FALSE; case bfd_reloc_overflow: { diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c index 39367a80fa..ea923c3409 100644 --- a/bfd/cpu-arm.c +++ b/bfd/cpu-arm.c @@ -195,9 +195,8 @@ bfd_arm_merge_machines (ibfd, obfd) && (out == bfd_mach_arm_XScale || out == bfd_mach_arm_iWMMXt)) { _bfd_error_handler (_("\ -ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); +ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"), + ibfd, obfd); bfd_set_error (bfd_error_wrong_format); return FALSE; } @@ -205,9 +204,8 @@ ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), && (in == bfd_mach_arm_XScale || in == bfd_mach_arm_iWMMXt)) { _bfd_error_handler (_("\ -ERROR: %s is compiled for the EP9312, whereas %s is compiled for XScale"), - bfd_archive_filename (obfd), - bfd_get_filename (ibfd)); +ERROR: %B is compiled for the EP9312, whereas %B is compiled for XScale"), + obfd, ibfd); bfd_set_error (bfd_error_wrong_format); return FALSE; } diff --git a/bfd/cpu-sh.c b/bfd/cpu-sh.c index 8fe25745c1..2fb738780a 100644 --- a/bfd/cpu-sh.c +++ b/bfd/cpu-sh.c @@ -434,8 +434,8 @@ sh_merge_bfd_arch (bfd *ibfd, bfd *obfd) if (!SH_VALID_CO_ARCH_SET (merged_arch)) { (*_bfd_error_handler) - ("%s: uses %s instructions while previous modules use %s instructions", - bfd_archive_filename (ibfd), + ("%B: uses %s instructions while previous modules use %s instructions", + ibfd, SH_ARCH_SET_HAS_DSP (new_arch) ? "dsp" : "floating point", SH_ARCH_SET_HAS_DSP (new_arch) ? "floating point" : "dsp"); bfd_set_error (bfd_error_bad_value); diff --git a/bfd/ecofflink.c b/bfd/ecofflink.c index 9abf9d1c41..8a8e146394 100644 --- a/bfd/ecofflink.c +++ b/bfd/ecofflink.c @@ -1,5 +1,5 @@ /* Routines to link ECOFF debugging information. - Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003 + Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, . @@ -1154,7 +1154,7 @@ bfd_ecoff_debug_accumulate_other (handle, output_bfd, output_debug, fdr.issBase = output_symhdr->issMax; fdr.cbSs = 0; fdr.rss = ecoff_add_string (ainfo, info, output_debug, &fdr, - bfd_archive_filename (input_bfd)); + input_bfd->filename); if (fdr.rss == -1) return FALSE; fdr.isymBase = output_symhdr->isymMax; diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 1e280b71ef..b1e00af1ce 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -1399,9 +1399,8 @@ elf_hppa_relocate_section (bfd *output_bfd, if (sym_sec->output_section == NULL && dyn_h == NULL) { (*_bfd_error_handler) - (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); + (_("%B(%A): warning: unresolvable relocation against symbol `%s'"), + input_bfd, input_section, h->root.root.string); relocation = 0; } else if (sym_sec->output_section) @@ -1426,9 +1425,8 @@ elf_hppa_relocate_section (bfd *output_bfd, if (dyn_h == NULL) { (*_bfd_error_handler) - (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); + (_("%B(%A): warning: unresolvable relocation against symbol `%s'"), + input_bfd, input_section, h->root.root.string); } relocation = 0; } @@ -1442,9 +1440,8 @@ elf_hppa_relocate_section (bfd *output_bfd, if (dyn_h == NULL) { (*_bfd_error_handler) - (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); + (_("%B(%A): warning: unresolvable relocation against symbol `%s'"), + input_bfd, input_section, h->root.root.string); } relocation = 0; } diff --git a/bfd/elf.c b/bfd/elf.c index 7e00c04acb..387f7194e2 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -292,8 +292,8 @@ bfd_elf_string_from_elf_section (bfd *abfd, if (strindex >= hdr->sh_size) { (*_bfd_error_handler) - (_("%s: invalid string offset %u >= %lu for section `%s'"), - bfd_archive_filename (abfd), strindex, (unsigned long) hdr->sh_size, + (_("%B: invalid string offset %u >= %lu for section `%s'"), + abfd, strindex, (unsigned long) hdr->sh_size, ((shindex == elf_elfheader(abfd)->e_shstrndx && strindex == hdr->sh_name) ? ".shstrtab" @@ -535,8 +535,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) if (idx >= shnum) { ((*_bfd_error_handler) - (_("%s: invalid SHT_GROUP entry"), - bfd_archive_filename (abfd))); + (_("%B: invalid SHT_GROUP entry"), abfd)); idx = 0; } dest->shdr = elf_elfsections (abfd)[idx]; @@ -606,8 +605,8 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) if (elf_group_name (newsect) == NULL) { - (*_bfd_error_handler) (_("%s: no group info for section %s"), - bfd_archive_filename (abfd), newsect->name); + (*_bfd_error_handler) (_("%B: no group info for section %A"), + abfd, newsect); } return TRUE; } @@ -643,8 +642,8 @@ _bfd_elf_setup_group_pointers (bfd *abfd) { /* There are some unknown sections in the group. */ (*_bfd_error_handler) - (_("%s: unknown [%d] section `%s' in group [%s]"), - bfd_archive_filename (abfd), + (_("%B: unknown [%d] section `%s' in group [%s]"), + abfd, (unsigned int) idx->shdr->sh_type, elf_string_from_elf_strtab (abfd, idx->shdr->sh_name), shdr->bfd_section->name); @@ -1904,8 +1903,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) || hdr->sh_link >= num_sec) { ((*_bfd_error_handler) - (_("%s: invalid link %lu for reloc section %s (index %u)"), - bfd_archive_filename (abfd), hdr->sh_link, name, shindex)); + (_("%B: invalid link %lu for reloc section %s (index %u)"), + abfd, hdr->sh_link, name, shindex)); return _bfd_elf_make_section_from_shdr (abfd, hdr, name); } @@ -2895,15 +2894,9 @@ assign_section_numbers (bfd *abfd) const struct elf_backend_data *bed = get_elf_backend_data (abfd); if (bed->link_order_error_handler) - { - char *name = bfd_get_section_ident (s); - bed->link_order_error_handler - (_("%s: warning: sh_link not set for section `%s'"), - bfd_archive_filename (abfd), - name ? name : s->name); - if (name) - free (name); - } + bed->link_order_error_handler + (_("%B: warning: sh_link not set for section `%S'"), + abfd, s); } else { @@ -4791,8 +4784,8 @@ _bfd_elf_symbol_from_bfd_symbol (bfd *abfd, asymbol **asym_ptr_ptr) /* This case can occur when using --strip-symbol on a symbol which is used in a relocation entry. */ (*_bfd_error_handler) - (_("%s: symbol `%s' required but not present"), - bfd_archive_filename (abfd), bfd_asymbol_name (asym_ptr)); + (_("%B: symbol `%s' required but not present"), + abfd, bfd_asymbol_name (asym_ptr)); bfd_set_error (bfd_error_no_symbols); return -1; } @@ -5079,8 +5072,8 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd) a warning is produced. */ if (segment->p_type == PT_LOAD) (*_bfd_error_handler) - (_("%s: warning: Empty loadable segment detected, is this intentional ?\n"), - bfd_archive_filename (ibfd)); + (_("%B: warning: Empty loadable segment detected, is this intentional ?\n"), + ibfd); map->count = 0; *pointer_to_map = map; @@ -6503,8 +6496,8 @@ _bfd_elf_validate_reloc (bfd *abfd, arelent *areloc) fail: (*_bfd_error_handler) - (_("%s: unsupported relocation type %s"), - bfd_archive_filename (abfd), areloc->howto->name); + (_("%B: unsupported relocation type %s"), + abfd, areloc->howto->name); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h index 6854b7d181..490a0d9261 100644 --- a/bfd/elf32-arm.h +++ b/bfd/elf32-arm.h @@ -486,8 +486,8 @@ find_thumb_glue (link_info, name, input_bfd) if (hash == NULL) /* xgettext:c-format */ - (*_bfd_error_handler) (_("%s: unable to find THUMB glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); + (*_bfd_error_handler) (_("%B: unable to find THUMB glue '%s' for `%s'"), + input_bfd, tmp_name, name); free (tmp_name); @@ -521,8 +521,8 @@ find_arm_glue (link_info, name, input_bfd) if (myh == NULL) /* xgettext:c-format */ - (*_bfd_error_handler) (_("%s: unable to find ARM glue '%s' for `%s'"), - bfd_archive_filename (input_bfd), tmp_name, name); + (*_bfd_error_handler) (_("%B: unable to find ARM glue '%s' for `%s'"), + input_bfd, tmp_name, name); free (tmp_name); @@ -863,9 +863,8 @@ bfd_elf32_arm_process_before_allocation (abfd, link_info, globals->no_pipeline_knowledge = no_pipeline_knowledge; if (byteswap_code && !bfd_big_endian (abfd)) { - _bfd_error_handler ( - _("%s: BE8 images only valid in big-endian mode."), - bfd_archive_filename (abfd)); + _bfd_error_handler (_("%B: BE8 images only valid in big-endian mode."), + abfd); return FALSE; } globals->byteswap_code = byteswap_code; @@ -1090,11 +1089,9 @@ elf32_thumb_to_arm_stub (info, name, input_bfd, output_bfd, input_section, && !INTERWORK_FLAG (sym_sec->owner)) { (*_bfd_error_handler) - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (sym_sec->owner), name); - (*_bfd_error_handler) - (_(" first occurrence: %s: thumb call to arm"), - bfd_archive_filename (input_bfd)); + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: thumb call to arm"), + sym_sec->owner, input_bfd, name); return FALSE; } @@ -1197,11 +1194,9 @@ elf32_arm_to_thumb_stub (info, name, input_bfd, output_bfd, input_section, && !INTERWORK_FLAG (sym_sec->owner)) { (*_bfd_error_handler) - (_("%s(%s): warning: interworking not enabled."), - bfd_archive_filename (sym_sec->owner), name); - (*_bfd_error_handler) - (_(" first occurrence: %s: arm call to thumb"), - bfd_archive_filename (input_bfd)); + (_("%B(%s): warning: interworking not enabled.\n" + " first occurrence: %B: arm call to thumb"), + sym_sec->owner, input_bfd, name); } --my_offset; @@ -1445,10 +1440,10 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, /* FIXME: Should we translate the instruction into a BL instruction instead ? */ if (sym_flags != STT_ARM_TFUNC) - (*_bfd_error_handler) (_("\ -%s: Warning: Arm BLX instruction targets Arm function '%s'."), - bfd_archive_filename (input_bfd), - h ? h->root.root.string : "(local)"); + (*_bfd_error_handler) + (_("\%B: Warning: Arm BLX instruction targets Arm function '%s'."), + input_bfd, + h ? h->root.root.string : "(local)"); } else #endif @@ -1641,10 +1636,10 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd, /* FIXME: Should we translate the instruction into a BL instruction instead ? */ if (sym_flags == STT_ARM_TFUNC) - (*_bfd_error_handler) (_("\ -%s: Warning: Thumb BLX instruction targets thumb function '%s'."), - bfd_archive_filename (input_bfd), - h ? h->root.root.string : "(local)"); + (*_bfd_error_handler) + (_("%B: Warning: Thumb BLX instruction targets thumb function '%s'."), + input_bfd, + h ? h->root.root.string : "(local)"); } else #endif @@ -2136,9 +2131,8 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, if (howto->rightshift) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): %s relocation against SEC_MERGE section"), + input_bfd, input_section, (long) rel->r_offset, howto->name); return FALSE; } @@ -2225,11 +2219,10 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section, default: if (unresolved_reloc) _bfd_error_handler - (_("%s: warning: unresolvable relocation %d against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), + (_("%B(%A): warning: unresolvable relocation %d against symbol `%s'"), + input_bfd, input_section, r_type, - h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); + h->root.root.string); break; } } @@ -2339,13 +2332,13 @@ elf32_arm_set_private_flags (abfd, flags) if (EF_ARM_EABI_VERSION (flags) == EF_ARM_EABI_UNKNOWN) { if (flags & EF_ARM_INTERWORK) - (*_bfd_error_handler) (_("\ -Warning: Not setting interworking flag of %s since it has already been specified as non-interworking"), - bfd_archive_filename (abfd)); + (*_bfd_error_handler) + (_("Warning: Not setting interworking flag of %B since it has already been specified as non-interworking"), + abfd); else - _bfd_error_handler (_("\ -Warning: Clearing the interworking flag of %s due to outside request"), - bfd_archive_filename (abfd)); + _bfd_error_handler + (_("Warning: Clearing the interworking flag of %B due to outside request"), + abfd); } } else @@ -2391,10 +2384,9 @@ elf32_arm_copy_private_bfd_data (ibfd, obfd) if ((in_flags & EF_ARM_INTERWORK) != (out_flags & EF_ARM_INTERWORK)) { if (out_flags & EF_ARM_INTERWORK) - _bfd_error_handler (_("\ -Warning: Clearing the interworking flag of %s because non-interworking code in %s has been linked with it"), - bfd_get_filename (obfd), - bfd_archive_filename (ibfd)); + _bfd_error_handler + (_("Warning: Clearing the interworking flag of %B because non-interworking code in %B has been linked with it"), + obfd, ibfd); in_flags &= ~EF_ARM_INTERWORK; } @@ -2509,12 +2501,11 @@ elf32_arm_merge_private_bfd_data (ibfd, obfd) /* Complain about various flag mismatches. */ if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags)) { - _bfd_error_handler (_("\ -ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d"), - bfd_archive_filename (ibfd), - (in_flags & EF_ARM_EABIMASK) >> 24, - bfd_get_filename (obfd), - (out_flags & EF_ARM_EABIMASK) >> 24); + _bfd_error_handler + (_("ERROR: %B is compiled for EABI version %d, whereas %B is compiled for version %d"), + ibfd, obfd, + (in_flags & EF_ARM_EABIMASK) >> 24, + (out_flags & EF_ARM_EABIMASK) >> 24); return FALSE; } @@ -2523,27 +2514,24 @@ ERROR: %s is compiled for EABI version %d, whereas %s is compiled for version %d { if ((in_flags & EF_ARM_APCS_26) != (out_flags & EF_ARM_APCS_26)) { - _bfd_error_handler (_("\ -ERROR: %s is compiled for APCS-%d, whereas target %s uses APCS-%d"), - bfd_archive_filename (ibfd), - in_flags & EF_ARM_APCS_26 ? 26 : 32, - bfd_get_filename (obfd), - out_flags & EF_ARM_APCS_26 ? 26 : 32); + _bfd_error_handler + (_("ERROR: %B is compiled for APCS-%d, whereas target %B uses APCS-%d"), + ibfd, obfd, + in_flags & EF_ARM_APCS_26 ? 26 : 32, + out_flags & EF_ARM_APCS_26 ? 26 : 32); flags_compatible = FALSE; } if ((in_flags & EF_ARM_APCS_FLOAT) != (out_flags & EF_ARM_APCS_FLOAT)) { if (in_flags & EF_ARM_APCS_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s passes floats in float registers, whereas %s passes them in integer registers"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B passes floats in float registers, whereas %B passes them in integer registers"), + ibfd, obfd); else - _bfd_error_handler (_("\ -ERROR: %s passes floats in integer registers, whereas %s passes them in float registers"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B passes floats in integer registers, whereas %B passes them in float registers"), + ibfd, obfd); flags_compatible = FALSE; } @@ -2551,15 +2539,13 @@ ERROR: %s passes floats in integer registers, whereas %s passes them in float re if ((in_flags & EF_ARM_VFP_FLOAT) != (out_flags & EF_ARM_VFP_FLOAT)) { if (in_flags & EF_ARM_VFP_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s uses VFP instructions, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B uses VFP instructions, whereas %B does not"), + ibfd, obfd); else - _bfd_error_handler (_("\ -ERROR: %s uses FPA instructions, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B uses FPA instructions, whereas %B does not"), + ibfd, obfd); flags_compatible = FALSE; } @@ -2567,15 +2553,13 @@ ERROR: %s uses FPA instructions, whereas %s does not"), if ((in_flags & EF_ARM_MAVERICK_FLOAT) != (out_flags & EF_ARM_MAVERICK_FLOAT)) { if (in_flags & EF_ARM_MAVERICK_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s uses Maverick instructions, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B uses Maverick instructions, whereas %B does not"), + ibfd, obfd); else - _bfd_error_handler (_("\ -ERROR: %s does not use Maverick instructions, whereas %s does"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B does not use Maverick instructions, whereas %B does"), + ibfd, obfd); flags_compatible = FALSE; } @@ -2592,15 +2576,13 @@ ERROR: %s does not use Maverick instructions, whereas %s does"), || (in_flags & EF_ARM_VFP_FLOAT) == 0) { if (in_flags & EF_ARM_SOFT_FLOAT) - _bfd_error_handler (_("\ -ERROR: %s uses software FP, whereas %s uses hardware FP"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B uses software FP, whereas %B uses hardware FP"), + ibfd, obfd); else - _bfd_error_handler (_("\ -ERROR: %s uses hardware FP, whereas %s uses software FP"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("ERROR: %B uses hardware FP, whereas %B uses software FP"), + ibfd, obfd); flags_compatible = FALSE; } @@ -2612,17 +2594,15 @@ ERROR: %s uses hardware FP, whereas %s uses software FP"), { if (in_flags & EF_ARM_INTERWORK) { - _bfd_error_handler (_("\ -Warning: %s supports interworking, whereas %s does not"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("Warning: %B supports interworking, whereas %B does not"), + ibfd, obfd); } else { - _bfd_error_handler (_("\ -Warning: %s does not support interworking, whereas %s does"), - bfd_archive_filename (ibfd), - bfd_get_filename (obfd)); + _bfd_error_handler + (_("Warning: %B does not support interworking, whereas %B does"), + ibfd, obfd); } } } diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c index ab98304be5..4994e08d87 100644 --- a/bfd/elf32-cris.c +++ b/bfd/elf32-cris.c @@ -918,11 +918,11 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, else if (unresolved_reloc) { _bfd_error_handler - (_("%s: unresolvable relocation %s against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), + (_("%B(%A): unresolvable relocation %s against symbol `%s'"), + input_bfd, + input_section, cris_elf_howto_table[r_type].name, - symname, - bfd_get_section_name (input_bfd, input_section)); + symname); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -975,14 +975,14 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, { (*_bfd_error_handler) ((h->got.offset == (bfd_vma) -1) - ? _("%s: No PLT nor GOT for relocation %s against\ - symbol `%s' from %s section") - : _("%s: No PLT for relocation %s against\ - symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), + ? _("%B(%A): No PLT nor GOT for relocation %s" + " against symbol `%s'") + : _("%B(%A): No PLT for relocation %s" + " against symbol `%s'"), + input_bfd, + input_section, cris_elf_howto_table[r_type].name, - symname[0] != '\0' ? symname : _("[whose name is lost]"), - bfd_get_section_name (input_bfd, input_section)); + symname[0] != '\0' ? symname : _("[whose name is lost]")); /* FIXME: Perhaps blaming input is not the right thing to do; this is probably an internal error. But it is true @@ -1103,19 +1103,21 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, allowed to pass us these kinds of things. */ if (h == NULL) (*_bfd_error_handler) - (_("%s: relocation %s with non-zero addend %d against local symbol from %s section"), - bfd_archive_filename (input_bfd), + (_("%B(%A): relocation %s with non-zero addend %d" + " against local symbol"), + input_bfd, + input_section, cris_elf_howto_table[r_type].name, - rel->r_addend, - bfd_get_section_name (input_bfd, input_section)); + rel->r_addend); else (*_bfd_error_handler) - (_("%s: relocation %s with non-zero addend %d against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), + (_("%B(%A): relocation %s with non-zero addend %d" + " against symbol `%s'"), + input_bfd, + input_section, cris_elf_howto_table[r_type].name, rel->r_addend, - symname[0] != '\0' ? symname : _("[whose name is lost]"), - bfd_get_section_name (input_bfd, input_section)); + symname[0] != '\0' ? symname : _("[whose name is lost]")); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -1135,11 +1137,11 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, && h->root.type == bfd_link_hash_undefweak)))) { (*_bfd_error_handler) - (_("%s: relocation %s is not allowed for global symbol: `%s' from %s section"), - bfd_archive_filename (input_bfd), + (_("%B(%A): relocation %s is not allowed for global symbol: `%s'"), + input_bfd, + input_section, cris_elf_howto_table[r_type].name, - symname, - bfd_get_section_name (input_bfd, input_section)); + symname); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1150,10 +1152,10 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (sgot == NULL) { (*_bfd_error_handler) - (_("%s: relocation %s in section %s with no GOT created"), - bfd_archive_filename (input_bfd), - cris_elf_howto_table[r_type].name, - bfd_get_section_name (input_bfd, input_section)); + (_("%B: relocation %s in section %A with no GOT created"), + input_bfd, + input_section, + cris_elf_howto_table[r_type].name); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -1269,8 +1271,8 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section, if (sreloc == NULL) { (*_bfd_error_handler) - (_("%s: Internal inconsistency; no relocation section %s"), - bfd_archive_filename (input_bfd), + (_("%B: Internal inconsistency; no relocation section %s"), + input_bfd, name); bfd_set_error (bfd_error_bad_value); @@ -2491,9 +2493,9 @@ cris_elf_check_relocs (abfd, info, sec, relocs) { /* FIXME: How do we make this optionally a warning only? */ (*_bfd_error_handler) - (_("%s, section %s:\n relocation %s should not be used in a shared object; recompile with -fPIC"), - bfd_archive_filename (abfd), - sec->name, + (_("%B, section %A:\n relocation %s should not be used in a shared object; recompile with -fPIC"), + abfd, + sec, cris_elf_howto_table[r_type].name); } /* Fall through. */ @@ -3011,9 +3013,9 @@ cris_elf_merge_private_bfd_data (ibfd, obfd) { (*_bfd_error_handler) ((new_flags & EF_CRIS_UNDERSCORE) - ? _("%s: uses _-prefixed symbols, but writing file with non-prefixed symbols") - : _("%s: uses non-prefixed symbols, but writing file with _-prefixed symbols"), - bfd_archive_filename (ibfd)); + ? _("%B: uses _-prefixed symbols, but writing file with non-prefixed symbols") + : _("%B: uses non-prefixed symbols, but writing file with _-prefixed symbols"), + ibfd); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c index 69d20bfe56..9341fe8acc 100644 --- a/bfd/elf32-frv.c +++ b/bfd/elf32-frv.c @@ -2042,9 +2042,8 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section, rel->r_addend)) { (*_bfd_error_handler) - (_("%s: relocation at `%s+0x%x' references symbol `%s' with nonzero addend"), - bfd_archive_filename (input_bfd), input_section->name, - rel->r_offset, name); + (_("%B: relocation at `%A+0x%x' references symbol `%s' with nonzero addend"), + input_bfd, input_section, rel->r_offset, name); return FALSE; } @@ -4237,8 +4236,8 @@ elf32_frv_check_relocs (abfd, info, sec, relocs) default: bad_reloc: (*_bfd_error_handler) - (_("%s: unsupported relocation type %i"), - bfd_archive_filename (abfd), ELF32_R_TYPE (rel->r_info)); + (_("%B: unsupported relocation type %i"), + abfd, ELF32_R_TYPE (rel->r_info)); return FALSE; } } diff --git a/bfd/elf32-gen.c b/bfd/elf32-gen.c index f2edf69da6..09cc5a1496 100644 --- a/bfd/elf32-gen.c +++ b/bfd/elf32-gen.c @@ -80,8 +80,8 @@ elf32_generic_link_add_symbols (abfd, info) Elf_Internal_Ehdr *ehdrp; ehdrp = elf_elfheader (abfd); - (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), - bfd_archive_filename (abfd), + (*_bfd_error_handler) (_("%B: Relocations in generic ELF (EM: %d)"), + abfd, ehdrp->e_machine); bfd_set_error (bfd_error_wrong_format); diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 67d1f50d43..8397943efa 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -539,8 +539,8 @@ hppa_add_stub (const char *stub_name, TRUE, FALSE); if (stub_entry == NULL) { - (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), - bfd_archive_filename (section->owner), + (*_bfd_error_handler) (_("%B: cannot create stub entry %s"), + section->owner, stub_name); return NULL; } @@ -792,9 +792,9 @@ hppa_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) || sym_value - 8 + (1 << (22 + 1)) >= (1 << (22 + 2)))) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"), - bfd_archive_filename (stub_entry->target_section->owner), - stub_sec->name, + (_("%B(%A+0x%lx): cannot reach %s, recompile with -ffunction-sections"), + stub_entry->target_section->owner, + stub_sec, (long) stub_entry->stub_offset, stub_entry->root.string); bfd_set_error (bfd_error_bad_value); @@ -1172,8 +1172,8 @@ elf32_hppa_check_relocs (bfd *abfd, if (info->shared) { (*_bfd_error_handler) - (_("%s: relocation %s can not be used when making a shared object; recompile with -fPIC"), - bfd_archive_filename (abfd), + (_("%B: relocation %s can not be used when making a shared object; recompile with -fPIC"), + abfd, elf_hppa_howto_table[r_type].name); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -1192,8 +1192,8 @@ elf32_hppa_check_relocs (bfd *abfd, if (info->shared) { (*_bfd_error_handler) - (_("%s: relocation %s should not be used when making a shared object; recompile with -fPIC"), - bfd_archive_filename (abfd), + (_("%B: relocation %s should not be used when making a shared object; recompile with -fPIC"), + abfd, elf_hppa_howto_table[r_type].name); } /* Fall through. */ @@ -2573,8 +2573,8 @@ get_local_syms (bfd *output_bfd, bfd *input_bfd, struct bfd_link_info *info) } else { - (*_bfd_error_handler) (_("%s: duplicate export stub %s"), - bfd_archive_filename (input_bfd), + (*_bfd_error_handler) (_("%B: duplicate export stub %s"), + input_bfd, stub_name); } } @@ -3164,9 +3164,9 @@ final_link_relocate (asection *input_section, and convert the associated add instruction, so issue an error. */ (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"), - bfd_archive_filename (input_bfd), - input_section->name, + (_("%B(%A+0x%lx): %s fixup for insn 0x%x is not supported in a non-shared link"), + input_bfd, + input_section, (long) rel->r_offset, howto->name, insn); @@ -3194,9 +3194,9 @@ final_link_relocate (asection *input_section, insn &= ~ (0x1f << 21); #if 0 /* debug them. */ (*_bfd_error_handler) - (_("%s(%s+0x%lx): fixing %s"), - bfd_archive_filename (input_bfd), - input_section->name, + (_("%B(%A+0x%lx): fixing %s"), + input_bfd, + input_section, (long) rel->r_offset, howto->name); #endif @@ -3317,9 +3317,9 @@ final_link_relocate (asection *input_section, && value + addend + max_branch_offset >= 2*max_branch_offset) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): cannot reach %s, recompile with -ffunction-sections"), - bfd_archive_filename (input_bfd), - input_section->name, + (_("%B(%A+0x%lx): cannot reach %s, recompile with -ffunction-sections"), + input_bfd, + input_section, (long) rel->r_offset, stub_entry->root.string); bfd_set_error (bfd_error_bad_value); @@ -3812,9 +3812,9 @@ elf32_hppa_relocate_section (bfd *output_bfd, if (r == bfd_reloc_notsupported || !warned_undef) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): cannot handle %s for %s"), - bfd_archive_filename (input_bfd), - input_section->name, + (_("%B(%A+0x%lx): cannot handle %s for %s"), + input_bfd, + input_section, (long) rel->r_offset, howto->name, sym_name); diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 49ecbb2583..a44ff4c881 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -367,8 +367,8 @@ i370_elf_merge_private_bfd_data (ibfd, obfd) else /* Incompatible flags */ { (*_bfd_error_handler) - ("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", - bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); + ("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)", + ibfd, (long) new_flags, (long) old_flags); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -891,9 +891,8 @@ i370_elf_check_relocs (abfd, info, sec, relocs) return TRUE; #ifdef DEBUG - fprintf (stderr, "i370_elf_check_relocs called for section %s in %s\n", - bfd_get_section_name (abfd, sec), - bfd_archive_filename (abfd)); + _bfd_error_handler ("i370_elf_check_relocs called for section %A in %B", + sec, abfd); #endif dynobj = elf_hash_table (info)->dynobj; @@ -1156,11 +1155,10 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, return TRUE; #ifdef DEBUG - fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n", - bfd_archive_filename (input_bfd), - bfd_section_name(input_bfd, input_section), - (long) input_section->reloc_count, - (info->relocatable) ? " (relocatable)" : ""); + _bfd_error_handler ("i370_elf_relocate_section called for %B section %A, %ld relocations%s", + input_bfd, input_section, + (long) input_section->reloc_count, + (info->relocatable) ? " (relocatable)" : ""); #endif if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table if needed */ @@ -1186,8 +1184,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, if ((unsigned)r_type >= (unsigned)R_I370_max || !i370_elf_howto_table[(int)r_type]) { - (*_bfd_error_handler) ("%s: unknown relocation type %d", - bfd_archive_filename (input_bfd), + (*_bfd_error_handler) ("%B: unknown relocation type %d", + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); @@ -1262,9 +1260,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, { default: (*_bfd_error_handler) - ("%s: unknown relocation type %d for symbol %s", - bfd_archive_filename (input_bfd), - (int) r_type, sym_name); + ("%B: unknown relocation type %d for symbol %s", + input_bfd, (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -1405,8 +1402,8 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section, case (int)R_I370_COPY: case (int)R_I370_RELATIVE: (*_bfd_error_handler) - ("%s: Relocation %s is not yet supported for symbol %s.", - bfd_archive_filename (input_bfd), + ("%B: Relocation %s is not yet supported for symbol %s.", + input_bfd, i370_elf_howto_table[(int) r_type]->name, sym_name); diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index e2fef2b44f..5eb34abe62 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -323,8 +323,8 @@ elf_i386_info_to_howto_rel (bfd *abfd ATTRIBUTE_UNUSED, && ((indx = r_type - R_386_vt_offset) - R_386_tls >= R_386_vt - R_386_tls)) { - (*_bfd_error_handler) (_("%s: invalid relocation type %d"), - bfd_archive_filename (abfd), (int) r_type); + (*_bfd_error_handler) (_("%B: invalid relocation type %d"), + abfd, (int) r_type); indx = R_386_NONE; } cache_ptr->howto = &elf_howto_table[indx]; @@ -861,8 +861,8 @@ elf_i386_check_relocs (bfd *abfd, if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -969,9 +969,9 @@ elf_i386_check_relocs (bfd *abfd, else { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and " + (_("%B: `%s' accessed both as normal and " "thread local symbol"), - bfd_archive_filename (abfd), + abfd, h ? h->root.root.string : ""); return FALSE; } @@ -1086,8 +1086,8 @@ elf_i386_check_relocs (bfd *abfd, name + 4) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -2039,13 +2039,9 @@ elf_i386_relocate_section (bfd *output_bfd, && ((indx = r_type - R_386_tls_offset) - R_386_ext >= R_386_tls - R_386_ext)) { - char *name = bfd_get_section_ident (input_section); (*_bfd_error_handler) - (_("%s: unrecognized relocation (0x%x) in section `%s'"), - bfd_archive_filename (input_bfd), r_type, - name ? name : input_section->name); - if (name) - free (name); + (_("%B: unrecognized relocation (0x%x) in section `%A'"), + input_bfd, input_section, r_type); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -2908,9 +2904,9 @@ elf_i386_relocate_section (bfd *output_bfd, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, h->root.root.string); return FALSE; @@ -2947,9 +2943,8 @@ elf_i386_relocate_section (bfd *output_bfd, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 6776a622c8..f929d7dec6 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -2606,8 +2606,8 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, r_type = ELF32_R_TYPE (rel->r_info); if (r_type < 0 || r_type >= (int) R_M32R_max) { - (*_bfd_error_handler) (_("%s: unknown relocation type %d"), - bfd_archive_filename (input_bfd), + (*_bfd_error_handler) (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -3195,11 +3195,11 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s: The target (%s) of an %s relocation is in the wrong section (%s)"), - bfd_archive_filename (input_bfd), + (_("%B: The target (%s) of an %s relocation is in the wrong section (%A)"), + input_bfd, + sec, sym_name, - m32r_elf_howto_table[(int) r_type].name, - bfd_get_section_name (abfd, sec)); + m32r_elf_howto_table[(int) r_type].name); /*bfd_set_error (bfd_error_bad_value); ??? why? */ ret = FALSE; continue; @@ -4262,8 +4262,7 @@ m32r_elf_merge_private_bfd_data (ibfd, obfd) || ((in_flags & EF_M32R_ARCH) == E_M32R2_ARCH)) { (*_bfd_error_handler) - (_("%s: Instruction set mismatch with previous modules"), - bfd_archive_filename (ibfd)); + (_("%B: Instruction set mismatch with previous modules"), ibfd); bfd_set_error (bfd_error_bad_value); return FALSE; diff --git a/bfd/elf32-m68hc1x.c b/bfd/elf32-m68hc1x.c index 190d257f7f..01529430a8 100644 --- a/bfd/elf32-m68hc1x.c +++ b/bfd/elf32-m68hc1x.c @@ -158,9 +158,8 @@ m68hc12_add_stub (const char *stub_name, asection *section, TRUE, FALSE); if (stub_entry == NULL) { - (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), - bfd_archive_filename (section->owner), - stub_name); + (*_bfd_error_handler) (_("%B: cannot create stub entry %s"), + section->owner, stub_name); return NULL; } @@ -1274,17 +1273,15 @@ _bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if ((new_flags & E_M68HC11_I32) != (old_flags & E_M68HC11_I32)) { (*_bfd_error_handler) - (_("%s: linking files compiled for 16-bit integers (-mshort) " - "and others for 32-bit integers"), - bfd_archive_filename (ibfd)); + (_("%B: linking files compiled for 16-bit integers (-mshort) " + "and others for 32-bit integers"), ibfd); ok = FALSE; } if ((new_flags & E_M68HC11_F64) != (old_flags & E_M68HC11_F64)) { (*_bfd_error_handler) - (_("%s: linking files compiled for 32-bit double (-fshort-double) " - "and others for 64-bit double"), - bfd_archive_filename (ibfd)); + (_("%B: linking files compiled for 32-bit double (-fshort-double) " + "and others for 64-bit double"), ibfd); ok = FALSE; } @@ -1292,9 +1289,8 @@ _bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (!EF_M68HC11_CAN_MERGE_MACH (new_flags, old_flags)) { (*_bfd_error_handler) - (_("%s: linking files compiled for HCS12 with " - "others compiled for HC12"), - bfd_archive_filename (ibfd)); + (_("%B: linking files compiled for HCS12 with " + "others compiled for HC12"), ibfd); ok = FALSE; } new_flags = ((new_flags & ~EF_M68HC11_MACH_MASK) @@ -1309,9 +1305,8 @@ _bfd_m68hc11_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (new_flags != old_flags) { (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (unsigned long) new_flags, - (unsigned long) old_flags); + (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + ibfd, (unsigned long) new_flags, (unsigned long) old_flags); ok = FALSE; } diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 842f38cd72..08cc793476 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1705,9 +1705,9 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, h->root.root.string); return FALSE; @@ -1744,9 +1744,8 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c index e6aa666c6d..b51649c4b9 100644 --- a/bfd/elf32-mcore.c +++ b/bfd/elf32-mcore.c @@ -350,8 +350,8 @@ mcore_elf_unsupported_reloc (abfd, reloc_entry, symbol, data, input_section, { BFD_ASSERT (reloc_entry->howto != (reloc_howto_type *)0); - _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), - bfd_archive_filename (abfd), + _bfd_error_handler (_("%B: Relocation %s (%d) is not currently supported.\n"), + abfd, reloc_entry->howto->name, reloc_entry->howto->type); @@ -406,12 +406,12 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, bfd_boolean ret = TRUE; #ifdef DEBUG - fprintf (stderr, - "mcore_elf_relocate_section called for %s section %s, %ld relocations%s\n", - bfd_archive_filename (input_bfd), - bfd_section_name(input_bfd, input_section), - (long) input_section->reloc_count, - (info->relocatable) ? " (relocatable)" : ""); + _bfd_error_handler + ("mcore_elf_relocate_section called for %B section %A, %ld relocations%s", + input_bfd, + input_section, + (long) input_section->reloc_count, + (info->relocatable) ? " (relocatable)" : ""); #endif if (info->relocatable) @@ -438,9 +438,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, if ((unsigned) r_type >= (unsigned) R_MCORE_max || ! mcore_elf_howto_table [(int)r_type]) { - _bfd_error_handler (_("%s: Unknown relocation type %d\n"), - bfd_archive_filename (input_bfd), - (int) r_type); + _bfd_error_handler (_("%B: Unknown relocation type %d\n"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -453,8 +452,8 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section, /* Complain about known relocation that are not yet supported. */ if (howto->special_function == mcore_elf_unsupported_reloc) { - _bfd_error_handler (_("%s: Relocation %s (%d) is not currently supported.\n"), - bfd_archive_filename (input_bfd), + _bfd_error_handler (_("%B: Relocation %s (%d) is not currently supported.\n"), + input_bfd, howto->name, (int)r_type); diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index e53c47d4a2..9c22c17244 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -2282,18 +2282,16 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: compiled with -mrelocatable and linked with " - "modules compiled normally"), - bfd_archive_filename (ibfd)); + (_("%B: compiled with -mrelocatable and linked with " + "modules compiled normally"), ibfd); } else if ((new_flags & (EF_PPC_RELOCATABLE | EF_PPC_RELOCATABLE_LIB)) == 0 && (old_flags & EF_PPC_RELOCATABLE) != 0) { error = TRUE; (*_bfd_error_handler) - (_("%s: compiled normally and linked with " - "modules compiled with -mrelocatable"), - bfd_archive_filename (ibfd)); + (_("%B: compiled normally and linked with " + "modules compiled with -mrelocatable"), ibfd); } /* The output is -mrelocatable-lib iff both the input files are. */ @@ -2319,9 +2317,9 @@ ppc_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields " + (_("%B: uses different e_flags (0x%lx) fields " "than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); + ibfd, (long) new_flags, (long) old_flags); } if (error) @@ -3561,8 +3559,8 @@ static void bad_shared_reloc (bfd *abfd, enum elf_ppc_reloc_type r_type) { (*_bfd_error_handler) - (_("%s: relocation %s cannot be used when making a shared object"), - bfd_archive_filename (abfd), + (_("%B: relocation %s cannot be used when making a shared object"), + abfd, ppc_elf_howto_table[r_type]->name); bfd_set_error (bfd_error_bad_value); } @@ -3588,9 +3586,8 @@ ppc_elf_check_relocs (bfd *abfd, return TRUE; #ifdef DEBUG - fprintf (stderr, "ppc_elf_check_relocs called for section %s in %s\n", - bfd_get_section_name (abfd, sec), - bfd_archive_filename (abfd)); + _bfd_error_handler ("ppc_elf_check_relocs called for section %A in %B", + sec, abfd); #endif /* Initialize howto table if not already done. */ @@ -3767,10 +3764,10 @@ ppc_elf_check_relocs (bfd *abfd, { /* It does not make sense to have a procedure linkage table entry for a local symbol. */ - (*_bfd_error_handler) (_("%s(%s+0x%lx): %s reloc against " + (*_bfd_error_handler) (_("%B(%A+0x%lx): %s reloc against " "local symbol"), - bfd_archive_filename (abfd), - sec->name, + abfd, + sec, (long) rel->r_offset, ppc_elf_howto_table[r_type]->name); bfd_set_error (bfd_error_bad_value); @@ -4664,12 +4661,11 @@ ppc_elf_relocate_section (bfd *output_bfd, bfd_boolean ret = TRUE; #ifdef DEBUG - fprintf (stderr, "ppc_elf_relocate_section called for %s section %s, " - "%ld relocations%s\n", - bfd_archive_filename (input_bfd), - bfd_section_name(input_bfd, input_section), - (long) input_section->reloc_count, - (info->relocatable) ? " (relocatable)" : ""); + _bfd_error_handler ("ppc_elf_relocate_section called for %B section %A, " + "%ld relocations%s", + input_bfd, input_section, + (long) input_section->reloc_count, + (info->relocatable) ? " (relocatable)" : ""); #endif if (info->relocatable) @@ -4972,8 +4968,8 @@ ppc_elf_relocate_section (bfd *output_bfd, { default: (*_bfd_error_handler) - (_("%s: unknown relocation type %d for symbol %s"), - bfd_archive_filename (input_bfd), (int) r_type, sym_name); + (_("%B: unknown relocation type %d for symbol %s"), + input_bfd, (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -5223,9 +5219,9 @@ ppc_elf_relocate_section (bfd *output_bfd, got at entry m+n bears little relation to the entry m. */ if (addend != 0) (*_bfd_error_handler) - (_("%s(%s+0x%lx): non-zero addend on %s reloc against `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): non-zero addend on %s reloc against `%s'"), + input_bfd, + input_section, (long) rel->r_offset, howto->name, sym_name); @@ -5534,9 +5530,9 @@ ppc_elf_relocate_section (bfd *output_bfd, && (name[5] == 0 || name[5] == '.')))) { (*_bfd_error_handler) - (_("%s: the target (%s) of a %s relocation is " + (_("%B: the target (%s) of a %s relocation is " "in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), + input_bfd, sym_name, howto->name, name); @@ -5560,9 +5556,9 @@ ppc_elf_relocate_section (bfd *output_bfd, || strncmp (name, ".sbss2", 6) == 0)) { (*_bfd_error_handler) - (_("%s: the target (%s) of a %s relocation is " + (_("%B: the target (%s) of a %s relocation is " "in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), + input_bfd, sym_name, howto->name, name); @@ -5619,9 +5615,9 @@ ppc_elf_relocate_section (bfd *output_bfd, else { (*_bfd_error_handler) - (_("%s: the target (%s) of a %s relocation is " + (_("%B: the target (%s) of a %s relocation is " "in the wrong output section (%s)"), - bfd_archive_filename (input_bfd), + input_bfd, sym_name, howto->name, name); @@ -5674,8 +5670,8 @@ ppc_elf_relocate_section (bfd *output_bfd, case R_PPC_EMB_RELST_HA: case R_PPC_EMB_BIT_FLD: (*_bfd_error_handler) - (_("%s: relocation %s is not yet supported for symbol %s."), - bfd_archive_filename (input_bfd), + (_("%B: relocation %s is not yet supported for symbol %s."), + input_bfd, howto->name, sym_name); @@ -5729,9 +5725,9 @@ ppc_elf_relocate_section (bfd *output_bfd, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, howto->name, sym_name); @@ -5779,9 +5775,8 @@ ppc_elf_relocate_section (bfd *output_bfd, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): %s reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, howto->name, sym_name, (int) r); ret = FALSE; } @@ -6023,20 +6018,20 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) length = asec->size; if (length < 24) { - error_message = _("corrupt or empty %s section in %s"); + error_message = _("corrupt or empty %s section in %B"); goto fail; } if (bfd_seek (ibfd, asec->filepos, SEEK_SET) != 0 || (bfd_bread (buffer + offset, length, ibfd) != length)) { - error_message = _("unable to read in %s section from %s"); + error_message = _("unable to read in %s section from %B"); goto fail; } /* Process the contents of the section. */ ptr = buffer + offset; - error_message = _("corrupt %s section in %s"); + error_message = _("corrupt %s section in %B"); /* Verify the contents of the header. Note - we have to extract the values this way in order to allow for a @@ -6079,14 +6074,13 @@ ppc_elf_begin_write_processing (bfd *abfd, struct bfd_link_info *link_info) if (! bfd_set_section_size (abfd, asec, output_section_size)) ibfd = abfd, - error_message = _("warning: unable to set size of %s section in %s"); + error_message = _("warning: unable to set size of %s section in %B"); fail: free (buffer); if (error_message) - (*_bfd_error_handler) (error_message, APUINFO_SECTION_NAME, - bfd_archive_filename (ibfd)); + (*_bfd_error_handler) (error_message, ibfd, APUINFO_SECTION_NAME); } diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 3c54d562ec..72ae02e832 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -980,9 +980,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), - r_symndx); + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -1158,8 +1157,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL) { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), h->root.root.string); + (_("%B: `%s' accessed both as normal and thread local symbol"), + abfd, h->root.root.string); return FALSE; } if (old_tls_type > tls_type) @@ -1269,8 +1268,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -2231,9 +2230,9 @@ invalid_tls_insn (input_bfd, input_section, rel) howto = elf_howto_table + ELF32_R_TYPE (rel->r_info); (*_bfd_error_handler) - (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): invalid instruction for TLS relocation %s"), + input_bfd, + input_section, (long) rel->r_offset, howto->name); } @@ -2993,9 +2992,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, && !((input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, h->root.root.string); @@ -3043,9 +3042,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } diff --git a/bfd/elf32-sh-symbian.c b/bfd/elf32-sh-symbian.c index 6c243399b2..1247c6f11a 100644 --- a/bfd/elf32-sh-symbian.c +++ b/bfd/elf32-sh-symbian.c @@ -125,8 +125,8 @@ sh_symbian_import_as (struct bfd_link_info *info, bfd * abfd, return TRUE; bfd_set_error (bfd_error_invalid_operation); - _bfd_error_handler (_("%s: IMPORT AS directive for %s conceals previous IMPORT AS"), - bfd_archive_filename (abfd), current_name); + _bfd_error_handler (_("%B: IMPORT AS directive for %s conceals previous IMPORT AS"), + abfd, current_name); return FALSE; } @@ -377,8 +377,8 @@ sh_symbian_process_embedded_commands (struct bfd_link_info *info, bfd * abfd, fprintf (stderr, "offset into .directive section: %d\n", directive - contents); bfd_set_error (bfd_error_invalid_operation); - _bfd_error_handler (_("%s: Unrecognised .directive command: %s"), - bfd_archive_filename (abfd), directive); + _bfd_error_handler (_("%B: Unrecognised .directive command: %s"), + abfd, directive); break; } } @@ -495,8 +495,8 @@ sh_symbian_relocate_section (bfd * output_bfd, & new_value, & new_hash, & skip, & override, & type_change_ok, & size_change_ok)) { - _bfd_error_handler (_("%s: Failed to add renamed symbol %s"), - bfd_archive_filename (input_bfd), ptr->new_name); + _bfd_error_handler (_("%B: Failed to add renamed symbol %s"), + input_bfd, ptr->new_name); continue; } /* XXX - should we check psec, skip, override etc ? */ diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index 00a7e4d56c..a5aa4ff7bc 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2242,8 +2242,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec, laddr = irel->r_offset + 4 + irel->r_addend; if (laddr >= sec->size) { - (*_bfd_error_handler) (_("%s: 0x%lx: warning: bad R_SH_USES offset"), - bfd_archive_filename (abfd), + (*_bfd_error_handler) (_("%B: 0x%lx: warning: bad R_SH_USES offset"), + abfd, (unsigned long) irel->r_offset); continue; } @@ -2254,8 +2254,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec, if ((insn & 0xf000) != 0xd000) { ((*_bfd_error_handler) - (_("%s: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"), - bfd_archive_filename (abfd), (unsigned long) irel->r_offset, insn)); + (_("%B: 0x%lx: warning: R_SH_USES points to unrecognized insn 0x%x"), + abfd, (unsigned long) irel->r_offset, insn)); continue; } @@ -2271,8 +2271,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec, if (paddr >= sec->size) { ((*_bfd_error_handler) - (_("%s: 0x%lx: warning: bad R_SH_USES load offset"), - bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); + (_("%B: 0x%lx: warning: bad R_SH_USES load offset"), + abfd, (unsigned long) irel->r_offset)); continue; } @@ -2286,8 +2286,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec, if (irelfn >= irelend) { ((*_bfd_error_handler) - (_("%s: 0x%lx: warning: could not find expected reloc"), - bfd_archive_filename (abfd), (unsigned long) paddr)); + (_("%B: 0x%lx: warning: could not find expected reloc"), + abfd, (unsigned long) paddr)); continue; } @@ -2314,8 +2314,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec, != (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec)) { ((*_bfd_error_handler) - (_("%s: 0x%lx: warning: symbol in unexpected section"), - bfd_archive_filename (abfd), (unsigned long) paddr)); + (_("%B: 0x%lx: warning: symbol in unexpected section"), + abfd, (unsigned long) paddr)); continue; } @@ -2439,8 +2439,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec, if (irelcount >= irelend) { ((*_bfd_error_handler) - (_("%s: 0x%lx: warning: could not find expected COUNT reloc"), - bfd_archive_filename (abfd), (unsigned long) paddr)); + (_("%B: 0x%lx: warning: could not find expected COUNT reloc"), + abfd, (unsigned long) paddr)); continue; } @@ -2448,8 +2448,8 @@ sh_elf_relax_section (bfd *abfd, asection *sec, just deleted one. */ if (irelcount->r_addend == 0) { - ((*_bfd_error_handler) (_("%s: 0x%lx: warning: bad count"), - bfd_archive_filename (abfd), + ((*_bfd_error_handler) (_("%B: 0x%lx: warning: bad count"), + abfd, (unsigned long) paddr)); continue; } @@ -2843,8 +2843,8 @@ sh_elf_relax_delete_bytes (bfd *abfd, asection *sec, bfd_vma addr, if (overflow) { ((*_bfd_error_handler) - (_("%s: 0x%lx: fatal: reloc overflow while relaxing"), - bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); + (_("%B: 0x%lx: fatal: reloc overflow while relaxing"), + abfd, (unsigned long) irel->r_offset)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -3213,8 +3213,8 @@ sh_elf_swap_insns (bfd *abfd, asection *sec, void *relocs, if (overflow) { ((*_bfd_error_handler) - (_("%s: 0x%lx: fatal: reloc overflow while relaxing"), - bfd_archive_filename (abfd), (unsigned long) irel->r_offset)); + (_("%B: 0x%lx: fatal: reloc overflow while relaxing"), + abfd, (unsigned long) irel->r_offset)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -4795,9 +4795,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (howto->rightshift || howto->src_mask != 0xffffffff) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): %s relocation against SEC_MERGE section"), + input_bfd, input_section, (long) rel->r_offset, howto->name); return FALSE; } @@ -4900,9 +4899,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else if (sec->output_section == NULL) { (*_bfd_error_handler) - (_("%s: unresolvable relocation against symbol `%s' from %s section"), - bfd_archive_filename (input_bfd), h->root.root.string, - bfd_get_section_name (input_bfd, input_section)); + (_("%B(%A): unresolvable relocation against symbol `%s'"), + input_bfd, input_section, h->root.root.string); return FALSE; } else @@ -4971,8 +4969,8 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (disp & mask) { ((*_bfd_error_handler) - (_("%s: 0x%lx: fatal: unaligned branch target for relax-support relocation"), - bfd_archive_filename (input_section->owner), + (_("%B: 0x%lx: fatal: unaligned branch target for relax-support relocation"), + input_section->owner, (unsigned long) rel->r_offset)); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -5004,10 +5002,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (relocation & 3) { ((*_bfd_error_handler) - (_("%s: 0x%lx: fatal: unaligned %s relocation 0x%lx"), - bfd_archive_filename (input_section->owner), + (_("%B: 0x%lx: fatal: unaligned %s relocation 0x%lx"), + input_section->owner, (unsigned long) rel->r_offset, howto->name, - (unsigned long)relocation)); + (unsigned long) relocation)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5019,10 +5017,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, if (relocation & 1) { ((*_bfd_error_handler) - (_("%s: 0x%lx: fatal: unaligned %s relocation 0x%lx"), - bfd_archive_filename (input_section->owner), + (_("%B: 0x%lx: fatal: unaligned %s relocation 0x%lx"), + input_section->owner, (unsigned long) rel->r_offset, howto->name, - (unsigned long)relocation)); + (unsigned long) relocation)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5033,10 +5031,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, || (signed int)relocation > 32) { ((*_bfd_error_handler) - (_("%s: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32"), - bfd_archive_filename (input_section->owner), + (_("%B: 0x%lx: fatal: R_SH_PSHA relocation %d not in range -32..32"), + input_section->owner, (unsigned long) rel->r_offset, - (unsigned long)relocation)); + (unsigned long) relocation)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5047,10 +5045,10 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, || (signed int)relocation > 16) { ((*_bfd_error_handler) - (_("%s: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32"), - bfd_archive_filename (input_section->owner), + (_("%B: 0x%lx: fatal: R_SH_PSHL relocation %d not in range -32..32"), + input_section->owner, (unsigned long) rel->r_offset, - (unsigned long)relocation)); + (unsigned long) relocation)); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -6577,8 +6575,8 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, else { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), h->root.root.string); + (_("%B: `%s' accessed both as normal and thread local symbol"), + abfd, h->root.root.string); return FALSE; } } @@ -6789,8 +6787,9 @@ sh_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, case R_SH_TLS_LE_32: if (info->shared) { - (*_bfd_error_handler) (_("%s: TLS local exec code cannot be linked into shared objects"), - bfd_archive_filename (abfd)); + (*_bfd_error_handler) + (_("%B: TLS local exec code cannot be linked into shared objects"), + abfd); return FALSE; } @@ -6914,9 +6913,9 @@ sh_elf_merge_private_data (bfd *ibfd, bfd *obfd) if (! sh_merge_bfd_arch (ibfd, obfd)) { - _bfd_error_handler ("%s: uses instructions which are incompatible " + _bfd_error_handler ("%B: uses instructions which are incompatible " "with instructions used in previous modules", - bfd_archive_filename (ibfd)); + ibfd); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c index d87ff7a46a..5b80533419 100644 --- a/bfd/elf32-sparc.c +++ b/bfd/elf32-sparc.c @@ -913,9 +913,8 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs) if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), - r_symndx); + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -1037,9 +1036,8 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs) else { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), - h ? h->root.root.string : ""); + (_("%B: `%s' accessed both as normal and thread local symbol"), + abfd, h ? h->root.root.string : ""); return FALSE; } } @@ -2495,8 +2493,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, { BFD_FAIL (); (*_bfd_error_handler) - (_("%s: probably compiled without -fPIC?"), - bfd_archive_filename (input_bfd)); + (_("%B: probably compiled without -fPIC?"), + input_bfd); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -2853,9 +2851,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section, && !((input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, h->root.root.string); @@ -3318,8 +3316,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: compiled for a 64 bit system and target is 32 bit"), - bfd_archive_filename (ibfd)); + (_("%B: compiled for a 64 bit system and target is 32 bit"), ibfd); } else if ((ibfd->flags & DYNAMIC) == 0) { @@ -3332,8 +3329,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd) && previous_ibfd_e_flags != (unsigned long) -1) { (*_bfd_error_handler) - (_("%s: linking little endian files with big endian files"), - bfd_archive_filename (ibfd)); + (_("%B: linking little endian files with big endian files"), ibfd); error = TRUE; } previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA; diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c index d52c303b0e..763220acce 100644 --- a/bfd/elf32-v850.c +++ b/bfd/elf32-v850.c @@ -656,9 +656,8 @@ v850_elf_check_relocs (abfd, info, sec, relocs) return TRUE; #ifdef DEBUG - fprintf (stderr, "v850_elf_check_relocs called for section %s in %s\n", - bfd_get_section_name (abfd, sec), - bfd_archive_filename (abfd)); + _bfd_error_handler ("v850_elf_check_relocs called for section %A in %B", + sec, abfd); #endif dynobj = elf_hash_table (info)->dynobj; @@ -1948,8 +1947,8 @@ v850_elf_merge_private_bfd_data (ibfd, obfd) return TRUE; } - _bfd_error_handler (_("%s: Architecture mismatch with previous modules"), - bfd_archive_filename (ibfd)); + _bfd_error_handler (_("%B: Architecture mismatch with previous modules"), + ibfd); } return TRUE; diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index c2596625ee..cfdbd235fd 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -641,9 +641,8 @@ elf_xtensa_check_relocs (abfd, info, sec, relocs) if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), - r_symndx); + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -2103,9 +2102,9 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd, && !((input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, h->root.root.string); @@ -2523,8 +2522,8 @@ elf_xtensa_merge_private_bfd_data (ibfd, obfd) if (out_mach != in_mach) { (*_bfd_error_handler) - ("%s: incompatible machine type. Output is 0x%x. Input is 0x%x", - bfd_archive_filename (ibfd), out_mach, in_mach); + ("%B: incompatible machine type. Output is 0x%x. Input is 0x%x", + ibfd, out_mach, in_mach); bfd_set_error (bfd_error_wrong_format); return FALSE; } diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 7b17db5433..a1f4e03cfb 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -1257,8 +1257,8 @@ elf64_alpha_relax_with_lituse (info, symval, irel) if (lit_insn >> 26 != OP_LDQ) { ((*_bfd_error_handler) - ("%s: %s+0x%lx: warning: LITERAL relocation against unexpected insn", - bfd_archive_filename (info->abfd), info->sec->name, + ("%B: %A+0x%lx: warning: LITERAL relocation against unexpected insn", + info->abfd, info->sec, (unsigned long) irel->r_offset)); return TRUE; } @@ -1570,8 +1570,8 @@ elf64_alpha_relax_got_load (info, symval, irel, r_type) { reloc_howto_type *howto = elf64_alpha_howto_table + r_type; ((*_bfd_error_handler) - ("%s: %s+0x%lx: warning: %s relocation against unexpected insn", - bfd_archive_filename (info->abfd), info->sec->name, + ("%B: %A+0x%lx: warning: %s relocation against unexpected insn", + info->abfd, info->sec, (unsigned long) irel->r_offset, howto->name)); return TRUE; } @@ -3638,9 +3638,8 @@ elf64_alpha_size_got_sections (info) { /* Yikes! A single object file has too many entries. */ (*_bfd_error_handler) - (_("%s: .got subsegment exceeds 64K (size %d)"), - bfd_archive_filename (i), - alpha_elf_tdata (this_got)->total_got_size); + (_("%B: .got subsegment exceeds 64K (size %d)"), + i, alpha_elf_tdata (this_got)->total_got_size); return FALSE; } @@ -4180,8 +4179,8 @@ elf64_alpha_relocate_section_r (output_bfd, info, input_bfd, input_section, if (r_type >= R_ALPHA_max) { (*_bfd_error_handler) - (_("%s: unknown relocation type %d"), - bfd_archive_filename (input_bfd), (int)r_type); + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret_val = FALSE; continue; @@ -4306,8 +4305,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (r_type >= R_ALPHA_max) { (*_bfd_error_handler) - (_("%s: unknown relocation type %d"), - bfd_archive_filename (input_bfd), (int)r_type); + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret_val = FALSE; continue; @@ -4478,8 +4477,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: gp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: gp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT(gp != 0); @@ -4490,8 +4489,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: gp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: gp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT(gp != 0); @@ -4516,8 +4515,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: pc-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: pc-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } /* The regular PC-relative stuff measures from the start of @@ -4544,8 +4543,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, && gotobj != alpha_elf_tdata (sec->owner)->gotobj) { (*_bfd_error_handler) - (_("%s: change in gp: BRSGP %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: change in gp: BRSGP %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } @@ -4574,8 +4573,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, name = bfd_section_name (input_bfd, sec); } (*_bfd_error_handler) - (_("%s: !samegp reloc against symbol without .prologue: %s"), - bfd_archive_filename (input_bfd), name); + (_("%B: !samegp reloc against symbol without .prologue: %s"), + input_bfd, name); ret_val = FALSE; break; } @@ -4625,8 +4624,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (r_type == R_ALPHA_REFLONG) { (*_bfd_error_handler) - (_("%s: unhandled dynamic relocation against %s"), - bfd_archive_filename (input_bfd), + (_("%B: unhandled dynamic relocation against %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } @@ -4649,8 +4648,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: pc-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: pc-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } @@ -4708,8 +4707,8 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: dtp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: dtp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); @@ -4724,15 +4723,15 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, if (info->shared) { (*_bfd_error_handler) - (_("%s: TLS local exec code cannot be linked into shared objects"), - bfd_archive_filename (input_bfd)); + (_("%B: TLS local exec code cannot be linked into shared objects"), + input_bfd); ret_val = FALSE; } else if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: tp-relative relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.root.string); + (_("%B: tp-relative relocation against dynamic symbol %s"), + input_bfd, h->root.root.root.string); ret_val = FALSE; } BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); diff --git a/bfd/elf64-gen.c b/bfd/elf64-gen.c index be1dc3e00e..6b9e22f68d 100644 --- a/bfd/elf64-gen.c +++ b/bfd/elf64-gen.c @@ -80,9 +80,8 @@ elf64_generic_link_add_symbols (abfd, info) Elf_Internal_Ehdr *ehdrp; ehdrp = elf_elfheader (abfd); - (*_bfd_error_handler) (_("%s: Relocations in generic ELF (EM: %d)"), - bfd_archive_filename (abfd), - ehdrp->e_machine); + (*_bfd_error_handler) (_("%B: Relocations in generic ELF (EM: %d)"), + abfd, ehdrp->e_machine); bfd_set_error (bfd_error_wrong_format); return FALSE; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index b801887a26..fca84ac87c 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2432,13 +2432,13 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) const char *msg; if (bfd_big_endian (ibfd)) - msg = _("%s: compiled for a big endian system " + msg = _("%B: compiled for a big endian system " "and target is little endian"); else - msg = _("%s: compiled for a little endian system " + msg = _("%B: compiled for a little endian system " "and target is big endian"); - (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd)); + (*_bfd_error_handler) (msg, ibfd); bfd_set_error (bfd_error_wrong_format); return FALSE; @@ -3205,9 +3205,8 @@ ppc_add_stub (const char *stub_name, TRUE, FALSE); if (stub_entry == NULL) { - (*_bfd_error_handler) (_("%s: cannot create stub entry %s"), - bfd_archive_filename (section->owner), - stub_name); + (*_bfd_error_handler) (_("%B: cannot create stub entry %s"), + section->owner, stub_name); return NULL; } @@ -4175,8 +4174,8 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); bfd_set_error (bfd_error_bad_value); } @@ -5320,8 +5319,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) something silly in .opd with the assembler. No .opd optimization for them! */ (*_bfd_error_handler) - (_("%s: .opd is not a regular array of opd entries"), - bfd_archive_filename (ibfd)); + (_("%B: .opd is not a regular array of opd entries"), ibfd); need_edit = FALSE; break; } @@ -5330,8 +5328,8 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) || (r_type = ELF64_R_TYPE ((rel + 1)->r_info)) != R_PPC64_TOC) { (*_bfd_error_handler) - (_("%s: unexpected reloc type %u in .opd section"), - bfd_archive_filename (ibfd), r_type); + (_("%B: unexpected reloc type %u in .opd section"), + ibfd, r_type); need_edit = FALSE; break; } @@ -5350,9 +5348,8 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info) sym_name = bfd_elf_local_sym_name (ibfd, sym); (*_bfd_error_handler) - (_("%s: undefined sym `%s' in .opd section"), - bfd_archive_filename (ibfd), - sym_name); + (_("%B: undefined sym `%s' in .opd section"), + ibfd, sym_name); need_edit = FALSE; break; } @@ -7913,10 +7910,10 @@ ppc64_elf_relocate_section (bfd *output_bfd, else (*_bfd_error_handler) (sym_type == STT_TLS - ? _("%s(%s+0x%lx): %s used with TLS symbol %s") - : _("%s(%s+0x%lx): %s used with non-TLS symbol %s"), - bfd_archive_filename (input_bfd), - input_section->name, + ? _("%B(%A+0x%lx): %s used with TLS symbol %s") + : _("%B(%A+0x%lx): %s used with non-TLS symbol %s"), + input_bfd, + input_section, (long) rel->r_offset, ppc64_elf_howto_table[r_type]->name, sym_name); @@ -8314,21 +8311,21 @@ ppc64_elf_relocate_section (bfd *output_bfd, || strcmp (input_section->output_section->name, ".fini") == 0) (*_bfd_error_handler) - (_("%s(%s+0x%lx): automatic multiple TOCs " + (_("%B(%A+0x%lx): automatic multiple TOCs " "not supported using your crt files; " "recompile with -mminimal-toc or upgrade gcc"), - bfd_archive_filename (input_bfd), - input_section->name, + input_bfd, + input_section, (long) rel->r_offset); else (*_bfd_error_handler) - (_("%s(%s+0x%lx): sibling call optimization to `%s' " + (_("%B(%A+0x%lx): sibling call optimization to `%s' " "does not allow automatic multiple TOCs; " "recompile with -mminimal-toc or " "-fno-optimize-sibling-calls, " "or make `%s' extern"), - bfd_archive_filename (input_bfd), - input_section->name, + input_bfd, + input_section, (long) rel->r_offset, sym_name, sym_name); @@ -8424,8 +8421,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, { default: (*_bfd_error_handler) - (_("%s: unknown relocation type %d for symbol %s"), - bfd_archive_filename (input_bfd), (int) r_type, sym_name); + (_("%B: unknown relocation type %d for symbol %s"), + input_bfd, (int) r_type, sym_name); bfd_set_error (bfd_error_bad_value); ret = FALSE; @@ -8964,8 +8961,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, /* These ones haven't been implemented yet. */ (*_bfd_error_handler) - (_("%s: relocation %s is not supported for symbol %s."), - bfd_archive_filename (input_bfd), + (_("%B: relocation %s is not supported for symbol %s."), + input_bfd, ppc64_elf_howto_table[r_type]->name, sym_name); bfd_set_error (bfd_error_invalid_operation); @@ -9043,8 +9040,8 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (((relocation + addend) & mask) != 0) { (*_bfd_error_handler) - (_("%s: error: relocation %s not a multiple of %d"), - bfd_archive_filename (input_bfd), + (_("%B: error: relocation %s not a multiple of %d"), + input_bfd, ppc64_elf_howto_table[r_type]->name, mask + 1); bfd_set_error (bfd_error_bad_value); @@ -9062,9 +9059,9 @@ ppc64_elf_relocate_section (bfd *output_bfd, && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable %s relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, ppc64_elf_howto_table[(int) r_type]->name, h->root.root.string); @@ -9108,9 +9105,9 @@ ppc64_elf_relocate_section (bfd *output_bfd, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): %s reloc against `%s': error %d"), + input_bfd, + input_section, (long) rel->r_offset, ppc64_elf_howto_table[r_type]->name, sym_name, diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 2c3246fb36..821ea51fb4 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -933,8 +933,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -1119,8 +1119,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) if (old_tls_type == GOT_NORMAL || tls_type == GOT_NORMAL) { (*_bfd_error_handler) - (_("%s: `%s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), h->root.root.string); + (_("%B: `%s' accessed both as normal and thread local symbol"), + abfd, h->root.root.string); return FALSE; } if (old_tls_type > tls_type) @@ -1233,8 +1233,8 @@ elf_s390_check_relocs (abfd, info, sec, relocs) name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -2201,9 +2201,9 @@ invalid_tls_insn (input_bfd, input_section, rel) howto = elf_howto_table + ELF64_R_TYPE (rel->r_info); (*_bfd_error_handler) - (_("%s(%s+0x%lx): invalid instruction for TLS relocation %s"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): invalid instruction for TLS relocation %s"), + input_bfd, + input_section, (long) rel->r_offset, howto->name); } @@ -2989,9 +2989,9 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, && !((input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, h->root.root.string); @@ -3039,9 +3039,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index e94aff18c8..ea6f4df34e 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -1593,9 +1593,8 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, if (howto->rightshift || howto->src_mask != 0xffffffff) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): %s relocation against SEC_MERGE section"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): %s relocation against SEC_MERGE section"), + input_bfd, input_section, (long) rel->r_offset, howto->name); return FALSE; } diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 75704e2e56..ca35eecba2 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -1368,9 +1368,8 @@ sparc64_elf_check_relocs (abfd, info, sec, relocs) break; default: - (*_bfd_error_handler) (_("%s: check_relocs: unhandled reloc type %d"), - bfd_archive_filename (abfd), - ELF64_R_TYPE_ID (rel->r_info)); + (*_bfd_error_handler) (_("%B: check_relocs: unhandled reloc type %d"), + abfd, ELF64_R_TYPE_ID (rel->r_info)); return FALSE; } } @@ -1405,8 +1404,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) case 6: reg -= 4; break; default: (*_bfd_error_handler) - (_("%s: Only registers %%g[2367] can be declared using STT_REGISTER"), - bfd_archive_filename (abfd)); + (_("%B: Only registers %%g[2367] can be declared using STT_REGISTER"), + abfd); return FALSE; } @@ -1425,10 +1424,10 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (p->name != NULL && strcmp (p->name, *namep)) { (*_bfd_error_handler) - (_("Register %%g%d used incompatibly: %s in %s, previously %s in %s"), - (int) sym->st_value, - **namep ? *namep : "#scratch", bfd_archive_filename (abfd), - *p->name ? p->name : "#scratch", bfd_archive_filename (p->abfd)); + (_("Register %%g%d used incompatibly: %s in %B, previously %s in %B"), + abfd, p->abfd, (int) sym->st_value, + **namep ? *namep : "#scratch", + *p->name ? p->name : "#scratch"); return FALSE; } @@ -1448,9 +1447,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (type > STT_FUNC) type = 0; (*_bfd_error_handler) - (_("Symbol `%s' has differing types: REGISTER in %s, previously %s in %s"), - *namep, bfd_archive_filename (abfd), - stt_types[type], bfd_archive_filename (p->abfd)); + (_("Symbol `%s' has differing types: REGISTER in %B, previously %s in %B"), + abfd, p->abfd, *namep, stt_types[type]); return FALSE; } @@ -1494,9 +1492,8 @@ sparc64_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) if (type > STT_FUNC) type = 0; (*_bfd_error_handler) - (_("Symbol `%s' has differing types: %s in %s, previously REGISTER in %s"), - *namep, stt_types[type], bfd_archive_filename (abfd), - bfd_archive_filename (p->abfd)); + (_("Symbol `%s' has differing types: %s in %B, previously REGISTER in %B"), + abfd, p->abfd, *namep, stt_types[type]); return FALSE; } } @@ -2275,8 +2272,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, { BFD_FAIL (); (*_bfd_error_handler) - (_("%s: probably compiled without -fPIC?"), - bfd_archive_filename (input_bfd)); + (_("%B: probably compiled without -fPIC?"), + input_bfd); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -2619,9 +2616,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, && !((input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, input_section, (long) rel->r_offset, h->root.root.string); @@ -3003,8 +2999,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: linking UltraSPARC specific with HAL specific code"), - bfd_archive_filename (ibfd)); + (_("%B: linking UltraSPARC specific with HAL specific code"), + ibfd); } /* Choose the most restrictive memory ordering. */ old_mm = (old_flags & EF_SPARCV9_MM); @@ -3022,8 +3018,8 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd) { error = TRUE; (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (long) new_flags, (long) old_flags); + (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + ibfd, (long) new_flags, (long) old_flags); } elf_elfheader (obfd)->e_flags = old_flags; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 683cf8c614..a5c5c9fedc 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -641,9 +641,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) { - (*_bfd_error_handler) (_("%s: bad symbol index: %d"), - bfd_archive_filename (abfd), - r_symndx); + (*_bfd_error_handler) (_("%B: bad symbol index: %d"), + abfd, r_symndx); return FALSE; } @@ -663,8 +662,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, if (info->shared) { (*_bfd_error_handler) - (_("%s: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), - bfd_archive_filename (abfd), + (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), + abfd, x86_64_elf_howto_table[r_type].name, (h) ? h->root.root.string : "a local symbol"); bfd_set_error (bfd_error_bad_value); @@ -731,9 +730,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, else { (*_bfd_error_handler) - (_("%s: %s' accessed both as normal and thread local symbol"), - bfd_archive_filename (abfd), - h ? h->root.root.string : ""); + (_("%B: %s' accessed both as normal and thread local symbol"), + abfd, h ? h->root.root.string : ""); return FALSE; } } @@ -789,8 +787,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, && (sec->flags & SEC_READONLY) != 0) { (*_bfd_error_handler) - (_("%s: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), - bfd_archive_filename (abfd), + (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), + abfd, x86_64_elf_howto_table[r_type].name, (h) ? h->root.root.string : "a local symbol"); bfd_set_error (bfd_error_bad_value); @@ -881,8 +879,8 @@ elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec, name + 5) != 0) { (*_bfd_error_handler) - (_("%s: bad relocation section name `%s\'"), - bfd_archive_filename (abfd), name); + (_("%B: bad relocation section name `%s\'"), + abfd, name); } if (htab->elf.dynobj == NULL) @@ -1954,8 +1952,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && (input_section->flags & SEC_READONLY) != 0) { (*_bfd_error_handler) - (_("%s: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), - bfd_archive_filename (input_bfd), + (_("%B: relocation %s against `%s' can not be used when making a shared object; recompile with -fPIC"), + input_bfd, x86_64_elf_howto_table[r_type].name, (h) ? h->root.root.string : "a local symbol"); bfd_set_error (bfd_error_bad_value); @@ -2408,9 +2406,9 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, && !((input_section->flags & SEC_DEBUGGING) != 0 && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0)) (*_bfd_error_handler) - (_("%s(%s+0x%lx): unresolvable relocation against symbol `%s'"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): unresolvable relocation against symbol `%s'"), + input_bfd, + input_section, (long) rel->r_offset, h->root.root.string); @@ -2451,9 +2449,8 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info, else { (*_bfd_error_handler) - (_("%s(%s+0x%lx): reloc against `%s': error %d"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (input_bfd, input_section), + (_("%B(%A+0x%lx): reloc against `%s': error %d"), + input_bfd, input_section, (long) rel->r_offset, name, (int) r); return FALSE; } diff --git a/bfd/elflink.c b/bfd/elflink.c index 82220ecf57..346e828e04 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -1392,8 +1392,8 @@ nondefault: if (hi->root.type != bfd_link_hash_defined && hi->root.type != bfd_link_hash_defweak) (*_bfd_error_handler) - (_("%s: warning: unexpected redefinition of indirect versioned symbol `%s'"), - bfd_archive_filename (abfd), shortname); + (_("%B: unexpected redefinition of indirect versioned symbol `%s'"), + abfd, shortname); } else { @@ -1711,8 +1711,8 @@ _bfd_elf_link_assign_sym_version (struct elf_link_hash_entry *h, void *data) /* We could not find the version for a symbol when generating a shared archive. Return an error. */ (*_bfd_error_handler) - (_("%s: undefined versioned symbol name %s"), - bfd_get_filename (sinfo->output_bfd), h->root.root.string); + (_("%B: undefined versioned symbol name %s"), + sinfo->output_bfd, h->root.root.string); bfd_set_error (bfd_error_bad_value); sinfo->failed = TRUE; return FALSE; @@ -1859,14 +1859,11 @@ elf_link_read_relocs_from_section (bfd *abfd, r_symndx >>= 24; if ((size_t) r_symndx >= nsyms) { - char *sec_name = bfd_get_section_ident (sec); (*_bfd_error_handler) - (_("%s: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in section `%s'"), - bfd_archive_filename (abfd), (unsigned long) r_symndx, - (unsigned long) nsyms, irela->r_offset, - sec_name ? sec_name : sec->name); - if (sec_name) - free (sec_name); + (_("%B: bad reloc symbol index (0x%lx >= 0x%lx)" + " for offset 0x%lx in section `%A'"), + abfd, sec, + (unsigned long) r_symndx, (unsigned long) nsyms, irela->r_offset); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -2052,14 +2049,9 @@ _bfd_elf_link_output_relocs (bfd *output_bfd, } else { - char *sec_name = bfd_get_section_ident (input_section); (*_bfd_error_handler) - (_("%s: relocation size mismatch in %s section %s"), - bfd_get_filename (output_bfd), - bfd_archive_filename (input_section->owner), - sec_name ? sec_name : input_section->name); - if (sec_name) - free (sec_name); + (_("%B: relocation size mismatch in %B section %A"), + output_bfd, input_section->owner, input_section); bfd_set_error (bfd_error_wrong_object_format); return FALSE; } @@ -3467,8 +3459,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (vernum > elf_tdata (abfd)->dynverdef_hdr.sh_info) { (*_bfd_error_handler) - (_("%s: %s: invalid version %u (max %d)"), - bfd_archive_filename (abfd), name, vernum, + (_("%B: %s: invalid version %u (max %d)"), + abfd, name, vernum, elf_tdata (abfd)->dynverdef_hdr.sh_info); bfd_set_error (bfd_error_bad_value); goto error_free_vers; @@ -3508,8 +3500,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (verstr == NULL) { (*_bfd_error_handler) - (_("%s: %s: invalid needed version %d"), - bfd_archive_filename (abfd), name, vernum); + (_("%B: %s: invalid needed version %d"), + abfd, name, vernum); bfd_set_error (bfd_error_bad_value); goto error_free_vers; } @@ -3683,12 +3675,10 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) if (normal_align < common_align) (*_bfd_error_handler) - (_("Warning: alignment %u of symbol `%s' in %s is smaller than %u in %s"), - 1 << normal_align, - name, - bfd_archive_filename (normal_bfd), - 1 << common_align, - bfd_archive_filename (common_bfd)); + (_("Warning: alignment %u of symbol `%s' in %B" + " is smaller than %u in %B"), + normal_bfd, common_bfd, + 1 << normal_align, name, 1 << common_align); } /* Remember the symbol size and type. */ @@ -3697,11 +3687,11 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { if (h->size != 0 && h->size != isym->st_size && ! size_change_ok) (*_bfd_error_handler) - (_("Warning: size of symbol `%s' changed from %lu in %s to %lu in %s"), + (_("Warning: size of symbol `%s' changed" + " from %lu in %B to %lu in %B"), + old_bfd, abfd, name, (unsigned long) h->size, - bfd_archive_filename (old_bfd), - (unsigned long) isym->st_size, - bfd_archive_filename (abfd)); + (unsigned long) isym->st_size); h->size = isym->st_size; } @@ -3721,9 +3711,9 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) && h->type != ELF_ST_TYPE (isym->st_info) && ! type_change_ok) (*_bfd_error_handler) - (_("Warning: type of symbol `%s' changed from %d to %d in %s"), - name, h->type, ELF_ST_TYPE (isym->st_info), - bfd_archive_filename (abfd)); + (_("Warning: type of symbol `%s' changed" + " from %d to %d in %B"), + abfd, name, h->type, ELF_ST_TYPE (isym->st_info)); h->type = ELF_ST_TYPE (isym->st_info); } @@ -3861,7 +3851,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info) { (*_bfd_error_handler) (_("%s: invalid DSO for symbol `%s' definition"), - bfd_archive_filename (abfd), name); + abfd, name); bfd_set_error (bfd_error_bad_value); goto error_free_vers; } @@ -4967,8 +4957,8 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd, == SHT_PREINIT_ARRAY) { (*_bfd_error_handler) - (_("%s: .preinit_array section is not allowed in DSO"), - bfd_archive_filename (sub)); + (_("%B: .preinit_array section is not allowed in DSO"), + sub); break; } @@ -6040,14 +6030,13 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) && ! elf_link_check_versioned_symbol (finfo->info, bed, h)) { (*_bfd_error_handler) - (_("%s: %s symbol `%s' in %s is referenced by DSO"), - bfd_get_filename (finfo->output_bfd), + (_("%B: %s symbol `%s' in %B is referenced by DSO"), + finfo->output_bfd, h->root.u.def.section->owner, ELF_ST_VISIBILITY (h->other) == STV_INTERNAL ? "internal" : ELF_ST_VISIBILITY (h->other) == STV_HIDDEN - ? "hidden" : "local", - h->root.root.string, - bfd_archive_filename (h->root.u.def.section->owner)); + ? "hidden" : "local", + h->root.root.string); eoinfo->failed = TRUE; return FALSE; } @@ -6120,14 +6109,9 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) input_sec->output_section); if (sym.st_shndx == SHN_BAD) { - char *sec_name = bfd_get_section_ident (input_sec); (*_bfd_error_handler) - (_("%s: could not find output section %s for input section %s"), - bfd_get_filename (finfo->output_bfd), - input_sec->output_section->name, - sec_name ? sec_name : input_sec->name); - if (sec_name) - free (sec_name); + (_("%B: could not find output section %A for input section %A"), + finfo->output_bfd, input_sec->output_section, input_sec); eoinfo->failed = TRUE; return FALSE; } @@ -6223,13 +6207,13 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) { (*_bfd_error_handler) - (_("%s: %s symbol `%s' isn't defined"), - bfd_get_filename (finfo->output_bfd), - ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED - ? "protected" - : ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL - ? "internal" : "hidden", - h->root.root.string); + (_("%B: %s symbol `%s' isn't defined"), + finfo->output_bfd, + ELF_ST_VISIBILITY (sym.st_other) == STV_PROTECTED + ? "protected" + : ELF_ST_VISIBILITY (sym.st_other) == STV_INTERNAL + ? "internal" : "hidden", + h->root.root.string); eoinfo->failed = TRUE; return FALSE; } @@ -6725,20 +6709,10 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd) } else if (complain) { - char *r_sec = bfd_get_section_ident (o); - char *d_sec = bfd_get_section_ident (sec); - - finfo->info->callbacks->error_handler - (LD_DEFINITION_IN_DISCARDED_SECTION, - _("`%T' referenced in section `%s' of %B: " - "defined in discarded section `%s' of %B\n"), - sym_name, sym_name, - r_sec ? r_sec : o->name, input_bfd, - d_sec ? d_sec : sec->name, sec->owner); - if (r_sec) - free (r_sec); - if (d_sec) - free (d_sec); + (*_bfd_error_handler) + (_("`%s' referenced in section `%A' of %B: " + "defined in discarded section `%A' of %B\n"), + o, input_bfd, sec, sec->owner, sym_name); } /* Remove the symbol reference from the reloc, but @@ -7244,15 +7218,8 @@ elf_get_linked_section_vma (struct bfd_link_order *p) const struct elf_backend_data *bed = get_elf_backend_data (s->owner); if (bed->link_order_error_handler) - { - char *name = bfd_get_section_ident (s); - bed->link_order_error_handler - (_("%s: warning: sh_link not set for section `%s'"), - bfd_archive_filename (s->owner), - name ? name : s->name); - if (name) - free (name); - } + bed->link_order_error_handler + (_("%B: warning: sh_link not set for section `%A'"), s->owner, s); return 0; } else @@ -7325,8 +7292,8 @@ elf_fixup_link_order (bfd *abfd, asection *o) if (seen_other && seen_linkorder) { - (*_bfd_error_handler) (_("%s: has both ordered and unordered sections"), - o->name); + (*_bfd_error_handler) (_("%A has both ordered and unordered sections"), + o); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -8155,8 +8122,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (o == NULL) { (*_bfd_error_handler) - (_("%s: could not find output section %s"), - bfd_get_filename (abfd), name); + (_("%B: could not find output section %s"), abfd, name); goto error_return; } if (o->size == 0) @@ -8197,8 +8163,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) if (o == NULL) { (*_bfd_error_handler) - (_("%s: could not find output section %s"), - bfd_get_filename (abfd), name); + (_("%B: could not find output section %s"), abfd, name); goto error_return; } dyn.d_un.d_ptr = o->vma; @@ -8806,7 +8771,6 @@ bfd_elf_gc_record_vtinherit (bfd *abfd, struct elf_link_hash_entry **search, *child; bfd_size_type extsymcount; const struct elf_backend_data *bed = get_elf_backend_data (abfd); - char *sec_name; /* The sh_info field of the symtab header tells us where the external symbols start. We don't care about the local symbols at @@ -8830,11 +8794,8 @@ bfd_elf_gc_record_vtinherit (bfd *abfd, goto win; } - sec_name = bfd_get_section_ident (sec); - (*_bfd_error_handler) ("%s: %s+%lu: No symbol found for INHERIT", - bfd_archive_filename (abfd), - sec_name ? sec_name : sec->name, - (unsigned long) offset); + (*_bfd_error_handler) ("%B: %A+%lu: No symbol found for INHERIT", + abfd, sec, (unsigned long) offset); bfd_set_error (bfd_error_invalid_operation); return FALSE; @@ -9387,15 +9348,15 @@ _bfd_elf_section_already_linked (bfd *abfd, struct bfd_section * sec) case SEC_LINK_DUPLICATES_ONE_ONLY: (*_bfd_error_handler) - (_("%s: %s: warning: ignoring duplicate section `%s'\n"), - bfd_archive_filename (abfd), name); + (_("%B: ignoring duplicate section `%A'\n"), + abfd, sec); break; case SEC_LINK_DUPLICATES_SAME_SIZE: if (sec->size != l->sec->size) (*_bfd_error_handler) - (_("%s: %s: warning: duplicate section `%s' has different size\n"), - bfd_archive_filename (abfd), name); + (_("%B: duplicate section `%A' has different size\n"), + abfd, sec); break; } diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 8ccf7f70b9..a3a69e4089 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -977,9 +977,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) || strcmp (sec->output_section->name, ".fini") == 0) { (*_bfd_error_handler) - (_("%s: Can't relax br at 0x%lx in section `%s'. Please use brl or indirect branch."), - bfd_archive_filename (sec->owner), - (unsigned long) roff, sec->name); + (_("%B: Can't relax br at 0x%lx in section `%A'. Please use brl or indirect branch."), + sec->owner, sec, (unsigned long) roff); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -3904,8 +3903,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (r_type > R_IA64_MAX_RELOC_CODE) { (*_bfd_error_handler) - (_("%s: unknown relocation type %d"), - bfd_archive_filename (input_bfd), (int)r_type); + (_("%B: unknown relocation type %d"), + input_bfd, (int) r_type); bfd_set_error (bfd_error_bad_value); ret_val = FALSE; continue; @@ -4009,8 +4008,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, /* ??? People shouldn't be doing non-pic code in shared libraries nor dynamic executables. */ (*_bfd_error_handler) - (_("%s: non-pic code with imm relocation against dynamic symbol `%s'"), - bfd_archive_filename (input_bfd), + (_("%B: non-pic code with imm relocation against dynamic symbol `%s'"), + input_bfd, h->root.root.string); ret_val = FALSE; continue; @@ -4074,8 +4073,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, if (dynamic_symbol_p) { (*_bfd_error_handler) - (_("%s: @gprel relocation against dynamic symbol %s"), - bfd_archive_filename (input_bfd), h->root.root.string); + (_("%B: @gprel relocation against dynamic symbol %s"), + input_bfd, h->root.root.string); ret_val = FALSE; continue; } @@ -4134,8 +4133,8 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, /* ??? People shouldn't be doing non-pic code in shared libraries. Hork. */ (*_bfd_error_handler) - (_("%s: linking non-pic code in a position independent executable"), - bfd_archive_filename (input_bfd)); + (_("%B: linking non-pic code in a position independent executable"), + input_bfd); ret_val = FALSE; continue; } @@ -4271,13 +4270,12 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section, const char *msg; if (r_type == R_IA64_PCREL21BI) - msg = _("%s: @internal branch to dynamic symbol %s"); + msg = _("%B: @internal branch to dynamic symbol %s"); else if (r_type == R_IA64_PCREL21F || r_type == R_IA64_PCREL21M) - msg = _("%s: speculation fixup to dynamic symbol %s"); + msg = _("%B: speculation fixup to dynamic symbol %s"); else - msg = _("%s: @pcrel relocation against dynamic symbol %s"); - (*_bfd_error_handler) (msg, bfd_archive_filename (input_bfd), - h->root.root.string); + msg = _("%B: @pcrel relocation against dynamic symbol %s"); + (*_bfd_error_handler) (msg, input_bfd, h->root.root.string); ret_val = FALSE; continue; } @@ -4761,8 +4759,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_TRAPNIL) != (out_flags & EF_IA_64_TRAPNIL)) { (*_bfd_error_handler) - (_("%s: linking trap-on-NULL-dereference with non-trapping files"), - bfd_archive_filename (ibfd)); + (_("%B: linking trap-on-NULL-dereference with non-trapping files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4770,8 +4768,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_BE) != (out_flags & EF_IA_64_BE)) { (*_bfd_error_handler) - (_("%s: linking big-endian files with little-endian files"), - bfd_archive_filename (ibfd)); + (_("%B: linking big-endian files with little-endian files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4779,8 +4777,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_ABI64) != (out_flags & EF_IA_64_ABI64)) { (*_bfd_error_handler) - (_("%s: linking 64-bit files with 32-bit files"), - bfd_archive_filename (ibfd)); + (_("%B: linking 64-bit files with 32-bit files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4788,8 +4786,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) if ((in_flags & EF_IA_64_CONS_GP) != (out_flags & EF_IA_64_CONS_GP)) { (*_bfd_error_handler) - (_("%s: linking constant-gp files with non-constant-gp files"), - bfd_archive_filename (ibfd)); + (_("%B: linking constant-gp files with non-constant-gp files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; @@ -4798,8 +4796,8 @@ elfNN_ia64_merge_private_bfd_data (ibfd, obfd) != (out_flags & EF_IA_64_NOFUNCDESC_CONS_GP)) { (*_bfd_error_handler) - (_("%s: linking auto-pic files with non-auto-pic files"), - bfd_archive_filename (ibfd)); + (_("%B: linking auto-pic files with non-auto-pic files"), + ibfd); bfd_set_error (bfd_error_bad_value); ok = FALSE; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index eaf2180aee..56d0d78bc7 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -3719,9 +3719,9 @@ mips_elf_perform_relocation (struct bfd_link_info *info, if (!ok) { (*_bfd_error_handler) - (_("%s: %s+0x%lx: jump to stub routine which is not jal"), - bfd_archive_filename (input_bfd), - input_section->name, + (_("%B: %A+0x%lx: jump to stub routine which is not jal"), + input_bfd, + input_section, (unsigned long) relocation->r_offset); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -5226,8 +5226,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, else if (r_symndx >= extsymoff + NUM_SHDR_ENTRIES (symtab_hdr)) { (*_bfd_error_handler) - (_("%s: Malformed reloc detected for section %s"), - bfd_archive_filename (abfd), name); + (_("%B: Malformed reloc detected for section %s"), + abfd, name); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -5300,8 +5300,8 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (h == NULL) { (*_bfd_error_handler) - (_("%s: CALL16 reloc at 0x%lx not against global symbol"), - bfd_archive_filename (abfd), (unsigned long) rel->r_offset); + (_("%B: CALL16 reloc at 0x%lx not against global symbol"), + abfd, (unsigned long) rel->r_offset); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -8895,8 +8895,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (! _bfd_generic_verify_endian_match (ibfd, obfd)) { (*_bfd_error_handler) - (_("%s: endianness incompatible with that of the selected emulation"), - bfd_archive_filename (ibfd)); + (_("%B: endianness incompatible with that of the selected emulation"), + ibfd); return FALSE; } @@ -8907,8 +8907,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (strcmp (bfd_get_target (ibfd), bfd_get_target (obfd)) != 0) { (*_bfd_error_handler) - (_("%s: ABI is incompatible with that of the selected emulation"), - bfd_archive_filename (ibfd)); + (_("%B: ABI is incompatible with that of the selected emulation"), + ibfd); return FALSE; } @@ -8979,8 +8979,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) != ((old_flags & (EF_MIPS_PIC | EF_MIPS_CPIC)) != 0)) { (*_bfd_error_handler) - (_("%s: warning: linking PIC files with non-PIC files"), - bfd_archive_filename (ibfd)); + (_("%B: warning: linking PIC files with non-PIC files"), + ibfd); ok = TRUE; } @@ -8996,8 +8996,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (mips_32bit_flags_p (old_flags) != mips_32bit_flags_p (new_flags)) { (*_bfd_error_handler) - (_("%s: linking 32-bit code with 64-bit code"), - bfd_archive_filename (ibfd)); + (_("%B: linking 32-bit code with 64-bit code"), + ibfd); ok = FALSE; } else if (!mips_mach_extends_p (bfd_get_mach (ibfd), bfd_get_mach (obfd))) @@ -9024,8 +9024,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { /* The ISAs aren't compatible. */ (*_bfd_error_handler) - (_("%s: linking %s module with previous %s modules"), - bfd_archive_filename (ibfd), + (_("%B: linking %s module with previous %s modules"), + ibfd, bfd_printable_name (ibfd), bfd_printable_name (obfd)); ok = FALSE; @@ -9047,8 +9047,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) != elf_elfheader (obfd)->e_ident[EI_CLASS])) { (*_bfd_error_handler) - (_("%s: ABI mismatch: linking %s module with previous %s modules"), - bfd_archive_filename (ibfd), + (_("%B: ABI mismatch: linking %s module with previous %s modules"), + ibfd, elf_mips_abi_name (ibfd), elf_mips_abi_name (obfd)); ok = FALSE; @@ -9070,8 +9070,8 @@ _bfd_mips_elf_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (new_flags != old_flags) { (*_bfd_error_handler) - (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), - bfd_archive_filename (ibfd), (unsigned long) new_flags, + (_("%B: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"), + ibfd, (unsigned long) new_flags, (unsigned long) old_flags); ok = FALSE; } diff --git a/bfd/ieee.c b/bfd/ieee.c index d7baa88e21..aaf1f1124b 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -935,9 +935,8 @@ ieee_slurp_external_symbols (abfd) break; default: (*_bfd_error_handler) - (_("%s: unimplemented ATI record %u for symbol %u"), - bfd_archive_filename (abfd), symbol_attribute_def, - symbol_name_index); + (_("%B: unimplemented ATI record %u for symbol %u"), + abfd, symbol_attribute_def, symbol_name_index); bfd_set_error (bfd_error_bad_value); return FALSE; break; @@ -960,8 +959,8 @@ ieee_slurp_external_symbols (abfd) if (value != 0x3f) { (*_bfd_error_handler) - (_("%s: unexpected ATN type %d in external part"), - bfd_archive_filename (abfd), (int) value); + (_("%B: unexpected ATN type %d in external part"), + abfd, (int) value); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -982,8 +981,7 @@ ieee_slurp_external_symbols (abfd) default: (*_bfd_error_handler) - (_("%s: unexpected type after ATN"), - bfd_archive_filename (abfd)); + (_("%B: unexpected type after ATN"), abfd); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/ihex.c b/bfd/ihex.c index a7636a9027..1392178fee 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -261,8 +261,8 @@ ihex_bad_byte (abfd, lineno, c, error) buf[1] = '\0'; } (*_bfd_error_handler) - (_("%s:%d: unexpected character `%s' in Intel Hex file\n"), - bfd_archive_filename (abfd), lineno, buf); + (_("%B:%d: unexpected character `%s' in Intel Hex file"), + abfd, lineno, buf); bfd_set_error (bfd_error_bad_value); } } @@ -369,8 +369,8 @@ ihex_scan (abfd) if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i)) { (*_bfd_error_handler) - (_("%s:%u: bad checksum in Intel Hex file (expected %u, found %u)"), - bfd_archive_filename (abfd), lineno, + (_("%B:%u: bad checksum in Intel Hex file (expected %u, found %u)"), + abfd, lineno, (- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i)); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -423,8 +423,8 @@ ihex_scan (abfd) if (len != 2) { (*_bfd_error_handler) - (_("%s:%u: bad extended address record length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended address record length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -440,8 +440,8 @@ ihex_scan (abfd) if (len != 4) { (*_bfd_error_handler) - (_("%s:%u: bad extended start address length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended start address length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -457,8 +457,8 @@ ihex_scan (abfd) if (len != 2) { (*_bfd_error_handler) - (_("%s:%u: bad extended linear address record length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended linear address record length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -474,8 +474,8 @@ ihex_scan (abfd) if (len != 2 && len != 4) { (*_bfd_error_handler) - (_("%s:%u: bad extended linear start address length in Intel Hex file"), - bfd_archive_filename (abfd), lineno); + (_("%B:%u: bad extended linear start address length in Intel Hex file"), + abfd, lineno); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -491,8 +491,8 @@ ihex_scan (abfd) default: (*_bfd_error_handler) - (_("%s:%u: unrecognized ihex type %u in Intel Hex file\n"), - bfd_archive_filename (abfd), lineno, type); + (_("%B:%u: unrecognized ihex type %u in Intel Hex file"), + abfd, lineno, type); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -616,8 +616,7 @@ ihex_read_section (abfd, section, contents) if (type != 0) { (*_bfd_error_handler) - (_("%s: internal error in ihex_read_section"), - bfd_archive_filename (abfd)); + (_("%B: internal error in ihex_read_section"), abfd); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -651,8 +650,7 @@ ihex_read_section (abfd, section, contents) if ((bfd_size_type) (p - contents) < section->size) { (*_bfd_error_handler) - (_("%s: bad section length in ihex_read_section"), - bfd_archive_filename (abfd)); + (_("%B: bad section length in ihex_read_section"), abfd); bfd_set_error (bfd_error_bad_value); goto error_return; } diff --git a/bfd/libbfd.c b/bfd/libbfd.c index d76a12e031..2791ca32a7 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -823,11 +823,11 @@ _bfd_generic_verify_endian_match (bfd *ibfd, bfd *obfd) const char *msg; if (bfd_big_endian (ibfd)) - msg = _("%s: compiled for a big endian system and target is little endian"); + msg = _("%B: compiled for a big endian system and target is little endian"); else - msg = _("%s: compiled for a little endian system and target is big endian"); + msg = _("%B: compiled for a little endian system and target is big endian"); - (*_bfd_error_handler) (msg, bfd_archive_filename (ibfd)); + (*_bfd_error_handler) (msg, ibfd); bfd_set_error (bfd_error_wrong_format); return FALSE; diff --git a/bfd/linker.c b/bfd/linker.c index a2095dccba..aac7da9076 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -1828,8 +1828,8 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info, && inh->u.i.link == h) { (*_bfd_error_handler) - (_("%s: indirect symbol `%s' to `%s' is a loop"), - bfd_archive_filename (abfd), name, string); + (_("%B: indirect symbol `%s' to `%s' is a loop"), + abfd, name, string); bfd_set_error (bfd_error_invalid_operation); return FALSE; } @@ -2992,14 +2992,9 @@ _bfd_generic_section_already_linked (bfd *abfd, asection *sec) break; case SEC_LINK_DUPLICATES_ONE_ONLY: - if (s_comdat == NULL) - (*_bfd_error_handler) - (_("%s: %s: warning: ignoring duplicate section `%s'\n"), - bfd_archive_filename (abfd), name); - else - (*_bfd_error_handler) - (_("%s: %s: warning: ignoring duplicate `%s' section symbol `%s'\n"), - bfd_archive_filename (abfd), name, s_comdat->name); + (*_bfd_error_handler) + (_("%B: warning: ignoring duplicate section `%A'\n"), + abfd, sec); break; case SEC_LINK_DUPLICATES_SAME_CONTENTS: @@ -3012,8 +3007,8 @@ _bfd_generic_section_already_linked (bfd *abfd, asection *sec) case SEC_LINK_DUPLICATES_SAME_SIZE: if (sec->size != l->sec->size) (*_bfd_error_handler) - (_("%s: %s: warning: duplicate section `%s' has different size\n"), - bfd_archive_filename (abfd), name); + (_("%B: warning: duplicate section `%A' has different size\n"), + abfd, sec); break; } diff --git a/bfd/pdp11.c b/bfd/pdp11.c index 3bff3a6378..a5df324628 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -1672,9 +1672,8 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) /* This case occurs, e.g., for the *DEBUG* section of a COFF file. */ (*_bfd_error_handler) - ("%s: can not represent section for symbol `%s' in a.out object file format", - bfd_archive_filename (abfd), - cache_ptr->name != NULL ? cache_ptr->name : "*unknown*"); + ("%B: can not represent section for symbol `%s' in a.out object file format", + abfd, cache_ptr->name != NULL ? cache_ptr->name : "*unknown*"); bfd_set_error (bfd_error_nonrepresentable_section); return FALSE; } @@ -1700,8 +1699,8 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) else { (*_bfd_error_handler) - ("%s: can not represent section `%s' in a.out object file format", - bfd_archive_filename (abfd), bfd_get_section_name (abfd, sec)); + ("%B: can not represent section `%A' in a.out object file format", + abfd, sec); bfd_set_error (bfd_error_nonrepresentable_section); return FALSE; } diff --git a/bfd/pe-mips.c b/bfd/pe-mips.c index 6e74c7eb0b..4d6d961849 100644 --- a/bfd/pe-mips.c +++ b/bfd/pe-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS PE COFF files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Modified from coff-i386.c by DJ Delorie, dj@cygnus.com This file is part of BFD, the Binary File Descriptor library. @@ -632,9 +632,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, if (info->relocatable) { - (*_bfd_error_handler) (_("\ -%s: `ld -r' not supported with PE MIPS objects\n"), - bfd_archive_filename (input_bfd)); + (*_bfd_error_handler) + (_("%B: `ld -r' not supported with PE MIPS objects\n"), input_bfd); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -768,8 +767,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, val = VMA of what we need to refer to */ -#define UI(x) (*_bfd_error_handler) (_("%s: unimplemented %s\n"), \ - bfd_archive_filename (input_bfd), x); \ +#define UI(x) (*_bfd_error_handler) (_("%B: unimplemented %s\n"), \ + input_bfd, x); \ bfd_set_error (bfd_error_bad_value); switch (rel->r_type) @@ -794,8 +793,7 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, targ = val + (tmp&0x03ffffff)*4; if ((src & 0xf0000000) != (targ & 0xf0000000)) { - (*_bfd_error_handler) (_("%s: jump too far away\n"), - bfd_archive_filename (input_bfd)); + (*_bfd_error_handler) (_("%B: jump too far away\n"), input_bfd); bfd_set_error (bfd_error_bad_value); return FALSE; } @@ -821,8 +819,8 @@ coff_pe_mips_relocate_section (output_bfd, info, input_bfd, targ = val + low + ((tmp & 0xffff) << 16); break; default: - (*_bfd_error_handler) (_("%s: bad pair/reflo after refhi\n"), - bfd_archive_filename (input_bfd)); + (*_bfd_error_handler) (_("%B: bad pair/reflo after refhi\n"), + input_bfd); bfd_set_error (bfd_error_bad_value); return FALSE; } diff --git a/bfd/peicode.h b/bfd/peicode.h index 41445e592c..ab940f7685 100644 --- a/bfd/peicode.h +++ b/bfd/peicode.h @@ -1,5 +1,5 @@ /* Support for the generic parts of PE/PEI, for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Solutions. @@ -784,13 +784,13 @@ pe_ILF_build_a_bfd (bfd * abfd, case IMPORT_CONST: /* XXX code yet to be written. */ - _bfd_error_handler (_("%s: Unhandled import type; %x"), - bfd_archive_filename (abfd), import_type); + _bfd_error_handler (_("%B: Unhandled import type; %x"), + abfd, import_type); return FALSE; default: - _bfd_error_handler (_("%s: Unrecognised import type; %x"), - bfd_archive_filename (abfd), import_type); + _bfd_error_handler (_("%B: Unrecognised import type; %x"), + abfd, import_type); return FALSE; } @@ -803,8 +803,8 @@ pe_ILF_build_a_bfd (bfd * abfd, break; default: - _bfd_error_handler (_("%s: Unrecognised import name type; %x"), - bfd_archive_filename (abfd), import_name_type); + _bfd_error_handler (_("%B: Unrecognised import name type; %x"), + abfd, import_name_type); return FALSE; } @@ -1190,9 +1190,9 @@ pe_ILF_object_p (bfd * abfd) /* We no longer support PowerPC. */ default: _bfd_error_handler - ( -_("%s: Unrecognised machine type (0x%x) in Import Library Format archive"), - bfd_archive_filename (abfd), machine); + (_("%B: Unrecognised machine type (0x%x)" + " in Import Library Format archive"), + abfd, machine); bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -1202,9 +1202,9 @@ _("%s: Unrecognised machine type (0x%x) in Import Library Format archive"), if (magic == 0) { _bfd_error_handler - ( -_("%s: Recognised but unhandled machine type (0x%x) in Import Library Format archive"), - bfd_archive_filename (abfd), machine); + (_("%B: Recognised but unhandled machine type (0x%x)" + " in Import Library Format archive"), + abfd, machine); bfd_set_error (bfd_error_wrong_format); return NULL; @@ -1220,8 +1220,7 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc if (size == 0) { _bfd_error_handler - (_("%s: size field is zero in Import Library Format header"), - bfd_archive_filename (abfd)); + (_("%B: size field is zero in Import Library Format header"), abfd); bfd_set_error (bfd_error_malformed_archive); return NULL; @@ -1251,8 +1250,7 @@ _("%s: Recognised but unhandled machine type (0x%x) in Import Library Format arc if (ptr[size - 1] != 0 || ((unsigned long) (source_dll - ptr) >= size)) { _bfd_error_handler - (_("%s: string not null terminated in ILF object file."), - bfd_archive_filename (abfd)); + (_("%B: string not null terminated in ILF object file."), abfd); bfd_set_error (bfd_error_malformed_archive); bfd_release (abfd, ptr); return NULL; diff --git a/bfd/srec.c b/bfd/srec.c index 3002c0baee..19dfaa9fd8 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -299,8 +299,8 @@ srec_bad_byte (abfd, lineno, c, error) buf[1] = '\0'; } (*_bfd_error_handler) - (_("%s:%d: Unexpected character `%s' in S-record file\n"), - bfd_archive_filename (abfd), lineno, buf); + (_("%B:%d: Unexpected character `%s' in S-record file\n"), + abfd, lineno, buf); bfd_set_error (bfd_error_bad_value); } } diff --git a/bfd/stabs.c b/bfd/stabs.c index 12285a3668..b18f93cf9c 100644 --- a/bfd/stabs.c +++ b/bfd/stabs.c @@ -293,10 +293,8 @@ _bfd_link_section_stabs (abfd, sinfo, stabsec, stabstrsec, psecinfo, pstring_off if (symstroff >= stabstrsec->size) { (*_bfd_error_handler) - (_("%s(%s+0x%lx): Stabs entry has invalid string index."), - bfd_archive_filename (abfd), - bfd_get_section_name (abfd, stabsec), - (long) (sym - stabbuf)); + (_("%B(%A+0x%lx): Stabs entry has invalid string index."), + abfd, stabsec, (long) (sym - stabbuf)); bfd_set_error (bfd_error_bad_value); goto error_return; } diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c index 2d195ca78c..ec737d12a4 100644 --- a/bfd/xcofflink.c +++ b/bfd/xcofflink.c @@ -1240,8 +1240,8 @@ xcoff_link_add_symbols (abfd, info) if (enclosing == NULL) { (*_bfd_error_handler) - (_("%s: `%s' has line numbers but no enclosing section"), - bfd_archive_filename (abfd), name); + (_("%B: `%s' has line numbers but no enclosing section"), + abfd, name); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1293,8 +1293,8 @@ xcoff_link_add_symbols (abfd, info) if (sym.n_numaux == 0) { (*_bfd_error_handler) - (_("%s: class %d symbol `%s' has no aux entries"), - bfd_archive_filename (abfd), sym.n_sclass, name); + (_("%B: class %d symbol `%s' has no aux entries"), + abfd, sym.n_sclass, name); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1316,8 +1316,8 @@ xcoff_link_add_symbols (abfd, info) { default: (*_bfd_error_handler) - (_("%s: symbol `%s' has unrecognized csect type %d"), - bfd_archive_filename (abfd), name, smtyp); + (_("%B: symbol `%s' has unrecognized csect type %d"), + abfd, name, smtyp); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -1328,8 +1328,8 @@ xcoff_link_add_symbols (abfd, info) || aux.x_csect.x_scnlen.l != 0) { (*_bfd_error_handler) - (_("%s: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"), - bfd_archive_filename (abfd), name, sym.n_sclass, sym.n_scnum, + (_("%B: bad XTY_ER symbol `%s': class %d scnum %d scnlen %d"), + abfd, name, sym.n_sclass, sym.n_scnum, aux.x_csect.x_scnlen.l); bfd_set_error (bfd_error_bad_value); goto error_return; @@ -1364,9 +1364,8 @@ xcoff_link_add_symbols (abfd, info) || aux.x_csect.x_scnlen.l != 0) { (*_bfd_error_handler) - (_("%s: XMC_TC0 symbol `%s' is class %d scnlen %d"), - bfd_archive_filename (abfd), name, sym.n_sclass, - aux.x_csect.x_scnlen.l); + (_("%B: XMC_TC0 symbol `%s' is class %d scnlen %d"), + abfd, name, sym.n_sclass, aux.x_csect.x_scnlen.l); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1516,8 +1515,8 @@ xcoff_link_add_symbols (abfd, info) > enclosing->vma + enclosing->size))) { (*_bfd_error_handler) - (_("%s: csect `%s' not in enclosing section"), - bfd_archive_filename (abfd), name); + (_("%B: csect `%s' not in enclosing section"), + abfd, name); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1623,8 +1622,8 @@ xcoff_link_add_symbols (abfd, info) if (bad) { (*_bfd_error_handler) - (_("%s: misplaced XTY_LD `%s'"), - bfd_archive_filename (abfd), name); + (_("%B: misplaced XTY_LD `%s'"), + abfd, name); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -1954,8 +1953,8 @@ xcoff_link_add_symbols (abfd, info) if (*rel_csect == NULL) { (*_bfd_error_handler) - (_("%s: reloc %s:%d not in csect"), - bfd_archive_filename (abfd), o->name, i); + (_("%B: reloc %s:%d not in csect"), + abfd, o->name, i); bfd_set_error (bfd_error_bad_value); goto error_return; } @@ -5283,9 +5282,8 @@ xcoff_link_input_bfd (finfo, input_bfd) else { (*_bfd_error_handler) - (_("%s: loader reloc in unrecognized section `%s'"), - bfd_archive_filename (input_bfd), - sec->name); + (_("%B: loader reloc in unrecognized section `%A'"), + input_bfd, sec); bfd_set_error (bfd_error_nonrepresentable_section); return FALSE; } @@ -5305,8 +5303,8 @@ xcoff_link_input_bfd (finfo, input_bfd) if (h->ldindx < 0 && ! quiet) { (*_bfd_error_handler) - (_("%s: `%s' in loader reloc but not loader sym"), - bfd_archive_filename (input_bfd), + (_("%B: `%s' in loader reloc but not loader sym"), + input_bfd, h->root.root.string); bfd_set_error (bfd_error_bad_value); return FALSE; @@ -5320,10 +5318,8 @@ xcoff_link_input_bfd (finfo, input_bfd) && ! quiet) { (*_bfd_error_handler) - (_("%s: loader reloc in read-only section %s"), - bfd_archive_filename (input_bfd), - bfd_get_section_name (finfo->output_bfd, - o->output_section)); + (_("%B: loader reloc in read-only section %A"), + input_bfd, o->output_section); bfd_set_error (bfd_error_invalid_operation); return FALSE; } diff --git a/include/ChangeLog b/include/ChangeLog index 39557fa3aa..c6299def51 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2004-08-13 Alan Modra + + * bfdlink.h (struct bfd_link_callbacks): Remove "error_handler". + (LD_DEFINITION_IN_DISCARDED_SECTION): Delete. + 2004-08-02 Gabriel Dos Reis * libiberty.h (XDELETE, XDELETEVEC, XRESIZEVEC): Remove any diff --git a/include/bfdlink.h b/include/bfdlink.h index 9a57dfe1d6..5adad790e6 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -511,14 +511,6 @@ struct bfd_link_callbacks bfd_boolean (*notice) (struct bfd_link_info *, const char *name, bfd *abfd, asection *section, bfd_vma address); - /* A function which is called for reporting a linker error. ID is the - error identifier. The remaining input is the same as einfo () in - ld. */ - bfd_boolean (*error_handler) - (int id, const char *fmt, ...); - -/* Identifiers of linker error messages used by error_handler. */ -#define LD_DEFINITION_IN_DISCARDED_SECTION 1 }; /* The linker builds link_order structures which tell the code how to diff --git a/ld/ChangeLog b/ld/ChangeLog index 374d8ceba5..d9aa177d6b 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,12 @@ +2004-08-13 Alan Modra + + * ldmain.c (link_callbacks): Remove "error_handler". + * ldmisc.c: Include elf-bfd.h. + (vfinfo): Sort comment. Handle %A. Use %A instead of + bfd_get_section_indent. + (error_handler): Delete. + * ldmisc.h (error_handler): Delete declaration. + 2004-08-10 Alan Modra * emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Call diff --git a/ld/ldmain.c b/ld/ldmain.c index 193fd69b09..45752218b5 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -156,8 +156,7 @@ static struct bfd_link_callbacks link_callbacks = reloc_overflow, reloc_dangerous, unattached_reloc, - notice, - error_handler + notice }; struct bfd_link_info link_info; diff --git a/ld/ldmisc.c b/ld/ldmisc.c index 3e8b3717e5..5f7d0e99aa 100644 --- a/ld/ldmisc.c +++ b/ld/ldmisc.c @@ -1,6 +1,6 @@ /* ldmisc.c - Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2002, 2003 + Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -35,27 +35,29 @@ #include "ldlex.h" #include "ldmain.h" #include "ldfile.h" +#include "elf-bfd.h" /* %% literal % + %A section name from a section + %B filename from a bfd + %C clever filename:linenumber with function + %D like %C, but no function name + %E current bfd error or errno %F error is fatal + %G like %D, but only function name + %I filename from a lang_input_statement_type %P print program name + %R info about a relent %S print script file and linenumber - %E current bfd error or errno - %I filename from a lang_input_statement_type - %B filename from a bfd %T symbol name - %X no object output, fail return %V hex bfd_vma - %v hex bfd_vma, no leading zeros %W hex bfd_vma with 0x with no leading zeros taking up 8 spaces - %C clever filename:linenumber with function - %D like %C, but no function name - %G like %D, but only function name - %R info about a relent - %s arbitrary string, like printf + %X no object output, fail return %d integer, like printf + %s arbitrary string, like printf %u integer, like printf + %v hex bfd_vma, no leading zeros */ static void @@ -158,6 +160,30 @@ vfinfo (FILE *fp, const char *fmt, va_list arg) } break; + case 'A': + /* section name from a section */ + { + asection *sec = va_arg (arg, asection *); + bfd *abfd = sec->owner; + const char *group = NULL; + struct coff_comdat_info *ci; + + fprintf (fp, "%s", sec->name); + if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_elf_flavour + && elf_next_in_group (sec) != NULL + && (sec->flags & SEC_GROUP) == 0) + group = elf_group_name (sec); + else if (abfd != NULL + && bfd_get_flavour (abfd) == bfd_target_coff_flavour + && (ci = bfd_coff_get_comdat_section (sec->owner, + sec)) != NULL) + group = ci->name; + if (group != NULL) + fprintf (fp, "[%s]", group); + } + break; + case 'B': /* filename from a bfd */ { @@ -241,7 +267,6 @@ vfinfo (FILE *fp, const char *fmt, va_list arg) const char *functionname; unsigned int linenumber; bfd_boolean discard_last; - char *sec_name; abfd = va_arg (arg, bfd *); section = va_arg (arg, asection *); @@ -270,11 +295,7 @@ vfinfo (FILE *fp, const char *fmt, va_list arg) } } - sec_name = bfd_get_section_ident (section); - lfinfo (fp, "%B(%s+0x%v)", abfd, - sec_name ? sec_name : section->name, offset); - if (sec_name) - free (sec_name); + lfinfo (fp, "%B(%A+0x%v)", abfd, section, offset); discard_last = TRUE; if (bfd_find_nearest_line (abfd, section, asymbols, offset, @@ -494,64 +515,3 @@ ld_abort (const char *file, int line, const char *fn) einfo (_("%P%F: please report this bug\n")); xexit (1); } - -bfd_boolean -error_handler (int id, const char *fmt, ...) -{ - va_list arg; - - va_start (arg, fmt); - - switch (id) - { - default: - break; - - /* We can be called with - - error_handler (-LD_DEFINITION_IN_DISCARDED_SECTION, "", 0); - - to make this error non-fatal and - - error_handler (-LD_DEFINITION_IN_DISCARDED_SECTION, "", 1); - - to make this error fatal. */ - case -LD_DEFINITION_IN_DISCARDED_SECTION: - case LD_DEFINITION_IN_DISCARDED_SECTION: - { - static struct bfd_hash_table *hash; - static int fatal = 1; - const char *name; - - if (id == -LD_DEFINITION_IN_DISCARDED_SECTION) - { - fatal = va_arg (arg, int); - goto out; - } - - name = va_arg (arg, const char *); - /* Only warn once about a particular undefined symbol. */ - if (hash == NULL) - { - hash = xmalloc (sizeof (struct bfd_hash_table)); - if (! bfd_hash_table_init (hash, bfd_hash_newfunc)) - einfo (_("%F%P: bfd_hash_table_init failed: %E\n")); - } - - if (bfd_hash_lookup (hash, name, FALSE, FALSE) != NULL) - goto out; - - if (bfd_hash_lookup (hash, name, TRUE, TRUE) == NULL) - einfo (_("%F%P: bfd_hash_lookup failed: %E\n")); - - if (fatal) - config.make_executable = FALSE; - } - break; - } - vfinfo (stderr, fmt, arg); - -out: - va_end (arg); - return TRUE; -} diff --git a/ld/ldmisc.h b/ld/ldmisc.h index b2812fbd82..0b1a6eaf8d 100644 --- a/ld/ldmisc.h +++ b/ld/ldmisc.h @@ -1,5 +1,5 @@ /* ldmisc.h - - Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2001, 2003 + Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2001, 2003, 2004 Free Software Foundation, Inc. This file is part of GLD, the Gnu Linker. @@ -22,7 +22,6 @@ #ifndef LDMISC_H #define LDMISC_H -extern bfd_boolean error_handler (int, const char *, ...); extern void einfo (const char *, ...); extern void minfo (const char *, ...); extern void info_msg (const char *, ...); -- 2.34.1