This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Use %A and %B in more error messages


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=dae82561a286618acf097ad9894eafba98377f66

commit dae82561a286618acf097ad9894eafba98377f66
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Apr 13 13:20:15 2017 +0930

    Use %A and %B in more error messages
    
    	* aoutx.h: Use %B and %A in error messages throughout file.
    	* aout-cris.c: Likewise.
    	* archive.c: Likewise.
    	* binary.c: Likewise.
    	* coff-rs6000.c: Likewise.
    	* coff-tic4x.c: Likewise.
    	* coffcode.h: Likewise.
    	* coffgen.c: Likewise.
    	* cofflink.c: Likewise.
    	* coffswap.h: Likewise.
    	* cpu-arm.c: Likewise.
    	* elf-eh-frame.c: Likewise.
    	* elf-m10300.c: Likewise.
    	* elf.c: Likewise.
    	* elf32-arc.c: Likewise.
    	* elf32-arm.c: Likewise.
    	* elf32-bfin.c: Likewise.
    	* elf32-frv.c: Likewise.
    	* elf32-iq2000.c: Likewise.
    	* elf32-m32c.c: Likewise.
    	* elf32-microblaze.c: Likewise.
    	* elf32-nds32.c: Likewise.
    	* elf32-rl78.c: Likewise.
    	* elf32-rx.c: Likewise.
    	* elf32-score.c: Likewise.
    	* elf32-score7.c: Likewise.
    	* elf32-sh64.c: Likewise.
    	* elf32-v850.c: Likewise.
    	* elf32-vax.c: Likewise.
    	* elf32-visium.c: Likewise.
    	* elf64-ia64-vms.c: Likewise.
    	* elf64-mmix.c: Likewise.
    	* elf64-sh64.c: Likewise.
    	* elfcode.h: Likewise.
    	* elfnn-aarch64.c: Likewise.
    	* elfnn-ia64.c: Likewise.
    	* elfxx-mips.c: Likewise.
    	* hpux-core.c: Likewise.
    	* ieee.c: Likewise.
    	* ihex.c: Likewise.
    	* linker.c: Likewise.
    	* merge.c: Likewise.
    	* mmo.c: Likewise.
    	* oasys.c: Likewise.
    	* pdp11.c: Likewise.
    	* peXXigen.c: Likewise.
    	* rs6000-core.c: Likewise.
    	* vms-alpha.c: Likewise.
    	* xcofflink.c: Likewise.

Diff:
---
 bfd/ChangeLog          |  52 ++++++++++++++++++++++
 bfd/aout-cris.c        |   4 +-
 bfd/aoutx.h            |  17 ++++----
 bfd/archive.c          |   4 +-
 bfd/binary.c           |   5 +--
 bfd/coff-rs6000.c      |   9 ++--
 bfd/coff-tic4x.c       |   4 +-
 bfd/coffcode.h         |   8 ++--
 bfd/coffgen.c          |   3 +-
 bfd/cofflink.c         |  12 ++---
 bfd/coffswap.h         |  10 ++---
 bfd/cpu-arm.c          |   4 +-
 bfd/elf-eh-frame.c     |  16 +++----
 bfd/elf-m10300.c       |   4 +-
 bfd/elf.c              |   4 +-
 bfd/elf32-arc.c        |   8 ++--
 bfd/elf32-arm.c        |   7 ++-
 bfd/elf32-bfin.c       |  13 +++---
 bfd/elf32-frv.c        |  23 +++++-----
 bfd/elf32-iq2000.c     |   8 ++--
 bfd/elf32-m32c.c       |   9 ++--
 bfd/elf32-microblaze.c |  20 ++++-----
 bfd/elf32-nds32.c      |   8 ++--
 bfd/elf32-rl78.c       |  20 ++++-----
 bfd/elf32-rx.c         |   5 ++-
 bfd/elf32-score.c      |   5 +--
 bfd/elf32-score7.c     |   5 +--
 bfd/elf32-sh64.c       |  27 +++++-------
 bfd/elf32-v850.c       |  28 ++++++------
 bfd/elf32-vax.c        |  27 +++++-------
 bfd/elf32-visium.c     |   5 +--
 bfd/elf64-ia64-vms.c   |   8 ++--
 bfd/elf64-mmix.c       |  41 ++++++++---------
 bfd/elf64-sh64.c       |  20 ++++-----
 bfd/elfcode.h          |  13 +++---
 bfd/elfnn-aarch64.c    |   2 +-
 bfd/elfnn-ia64.c       |   8 ++--
 bfd/elfxx-mips.c       |   3 +-
 bfd/hpux-core.c        |   6 ++-
 bfd/ieee.c             |   8 ++--
 bfd/ihex.c             |   4 +-
 bfd/linker.c           |   3 +-
 bfd/merge.c            |   4 +-
 bfd/mmo.c              | 116 ++++++++++++++++++++++++++-----------------------
 bfd/oasys.c            |   3 +-
 bfd/pdp11.c            |   9 ++--
 bfd/peXXigen.c         |  13 +++---
 bfd/rs6000-core.c      |   3 +-
 bfd/vms-alpha.c        |   9 ++--
 bfd/xcofflink.c        |   8 ++--
 50 files changed, 341 insertions(+), 314 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b8a218f..f46aaae 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,57 @@
 2017-04-13  Alan Modra  <amodra@gmail.com>
 
+	* aoutx.h: Use %B and %A in error messages throughout file.
+	* aout-cris.c: Likewise.
+	* archive.c: Likewise.
+	* binary.c: Likewise.
+	* coff-rs6000.c: Likewise.
+	* coff-tic4x.c: Likewise.
+	* coffcode.h: Likewise.
+	* coffgen.c: Likewise.
+	* cofflink.c: Likewise.
+	* coffswap.h: Likewise.
+	* cpu-arm.c: Likewise.
+	* elf-eh-frame.c: Likewise.
+	* elf-m10300.c: Likewise.
+	* elf.c: Likewise.
+	* elf32-arc.c: Likewise.
+	* elf32-arm.c: Likewise.
+	* elf32-bfin.c: Likewise.
+	* elf32-frv.c: Likewise.
+	* elf32-iq2000.c: Likewise.
+	* elf32-m32c.c: Likewise.
+	* elf32-microblaze.c: Likewise.
+	* elf32-nds32.c: Likewise.
+	* elf32-rl78.c: Likewise.
+	* elf32-rx.c: Likewise.
+	* elf32-score.c: Likewise.
+	* elf32-score7.c: Likewise.
+	* elf32-sh64.c: Likewise.
+	* elf32-v850.c: Likewise.
+	* elf32-vax.c: Likewise.
+	* elf32-visium.c: Likewise.
+	* elf64-ia64-vms.c: Likewise.
+	* elf64-mmix.c: Likewise.
+	* elf64-sh64.c: Likewise.
+	* elfcode.h: Likewise.
+	* elfnn-aarch64.c: Likewise.
+	* elfnn-ia64.c: Likewise.
+	* elfxx-mips.c: Likewise.
+	* hpux-core.c: Likewise.
+	* ieee.c: Likewise.
+	* ihex.c: Likewise.
+	* linker.c: Likewise.
+	* merge.c: Likewise.
+	* mmo.c: Likewise.
+	* oasys.c: Likewise.
+	* pdp11.c: Likewise.
+	* peXXigen.c: Likewise.
+	* rs6000-core.c: Likewise.
+	* vms-alpha.c: Likewise.
+	* xcofflink.c: Likewise.
+
+2017-04-13  Alan Modra  <amodra@gmail.com>
+
 	* bfd.c (PRINT_TYPE): Define.
 	(_doprnt): New function.
 	(error_handler_internal): Use _doprnt.
diff --git a/bfd/aout-cris.c b/bfd/aout-cris.c
index 2e36e9d..6cd14e3 100644
--- a/bfd/aout-cris.c
+++ b/bfd/aout-cris.c
@@ -197,8 +197,8 @@ MY (swap_ext_reloc_out) (bfd *abfd,
   if (r_type > 2)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%s: Invalid relocation type exported: %d"),
-			  bfd_get_filename (abfd), r_type);
+      _bfd_error_handler (_("%B: Invalid relocation type exported: %d"),
+			  abfd, r_type);
 
       bfd_set_error (bfd_error_wrong_format);
     }
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index d30e8b8..9a5f7ce 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1279,8 +1279,8 @@ NAME (aout, set_section_contents) (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	   (_("%s: can not represent section `%s' in a.out object file format"),
-	     bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
+	   (_("%B: can not represent section `%A' in a.out object file format"),
+	     abfd, section);
           bfd_set_error (bfd_error_nonrepresentable_section);
           return FALSE;
 	}
@@ -1580,9 +1580,9 @@ translate_to_native_sym_flags (bfd *abfd,
 	 file.  */
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: can not represent section for symbol `%s' in a.out "
+	(_("%B: can not represent section for symbol `%s' in a.out "
 	   "object file format"),
-	 bfd_get_filename (abfd),
+	 abfd,
 	 cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*"));
       bfd_set_error (bfd_error_nonrepresentable_section);
       return FALSE;
@@ -1616,8 +1616,8 @@ translate_to_native_sym_flags (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	   (_("%s: can not represent section `%s' in a.out object file format"),
-	     bfd_get_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;
 	}
@@ -5419,9 +5419,8 @@ NAME (aout, final_link) (bfd *abfd,
 		 by the reloc size.  */
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%s: relocatable link from %s to %s not supported"),
-		 bfd_get_filename (abfd),
-		 sub->xvec->name, abfd->xvec->name);
+		(_("%B: relocatable link from %s to %s not supported"),
+		 abfd, sub->xvec->name, abfd->xvec->name);
 	      bfd_set_error (bfd_error_invalid_operation);
 	      goto error_return;
 	    }
diff --git a/bfd/archive.c b/bfd/archive.c
index d96c866..f209bab 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -2402,8 +2402,8 @@ _bfd_compute_and_write_armap (bfd *arch, unsigned int elength)
 
 		      if (strcmp (syms[src_count]->name, "__gnu_lto_slim") == 0)
 			_bfd_error_handler
-			  (_("%s: plugin needed to handle lto object"),
-			   bfd_get_filename (current));
+			  (_("%B: plugin needed to handle lto object"),
+			   current);
 		      namelen = strlen (syms[src_count]->name);
 		      amt = sizeof (char *);
 		      map[orl_count].name = (char **) bfd_alloc (arch, amt);
diff --git a/bfd/binary.c b/bfd/binary.c
index f630474..ff52f14 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -271,10 +271,9 @@ binary_set_section_contents (bfd *abfd,
 	  if (s->filepos < 0)
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("Warning: Writing section `%s' at huge (ie negative) "
+	      (_("warning: writing section `%A' at huge (ie negative) "
 		 "file offset 0x%lx."),
-	       bfd_get_section_name (abfd, s),
-	       (unsigned long) s->filepos);
+	       s, (unsigned long) s->filepos);
 	}
 
       abfd->output_has_begun = TRUE;
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 511f0c1..e2b149b 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -2738,8 +2738,8 @@ xcoff_reloc_type_fail (bfd *input_bfd,
 {
   _bfd_error_handler
     /* xgettext: c-format */
-    (_("%s: unsupported relocation type 0x%02x"),
-     bfd_get_filename (input_bfd), (unsigned int) rel->r_type);
+    (_("%B: unsupported relocation type 0x%02x"),
+     input_bfd, (unsigned int) rel->r_type);
   bfd_set_error (bfd_error_bad_value);
   return FALSE;
 }
@@ -2824,9 +2824,8 @@ xcoff_reloc_type_toc (bfd *input_bfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("%s: TOC reloc at 0x%x to symbol `%s' with no TOC entry"),
-	     bfd_get_filename (input_bfd), rel->r_vaddr,
-	     h->root.root.string);
+	    (_("%B: TOC reloc at 0x%x to symbol `%s' with no TOC entry"),
+	     input_bfd, rel->r_vaddr, h->root.root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
diff --git a/bfd/coff-tic4x.c b/bfd/coff-tic4x.c
index aae0591..89dc36b 100644
--- a/bfd/coff-tic4x.c
+++ b/bfd/coff-tic4x.c
@@ -224,8 +224,8 @@ tic4x_reloc_processing (arelent *relent,
         {
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-            (_("%s: warning: illegal symbol index %ld in relocs"),
-             bfd_get_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/coffcode.h b/bfd/coffcode.h
index 975d249..2716b50 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -1942,8 +1942,8 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED,
     }
   else if (hdr->s_nreloc == 0xffff)
     _bfd_error_handler
-      (_("%s: warning: claims to have 0xffff relocs, without overflow"),
-       bfd_get_filename (abfd));
+      (_("%B: warning: claims to have 0xffff relocs, without overflow"),
+       abfd);
 }
 #undef ALIGN_SET
 #undef ELIFALIGN_SET
@@ -3767,8 +3767,8 @@ coff_write_object_contents (bfd * abfd)
 		  bfd_set_error (bfd_error_file_too_big);
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%B: section %s: string table overflow at offset %ld"),
-		    abfd, current->name, string_size);
+		    (_("%B: section %A: string table overflow at offset %ld"),
+		    abfd, current, string_size);
 		  return FALSE;
 		}
 
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 18f423b..31c2c5a 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -3004,7 +3004,8 @@ coff_gc_sweep (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
 
 	  if (info->print_gc_sections && o->size != 0)
 	    /* xgettext: c-format */
-            _bfd_error_handler (_("Removing unused section '%s' in file '%B'"), sub, o->name);
+	    _bfd_error_handler (_("Removing unused section '%A' in file '%B'"),
+				o, sub);
 
 #if 0
 	  /* But we also have to update some of the relocation
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 033b64e..aa84a35 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -2727,20 +2727,16 @@ _bfd_coff_write_global_sym (struct bfd_hash_entry *bh, void *data)
 		      || bfd_link_relocatable (flaginfo->info)))
 		_bfd_error_handler
 		  /* xgettext: c-format */
-		  (_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
-		   bfd_get_filename (output_bfd),
-		   bfd_get_section_name (output_bfd, sec),
-		   sec->reloc_count);
+		  (_("%B: %A: reloc overflow: 0x%lx > 0xffff"),
+		   output_bfd, sec, sec->reloc_count);
 
 	      if (sec->lineno_count > 0xffff
 		  && (! obj_pe (output_bfd)
 		      || bfd_link_relocatable (flaginfo->info)))
 		_bfd_error_handler
 		  /* xgettext: c-format */
-		  (_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
-		   bfd_get_filename (output_bfd),
-		   bfd_get_section_name (output_bfd, sec),
-		   sec->lineno_count);
+		  (_("%B: warning: %A: line number overflow: 0x%lx > 0xffff"),
+		   output_bfd, sec, sec->lineno_count);
 
 	      auxp->x_scn.x_nreloc = sec->reloc_count;
 	      auxp->x_scn.x_nlinno = sec->lineno_count;
diff --git a/bfd/coffswap.h b/bfd/coffswap.h
index 7f25051..3c147f5 100644
--- a/bfd/coffswap.h
+++ b/bfd/coffswap.h
@@ -808,9 +808,8 @@ coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
       buf[sizeof (scnhdr_int->s_name)] = '\0';
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
-	 bfd_get_filename (abfd),
-	 buf, scnhdr_int->s_nlnno);
+	(_("%B: warning: %s: line number overflow: 0x%lx > 0xffff"),
+	 abfd, buf, scnhdr_int->s_nlnno);
       PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
     }
 
@@ -823,9 +822,8 @@ coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
       memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
       buf[sizeof (scnhdr_int->s_name)] = '\0';
       /* xgettext:c-format */
-      _bfd_error_handler (_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
-			  bfd_get_filename (abfd),
-			  buf, scnhdr_int->s_nreloc);
+      _bfd_error_handler (_("%B: %s: reloc overflow: 0x%lx > 0xffff"),
+			  abfd, buf, scnhdr_int->s_nreloc);
       bfd_set_error (bfd_error_file_truncated);
       PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc);
       ret = 0;
diff --git a/bfd/cpu-arm.c b/bfd/cpu-arm.c
index 80bd296..3d4ed5d 100644
--- a/bfd/cpu-arm.c
+++ b/bfd/cpu-arm.c
@@ -335,8 +335,8 @@ bfd_arm_update_notes (bfd *abfd, const char *note_section)
 	{
 	  _bfd_error_handler
 	    /* xgettext: c-format */
-	    (_("warning: unable to update contents of %s section in %s"),
-	     note_section, bfd_get_filename (abfd));
+	    (_("warning: unable to update contents of %s section in %B"),
+	     note_section, abfd);
 	  goto FAIL;
 	}
     }
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index 6967f37..1743823 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1724,7 +1724,7 @@ _bfd_elf_write_section_eh_frame_entry (bfd *abfd, struct bfd_link_info *info,
       if (addr <= last_addr)
 	{
 	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%B: %s not in order"), sec->owner, sec->name);
+	  _bfd_error_handler (_("%B: %A not in order"), sec->owner, sec);
 	  return FALSE;
 	}
 
@@ -1738,16 +1738,16 @@ _bfd_elf_write_section_eh_frame_entry (bfd *abfd, struct bfd_link_info *info,
   if (addr & 1)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%B: %s invalid input section size"),
-			  sec->owner, sec->name);
+      _bfd_error_handler (_("%B: %A invalid input section size"),
+			  sec->owner, sec);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
   if (last_addr >= addr + sec->rawsize)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%B: %s points past end of text section"),
-			  sec->owner, sec->name);
+      _bfd_error_handler (_("%B: %A points past end of text section"),
+			  sec->owner, sec);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -2165,8 +2165,8 @@ _bfd_elf_fixup_eh_frame_hdr (struct bfd_link_info *info)
       if (sec->output_section != osec)
 	{
 	  _bfd_error_handler
-	    (_("Invalid output section for .eh_frame_entry: %s"),
-	     sec->output_section->name);
+	    (_("Invalid output section for .eh_frame_entry: %A"),
+	     sec->output_section);
 	  return FALSE;
 	}
       sec->output_offset = offset;
@@ -2188,7 +2188,7 @@ _bfd_elf_fixup_eh_frame_hdr (struct bfd_link_info *info)
   if (i != 0)
     {
       _bfd_error_handler
-	(_("Invalid contents in %s section"), osec->name);
+	(_("Invalid contents in %A section"), osec);
       return FALSE;
     }
 
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index e7d466b..f9d8089 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1025,8 +1025,8 @@ mn10300_do_tls_transition (bfd *         input_bfd,
     default:
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: Unsupported transition from %s to %s"),
-	 bfd_get_filename (input_bfd),
+	(_("%B: Unsupported transition from %s to %s"),
+	 input_bfd,
 	 elf_mn10300_howto_table[r_type].name,
 	 elf_mn10300_howto_table[tls_r_type].name);
       break;
diff --git a/bfd/elf.c b/bfd/elf.c
index 802a339..6b5e42b 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -894,14 +894,14 @@ _bfd_elf_setup_sections (bfd *abfd)
 	    /* There are some unknown sections in the group.  */
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%B: unknown [%d] section `%s' in group [%s]"),
+	      (_("%B: unknown [%d] section `%s' in group [%A]"),
 	       abfd,
 	       (unsigned int) idx->shdr->sh_type,
 	       bfd_elf_string_from_elf_section (abfd,
 						(elf_elfheader (abfd)
 						 ->e_shstrndx),
 						idx->shdr->sh_name),
-	       shdr->bfd_section->name);
+	       shdr->bfd_section);
 	    result = FALSE;
 	  }
     }
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index f31aeff..5f1505e 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -565,8 +565,8 @@ arc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	{
 	  /* xgettext:c-format */
 	  _bfd_error_handler (_("ERROR: Attempting to link %B "
-				"with a binary %s of different architecture"),
-			      ibfd, bfd_get_filename (obfd));
+				"with a binary %B of different architecture"),
+			      ibfd, obfd);
 	  return FALSE;
 	}
       else if (in_flags != out_flags)
@@ -574,9 +574,9 @@ arc_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	  /* Warn if different flags.  */
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: uses different e_flags (0x%lx) fields than "
+	    (_("%B: uses different e_flags (0x%lx) fields than "
 	       "previous modules (0x%lx)"),
-	     bfd_get_filename (ibfd), (long)in_flags, (long)out_flags);
+	     ibfd, (long) in_flags, (long) out_flags);
 	  if (in_flags && out_flags)
 	    return FALSE;
 	  /* MWDT doesnt set the eflags hence make sure we choose the
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index e0ae923..61cadf7 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -4493,7 +4493,7 @@ elf32_arm_add_stub (const char *stub_name, asection *section,
     {
       if (section == NULL)
 	section = stub_sec;
-      _bfd_error_handler (_("%s: cannot create stub entry %s"),
+      _bfd_error_handler (_("%B: cannot create stub entry %s"),
 			  section->owner, stub_name);
       return NULL;
     }
@@ -6630,7 +6630,7 @@ elf32_arm_size_stubs (bfd *output_bfd,
 					     TRUE, FALSE);
 	  if (stub_entry == NULL)
 	    {
-	      _bfd_error_handler (_("%s: cannot create stub entry %s"),
+	      _bfd_error_handler (_("%B: cannot create stub entry %s"),
 				  section->owner, stub_name);
 	      return FALSE;
 	    }
@@ -16023,8 +16023,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
       if (!bfd_elf32_arm_process_before_allocation (ibfd, info)
 	  || !bfd_elf32_arm_vfp11_erratum_scan (ibfd, info)
 	  || !bfd_elf32_arm_stm32l4xx_erratum_scan (ibfd, info))
-	_bfd_error_handler (_("Errors encountered processing file %s"),
-			    ibfd->filename);
+	_bfd_error_handler (_("Errors encountered processing file %B"), ibfd);
     }
 
   /* Allocate space for the glue sections now that we've sized them.  */
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 2a53903..ff1bcc6 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -4949,9 +4949,8 @@ elf32_bfin_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
   if (0)
 #endif
   _bfd_error_handler
-    ("old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s, filename = %s",
-     old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no",
-     bfd_get_filename (ibfd));
+    ("old_flags = 0x%.8lx, new_flags = 0x%.8lx, init = %s, filename = %B",
+     old_flags, new_flags, elf_flags_init (obfd) ? "yes" : "no", ibfd);
 
   if (!elf_flags_init (obfd))			/* First call, no flags set.  */
     {
@@ -4964,12 +4963,12 @@ elf32_bfin_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
       error = TRUE;
       if (IS_FDPIC (obfd))
 	_bfd_error_handler
-	  (_("%s: cannot link non-fdpic object file into fdpic executable"),
-	   bfd_get_filename (ibfd));
+	  (_("%B: cannot link non-fdpic object file into fdpic executable"),
+	   ibfd);
       else
 	_bfd_error_handler
-	  (_("%s: cannot link fdpic object file into non-fdpic executable"),
-	   bfd_get_filename (ibfd));
+	  (_("%B: cannot link fdpic object file into non-fdpic executable"),
+	   ibfd);
     }
 
   if (error)
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index f998690..d4b7727 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -6507,9 +6507,9 @@ frv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	      error = TRUE;
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%s: compiled with %s and linked with modules that use non-pic relocations"),
-		 bfd_get_filename (ibfd),
-		 (new_flags & EF_FRV_BIGPIC) ? "-fPIC" : "-fpic");
+		(_("%B: compiled with %s and linked with modules"
+		   " that use non-pic relocations"),
+		 ibfd, (new_flags & EF_FRV_BIGPIC) ? "-fPIC" : "-fpic");
 #endif
 	    }
 	}
@@ -6561,8 +6561,8 @@ frv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	  error = TRUE;
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: compiled with %s and linked with modules compiled with %s"),
-	     bfd_get_filename (ibfd), new_opt, old_opt);
+	    (_("%B: compiled with %s and linked with modules compiled with %s"),
+	     ibfd, new_opt, old_opt);
 	}
 
       /* Warn about any other mismatches */
@@ -6574,8 +6574,9 @@ frv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	  error = TRUE;
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: uses different unknown e_flags (0x%lx) fields than previous modules (0x%lx)"),
-	     bfd_get_filename (ibfd), (long)new_partial, (long)old_partial);
+	    (_("%B: uses different unknown e_flags (0x%lx) fields"
+	       " than previous modules (0x%lx)"),
+	     ibfd, (long) new_partial, (long) old_partial);
 	}
     }
 
@@ -6595,12 +6596,12 @@ frv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
       error = TRUE;
       if (IS_FDPIC (obfd))
 	_bfd_error_handler
-	  (_("%s: cannot link non-fdpic object file into fdpic executable"),
-	   bfd_get_filename (ibfd));
+	  (_("%B: cannot link non-fdpic object file into fdpic executable"),
+	   ibfd);
       else
 	_bfd_error_handler
-	  (_("%s: cannot link fdpic object file into non-fdpic executable"),
-	   bfd_get_filename (ibfd));
+	  (_("%B: cannot link fdpic object file into non-fdpic executable"),
+	   ibfd);
     }
 
   if (error)
diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c
index f28e751..1f88726 100644
--- a/bfd/elf32-iq2000.c
+++ b/bfd/elf32-iq2000.c
@@ -829,8 +829,8 @@ iq2000_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	  error = TRUE;
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: compiled with %s and linked with modules compiled with %s"),
-	     bfd_get_filename (ibfd), new_opt, old_opt);
+	    (_("%B: compiled with %s and linked with modules compiled with %s"),
+	     ibfd, new_opt, old_opt);
 	}
 
       new_flags &= ~ EF_IQ2000_ALL_FLAGS;
@@ -843,8 +843,8 @@ iq2000_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
-	     bfd_get_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);
 	}
     }
 
diff --git a/bfd/elf32-m32c.c b/bfd/elf32-m32c.c
index b5e2474..1944465 100644
--- a/bfd/elf32-m32c.c
+++ b/bfd/elf32-m32c.c
@@ -874,8 +874,8 @@ m32c_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	  error = TRUE;
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: compiled with %s and linked with modules compiled with %s"),
-	     bfd_get_filename (ibfd), new_opt, old_opt);
+	    (_("%B: compiled with %s and linked with modules compiled with %s"),
+	     ibfd, new_opt, old_opt);
 	}
 
       new_flags &= ~ EF_M32C_ALL_FLAGS;
@@ -887,8 +887,9 @@ m32c_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 	  error = TRUE;
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: uses different e_flags (0x%lx) fields than previous modules (0x%lx)"),
-	     bfd_get_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);
 	}
     }
 
diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c
index 325a0d6..f2796b4 100644
--- a/bfd/elf32-microblaze.c
+++ b/bfd/elf32-microblaze.c
@@ -949,8 +949,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
       if (r_type < 0 || r_type >= (int) R_MICROBLAZE_max)
 	{
 	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%s: unknown relocation type %d"),
-			      bfd_get_filename (input_bfd), (int) r_type);
+	  _bfd_error_handler (_("%B: unknown relocation type %d"),
+			      input_bfd, (int) r_type);
 	  bfd_set_error (bfd_error_bad_value);
 	  ret = FALSE;
 	  continue;
@@ -1077,12 +1077,12 @@ microblaze_elf_relocate_section (bfd *output_bfd,
 		      {
 			_bfd_error_handler
 			  /* xgettext:c-format */
-			  (_("%s: The target (%s) of an %s relocation "
-			     "is in the wrong section (%s)"),
-			   bfd_get_filename (input_bfd),
+			  (_("%B: The target (%s) of an %s relocation"
+			     " is in the wrong section (%A)"),
+			   input_bfd,
 			   sym_name,
 			   microblaze_elf_howto_table[(int) r_type]->name,
-			   bfd_get_section_name (sec->owner, sec));
+			   sec);
 			/*bfd_set_error (bfd_error_bad_value); ??? why? */
 			ret = FALSE;
 			continue;
@@ -1125,12 +1125,12 @@ microblaze_elf_relocate_section (bfd *output_bfd,
 		      {
 			_bfd_error_handler
 			  /* xgettext:c-format */
-			  (_("%s: The target (%s) of an %s relocation "
-			     "is in the wrong section (%s)"),
-			   bfd_get_filename (input_bfd),
+			  (_("%B: The target (%s) of an %s relocation"
+			     " is in the wrong section (%A)"),
+			   input_bfd,
 			   sym_name,
 			   microblaze_elf_howto_table[(int) r_type]->name,
-			   bfd_get_section_name (sec->owner, sec));
+			   sec);
 			/*bfd_set_error (bfd_error_bad_value); ??? why? */
 			ret = FALSE;
 			continue;
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 9828160..1795175 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -4969,8 +4969,8 @@ nds32_elf_relocate_section (bfd *                  output_bfd ATTRIBUTE_UNUSED,
 	  if (bfd_link_pic (info))
 	    {
 	      _bfd_error_handler
-		(_("%s: warning: cannot deal R_NDS32_25_ABS_RELA in shared "
-		   "mode."), bfd_get_filename (input_bfd));
+		(_("%B: warning: cannot deal R_NDS32_25_ABS_RELA in shared "
+		   "mode."), input_bfd);
 	      return FALSE;
 	    }
 	  break;
@@ -15433,9 +15433,9 @@ nds32_elf_ex9_build_hash_table (bfd *abfd, asection *sec,
 			  /* Incorrect alignment.  */
 			  _bfd_error_handler
 			    /* xgettext:c-format */
-			    (_("%s: warning: unaligned small data access. "
+			    (_("%B: warning: unaligned small data access. "
 			       "For entry: {%d, %d, %d}, addr = 0x%x, align = 0x%x."),
-			     bfd_get_filename (abfd), irel->r_offset,
+			     abfd, irel->r_offset,
 			     irel->r_info, irel->r_addend, relocation, align);
 			  off += 4;
 			  continue;
diff --git a/bfd/elf32-rl78.c b/bfd/elf32-rl78.c
index 42e2568..0326445 100644
--- a/bfd/elf32-rl78.c
+++ b/bfd/elf32-rl78.c
@@ -1198,9 +1198,9 @@ rl78_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("RL78 ABI conflict: G10 file %s cannot be linked with %s file %s"),
-		     bfd_get_filename (ibfd),
-		     rl78_cpu_name (out_cpu), bfd_get_filename (obfd));
+		    (_("RL78 ABI conflict: G10 file %B cannot be linked"
+		       " with %s file %B"),
+		     ibfd, rl78_cpu_name (out_cpu), obfd);
 		}
 	      else
 		{
@@ -1215,9 +1215,9 @@ rl78_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("RL78 ABI conflict: cannot link %s file %s with %s file %s"),
-		 rl78_cpu_name (in_cpu),  bfd_get_filename (ibfd),
-		 rl78_cpu_name (out_cpu), bfd_get_filename (obfd));
+		(_("RL78 ABI conflict: cannot link %s file %B with %s file %B"),
+		 rl78_cpu_name (in_cpu),  ibfd,
+		 rl78_cpu_name (out_cpu), obfd);
 	    }
 	}
 
@@ -1228,12 +1228,12 @@ rl78_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
 
 	  if (old_flags & E_FLAG_RL78_64BIT_DOUBLES)
 	    /* xgettext:c-format */
-	    _bfd_error_handler (_("- %s is 64-bit, %s is not"),
-				bfd_get_filename (obfd), bfd_get_filename (ibfd));
+	    _bfd_error_handler (_("- %B is 64-bit, %B is not"),
+				obfd, ibfd);
 	  else
 	    /* xgettext:c-format */
-	    _bfd_error_handler (_("- %s is 64-bit, %s is not"),
-				bfd_get_filename (ibfd), bfd_get_filename (obfd));
+	    _bfd_error_handler (_("- %B is 64-bit, %B is not"),
+				ibfd, obfd);
 	  error = TRUE;
 	}
     }
diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c
index c09fd9f..bb2b307 100644
--- a/bfd/elf32-rx.c
+++ b/bfd/elf32-rx.c
@@ -3142,8 +3142,9 @@ rx_elf_merge_private_bfd_data (bfd * ibfd, struct bfd_link_info *info)
 	    }
 	  else
 	    {
-	      _bfd_error_handler (_("There is a conflict merging the ELF header flags from %s"),
-				  bfd_get_filename (ibfd));
+	      _bfd_error_handler (_("There is a conflict merging the"
+				    " ELF header flags from %B"),
+				  ibfd);
 	      _bfd_error_handler (_("  the input  file's flags: %s"),
 				  describe_flags (new_flags));
 	      _bfd_error_handler (_("  the output file's flags: %s"),
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index 98170df..98856e8 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -2769,7 +2769,6 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
                                asection *sec,
                                const Elf_Internal_Rela *relocs)
 {
-  const char *name;
   bfd *dynobj;
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -2789,8 +2788,6 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
   sym_hashes = elf_sym_hashes (abfd);
   extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info;
 
-  name = bfd_get_section_name (abfd, sec);
-
   if (dynobj == NULL)
     {
       sgot = NULL;
@@ -2829,7 +2826,7 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
         {
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: Malformed reloc detected for section %s"), abfd, name);
+	    (_("%B: Malformed reloc detected for section %A"), abfd, sec);
           bfd_set_error (bfd_error_bad_value);
           return FALSE;
         }
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index 91b25d9..2698c10 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -2578,7 +2578,6 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
                                asection *sec,
                                const Elf_Internal_Rela *relocs)
 {
-  const char *name;
   bfd *dynobj;
   Elf_Internal_Shdr *symtab_hdr;
   struct elf_link_hash_entry **sym_hashes;
@@ -2598,8 +2597,6 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
   sym_hashes = elf_sym_hashes (abfd);
   extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info;
 
-  name = bfd_get_section_name (abfd, sec);
-
   if (dynobj == NULL)
     {
       sgot = NULL;
@@ -2638,7 +2635,7 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
         {
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: Malformed reloc detected for section %s"), abfd, name);
+	    (_("%B: Malformed reloc detected for section %A"), abfd, sec);
           bfd_set_error (bfd_error_bad_value);
           return FALSE;
         }
diff --git a/bfd/elf32-sh64.c b/bfd/elf32-sh64.c
index 47ca44d..de7ce95d 100644
--- a/bfd/elf32-sh64.c
+++ b/bfd/elf32-sh64.c
@@ -222,17 +222,16 @@ sh64_elf_merge_private_data (bfd *ibfd, struct bfd_link_info *info)
       if (bfd_get_arch_size (ibfd) == 32
 	  && bfd_get_arch_size (obfd) == 64)
 	/* xgettext:c-format */
-	msg = _("%s: compiled as 32-bit object and %s is 64-bit");
+	msg = _("%B: compiled as 32-bit object and %B is 64-bit");
       else if (bfd_get_arch_size (ibfd) == 64
 	       && bfd_get_arch_size (obfd) == 32)
 	/* xgettext:c-format */
-	msg = _("%s: compiled as 64-bit object and %s is 32-bit");
+	msg = _("%B: compiled as 64-bit object and %B is 32-bit");
       else
 	/* xgettext:c-format */
-	msg = _("%s: object size does not match that of target %s");
+	msg = _("%B: object size does not match that of target %B");
 
-      _bfd_error_handler (msg, bfd_get_filename (ibfd),
-			  bfd_get_filename (obfd));
+      _bfd_error_handler (msg, ibfd, obfd);
       bfd_set_error (bfd_error_wrong_format);
       return FALSE;
     }
@@ -249,8 +248,9 @@ sh64_elf_merge_private_data (bfd *ibfd, struct bfd_link_info *info)
   else if ((new_flags & EF_SH_MACH_MASK) != EF_SH5)
     {
       _bfd_error_handler
-	("%s: uses non-SH64 instructions while previous modules use SH64 instructions",
-	 bfd_get_filename (ibfd));
+	("%B: uses non-SH64 instructions while previous modules"
+	 " use SH64 instructions",
+	 ibfd);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -452,8 +452,7 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
 	{
 	  /* Make sure we don't get confused on invalid input.  */
 	  _bfd_error_handler
-	    (_("%s: encountered datalabel symbol in input"),
-	     bfd_get_filename (abfd));
+	    (_("%B: encountered datalabel symbol in input"), abfd);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -548,8 +547,8 @@ shmedia_prepare_reloc (struct bfd_link_info *info, bfd *abfd,
 	    if ((insn & SHMEDIA_PTB_BIT) != 0)
 	      {
 		_bfd_error_handler
-		  (_("%s: GAS error: unexpected PTB insn with R_SH_PT_16"),
-		   bfd_get_filename (input_section->owner));
+		  (_("%B: GAS error: unexpected PTB insn with R_SH_PT_16"),
+		   input_section->owner);
 		return FALSE;
 	      }
 
@@ -674,8 +673,7 @@ sh64_elf_final_write_processing (bfd *abfd,
 	{
 	  bfd_set_error (bfd_error_file_truncated);
 	  _bfd_error_handler
-	    (_("%s: could not write out added .cranges entries"),
-	     bfd_get_filename (abfd));
+	    (_("%B: could not write out added .cranges entries"), abfd);
 	}
     }
 
@@ -734,8 +732,7 @@ sh64_elf_final_write_processing (bfd *abfd,
 	    {
 	      bfd_set_error (bfd_error_file_truncated);
 	      _bfd_error_handler
-		(_("%s: could not write out sorted .cranges entries"),
-		 bfd_get_filename (abfd));
+		(_("%B: could not write out sorted .cranges entries"), abfd);
 	    }
 	}
     }
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index e97d1d1..823ba98 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -3600,9 +3600,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: 0x%lx: warning: R_V850_LONGCALL points to "
+		    (_("%B: 0x%lx: warning: R_V850_LONGCALL points to "
 		       "unrecognized insns"),
-		     bfd_get_filename (abfd), (unsigned long) irel->r_offset);
+		     abfd, (unsigned long) irel->r_offset);
 		  continue;
 		}
 
@@ -3610,9 +3610,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: 0x%lx: warning: R_V850_LONGCALL points to "
+		    (_("%B: 0x%lx: warning: R_V850_LONGCALL points to "
 		       "unrecognized insn 0x%x"),
-		     bfd_get_filename (abfd),
+		     abfd,
 		     (unsigned long) irel->r_offset + no_match,
 		     insn[no_match]);
 		  continue;
@@ -3655,9 +3655,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: 0x%lx: warning: R_V850_LONGCALL points to "
+		    (_("%B: 0x%lx: warning: R_V850_LONGCALL points to "
 		       "unrecognized reloc"),
-		     bfd_get_filename (abfd), (unsigned long) irel->r_offset);
+		     abfd, (unsigned long) irel->r_offset);
 
 		  continue;
 		}
@@ -3695,9 +3695,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: 0x%lx: warning: R_V850_LONGCALL points to "
+		    (_("%B: 0x%lx: warning: R_V850_LONGCALL points to "
 		       "unrecognized reloc 0x%lx"),
-		     bfd_get_filename (abfd), (unsigned long) irel->r_offset,
+		     abfd, (unsigned long) irel->r_offset,
 		     irelcall->r_offset);
 		  continue;
 		}
@@ -3838,9 +3838,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: 0x%lx: warning: R_V850_LONGJUMP points to "
+		    (_("%B: 0x%lx: warning: R_V850_LONGJUMP points to "
 		       "unrecognized insns"),
-		     bfd_get_filename (abfd), (unsigned long) irel->r_offset);
+		     abfd, (unsigned long) irel->r_offset);
 		  continue;
 		}
 
@@ -3848,9 +3848,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: 0x%lx: warning: R_V850_LONGJUMP points to "
+		    (_("%B: 0x%lx: warning: R_V850_LONGJUMP points to "
 		       "unrecognized insn 0x%x"),
-		     bfd_get_filename (abfd),
+		     abfd,
 		     (unsigned long) irel->r_offset + no_match,
 		     insn[no_match]);
 		  continue;
@@ -3882,9 +3882,9 @@ v850_elf_relax_section (bfd *abfd,
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: 0x%lx: warning: R_V850_LONGJUMP points to "
+		    (_("%B: 0x%lx: warning: R_V850_LONGJUMP points to "
 		       "unrecognized reloc"),
-		     bfd_get_filename (abfd), (unsigned long) irel->r_offset);
+		     abfd, (unsigned long) irel->r_offset);
 		  continue;
 		}
 
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 41bd772..0e4d2e4 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -632,10 +632,9 @@ elf_vax_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
 		  if (eh->got_addend != (bfd_vma) rel->r_addend)
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: warning: GOT addend of %ld to `%s' does"
+		      (_("%B: warning: GOT addend of %ld to `%s' does"
 			 " not match previous GOT addend of %ld"),
-			 bfd_get_filename (abfd), rel->r_addend,
-			 h->root.root.string,
+			 abfd, rel->r_addend, h->root.root.string,
 			 eh->got_addend);
 
 		}
@@ -1509,10 +1508,9 @@ elf_vax_relocate_section (bfd *output_bfd,
 	  else if (rel->r_addend != 0)
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: warning: PLT addend of %d to `%s' from %s section ignored"),
-		      bfd_get_filename (input_bfd), rel->r_addend,
-		      h->root.root.string,
-		      bfd_get_section_name (input_bfd, input_section));
+	      (_("%B: warning: PLT addend of %d to `%s'"
+		 " from %A section ignored"),
+	       input_bfd, rel->r_addend, h->root.root.string, input_section);
 	  rel->r_addend = 0;
 
 	  break;
@@ -1635,17 +1633,16 @@ elf_vax_relocate_section (bfd *output_bfd,
 		  if (h != NULL)
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: warning: %s relocation against symbol `%s' from %s section"),
-		      bfd_get_filename (input_bfd), howto->name,
-		      h->root.root.string,
-		      bfd_get_section_name (input_bfd, input_section));
+		      (_("%B: warning: %s relocation against symbol `%s'"
+			 " from %A section"),
+		      input_bfd, howto->name, h->root.root.string,
+		      input_section);
 		  else
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: warning: %s relocation to 0x%x from %s section"),
-		      bfd_get_filename (input_bfd), howto->name,
-		      outrel.r_addend,
-		      bfd_get_section_name (input_bfd, input_section));
+		      (_("%B: warning: %s relocation to 0x%x from %A section"),
+		      input_bfd, howto->name, outrel.r_addend,
+		      input_section);
 		}
 	      loc = sreloc->contents;
 	      loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c
index 2a2e930..e92a99a 100644
--- a/bfd/elf32-visium.c
+++ b/bfd/elf32-visium.c
@@ -814,10 +814,9 @@ visium_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
       if (mismatch)
 	_bfd_error_handler
 	  /* xgettext:c-format */
-	  (_("%s: compiled %s -mtune=%s and linked with modules"
+	  (_("%B: compiled %s -mtune=%s and linked with modules"
 	     " compiled %s -mtune=%s"),
-	   bfd_get_filename (ibfd), new_opt_with, opt_arch, old_opt_with,
-	   opt_arch);
+	   ibfd, new_opt_with, opt_arch, old_opt_with, opt_arch);
     }
 
   return TRUE;
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index 7c4dfb3..4d35a5d 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -3279,9 +3279,8 @@ elf64_ia64_choose_gp (bfd *abfd, struct bfd_link_info *info, bfd_boolean final)
 overflow:
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: short data segment overflowed (0x%lx >= 0x400000)"),
-	     bfd_get_filename (abfd),
-	     (unsigned long) (max_short_vma - min_short_vma));
+	    (_("%B: short data segment overflowed (0x%lx >= 0x400000)"),
+	     abfd, (unsigned long) (max_short_vma - min_short_vma));
 	  return FALSE;
 	}
       else if ((gp_val > min_short_vma
@@ -3290,8 +3289,7 @@ overflow:
 		   && max_short_vma - gp_val >= 0x200000))
 	{
 	  _bfd_error_handler
-	    (_("%s: __gp does not cover short data segment"),
-	     bfd_get_filename (abfd));
+	    (_("%B: __gp does not cover short data segment"), abfd);
 	  return FALSE;
 	}
     }
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 91aa4c5..2ebe0aa 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -1192,9 +1192,9 @@ mmix_elf_perform_relocation (asection *isec, reloc_howto_type *howto,
 	  {
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: Internal inconsistency error for value for\n\
+	      (_("%B: Internal inconsistency error for value for\n\
  linker-allocated global register: linked: 0x%lx%08lx != relaxed: 0x%lx%08lx\n"),
-	       bfd_get_filename (isec->owner),
+	       isec->owner,
 	       (unsigned long) (value >> 32), (unsigned long) value,
 	       (unsigned long) (gregdata->reloc_request[bpo_index].value
 				>> 32),
@@ -1615,15 +1615,15 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
 	  if (symname == NULL || *symname == 0)
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: base-plus-offset relocation against register symbol: (unknown) in %s"),
-	       bfd_get_filename (input_section->owner),
-	       bfd_get_section_name (symsec->owner, symsec));
+	      (_("%B: base-plus-offset relocation against register symbol:"
+		 " (unknown) in %A"),
+	       input_section->owner, symsec);
 	  else
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: base-plus-offset relocation against register symbol: %s in %s"),
-	       bfd_get_filename (input_section->owner), symname,
-	       bfd_get_section_name (symsec->owner, symsec));
+	      (_("%B: base-plus-offset relocation against register symbol:"
+		 " %s in %A"),
+	       input_section->owner, symname, symsec);
 	  return bfd_reloc_overflow;
 	}
       goto do_mmix_reloc;
@@ -1666,15 +1666,15 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
 	  if (symname == NULL || *symname == 0)
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: register relocation against non-register symbol: (unknown) in %s"),
-	       bfd_get_filename (input_section->owner),
-	       bfd_get_section_name (symsec->owner, symsec));
+	      (_("%B: register relocation against non-register symbol:"
+		 " (unknown) in %A"),
+	       input_section->owner, symsec);
 	  else
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: register relocation against non-register symbol: %s in %s"),
-	       bfd_get_filename (input_section->owner), symname,
-	       bfd_get_section_name (symsec->owner, symsec));
+	      (_("%B: register relocation against non-register symbol:"
+		 " %s in %A"),
+	       input_section->owner, symname, symsec);
 
 	  /* The bfd_reloc_outofrange return value, though intuitively a
 	     better value, will not get us an error.  */
@@ -1709,8 +1709,8 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
 		       MMIX_REG_SECTION_NAME) != 0)
 	{
 	  _bfd_error_handler
-	    (_("%s: directive LOCAL valid only with a register or absolute value"),
-	     bfd_get_filename (input_section->owner));
+	    (_("%B: directive LOCAL valid only with a register or absolute value"),
+	     input_section->owner);
 
 	  return bfd_reloc_overflow;
 	}
@@ -1740,8 +1740,9 @@ mmix_final_link_relocate (reloc_howto_type *howto, asection *input_section,
 	    /* FIXME: Better error message.  */
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: LOCAL directive: Register $%ld is not a local register.  First global register is $%ld."),
-	       bfd_get_filename (input_section->owner), (long) srel, (long) first_global);
+	      (_("%B: LOCAL directive: Register $%ld is not a local register."
+		 "  First global register is $%ld."),
+	       input_section->owner, (long) srel, (long) first_global);
 
 	    return bfd_reloc_overflow;
 	  }
@@ -2198,9 +2199,9 @@ mmix_elf_add_symbol_hook (bfd *abfd,
 	     h->u.def.section->owner is NULL.  */
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: Error: multiple definition of `%s'; start of %s "
+	    (_("%B: Error: multiple definition of `%s'; start of %s "
 	       "is set in a earlier linked file\n"),
-	     bfd_get_filename (abfd), *namep,
+	     abfd, *namep,
 	     *namep + strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX));
 	   bfd_set_error (bfd_error_bad_value);
 	   return FALSE;
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index 5de67b2..e38333d 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -1677,8 +1677,9 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: error: unaligned relocation type %d at %08x reloc %08x\n"),
-	     bfd_get_filename (input_bfd), (int)r_type, (unsigned)rel->r_offset, (unsigned)relocation);
+	    (_("%B: error: unaligned relocation type %d at %08x reloc %08x\n"),
+	     input_bfd, (int) r_type, (unsigned) rel->r_offset,
+	     (unsigned) relocation);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -2273,17 +2274,16 @@ sh_elf64_merge_private_data (bfd *ibfd, struct bfd_link_info *info)
       if (bfd_get_arch_size (ibfd) == 32
 	  && bfd_get_arch_size (obfd) == 64)
 	/* xgettext:c-format */
-	msg = _("%s: compiled as 32-bit object and %s is 64-bit");
+	msg = _("%B: compiled as 32-bit object and %B is 64-bit");
       else if (bfd_get_arch_size (ibfd) == 64
 	       && bfd_get_arch_size (obfd) == 32)
 	/* xgettext:c-format */
-	msg = _("%s: compiled as 64-bit object and %s is 32-bit");
+	msg = _("%B: compiled as 64-bit object and %B is 32-bit");
       else
 	/* xgettext:c-format */
-	msg = _("%s: object size does not match that of target %s");
+	msg = _("%B: object size does not match that of target %B");
 
-      _bfd_error_handler (msg, bfd_get_filename (ibfd),
-			  bfd_get_filename (obfd));
+      _bfd_error_handler (msg, ibfd, obfd);
       bfd_set_error (bfd_error_wrong_format);
       return FALSE;
     }
@@ -2302,8 +2302,7 @@ sh_elf64_merge_private_data (bfd *ibfd, struct bfd_link_info *info)
   else if ((new_flags & EF_SH_MACH_MASK) != EF_SH5)
     {
       _bfd_error_handler
-	("%s: does not use the SH64 64-bit ABI as previous modules do",
-	 bfd_get_filename (ibfd));
+	("%B: does not use the SH64 64-bit ABI as previous modules do", ibfd);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -2774,8 +2773,7 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
 	{
 	  /* Make sure we don't get confused on invalid input.  */
 	  _bfd_error_handler
-	    (_("%s: encountered datalabel symbol in input"),
-	     bfd_get_filename (abfd));
+	    (_("%B: encountered datalabel symbol in input"), abfd);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 5142273..ef097f7 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -756,8 +756,9 @@ elf_object_p (bfd *abfd)
 	     So we are kind, and reset the string index value to 0
 	     so that at least some processing can be done.  */
 	  i_ehdrp->e_shstrndx = SHN_UNDEF;
-	  _bfd_error_handler (_("warning: %s has a corrupt string table index - ignoring"),
-			      abfd->filename);
+	  _bfd_error_handler
+	    (_("warning: %B has a corrupt string table index - ignoring"),
+	     abfd);
 	}
     }
   else if (i_ehdrp->e_shstrndx != SHN_UNDEF)
@@ -1189,8 +1190,8 @@ elf_slurp_symbol_table (bfd *abfd, asymbol **symptrs, bfd_boolean dynamic)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: version count (%ld) does not match symbol count (%ld)"),
-	     abfd->filename,
+	    (_("%B: version count (%ld) does not match symbol count (%ld)"),
+	     abfd,
 	     (long) (verhdr->sh_size / sizeof (Elf_External_Versym)),
 	     symcount);
 
@@ -1444,8 +1445,8 @@ elf_slurp_reloc_table_from_section (bfd *abfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s(%s): relocation %d has invalid symbol index %ld"),
-	     abfd->filename, asect->name, i, ELF_R_SYM (rela.r_info));
+	    (_("%B(%A): relocation %d has invalid symbol index %ld"),
+	     abfd, asect, i, ELF_R_SYM (rela.r_info));
 	  relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
 	}
       else
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 9976638..00f19e9 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2849,7 +2849,7 @@ _bfd_aarch64_add_stub_entry_in_group (const char *stub_name,
   if (stub_entry == NULL)
     {
       /* xgettext:c-format */
-      _bfd_error_handler (_("%s: cannot create stub entry %s"),
+      _bfd_error_handler (_("%B: cannot create stub entry %s"),
 			  section->owner, stub_name);
       return NULL;
     }
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index 3c27f5d..92ff8d7 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -3685,9 +3685,8 @@ elfNN_ia64_choose_gp (bfd *abfd, struct bfd_link_info *info, bfd_boolean final)
 overflow:
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: short data segment overflowed (0x%lx >= 0x400000)"),
-	     bfd_get_filename (abfd),
-	     (unsigned long) (max_short_vma - min_short_vma));
+	    (_("%B: short data segment overflowed (0x%lx >= 0x400000)"),
+	     abfd, (unsigned long) (max_short_vma - min_short_vma));
 	  return FALSE;
 	}
       else if ((gp_val > min_short_vma
@@ -3696,8 +3695,7 @@ overflow:
 		   && max_short_vma - gp_val >= 0x200000))
 	{
 	  _bfd_error_handler
-	    (_("%s: __gp does not cover short data segment"),
-	     bfd_get_filename (abfd));
+	    (_("%B: __gp does not cover short data segment"), abfd);
 	  return FALSE;
 	}
     }
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 4efa513..08151c1 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -14685,8 +14685,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%s: illegal section name `%s'"),
-		 bfd_get_filename (abfd), o->name);
+		(_("%B: illegal section name `%A'"), abfd, o);
 	      bfd_set_error (bfd_error_nonrepresentable_section);
 	      return FALSE;
 	    }
diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c
index 11dc9d5..ae627c7 100644
--- a/bfd/hpux-core.c
+++ b/bfd/hpux-core.c
@@ -337,8 +337,10 @@ hpux_core_core_file_p (bfd *abfd)
      */
   if ((unknown_sections > 0) && (good_sections > 0))
     _bfd_error_handler
-      ("%s appears to be a core file,\nbut contains unknown sections.  It may have been created on an incompatible\nversion of HP-UX.  As a result, some information may be unavailable.\n",
-       abfd->filename);
+      ("%B appears to be a core file,\nbut contains unknown sections."
+       "  It may have been created on an incompatible\nversion of HP-UX."
+       "  As a result, some information may be unavailable.\n",
+       abfd);
 
   return abfd->xvec;
 
diff --git a/bfd/ieee.c b/bfd/ieee.c
index aac8660..a2d3835 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -156,8 +156,7 @@ ieee_write_id (bfd *abfd, const char *id)
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: string too long (%d chars, max 65535)"),
-	 bfd_get_filename (abfd), length);
+	(_("%B: string too long (%d chars, max 65535)"), abfd, length);
       bfd_set_error (bfd_error_invalid_operation);
       return FALSE;
     }
@@ -291,9 +290,8 @@ ieee_write_expression (bfd *abfd,
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%s: unrecognized symbol `%s' flags 0x%x"),
-		 bfd_get_filename (abfd), bfd_asymbol_name (symbol),
-		 symbol->flags);
+		(_("%B: unrecognized symbol `%s' flags 0x%x"),
+		 abfd, bfd_asymbol_name (symbol), symbol->flags);
 	      bfd_set_error (bfd_error_invalid_operation);
 	      return FALSE;
 	    }
diff --git a/bfd/ihex.c b/bfd/ihex.c
index fd3da39..6dda98f 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -830,8 +830,8 @@ ihex_write_object_contents (bfd *abfd)
 		      sprintf_vma (buf, where);
 		      _bfd_error_handler
 			/* xgettext:c-format */
-			(_("%s: address 0x%s out of range for Intel Hex file"),
-			 bfd_get_filename (abfd), buf);
+			(_("%B: address 0x%s out of range for Intel Hex file"),
+			 abfd, buf);
 		      bfd_set_error (bfd_error_bad_value);
 		      return FALSE;
 		    }
diff --git a/bfd/linker.c b/bfd/linker.c
index 12c9fb0..2f56b46 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -1405,8 +1405,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
       if (!bfd_link_relocatable (info)
 	  && strcmp (name, "__gnu_lto_slim") == 0)
 	_bfd_error_handler
-	  (_("%s: plugin needed to handle lto object"),
-	   bfd_get_filename (abfd));
+	  (_("%B: plugin needed to handle lto object"), abfd);
     }
   else
     row = DEF_ROW;
diff --git a/bfd/merge.c b/bfd/merge.c
index 3cddeff..553de8e 100644
--- a/bfd/merge.c
+++ b/bfd/merge.c
@@ -861,8 +861,8 @@ _bfd_merged_section_offset (bfd *output_bfd ATTRIBUTE_UNUSED, asection **psec,
       if (offset > sec->rawsize)
 	_bfd_error_handler
 	  /* xgettext:c-format */
-	  (_("%s: access beyond end of merged section (%ld)"),
-	   bfd_get_filename (sec->owner), (long) offset);
+	  (_("%B: access beyond end of merged section (%ld)"),
+	   sec->owner, (long) offset);
       return secinfo->first_str ? sec->size : 0;
     }
 
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 3e436a5..6b2772b 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -465,8 +465,8 @@ mmo_make_section (bfd *abfd, const char *secname)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: No core to allocate section name %s\n"),
-	     bfd_get_filename (abfd), secname);
+	    (_("%B: No core to allocate section name %s\n"),
+	     abfd, secname);
 	  bfd_set_error (bfd_error_system_call);
 	  return NULL;
 	}
@@ -541,8 +541,8 @@ mmo_object_p (bfd *abfd)
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: No core to allocate a symbol %d bytes long\n"),
-	 bfd_get_filename (abfd), abfd->tdata.mmo_data->max_symbol_length);
+	(_("%B: No core to allocate a symbol %d bytes long\n"),
+	 abfd, abfd->tdata.mmo_data->max_symbol_length);
       goto bad_final;
     }
 
@@ -955,8 +955,9 @@ mmo_write_loc_chunk (bfd *abfd, bfd_vma vma, const bfd_byte *loc,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: attempt to emit contents at non-multiple-of-4 address 0x%lx\n"),
-	     bfd_get_filename (abfd), (unsigned long) vma);
+	    (_("%B: attempt to emit contents at non-multiple-of-4"
+	       " address 0x%lx\n"),
+	     abfd, (unsigned long) vma);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -1251,8 +1252,9 @@ mmo_create_symbol (bfd *abfd, const char *symname, bfd_vma addr, enum
       && !mmo_ignore_symbol_consistency (abfd))
     {
       _bfd_error_handler
-	(_("%s: invalid mmo file: initialization value for $255 is not `Main'\n"),
-	 bfd_get_filename (abfd));
+	(_("%B: invalid mmo file: initialization value for $255"
+	   " is not `Main'\n"),
+	 abfd);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -1397,10 +1399,9 @@ SUBSECTION
 
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%s: unsupported wide character sequence"
+		(_("%B: unsupported wide character sequence"
 		   " 0x%02X 0x%02X after symbol name starting with `%s'\n"),
-		 bfd_get_filename (abfd), c, c2,
-		 abfd->tdata.mmo_data->lop_stab_symbol);
+		 abfd, c, c2, abfd->tdata.mmo_data->lop_stab_symbol);
 	      bfd_set_error (bfd_error_bad_value);
 	      abfd->tdata.mmo_data->have_error = TRUE;
 	      return FALSE;
@@ -1632,8 +1633,8 @@ mmo_scan (bfd *abfd)
 	    default:
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%s: invalid mmo file: unsupported lopcode `%d'\n"),
-		 bfd_get_filename (abfd), buf[1]);
+		(_("%B: invalid mmo file: unsupported lopcode `%d'\n"),
+		 abfd, buf[1]);
 	      bfd_set_error (bfd_error_bad_value);
 	      goto error_return;
 
@@ -1643,8 +1644,9 @@ mmo_scan (bfd *abfd)
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: invalid mmo file: expected YZ = 1 got YZ = %d for lop_quote\n"),
-		     bfd_get_filename (abfd), y*256+z);
+		    (_("%B: invalid mmo file: expected YZ = 1"
+		       " got YZ = %d for lop_quote\n"),
+		     abfd, y*256+z);
 		  bfd_set_error (bfd_error_bad_value);
 		  goto error_return;
 		}
@@ -1680,8 +1682,9 @@ mmo_scan (bfd *abfd)
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_loc\n"),
-		     bfd_get_filename (abfd), z);
+		    (_("%B: invalid mmo file: expected z = 1 or z = 2,"
+		       " got z = %d for lop_loc\n"),
+		     abfd, z);
 		  bfd_set_error (bfd_error_bad_value);
 		  goto error_return;
 		}
@@ -1730,8 +1733,9 @@ mmo_scan (bfd *abfd)
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: invalid mmo file: expected z = 1 or z = 2, got z = %d for lop_fixo\n"),
-		       bfd_get_filename (abfd), z);
+		      (_("%B: invalid mmo file: expected z = 1 or z = 2,"
+			 " got z = %d for lop_fixo\n"),
+		       abfd, z);
 		    bfd_set_error (bfd_error_bad_value);
 		    goto error_return;
 		  }
@@ -1770,8 +1774,9 @@ mmo_scan (bfd *abfd)
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: invalid mmo file: expected y = 0, got y = %d for lop_fixrx\n"),
-		       bfd_get_filename (abfd), y);
+		      (_("%B: invalid mmo file: expected y = 0,"
+			 " got y = %d for lop_fixrx\n"),
+		       abfd, y);
 		    bfd_set_error (bfd_error_bad_value);
 		    goto error_return;
 		  }
@@ -1780,8 +1785,9 @@ mmo_scan (bfd *abfd)
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: invalid mmo file: expected z = 16 or z = 24, got z = %d for lop_fixrx\n"),
-		       bfd_get_filename (abfd), z);
+		      (_("%B: invalid mmo file: expected z = 16 or z = 24,"
+			 " got z = %d for lop_fixrx\n"),
+		       abfd, z);
 		    bfd_set_error (bfd_error_bad_value);
 		    goto error_return;
 		  }
@@ -1804,8 +1810,9 @@ mmo_scan (bfd *abfd)
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: invalid mmo file: leading byte of operand word must be 0 or 1, got %d for lop_fixrx\n"),
-		       bfd_get_filename (abfd), buf[0]);
+		      (_("%B: invalid mmo file: leading byte of operand word"
+			 " must be 0 or 1, got %d for lop_fixrx\n"),
+		       abfd, buf[0]);
 		    bfd_set_error (bfd_error_bad_value);
 		    goto error_return;
 		  }
@@ -1828,8 +1835,9 @@ mmo_scan (bfd *abfd)
 		    {
 		      _bfd_error_handler
 			/* xgettext:c-format */
-			(_("%s: cannot allocate file name for file number %d, %d bytes\n"),
-			 bfd_get_filename (abfd), y, z * 4 + 1);
+			(_("%B: cannot allocate file name for file number %d,"
+			   " %d bytes\n"),
+			 abfd, y, z * 4 + 1);
 		      bfd_set_error (bfd_error_system_call);
 		      goto error_return;
 		    }
@@ -1849,9 +1857,9 @@ mmo_scan (bfd *abfd)
 		    {
 		      _bfd_error_handler
 			/* xgettext:c-format */
-			(_("%s: invalid mmo file: file number %d `%s',"
+			(_("%B: invalid mmo file: file number %d `%s',"
 			   " was already entered as `%s'\n"),
-			 bfd_get_filename (abfd), y, fname, file_names[y]);
+			 abfd, y, fname, file_names[y]);
 		      bfd_set_error (bfd_error_bad_value);
 		      goto error_return;
 		    }
@@ -1863,9 +1871,9 @@ mmo_scan (bfd *abfd)
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: invalid mmo file: file name for number %d"
+		    (_("%B: invalid mmo file: file name for number %d"
 		       " was not specified before use\n"),
-		     bfd_get_filename (abfd), y);
+		     abfd, y);
 		  bfd_set_error (bfd_error_bad_value);
 		  goto error_return;
 		}
@@ -1970,9 +1978,9 @@ mmo_scan (bfd *abfd)
 		{
 		  _bfd_error_handler
 		    /* xgettext:c-format */
-		    (_("%s: invalid mmo file: fields y and z of lop_stab"
+		    (_("%B: invalid mmo file: fields y and z of lop_stab"
 		       " non-zero, y: %d, z: %d\n"),
-		     bfd_get_filename (abfd), y, z);
+		     abfd, y, z);
 		  bfd_set_error (bfd_error_bad_value);
 		  goto error_return;
 		}
@@ -2007,9 +2015,9 @@ mmo_scan (bfd *abfd)
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: invalid mmo file: lop_end not last item in"
+		      (_("%B: invalid mmo file: lop_end not last item in"
 			 " file\n"),
-		       bfd_get_filename (abfd));
+		       abfd);
 		    bfd_set_error (bfd_error_bad_value);
 		    goto error_return;
 		  }
@@ -2021,10 +2029,10 @@ mmo_scan (bfd *abfd)
 		  {
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%s: invalid mmo file: YZ of lop_end (%ld)"
+		      (_("%B: invalid mmo file: YZ of lop_end (%ld)"
 			 " not equal to the number of tetras to the preceding"
 			 " lop_stab (%ld)\n"),
-		       bfd_get_filename (abfd), (long) (y * 256 + z),
+		       abfd, (long) (y * 256 + z),
 		       (curpos - stab_loc - 4)/4);
 		    bfd_set_error (bfd_error_bad_value);
 		    goto error_return;
@@ -2732,8 +2740,8 @@ mmo_internal_add_3_sym (bfd *abfd, struct mmo_symbol_trie *rootp,
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: invalid symbol table: duplicate symbol `%s'\n"),
-	 bfd_get_filename (abfd), trie->sym.name);
+	(_("%B: invalid symbol table: duplicate symbol `%s'\n"),
+	 abfd, trie->sym.name);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -2975,9 +2983,9 @@ mmo_write_symbols_and_terminator (bfd *abfd)
 
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: Bad symbol definition: `Main' set to %s rather"
+	      (_("%B: Bad symbol definition: `Main' set to %s rather"
 		 " than the start address %s\n"),
-	       bfd_get_filename (abfd), vmas_main, vmas_start);
+	       abfd, vmas_main, vmas_start);
 	    bfd_set_error (bfd_error_bad_value);
 	    return FALSE;
 	  }
@@ -3074,9 +3082,9 @@ mmo_write_symbols_and_terminator (bfd *abfd)
 
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: warning: symbol table too large for mmo, larger than 65535"
+	(_("%B: warning: symbol table too large for mmo, larger than 65535"
 	   " 32-bit words: %d.  Only `Main' will be emitted.\n"),
-	 bfd_get_filename (abfd), trie_len);
+	 abfd, trie_len);
 
       memset (&sym, 0, sizeof (sym));
       sym.sym_type = mmo_abs_sym;
@@ -3120,9 +3128,9 @@ mmo_write_symbols_and_terminator (bfd *abfd)
 	 diagnostic and fail "normally".  */
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: internal error, symbol table changed size from %d to %d"
+	(_("%B: internal error, symbol table changed size from %d to %d"
 	   " words\n"),
-	 bfd_get_filename (abfd), trie_len,
+	 abfd, trie_len,
 	 (abfd->tdata.mmo_data->byte_no + 3)/4);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
@@ -3173,9 +3181,9 @@ mmo_write_section_unless_reg_contents (bfd *abfd, asection *sec, void *p)
 	     this.  */
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: internal error, internal register section %s had"
+	    (_("%B: internal error, internal register section %A had"
 	       " contents\n"),
-	     bfd_get_filename (abfd), sec->name);
+	     abfd, sec);
 	  bfd_set_error (bfd_error_bad_value);
 	  infop->retval = FALSE;
 	  return;
@@ -3224,23 +3232,21 @@ mmo_write_object_contents (bfd *abfd)
 	  if (sec->size == 0)
 	    /* There must always be at least one such register.  */
 	    _bfd_error_handler
-	      (_("%s: no initialized registers; section length 0\n"),
-	       bfd_get_filename (abfd));
+	      (_("%B: no initialized registers; section length 0\n"),
+	       abfd);
 	  else if (sec->vma > (256 - 32) * 8)
 	    /* Provide better error message for the case of too many
 	       global registers.  */
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: too many initialized registers; section length %ld\n"),
-	       bfd_get_filename (abfd),
-	       (long) sec->size);
+	      (_("%B: too many initialized registers; section length %ld\n"),
+	       abfd, (long) sec->size);
 	  else
 	    _bfd_error_handler
 	      /* xgettext:c-format */
-	      (_("%s: invalid start address for initialized registers of"
+	      (_("%B: invalid start address for initialized registers of"
 		 " length %ld: 0x%lx%08lx\n"),
-	       bfd_get_filename (abfd),
-	       (long) sec->size,
+	       abfd, (long) sec->size,
 	       (unsigned long) (sec->vma >> 32), (unsigned long) (sec->vma));
 
 	  return FALSE;
diff --git a/bfd/oasys.c b/bfd/oasys.c
index 0479679..06491aa 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -878,8 +878,7 @@ oasys_write_sections (bfd *abfd)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%s: can not represent section `%s' in oasys"),
-	     bfd_get_filename (abfd), s->name);
+	    (_("%B: can not represent section `%A' in oasys"), abfd, s);
 	  bfd_set_error (bfd_error_nonrepresentable_section);
 	  return FALSE;
 	}
diff --git a/bfd/pdp11.c b/bfd/pdp11.c
index 168dde0..3f3eb68 100644
--- a/bfd/pdp11.c
+++ b/bfd/pdp11.c
@@ -1149,8 +1149,8 @@ NAME (aout, set_section_contents) (bfd *abfd,
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%s: can not represent section `%s' in a.out object file format"),
-	 bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
+	(_("%B: can not represent section `%A' in a.out object file format"),
+	 abfd, section);
       bfd_set_error (bfd_error_nonrepresentable_section);
       return FALSE;
     }
@@ -3705,9 +3705,8 @@ NAME (aout, final_link) (bfd *abfd,
 		 by the reloc size.  */
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%s: relocatable link from %s to %s not supported"),
-		 bfd_get_filename (abfd),
-		 sub->xvec->name, abfd->xvec->name);
+		(_("%B: relocatable link from %s to %s not supported"),
+		 abfd, sub->xvec->name, abfd->xvec->name);
 	      bfd_set_error (bfd_error_invalid_operation);
 	      goto error_return;
 	    }
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index eb9c879..38571cc 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1086,9 +1086,8 @@ _bfd_XXi_swap_scnhdr_out (bfd * abfd, void * in, void * out)
       else
 	{
 	  /* xgettext:c-format */
-	  _bfd_error_handler (_("%s: line number overflow: 0x%lx > 0xffff"),
-			      bfd_get_filename (abfd),
-			      scnhdr_int->s_nlnno);
+	  _bfd_error_handler (_("%B: line number overflow: 0x%lx > 0xffff"),
+			      abfd, scnhdr_int->s_nlnno);
 	  bfd_set_error (bfd_error_file_truncated);
 	  H_PUT_16 (abfd, 0xffff, scnhdr_ext->s_nlnno);
 	  ret = 0;
@@ -4220,16 +4219,16 @@ rsrc_process_section (bfd * abfd,
       if (data > dataend)
 	{
 	  /* Corrupted .rsrc section - cannot merge.  */
-	  _bfd_error_handler (_("%s: .rsrc merge failure: corrupt .rsrc section"),
-			      bfd_get_filename (abfd));
+	  _bfd_error_handler (_("%B: .rsrc merge failure: corrupt .rsrc section"),
+			      abfd);
 	  bfd_set_error (bfd_error_file_truncated);
 	  goto end;
 	}
 
       if ((data - p) > rsrc_sizes [num_resource_sets])
 	{
-	  _bfd_error_handler (_("%s: .rsrc merge failure: unexpected .rsrc size"),
-			      bfd_get_filename (abfd));
+	  _bfd_error_handler (_("%B: .rsrc merge failure: unexpected .rsrc size"),
+			      abfd);
 	  bfd_set_error (bfd_error_file_truncated);
 	  goto end;
 	}
diff --git a/bfd/rs6000-core.c b/bfd/rs6000-core.c
index 6951e67..00cc3c0 100644
--- a/bfd/rs6000-core.c
+++ b/bfd/rs6000-core.c
@@ -468,8 +468,7 @@ rs6000coff_core_p (bfd *abfd)
 
   /* Issue warning if the core file was truncated during writing.  */
   if (c_flag & CORE_TRUNC)
-    _bfd_error_handler (_("%s: warning core file truncated"),
-			bfd_get_filename (abfd));
+    _bfd_error_handler (_("%B: warning core file truncated"), abfd);
 
   /* Allocate core file header.  */
 #ifndef BFD64
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index fcfc243..4a9881b 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -3672,7 +3672,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
 
 	  if (section->reloc_count == 0)
 	    _bfd_error_handler
-	      (_("SEC_RELOC with no relocs in section %s"), section->name);
+	      (_("SEC_RELOC with no relocs in section %A"), section);
 
 #if VMS_DEBUG
 	  else
@@ -3724,8 +3724,8 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
 
 		  /* Regular relocs are intertwined with binary data.  */
 	          if (curr_addr > addr)
-		    _bfd_error_handler (_("Size error in section %s"),
-					section->name);
+		    _bfd_error_handler (_("Size error in section %A"),
+					section);
 		  size = addr - curr_addr;
 		  sto_imm (abfd, section, size, curr_data, curr_addr);
 		  curr_data += size;
@@ -3937,8 +3937,7 @@ _bfd_vms_write_etir (bfd * abfd, int objtype ATTRIBUTE_UNUSED)
 	    {
 	      /* Output rest of section.  */
 	      if (curr_addr > section->size)
-		_bfd_error_handler (_("Size error in section %s"),
-				    section->name);
+		_bfd_error_handler (_("Size error in section %A"), section);
 	      size = section->size - curr_addr;
 	      sto_imm (abfd, section, size, curr_data, curr_addr);
 	      curr_data += size;
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 9944f23..8121c7e 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -829,8 +829,8 @@ xcoff_link_add_dynamic_symbols (bfd *abfd, struct bfd_link_info *info)
    if (info->output_bfd->xvec != abfd->xvec)
     {
       _bfd_error_handler
-	(_("%s: XCOFF shared object when not producing XCOFF output"),
-	 bfd_get_filename (abfd));
+	(_("%B: XCOFF shared object when not producing XCOFF output"),
+	 abfd);
       bfd_set_error (bfd_error_invalid_operation);
       return FALSE;
     }
@@ -850,8 +850,8 @@ xcoff_link_add_dynamic_symbols (bfd *abfd, struct bfd_link_info *info)
   if (lsec == NULL)
     {
       _bfd_error_handler
-	(_("%s: dynamic object with no .loader section"),
-	 bfd_get_filename (abfd));
+	(_("%B: dynamic object with no .loader section"),
+	 abfd);
       bfd_set_error (bfd_error_no_symbols);
       return FALSE;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]