This is the mail archive of the binutils@sources.redhat.com 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]

Re: bfd_error_handler extension


On Thu, Aug 12, 2004 at 08:07:50AM +0100, Nick Clifton wrote:
> Hi Alan,
> 
> >So my idea was to always pass extension args first.  A call might look
> >like
> >
> >  (*_bfd_error_handler)
> >    (_("%B: bad reloc symbol index (0x%lx >= 0x%lx) for offset 0x%lx in 
> >    section `%S'"),
> >     abfd, sec,
> >     (unsigned long) r_symndx, (unsigned long) nsyms, irela->r_offset);
> 
> >_bfd_default_error_handler then would process any %B or %S in the format
> >string, and pass a substituted format string on to vfprint.  There is
> >some nastiness with this approach, since you need to expand "%" in any
> >substitutions to "%%".
> 
> Which should be a pretty rare case right ?  I think that this is a good 
> idea - code simplification is always a good thing.

Yes.  The following implements my idea, updating all _bdf_error_handler
calls that currently use bfd_archive_filename or bfd_get_section_ident.
In the process, I discovered a number of existing bugs.  eg. use of
bfd_archive_filename twice in the same error message, extra format
params in section_already_linked functions.  I've also downgraded the
error concerning relocations using symbols from discarded sections to
a warning.

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.

Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.64
diff -u -p -r1.64 bfd.c
--- bfd/bfd.c	30 Jul 2004 15:37:04 -0000	1.64
+++ bfd/bfd.c	13 Aug 2004 02:37:57 -0000
@@ -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;
+	}
 
-  fprintf (stderr, "\n");
+      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);
+
+  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
      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;
-}
Index: bfd/ecofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/ecofflink.c,v
retrieving revision 1.13
diff -u -p -r1.13 ecofflink.c
--- bfd/ecofflink.c	24 Apr 2004 06:12:24 -0000	1.13
+++ bfd/ecofflink.c	13 Aug 2004 02:38:16 -0000
@@ -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, <ian@cygnus.com>.
 
@@ -1154,7 +1154,7 @@ bfd_ecoff_debug_accumulate_other (handle
   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;
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.93
diff -u -p -r1.93 elflink.c
--- bfd/elflink.c	9 Aug 2004 06:02:03 -0000	1.93
+++ bfd/elflink.c	13 Aug 2004 02:39:14 -0000
@@ -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
 	  /* 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 *
 	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
     }
   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, 
 		      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, 
 		      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, 
 
 	      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, 
 	    {
 	      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, 
 		  && 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, 
 		{
 		  (*_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 *outp
 		      == 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_
       && ! 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_
 						 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_
       && (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_lin
 			}
 		      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_l
       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, asectio
 
   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 bf
 	      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 bf
 	      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 *ab
 
 	    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;
 	    }
 
Index: bfd/aout-adobe.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-adobe.c,v
retrieving revision 1.20
diff -u -p -r1.20 aout-adobe.c
--- bfd/aout-adobe.c	21 Jul 2004 15:42:56 -0000	1.20
+++ bfd/aout-adobe.c	13 Aug 2004 02:37:50 -0000
@@ -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;
 	}
 
Index: bfd/aout-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-cris.c,v
retrieving revision 1.10
diff -u -p -r1.10 aout-cris.c
--- bfd/aout-cris.c	13 Mar 2003 09:28:49 -0000	1.10
+++ bfd/aout-cris.c	13 Aug 2004 02:37:51 -0000
@@ -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, cach
 
   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, cach
   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);
 
Index: bfd/coff-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-arm.c,v
retrieving revision 1.53
diff -u -p -r1.53 coff-arm.c
--- bfd/coff-arm.c	29 Jun 2004 13:46:29 -0000	1.53
+++ bfd/coff-arm.c	13 Aug 2004 02:37:57 -0000
@@ -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, i
 			  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, i
 			      && 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, i
 	  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,
 	  /* 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, o
 	    {
 	      _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, o
 
 	      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, o
 
 	      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, o
 
 	      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, f
     {
       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, des
 		{
 		  /* 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);
Index: bfd/coff-i860.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-i860.c,v
retrieving revision 1.14
diff -u -p -r1.14 coff-i860.c
--- bfd/coff-i860.c	4 Dec 2003 12:08:42 -0000	1.14
+++ bfd/coff-i860.c	13 Aug 2004 02:37:57 -0000
@@ -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 <dolan@ssd.intel.com>, October 1995
 
@@ -607,8 +607,8 @@ i860_reloc_processing (arelent *cache_pt
 	  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;
 	    }
Index: bfd/coff-mcore.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-mcore.c,v
retrieving revision 1.29
diff -u -p -r1.29 coff-mcore.c
--- bfd/coff-mcore.c	24 Nov 2003 18:06:40 -0000	1.29
+++ bfd/coff-mcore.c	13 Aug 2004 02:37:58 -0000
@@ -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, relo
 {
   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,
       && 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,
       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 <file %s, section %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 <file %B, section %A>\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:
Index: bfd/coff-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-ppc.c,v
retrieving revision 1.21
diff -u -p -r1.21 coff-ppc.c
--- bfd/coff-ppc.c	28 Jun 2004 13:57:58 -0000	1.21
+++ bfd/coff-ppc.c	13 Aug 2004 02:37:59 -0000
@@ -1188,8 +1188,7 @@ coff_ppc_relocate_section (output_bfd, i
 	{
 	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, i
 		    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, i
 		&& (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, i
 	    else
 	      my_name = h->root.root.root.string;
 
-	    fprintf (stderr,
-		    _("Warning: unsupported reloc %s <file %s, section %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 <file %B, section %A>\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, i
 	    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;
 	  }
Index: bfd/coff-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-rs6000.c,v
retrieving revision 1.62
diff -u -p -r1.62 coff-rs6000.c
--- bfd/coff-rs6000.c	21 Jul 2004 15:42:57 -0000	1.62
+++ bfd/coff-rs6000.c	13 Aug 2004 02:38:01 -0000
@@ -3611,8 +3611,8 @@ xcoff_create_csect_from_smclas (abfd, au
   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);
     }
 
Index: bfd/coff-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-sh.c,v
retrieving revision 1.27
diff -u -p -r1.27 coff-sh.c
--- bfd/coff-sh.c	24 Jun 2004 04:46:16 -0000	1.27
+++ bfd/coff-sh.c	13 Aug 2004 02:38:03 -0000
@@ -762,9 +762,8 @@ sh_relax_section (abfd, sec, link_info, 
       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, 
       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, 
       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, 
       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, 
       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, 
       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, 
          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, 
 	  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, 
       || 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, conten
 	  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, i
 	      || (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;
 	    }
Index: bfd/coff-tic54x.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-tic54x.c,v
retrieving revision 1.15
diff -u -p -r1.15 coff-tic54x.c
--- bfd/coff-tic54x.c	15 Mar 2004 12:23:10 -0000	1.15
+++ bfd/coff-tic54x.c	13 Aug 2004 02:38:03 -0000
@@ -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, 
       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;
         }
Index: bfd/coff-tic80.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-tic80.c,v
retrieving revision 1.12
diff -u -p -r1.12 coff-tic80.c
--- bfd/coff-tic80.c	25 Jun 2003 06:40:22 -0000	1.12
+++ bfd/coff-tic80.c	13 Aug 2004 02:38:03 -0000
@@ -684,10 +684,8 @@ coff_tic80_relocate_section (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:
 	  {
Index: bfd/coff64-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff64-rs6000.c,v
retrieving revision 1.54
diff -u -p -r1.54 coff64-rs6000.c
--- bfd/coff64-rs6000.c	21 Jul 2004 15:42:57 -0000	1.54
+++ bfd/coff64-rs6000.c	13 Aug 2004 02:38:04 -0000
@@ -2104,8 +2104,8 @@ xcoff64_create_csect_from_smclas (abfd, 
   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);
     }
 
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.109
diff -u -p -r1.109 coffcode.h
--- bfd/coffcode.h	21 Jul 2004 15:42:57 -0000	1.109
+++ bfd/coffcode.h	13 Aug 2004 02:38:07 -0000
@@ -1071,8 +1071,8 @@ styp_to_sec_flags (abfd, hdr, name, sect
 	  /* 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, sect
       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, sym
 	  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, sym
       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;
 	}
Index: bfd/coffgen.c
===================================================================
RCS file: /cvs/src/src/bfd/coffgen.c,v
retrieving revision 1.44
diff -u -p -r1.44 coffgen.c
--- bfd/coffgen.c	21 Jul 2004 15:42:57 -0000	1.44
+++ bfd/coffgen.c	13 Aug 2004 02:38:09 -0000
@@ -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;
     }
Index: bfd/cofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/cofflink.c,v
retrieving revision 1.47
diff -u -p -r1.47 cofflink.c
--- bfd/cofflink.c	21 Jul 2004 15:42:57 -0000	1.47
+++ bfd/cofflink.c	13 Aug 2004 02:38:10 -0000
@@ -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_fi
 	  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 
 	       || (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 
 	  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:
 	  {
Index: bfd/cpu-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-arm.c,v
retrieving revision 1.13
diff -u -p -r1.13 cpu-arm.c
--- bfd/cpu-arm.c	24 Jun 2004 04:46:16 -0000	1.13
+++ bfd/cpu-arm.c	13 Aug 2004 02:38:14 -0000
@@ -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, wh
 	   && (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;
     }
Index: bfd/cpu-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/cpu-sh.c,v
retrieving revision 1.16
diff -u -p -r1.16 cpu-sh.c
--- bfd/cpu-sh.c	29 Jul 2004 05:17:39 -0000	1.16
+++ bfd/cpu-sh.c	13 Aug 2004 02:38:14 -0000
@@ -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);
Index: bfd/elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.73
diff -u -p -r1.73 elf-hppa.h
--- bfd/elf-hppa.h	24 Jun 2004 04:46:17 -0000	1.73
+++ bfd/elf-hppa.h	13 Aug 2004 02:38:17 -0000
@@ -1399,9 +1399,8 @@ elf_hppa_relocate_section (bfd *output_b
 	      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_b
 	      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_b
 	      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;
 	    }
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.237
diff -u -p -r1.237 elf.c
--- bfd/elf.c	30 Jul 2004 15:37:04 -0000	1.237
+++ bfd/elf.c	13 Aug 2004 02:38:21 -0000
@@ -292,8 +292,8 @@ bfd_elf_string_from_elf_section (bfd *ab
   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_Shd
 		      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_Shd
 
   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, unsign
 	    || 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 *ab
       /* 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 *o
 	     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, arel
 
  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;
 }
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.133
diff -u -p -r1.133 elf32-arm.h
--- bfd/elf32-arm.h	24 Jun 2004 04:46:18 -0000	1.133
+++ bfd/elf32-arm.h	13 Aug 2004 02:38:25 -0000
@@ -486,8 +486,8 @@ find_thumb_glue (link_info, name, input_
 
   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_bf
 
   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 
   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, inp
 	  && !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, inp
 	  && !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, in
 	      /* 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, in
 	    /* 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, 
 	      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, 
 	        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, o
       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, 
   /* 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 %
     {
       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 regis
       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
       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 instruct
 	      || (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 u
 	{
 	  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);
 	    }
 	}
     }
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.52
diff -u -p -r1.52 elf32-cris.c
--- bfd/elf32-cris.c	24 Jun 2004 04:46:18 -0000	1.52
+++ bfd/elf32-cris.c	13 Aug 2004 02:38:25 -0000
@@ -918,11 +918,11 @@ cris_elf_relocate_section (output_bfd, i
 	      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, i
 	    {
 	      (*_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, i
 		   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, i
 			   && 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, i
 	  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, i
 		  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, 
 	    {
 	      /* 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, o
     {
       (*_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;
     }
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.27
diff -u -p -r1.27 elf32-frv.c
--- bfd/elf32-frv.c	21 Jul 2004 06:46:20 -0000	1.27
+++ bfd/elf32-frv.c	13 Aug 2004 02:38:27 -0000
@@ -2042,9 +2042,8 @@ elf32_frv_relocate_section (output_bfd, 
 						      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,
 	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;
         }
     }
Index: bfd/elf32-gen.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-gen.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf32-gen.c
--- bfd/elf32-gen.c	26 Mar 2004 05:55:15 -0000	1.11
+++ bfd/elf32-gen.c	13 Aug 2004 02:38:27 -0000
@@ -80,8 +80,8 @@ elf32_generic_link_add_symbols (abfd, in
 	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);
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.118
diff -u -p -r1.118 elf32-hppa.c
--- bfd/elf32-hppa.c	27 Jul 2004 22:30:24 -0000	1.118
+++ bfd/elf32-hppa.c	13 Aug 2004 02:38:30 -0000
@@ -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_ent
 	      || 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 *in
 		    }
 		  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_sec
 	       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_sec
 	      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_sec
       && 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
 	  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);
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.36
diff -u -p -r1.36 elf32-i370.c
--- bfd/elf32-i370.c	24 Jun 2004 04:46:19 -0000	1.36
+++ bfd/elf32-i370.c	13 Aug 2004 02:38:31 -0000
@@ -367,8 +367,8 @@ i370_elf_merge_private_bfd_data (ibfd, o
   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, 
     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, i
     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, i
       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, i
 	{
 	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, i
 	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);
 
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.124
diff -u -p -r1.124 elf32-i386.c
--- bfd/elf32-i386.c	12 Aug 2004 15:56:05 -0000	1.124
+++ bfd/elf32-i386.c	13 Aug 2004 02:38:32 -0000
@@ -323,8 +323,8 @@ elf_i386_info_to_howto_rel (bfd *abfd AT
       && ((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 : "<local>");
 		    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_b
 	  && ((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_b
 	       && (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_b
 	  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;
 	    }
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.47
diff -u -p -r1.47 elf32-m32r.c
--- bfd/elf32-m32r.c	29 Jun 2004 13:46:29 -0000	1.47
+++ bfd/elf32-m32r.c	13 Aug 2004 02:38:35 -0000
@@ -2606,8 +2606,8 @@ m32r_elf_relocate_section (output_bfd, i
       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, i
 		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, o
           || ((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;
Index: bfd/elf32-m68hc1x.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68hc1x.c,v
retrieving revision 1.16
diff -u -p -r1.16 elf32-m68hc1x.c
--- bfd/elf32-m68hc1x.c	1 Aug 2004 19:32:28 -0000	1.16
+++ bfd/elf32-m68hc1x.c	13 Aug 2004 02:38:36 -0000
@@ -158,9 +158,8 @@ m68hc12_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;
     }
 
@@ -1274,17 +1273,15 @@ _bfd_m68hc11_elf_merge_private_bfd_data 
   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 
   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 
   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;
     }
 
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.65
diff -u -p -r1.65 elf32-m68k.c
--- bfd/elf32-m68k.c	24 Jun 2004 04:46:20 -0000	1.65
+++ bfd/elf32-m68k.c	13 Aug 2004 02:38:37 -0000
@@ -1705,9 +1705,9 @@ elf_m68k_relocate_section (output_bfd, i
 	       && (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, i
 	  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;
 	    }
Index: bfd/elf32-mcore.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mcore.c,v
retrieving revision 1.34
diff -u -p -r1.34 elf32-mcore.c
--- bfd/elf32-mcore.c	27 Mar 2004 10:58:06 -0000	1.34
+++ bfd/elf32-mcore.c	13 Aug 2004 02:38:38 -0000
@@ -350,8 +350,8 @@ mcore_elf_unsupported_reloc (abfd, reloc
 {
   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, 
   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, 
       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, 
       /* 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);
 
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.123
diff -u -p -r1.123 elf32-ppc.c
--- bfd/elf32-ppc.c	29 Jun 2004 13:46:31 -0000	1.123
+++ bfd/elf32-ppc.c	13 Aug 2004 02:38:41 -0000
@@ -2282,18 +2282,16 @@ ppc_elf_merge_private_bfd_data (bfd *ibf
 	{
 	  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 *ibf
 	{
 	  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_bf
   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_bf
 	{
 	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_bf
 	       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_bf
 		       && (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_bf
 		   || 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_bf
 	    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_bf
 	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_bf
 	       && (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_bf
 	  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 *abf
       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 *abf
 
   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);
 }
 
 
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.63
diff -u -p -r1.63 elf32-s390.c
--- bfd/elf32-s390.c	29 Jun 2004 13:46:31 -0000	1.63
+++ bfd/elf32-s390.c	13 Aug 2004 02:38:43 -0000
@@ -980,9 +980,8 @@ elf_s390_check_relocs (abfd, info, 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;
 	}
 
@@ -1158,8 +1157,8 @@ elf_s390_check_relocs (abfd, info, sec, 
 	      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, 
 				 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_secti
 
   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, i
 	  && !((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, i
 	  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;
 	    }
Index: bfd/elf32-sh-symbian.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh-symbian.c,v
retrieving revision 1.2
diff -u -p -r1.2 elf32-sh-symbian.c
--- bfd/elf32-sh-symbian.c	9 Jul 2004 12:32:35 -0000	1.2
+++ bfd/elf32-sh-symbian.c	13 Aug 2004 02:38:43 -0000
@@ -125,8 +125,8 @@ sh_symbian_import_as (struct bfd_link_in
 	  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 (st
 	    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 *      
 					   & 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 ?  */
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.112
diff -u -p -r1.112 elf32-sh.c
--- bfd/elf32-sh.c	29 Jul 2004 05:17:39 -0000	1.112
+++ bfd/elf32-sh.c	13 Aug 2004 02:38:46 -0000
@@ -2242,8 +2242,8 @@ sh_elf_relax_section (bfd *abfd, asectio
       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, asectio
       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, asectio
       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, asectio
       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, asectio
 	      != (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, asectio
       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, asectio
 	 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, as
 	  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 *
 	  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
 	      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
 	      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
 	      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
 	  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
 	  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
 	      || (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
 	      || (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 b
 	      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 b
 	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, bf
 
   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;
     }
Index: bfd/elf32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
retrieving revision 1.71
diff -u -p -r1.71 elf32-sparc.c
--- bfd/elf32-sparc.c	30 Jul 2004 10:08:00 -0000	1.71
+++ bfd/elf32-sparc.c	13 Aug 2004 02:38:48 -0000
@@ -913,9 +913,8 @@ elf32_sparc_check_relocs (abfd, info, se
 
       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, se
 		else
 		  {
 		    (*_bfd_error_handler)
-		      (_("%s: `%s' accessed both as normal and thread local symbol"),
-		       bfd_archive_filename (abfd),
-		       h ? h->root.root.string : "<local>");
+		      (_("%B: `%s' accessed both as normal and thread local symbol"),
+		       abfd, h ? h->root.root.string : "<local>");
 		    return FALSE;
 		  }
 	      }
@@ -2495,8 +2493,8 @@ elf32_sparc_relocate_section (output_bfd
 			    {
 			      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
 	  && !((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
     {
       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
       && 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;
Index: bfd/elf32-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-v850.c,v
retrieving revision 1.45
diff -u -p -r1.45 elf32-v850.c
--- bfd/elf32-v850.c	29 Jun 2004 13:46:32 -0000	1.45
+++ bfd/elf32-v850.c	13 Aug 2004 02:38:50 -0000
@@ -656,9 +656,8 @@ v850_elf_check_relocs (abfd, info, sec, 
     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, o
 	  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;
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.31
diff -u -p -r1.31 elf32-xtensa.c
--- bfd/elf32-xtensa.c	29 Jun 2004 22:03:33 -0000	1.31
+++ bfd/elf32-xtensa.c	13 Aug 2004 02:38:53 -0000
@@ -641,9 +641,8 @@ elf_xtensa_check_relocs (abfd, info, 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;
 	}
 
@@ -2103,9 +2102,9 @@ elf_xtensa_relocate_section (output_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,
   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;
     }
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.121
diff -u -p -r1.121 elf64-alpha.c
--- bfd/elf64-alpha.c	29 Jun 2004 13:46:33 -0000	1.121
+++ bfd/elf64-alpha.c	13 Aug 2004 02:38:55 -0000
@@ -1257,8 +1257,8 @@ elf64_alpha_relax_with_lituse (info, sym
   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
     {
       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_b
       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
       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
 	  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
 	  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
 	  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
 		&& 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
 		      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
 		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
 	  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
 	  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
 	  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);
Index: bfd/elf64-gen.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-gen.c,v
retrieving revision 1.11
diff -u -p -r1.11 elf64-gen.c
--- bfd/elf64-gen.c	26 Mar 2004 05:55:15 -0000	1.11
+++ bfd/elf64-gen.c	13 Aug 2004 02:38:55 -0000
@@ -80,9 +80,8 @@ elf64_generic_link_add_symbols (abfd, in
 	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;
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.158
diff -u -p -r1.158 elf64-ppc.c
--- bfd/elf64-ppc.c	10 Aug 2004 11:23:01 -0000	1.158
+++ bfd/elf64-ppc.c	13 Aug 2004 02:39:00 -0000
@@ -2432,13 +2432,13 @@ ppc64_elf_merge_private_bfd_data (bfd *i
       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, struc
 				 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 bf
 		 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 bf
 	      || (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 bf
 		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_
 	  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_
 			  || 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_
 	{
 	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_
 	  /* 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_
 	  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_
 	       && (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_
 	  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,
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.63
diff -u -p -r1.63 elf64-s390.c
--- bfd/elf64-s390.c	29 Jun 2004 13:46:33 -0000	1.63
+++ bfd/elf64-s390.c	13 Aug 2004 02:39:02 -0000
@@ -933,8 +933,8 @@ elf_s390_check_relocs (abfd, info, sec, 
 
       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, 
 	      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, 
 				 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_secti
 
   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, i
 	  && !((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, i
 	  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;
 	    }
Index: bfd/elf64-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sh64.c,v
retrieving revision 1.47
diff -u -p -r1.47 elf64-sh64.c
--- bfd/elf64-sh64.c	24 Jun 2004 04:46:22 -0000	1.47
+++ bfd/elf64-sh64.c	13 Aug 2004 02:39:04 -0000
@@ -1593,9 +1593,8 @@ sh_elf64_relocate_section (bfd *output_b
 	      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;
 		}
Index: bfd/elf64-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.93
diff -u -p -r1.93 elf64-sparc.c
--- bfd/elf64-sparc.c	29 Jun 2004 13:46:34 -0000	1.93
+++ bfd/elf64-sparc.c	13 Aug 2004 02:39:06 -0000
@@ -1368,9 +1368,8 @@ sparc64_elf_check_relocs (abfd, info, se
 	  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,
 	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,
       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,
 		  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,
 	    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
 			      {
 				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
 	  && !((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
 	    {
 	      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
         {
           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;
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.82
diff -u -p -r1.82 elf64-x86-64.c
--- bfd/elf64-x86-64.c	9 Aug 2004 08:53:51 -0000	1.82
+++ bfd/elf64-x86-64.c	13 Aug 2004 02:39:07 -0000
@@ -641,9 +641,8 @@ elf64_x86_64_check_relocs (bfd *abfd, st
 
       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, st
 	  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, st
 		else
 		  {
 		    (*_bfd_error_handler)
-		      (_("%s: %s' accessed both as normal and thread local symbol"),
-		       bfd_archive_filename (abfd),
-		       h ? h->root.root.string : "<local>");
+		      (_("%B: %s' accessed both as normal and thread local symbol"),
+		       abfd, h ? h->root.root.string : "<local>");
 		    return FALSE;
 		  }
 	      }
@@ -789,8 +787,8 @@ elf64_x86_64_check_relocs (bfd *abfd, st
 	      && (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, st
 				 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 *outp
 	      && (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 *outp
 	  && !((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 *outp
 	  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;
 	    }
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.137
diff -u -p -r1.137 elfxx-ia64.c
--- bfd/elfxx-ia64.c	30 Jul 2004 15:37:04 -0000	1.137
+++ bfd/elfxx-ia64.c	13 Aug 2004 02:39:15 -0000
@@ -977,9 +977,8 @@ elfNN_ia64_relax_section (abfd, sec, lin
 	      || 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,
       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,
 		  /* ??? 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,
 	  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,
 		      /* ??? 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,
 	      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,
   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,
   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,
   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,
   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,
       != (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;
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.108
diff -u -p -r1.108 elfxx-mips.c
--- bfd/elfxx-mips.c	1 Aug 2004 20:13:16 -0000	1.108
+++ bfd/elfxx-mips.c	13 Aug 2004 02:39:21 -0000
@@ -3719,9 +3719,9 @@ mips_elf_perform_relocation (struct bfd_
       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, s
       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, s
 	  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 (bf
   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 (bf
   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 (bf
       != ((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 (bf
   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 (bf
 	{
 	  /* 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 (bf
 	      != 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 (bf
   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;
     }
Index: bfd/ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.39
diff -u -p -r1.39 ieee.c
--- bfd/ieee.c	21 Jul 2004 15:42:57 -0000	1.39
+++ bfd/ieee.c	13 Aug 2004 02:39:23 -0000
@@ -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;
 		      }
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.24
diff -u -p -r1.24 ihex.c
--- bfd/ihex.c	21 Jul 2004 15:42:57 -0000	1.24
+++ bfd/ihex.c	13 Aug 2004 02:39:24 -0000
@@ -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, conten
       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, conten
   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;
     }
Index: bfd/libbfd.c
===================================================================
RCS file: /cvs/src/src/bfd/libbfd.c,v
retrieving revision 1.32
diff -u -p -r1.32 libbfd.c
--- bfd/libbfd.c	24 Jun 2004 04:46:24 -0000	1.32
+++ bfd/libbfd.c	13 Aug 2004 02:39:24 -0000
@@ -823,11 +823,11 @@ _bfd_generic_verify_endian_match (bfd *i
       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;
Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.39
diff -u -p -r1.39 linker.c
--- bfd/linker.c	27 Jul 2004 14:20:49 -0000	1.39
+++ bfd/linker.c	13 Aug 2004 02:39:26 -0000
@@ -1828,8 +1828,8 @@ _bfd_generic_link_add_one_symbol (struct
 		&& 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
 	      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
 	    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;
 	    }
 
Index: bfd/pdp11.c
===================================================================
RCS file: /cvs/src/src/bfd/pdp11.c,v
retrieving revision 1.23
diff -u -p -r1.23 pdp11.c
--- bfd/pdp11.c	24 Jun 2004 04:46:25 -0000	1.23
+++ bfd/pdp11.c	13 Aug 2004 02:39:29 -0000
@@ -1672,9 +1672,8 @@ translate_to_native_sym_flags (abfd, cac
       /* 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, cac
   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;
     }
Index: bfd/pe-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/pe-mips.c,v
retrieving revision 1.12
diff -u -p -r1.12 pe-mips.c
--- bfd/pe-mips.c	24 Apr 2004 06:12:24 -0000	1.12
+++ bfd/pe-mips.c	13 Aug 2004 02:39:30 -0000
@@ -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_bf
 
   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_bf
 	   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_bf
 	  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_bf
 	      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;
 	    }
Index: bfd/peicode.h
===================================================================
RCS file: /cvs/src/src/bfd/peicode.h,v
retrieving revision 1.40
diff -u -p -r1.40 peicode.h
--- bfd/peicode.h	16 Dec 2003 11:10:42 -0000	1.40
+++ bfd/peicode.h	13 Aug 2004 02:39:31 -0000
@@ -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) 
   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 
   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 
   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;
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.30
diff -u -p -r1.30 srec.c
--- bfd/srec.c	21 Jul 2004 15:42:57 -0000	1.30
+++ bfd/srec.c	13 Aug 2004 02:39:32 -0000
@@ -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);
     }
 }
Index: bfd/stabs.c
===================================================================
RCS file: /cvs/src/src/bfd/stabs.c,v
retrieving revision 1.20
diff -u -p -r1.20 stabs.c
--- bfd/stabs.c	28 Jun 2004 13:57:58 -0000	1.20
+++ bfd/stabs.c	13 Aug 2004 02:39:32 -0000
@@ -293,10 +293,8 @@ _bfd_link_section_stabs (abfd, sinfo, st
       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;
 	}
Index: bfd/xcofflink.c
===================================================================
RCS file: /cvs/src/src/bfd/xcofflink.c,v
retrieving revision 1.34
diff -u -p -r1.34 xcofflink.c
--- bfd/xcofflink.c	24 Jun 2004 04:46:26 -0000	1.34
+++ bfd/xcofflink.c	13 Aug 2004 02:39:35 -0000
@@ -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;
 		    }
Index: include/bfdlink.h
===================================================================
RCS file: /cvs/src/src/include/bfdlink.h,v
retrieving revision 1.44
diff -u -p -r1.44 bfdlink.h
--- include/bfdlink.h	24 Jun 2004 04:46:13 -0000	1.44
+++ include/bfdlink.h	13 Aug 2004 02:40:08 -0000
@@ -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
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.83
diff -u -p -r1.83 ldmain.c
--- ld/ldmain.c	19 Jul 2004 16:40:52 -0000	1.83
+++ ld/ldmain.c	13 Aug 2004 02:40:14 -0000
@@ -156,8 +156,7 @@ static struct bfd_link_callbacks link_ca
   reloc_overflow,
   reloc_dangerous,
   unattached_reloc,
-  notice,
-  error_handler
+  notice
 };
 
 struct bfd_link_info link_info;
Index: ld/ldmisc.c
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.c,v
retrieving revision 1.19
diff -u -p -r1.19 ldmisc.c
--- ld/ldmisc.c	2 Jul 2004 01:39:32 -0000	1.19
+++ ld/ldmisc.c	13 Aug 2004 02:40:14 -0000
@@ -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_li
 	      }
 	      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_li
 		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_li
 		      }
 		  }
 
-		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, co
   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;
-}
Index: ld/ldmisc.h
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.h,v
retrieving revision 1.6
diff -u -p -r1.6 ldmisc.h
--- ld/ldmisc.h	28 Jun 2003 05:28:54 -0000	1.6
+++ ld/ldmisc.h	13 Aug 2004 02:40:14 -0000
@@ -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 *, ...);


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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