[binutils-gdb/binutils-2_44-branch] PR 32603, revert message changes in 0b7f992b78fe and 31e9e2e8d109

Alan Modra amodra@sourceware.org
Thu Apr 24 01:35:36 GMT 2025


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

commit fe459e33c676883b5f28cc96c00e242973d906a9
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Apr 24 10:01:29 2025 +0930

    PR 32603, revert message changes in 0b7f992b78fe and 31e9e2e8d109
    
    This puts back %F into translated fatal error messages (and reverts a
    few other small changes), to not disturb translation work done for the
    2.44 branch.

Diff:
---
 bfd/archive.c                        |   2 +-
 bfd/coff-aarch64.c                   |   2 +-
 bfd/coffgen.c                        |   2 +-
 bfd/elf-ifunc.c                      |   2 +-
 bfd/elf-m10300.c                     |   2 +-
 bfd/elf-properties.c                 |   4 +-
 bfd/elf.c                            |   2 +-
 bfd/elf32-arm.c                      |   2 +-
 bfd/elf32-avr.c                      |   2 +-
 bfd/elf32-csky.c                     |   2 +-
 bfd/elf32-frv.c                      |   2 +-
 bfd/elf32-hppa.c                     |   6 +-
 bfd/elf32-i386.c                     |   2 +-
 bfd/elf32-m68hc11.c                  |   2 +-
 bfd/elf32-m68hc12.c                  |   2 +-
 bfd/elf32-metag.c                    |   2 +-
 bfd/elf32-spu.c                      |   4 +-
 bfd/elf64-ia64-vms.c                 |   2 +-
 bfd/elf64-ppc.c                      |   4 +-
 bfd/elf64-x86-64.c                   |  10 ++--
 bfd/elflink.c                        |  12 ++--
 bfd/elfnn-aarch64.c                  |   4 +-
 bfd/elfnn-ia64.c                     |   2 +-
 bfd/elfnn-kvx.c                      |   2 +-
 bfd/elfnn-loongarch.c                |   2 +-
 bfd/elfxx-aarch64.c                  |   4 +-
 bfd/elfxx-sparc.c                    |   2 +-
 bfd/elfxx-x86.c                      |  44 +++++++-------
 bfd/linker.c                         |   2 +-
 bfd/reloc.c                          |   2 +-
 bfd/reloc16.c                        |   2 +-
 bfd/xcofflink.c                      |   2 +-
 ld/emulparams/call_nop.sh            |   6 +-
 ld/emulparams/cet.sh                 |   2 +-
 ld/emulparams/elf32mcore.sh          |   2 +-
 ld/emulparams/x86-64-lam.sh          |   6 +-
 ld/emulparams/x86-64-level-report.sh |   2 +-
 ld/emulparams/x86-64-level.sh        |   2 +-
 ld/emultempl/aarch64elf.em           |   6 +-
 ld/emultempl/aix.em                  |  41 ++++++-------
 ld/emultempl/armelf.em               |  10 ++--
 ld/emultempl/avrelf.em               |   2 +-
 ld/emultempl/beos.em                 |  18 +++---
 ld/emultempl/cr16elf.em              |   4 +-
 ld/emultempl/cskyelf.em              |   4 +-
 ld/emultempl/elf.em                  |  14 ++---
 ld/emultempl/hppaelf.em              |   4 +-
 ld/emultempl/kvxelf.em               |   4 +-
 ld/emultempl/loongarchelf.em         |   2 +-
 ld/emultempl/m68hc1xelf.em           |   2 +-
 ld/emultempl/m68kelf.em              |   4 +-
 ld/emultempl/metagelf.em             |   4 +-
 ld/emultempl/mipself.em              |   2 +-
 ld/emultempl/mmix-elfnmmo.em         |   2 +-
 ld/emultempl/nds32elf.em             |   6 +-
 ld/emultempl/nto.em                  |  10 ++--
 ld/emultempl/pe.em                   |  20 +++----
 ld/emultempl/pep.em                  |  16 ++---
 ld/emultempl/ppc32elf.em             |   4 +-
 ld/emultempl/ppc64elf.em             |  10 ++--
 ld/emultempl/riscvelf.em             |   2 +-
 ld/emultempl/s390.em                 |   2 +-
 ld/emultempl/scoreelf.em             |   2 +-
 ld/emultempl/spuelf.em               |  20 +++----
 ld/emultempl/tic6xdsbt.em            |   6 +-
 ld/emultempl/ticoff.em               |   2 +-
 ld/emultempl/v850elf.em              |   2 +-
 ld/emultempl/vms.em                  |   2 +-
 ld/emultempl/xtensaelf.em            |  12 ++--
 ld/emultempl/z80.em                  |   2 +-
 ld/ldcref.c                          |   8 +--
 ld/ldelf.c                           |  30 +++++-----
 ld/ldelfgen.c                        |  14 ++---
 ld/ldexp.c                           |  42 ++++++-------
 ld/ldfile.c                          |  14 ++---
 ld/ldgram.y                          |   6 +-
 ld/ldlang.c                          | 112 +++++++++++++++++------------------
 ld/ldlex.l                           |  10 ++--
 ld/ldmain.c                          |  44 +++++++-------
 ld/ldmisc.c                          |   6 +-
 ld/ldwrite.c                         |  20 +++----
 ld/lexsup.c                          |  64 ++++++++++----------
 ld/mri.c                             |   2 +-
 ld/pe-dll.c                          |  12 ++--
 ld/plugin.c                          |  27 ++++-----
 85 files changed, 405 insertions(+), 405 deletions(-)

diff --git a/bfd/archive.c b/bfd/archive.c
index 6cda73ce903..22253440419 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -745,7 +745,7 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos,
 	      if (info != NULL)
 		{
 		  info->callbacks->fatal
-		    (_("%P: %pB(%s): error opening thin archive member: %E\n"),
+		    (_("%F%P: %pB(%s): error opening thin archive member: %E\n"),
 		     archive, filename);
 		  break;
 		}
diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c
index af4a44dede0..6f1f5db2f1f 100644
--- a/bfd/coff-aarch64.c
+++ b/bfd/coff-aarch64.c
@@ -907,7 +907,7 @@ coff_pe_aarch64_relocate_section (bfd *output_bfd,
 	  }
 
 	default:
-	  info->callbacks->fatal (_("%P: Unhandled relocation type %u\n"),
+	  info->callbacks->fatal (_("%F%P: Unhandled relocation type %u\n"),
 				  rel->r_type);
 	}
     }
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index d03effd351a..f9c3cd8c6ad 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2794,7 +2794,7 @@ _bfd_coff_section_already_linked (bfd *abfd,
 
   /* This is the first section with this name.  Record it.  */
   if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
-    info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
+    info->callbacks->fatal (_("%F%P: already_linked_table: %E\n"));
   return false;
 }
 
diff --git a/bfd/elf-ifunc.c b/bfd/elf-ifunc.c
index 96b828812e9..b88557fbd50 100644
--- a/bfd/elf-ifunc.c
+++ b/bfd/elf-ifunc.c
@@ -141,7 +141,7 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
     {
       info->callbacks->fatal
 	/* xgettext:c-format */
-	(_("%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
+	(_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
 	   "equality in `%pB' can not be used when making an "
 	   "executable; recompile with -fPIE and relink with -pie\n"),
 	 h->root.root.string,
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 368ff7e708c..557683ce079 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -2647,7 +2647,7 @@ mn10300_elf_relax_section (bfd *abfd,
 
   if (bfd_link_relocatable (link_info))
     link_info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   /* Assume nothing changes.  */
   *again = false;
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index 79741395f5e..8f176e97247 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -637,11 +637,11 @@ _bfd_elf_link_create_gnu_property_sec (struct bfd_link_info *info, bfd *elf_bfd,
 				      | SEC_HAS_CONTENTS
 				      | SEC_DATA));
   if (sec == NULL)
-    info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
+    info->callbacks->fatal (_("%F%P: failed to create GNU property section\n"));
 
   if (!bfd_set_section_alignment (sec,
 				  elfclass == ELFCLASS64 ? 3 : 2))
-    info->callbacks->fatal (_("%pA: failed to align section\n"),
+    info->callbacks->fatal (_("%F%pA: failed to align section\n"),
 			    sec);
 
   elf_section_type (sec) = SHT_NOTE;
diff --git a/bfd/elf.c b/bfd/elf.c
index 22282561de9..5d1be92a568 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5010,7 +5010,7 @@ _bfd_elf_map_sections_to_segments (bfd *abfd,
 	  && bed->size_relative_relocs
 	  && !bed->size_relative_relocs (info, need_layout))
 	info->callbacks->fatal
-	  (_("%P: failed to size relative relocations\n"));
+	  (_("%F%P: failed to size relative relocations\n"));
     }
 
   if (no_user_phdrs && bfd_count_sections (abfd) != 0)
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index b9c3b4bb1e9..9f38d31394b 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -5074,7 +5074,7 @@ arm_build_one_stub (struct bfd_hash_entry *gen_entry,
      section.  The user should fix his linker script.  */
   if (stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    stub_entry->target_section);
 
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 52c439ac801..695eb55847b 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -2480,7 +2480,7 @@ elf32_avr_relax_section (bfd *abfd,
 
   if (bfd_link_relocatable (link_info))
     link_info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   htab = avr_link_hash_table (link_info);
   if (htab == NULL)
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index bb70169ce7b..877f95ac3c3 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -3724,7 +3724,7 @@ csky_build_one_stub (struct bfd_hash_entry *gen_entry,
      section.  The user should fix his linker script.  */
   if (stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    stub_entry->target_section);
 
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 04d812b97fb..01a0e0cbbac 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -5618,7 +5618,7 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
 
   if (bfd_link_relocatable (info))
     info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   /* If we return early, we didn't change anything.  */
   *again = false;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index ecfc8c4a8f3..0c047fd6921 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -728,7 +728,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
 	 section.  The user should fix his linker script.  */
       if (hsh->target_section->output_section == NULL
 	  && info->non_contiguous_regions)
-	info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
+	info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output "
 				  "section. Retry without "
 				  "--enable-non-contiguous-regions.\n"),
 				hsh->target_section);
@@ -757,7 +757,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
 	 section.  The user should fix his linker script.  */
       if (hsh->target_section->output_section == NULL
 	  && info->non_contiguous_regions)
-	info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
+	info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output "
 				  "section. Retry without "
 				  "--enable-non-contiguous-regions.\n"),
 				hsh->target_section);
@@ -838,7 +838,7 @@ hppa_build_one_stub (struct bfd_hash_entry *bh, void *in_arg)
 	 section.  The user should fix his linker script.  */
       if (hsh->target_section->output_section == NULL
 	  && info->non_contiguous_regions)
-	info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
+	info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output "
 				  "section. Retry without "
 				  "--enable-non-contiguous-regions.\n"),
 				hsh->target_section);
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index e34296a0e5d..85cebf1155f 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -4100,7 +4100,7 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
       if (bfd_is_abs_section (htab->elf.splt->output_section))
 	{
 	  info->callbacks->fatal
-	    (_("%P: discarded output section: `%pA'\n"),
+	    (_("%F%P: discarded output section: `%pA'\n"),
 	     htab->elf.splt);
 	  return false;
 	}
diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c
index f70716d66a2..6bbbc9b8023 100644
--- a/bfd/elf32-m68hc11.c
+++ b/bfd/elf32-m68hc11.c
@@ -419,7 +419,7 @@ m68hc11_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
      section.  The user should fix his linker script.  */
   if (stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    stub_entry->target_section);
 
diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c
index f8619896978..8a435f7b509 100644
--- a/bfd/elf32-m68hc12.c
+++ b/bfd/elf32-m68hc12.c
@@ -539,7 +539,7 @@ m68hc12_elf_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
      section.  The user should fix his linker script.  */
   if (stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    stub_entry->target_section);
 
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
index 838ec2dd41a..5838580c1a0 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
@@ -3341,7 +3341,7 @@ metag_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
      section.  The user should fix his linker script.  */
   if (hsh->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    hsh->target_section);
 
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index bd5c457ebaf..c446ef3a24b 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -4685,7 +4685,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
  file_err:
   bfd_set_error (bfd_error_system_call);
  err_exit:
-  info->callbacks->fatal (_("%P: auto overlay error: %E\n"));
+  info->callbacks->fatal (_("%F%P: auto overlay error: %E\n"));
 }
 
 /* Provide an estimate of total stack required.  */
@@ -4738,7 +4738,7 @@ spu_elf_final_link (bfd *output_bfd, struct bfd_link_info *info)
     info->callbacks->einfo (_("%X%P: stack/lrlive analysis error: %E\n"));
 
   if (!spu_elf_build_stubs (info))
-    info->callbacks->fatal (_("%P: can not build overlay stubs: %E\n"));
+    info->callbacks->fatal (_("%F%P: can not build overlay stubs: %E\n"));
 
   return bfd_elf_final_link (output_bfd, info);
 }
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index 558ce95e996..c4b859dcfda 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -362,7 +362,7 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
 
   if (bfd_link_relocatable (link_info))
     link_info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   /* Don't even try to relax for non-ELF outputs.  */
   if (!is_elf_hash_table (link_info->hash))
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index c273973408e..b8c490abaf6 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -12289,7 +12289,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
   if (stub_entry->target_section != NULL
       && stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    stub_entry->target_section);
 
@@ -12297,7 +12297,7 @@ ppc_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
   if (stub_entry->group->stub_sec != NULL
       && stub_entry->group->stub_sec->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    stub_entry->group->stub_sec);
 
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 7baae66cca6..cb32732eba6 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -3791,7 +3791,7 @@ elf_x86_64_relocate_section (bfd *output_bfd,
 			    {
 			    corrupt_input:
 			      info->callbacks->fatal
-				(_("%P: corrupt input: %pB\n"),
+				(_("%F%P: corrupt input: %pB\n"),
 				 input_bfd);
 			      return false;
 			    }
@@ -4761,7 +4761,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
       /* Check PC-relative offset overflow in PLT entry.  */
       if ((plt_got_pcrel_offset + 0x80000000) > 0xffffffff)
 	/* xgettext:c-format */
-	info->callbacks->fatal (_("%pB: PC-relative offset overflow in PLT entry for `%s'\n"),
+	info->callbacks->fatal (_("%F%pB: PC-relative offset overflow in PLT entry for `%s'\n"),
 				output_bfd, h->root.root.string);
 
       bfd_put_32 (output_bfd, plt_got_pcrel_offset,
@@ -4834,7 +4834,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
 		 will overflow first.  */
 	      if (plt0_offset > 0x80000000)
 		/* xgettext:c-format */
-		info->callbacks->fatal (_("%pB: branch displacement overflow in PLT entry for `%s'\n"),
+		info->callbacks->fatal (_("%F%pB: branch displacement overflow in PLT entry for `%s'\n"),
 					output_bfd, h->root.root.string);
 	      bfd_put_32 (output_bfd, - plt0_offset,
 			  (plt->contents + h->plt.offset
@@ -4887,7 +4887,7 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
       if ((got_after_plt && got_pcrel_offset < 0)
 	  || (!got_after_plt && got_pcrel_offset > 0))
 	/* xgettext:c-format */
-	info->callbacks->fatal (_("%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"),
+	info->callbacks->fatal (_("%F%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"),
 				output_bfd, h->root.root.string);
 
       bfd_put_32 (output_bfd, got_pcrel_offset,
@@ -5166,7 +5166,7 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
       if (bfd_is_abs_section (htab->elf.splt->output_section))
 	{
 	  info->callbacks->fatal
-	    (_("%P: discarded output section: `%pA'\n"),
+	    (_("%F%P: discarded output section: `%pA'\n"),
 	     htab->elf.splt);
 	  return false;
 	}
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 384fafb9e04..6346d7e2b4b 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -4335,7 +4335,7 @@ elf_link_add_to_first_hash (bfd *abfd, struct bfd_link_info *info,
        bfd_hash_lookup (htab->first_hash, name, true, copy));
   if (e == NULL)
     info->callbacks->fatal
-      (_("%P: %pB: failed to add %s to first hash\n"), abfd, name);
+      (_("%F%P: %pB: failed to add %s to first hash\n"), abfd, name);
 
   if (e->abfd == NULL)
     /* Store ABFD in abfd.  */
@@ -4403,7 +4403,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
 		   (htab->first_hash, elf_link_first_hash_newfunc,
 		    sizeof (struct elf_link_first_hash_entry)))
 	    info->callbacks->fatal
-	      (_("%P: first_hash failed to create: %E\n"));
+	      (_("%F%P: first_hash failed to create: %E\n"));
 	}
     }
   else
@@ -13075,7 +13075,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
       && bed->finish_relative_relocs
       && !bed->finish_relative_relocs (info))
     info->callbacks->fatal
-      (_("%P: %pB: failed to finish relative relocations\n"), abfd);
+      (_("%F%P: %pB: failed to finish relative relocations\n"), abfd);
 
   /* Since ELF permits relocations to be against local symbols, we
      must have the local symbols available when we do the relocations.
@@ -14002,7 +14002,7 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
       h = cookie->sym_hashes[r_symndx - cookie->extsymoff];
       if (h == NULL)
 	{
-	  info->callbacks->fatal (_("%P: corrupt input: %pB\n"),
+	  info->callbacks->fatal (_("%F%P: corrupt input: %pB\n"),
 				  sec->owner);
 	  return NULL;
 	}
@@ -14255,7 +14255,7 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
 	  else if (strcmp (bfd_section_name (isec),
 			   "__patchable_function_entries") == 0
 		   && elf_linked_to_section (isec) == NULL)
-	      info->callbacks->fatal (_("%P: %pB(%pA): error: "
+	      info->callbacks->fatal (_("%F%P: %pB(%pA): error: "
 					"need linked-to section "
 					"for --gc-sections\n"),
 				      isec->owner, isec);
@@ -15432,7 +15432,7 @@ _bfd_elf_section_already_linked (bfd *abfd,
 
   /* This is the first section with this name.  Record it.  */
   if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
-    info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
+    info->callbacks->fatal (_("%F%P: already_linked_table: %E\n"));
   return sec->output_section == bfd_abs_section_ptr;
 }
 
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index ff4eb4ce9ac..3cac81508b7 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -3263,7 +3263,7 @@ aarch64_build_one_stub (struct bfd_hash_entry *gen_entry,
      section.  The user should fix his linker script.  */
   if (stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without "
 			      "--enable-non-contiguous-regions.\n"),
 			    stub_entry->target_section);
@@ -8928,7 +8928,7 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 	  {
 	    info->callbacks->fatal
 		/* xgettext:c-format */
-		(_ ("%P: %pB: copy relocation against non-copyable "
+		(_ ("%F%P: %pB: copy relocation against non-copyable "
 		    "protected symbol `%s'\n"),
 		 p->sec->owner, h->root.root.string);
 	    return false;
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index 8c7302a14d5..a52f240ec2f 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -362,7 +362,7 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 
   if (bfd_link_relocatable (link_info))
     link_info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   /* Don't even try to relax for non-ELF outputs.  */
   if (!is_elf_hash_table (link_info->hash))
diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c
index 4f181b7c68a..627a21e4956 100644
--- a/bfd/elfnn-kvx.c
+++ b/bfd/elfnn-kvx.c
@@ -926,7 +926,7 @@ kvx_build_one_stub (struct bfd_hash_entry *gen_entry,
      section.  The user should fix his linker script.  */
   if (stub_entry->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign '%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign '%pA' to an output section. "
 			      "Retry without "
 			      "--enable-non-contiguous-regions.\n"),
 			    stub_entry->target_section);
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index b24fbd189f8..7c3e9cd1754 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -1701,7 +1701,7 @@ local_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
     {
       info->callbacks->fatal
 	/* xgettext:c-format.  */
-	(_("%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
+	(_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
 	   "equality in `%pB' can not be used when making an "
 	   "executable; recompile with -fPIE and relink with -pie\n"),
 	 h->root.root.string,
diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index 04c65a01788..b29427e5b3a 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -744,11 +744,11 @@ _bfd_aarch64_elf_create_gnu_property_section (struct bfd_link_info *info,
 				      | SEC_HAS_CONTENTS
 				      | SEC_DATA));
   if (sec == NULL)
-    info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
+    info->callbacks->fatal (_("%F%P: failed to create GNU property section\n"));
 
   unsigned align = (bfd_get_mach (ebfd) & bfd_mach_aarch64_ilp32) ? 2 : 3;
   if (!bfd_set_section_alignment (sec, align))
-    info->callbacks->fatal (_("%pA: failed to align section\n"), sec);
+    info->callbacks->fatal (_("%F%pA: failed to align section\n"), sec);
 
   elf_section_type (sec) = SHT_NOTE;
 }
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index bf4e34e1559..a650be369ee 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2677,7 +2677,7 @@ _bfd_sparc_elf_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
 {
   if (bfd_link_relocatable (link_info))
     link_info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   *again = false;
   sec_do_relax (section) = 1;
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index f785d11b0a9..652363fb64b 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -531,7 +531,7 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
 	    {
 	      info->callbacks->fatal
 		/* xgettext:c-format */
-		(_("%P: %pB: copy relocation against non-copyable "
+		(_("%F%P: %pB: copy relocation against non-copyable "
 		   "protected symbol `%s' in %pB\n"),
 		 p->sec->owner, h->root.root.string,
 		 h->root.u.def.section->owner);
@@ -1041,7 +1041,7 @@ elf_x86_relative_reloc_record_add
     {
       info->callbacks->fatal
 	/* xgettext:c-format */
-	(_("%P: %pB: failed to allocate relative reloc record\n"),
+	(_("%F%P: %pB: failed to allocate relative reloc record\n"),
 	 info->output_bfd);
       return false;
     }
@@ -1400,7 +1400,7 @@ elf64_dt_relr_bitmap_add
     {
       info->callbacks->fatal
 	/* xgettext:c-format */
-	(_("%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
+	(_("%F%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
 	 info->output_bfd);
     }
 
@@ -1436,7 +1436,7 @@ elf32_dt_relr_bitmap_add
     {
       info->callbacks->fatal
 	/* xgettext:c-format */
-	(_("%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
+	(_("%F%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
 	 info->output_bfd);
     }
 
@@ -1575,7 +1575,7 @@ elf_x86_size_or_finish_relative_reloc
 							       &contents))
 			    info->callbacks->fatal
 			      /* xgettext:c-format */
-			      (_("%P: %pB: failed to allocate memory for section `%pA'\n"),
+			      (_("%F%P: %pB: failed to allocate memory for section `%pA'\n"),
 			       info->output_bfd, sec);
 
 			  /* Cache the section contents for
@@ -1762,7 +1762,7 @@ elf_x86_compute_dl_relr_bitmap
       else
 	info->callbacks->fatal
 	  /* xgettext:c-format */
-	  (_("%P: %pB: size of compact relative reloc section is "
+	  (_("%F%P: %pB: size of compact relative reloc section is "
 	     "changed: new (%lu) != old (%lu)\n"),
 	   info->output_bfd, htab->dt_relr_bitmap.count,
 	   dt_relr_bitmap_count);
@@ -1784,7 +1784,7 @@ elf_x86_write_dl_relr_bitmap (struct bfd_link_info *info,
   if (contents == NULL)
     info->callbacks->fatal
       /* xgettext:c-format */
-      (_("%P: %pB: failed to allocate compact relative reloc section\n"),
+      (_("%F%P: %pB: failed to allocate compact relative reloc section\n"),
        info->output_bfd);
 
   /* Cache the section contents for elf_link_input_bfd.  */
@@ -2253,7 +2253,7 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
 				     sym, NULL);
 	  info->callbacks->fatal
 	    /* xgettext:c-format */
-	    (_("%P: %pB: relocation %s against absolute symbol "
+	    (_("%F%P: %pB: relocation %s against absolute symbol "
 	       "`%s' in section `%pA' is disallowed\n"),
 	     input_section->owner, internal_reloc.howto->name, name,
 	     input_section);
@@ -3594,7 +3594,7 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
 	      {
 		info->callbacks->fatal
 		  /* xgettext:c-format */
-		  (_("%P: %pB: copy relocation against non-copyable "
+		  (_("%F%P: %pB: copy relocation against non-copyable "
 		     "protected symbol `%s' in %pB\n"),
 		   p->sec->owner, h->root.root.string,
 		   h->root.u.def.section->owner);
@@ -4345,12 +4345,12 @@ _bfd_x86_elf_link_setup_gnu_properties
 					      | SEC_HAS_CONTENTS
 					      | SEC_DATA));
 	  if (sec == NULL)
-	    info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
+	    info->callbacks->fatal (_("%F%P: failed to create GNU property section\n"));
 
 	  if (!bfd_set_section_alignment (sec, class_align))
 	    {
 	    error_alignment:
-	      info->callbacks->fatal (_("%pA: failed to align section\n"),
+	      info->callbacks->fatal (_("%F%pA: failed to align section\n"),
 				      sec);
 	    }
 
@@ -4664,7 +4664,7 @@ _bfd_x86_elf_link_setup_gnu_properties
       && !elf_vxworks_create_dynamic_sections (dynobj, info,
 					       &htab->srelplt2))
     {
-      info->callbacks->fatal (_("%P: failed to create VxWorks dynamic sections\n"));
+      info->callbacks->fatal (_("%F%P: failed to create VxWorks dynamic sections\n"));
       return pbfd;
     }
 
@@ -4673,7 +4673,7 @@ _bfd_x86_elf_link_setup_gnu_properties
      don't need to do it in check_relocs.  */
   if (htab->elf.sgot == NULL
       && !_bfd_elf_create_got_section (dynobj, info))
-    info->callbacks->fatal (_("%P: failed to create GOT sections\n"));
+    info->callbacks->fatal (_("%F%P: failed to create GOT sections\n"));
 
   got_align = (bed->target_id == X86_64_ELF_DATA) ? 3 : 2;
 
@@ -4691,7 +4691,7 @@ _bfd_x86_elf_link_setup_gnu_properties
   /* Create the ifunc sections here so that check_relocs can be
      simplified.  */
   if (!_bfd_elf_create_ifunc_sections (dynobj, info))
-    info->callbacks->fatal (_("%P: failed to create ifunc sections\n"));
+    info->callbacks->fatal (_("%F%P: failed to create ifunc sections\n"));
 
   plt_alignment = bfd_log2 (htab->plt.plt_entry_size);
 
@@ -4728,7 +4728,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 						    ".plt.got",
 						    pltflags);
 	  if (sec == NULL)
-	    info->callbacks->fatal (_("%P: failed to create GOT PLT section\n"));
+	    info->callbacks->fatal (_("%F%P: failed to create GOT PLT section\n"));
 
 	  if (!bfd_set_section_alignment (sec, non_lazy_plt_alignment))
 	    goto error_alignment;
@@ -4747,7 +4747,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 							    ".plt.sec",
 							    pltflags);
 		  if (sec == NULL)
-		    info->callbacks->fatal (_("%P: failed to create IBT-enabled PLT section\n"));
+		    info->callbacks->fatal (_("%F%P: failed to create IBT-enabled PLT section\n"));
 
 		  if (!bfd_set_section_alignment (sec, plt_alignment))
 		    goto error_alignment;
@@ -4767,7 +4767,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 						    ".eh_frame",
 						    flags);
 	  if (sec == NULL)
-	    info->callbacks->fatal (_("%P: failed to create PLT .eh_frame section\n"));
+	    info->callbacks->fatal (_("%F%P: failed to create PLT .eh_frame section\n"));
 
 	  if (!bfd_set_section_alignment (sec, class_align))
 	    goto error_alignment;
@@ -4780,7 +4780,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 							".eh_frame",
 							flags);
 	      if (sec == NULL)
-		info->callbacks->fatal (_("%P: failed to create GOT PLT .eh_frame section\n"));
+		info->callbacks->fatal (_("%F%P: failed to create GOT PLT .eh_frame section\n"));
 
 	      if (!bfd_set_section_alignment (sec, class_align))
 		goto error_alignment;
@@ -4794,7 +4794,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 							".eh_frame",
 							flags);
 	      if (sec == NULL)
-		info->callbacks->fatal (_("%P: failed to create the second PLT .eh_frame section\n"));
+		info->callbacks->fatal (_("%F%P: failed to create the second PLT .eh_frame section\n"));
 
 	      if (!bfd_set_section_alignment (sec, class_align))
 		goto error_alignment;
@@ -4814,7 +4814,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 						    ".sframe",
 						    flags);
 	  if (sec == NULL)
-	    info->callbacks->fatal (_("%P: failed to create PLT .sframe section\n"));
+	    info->callbacks->fatal (_("%F%P: failed to create PLT .sframe section\n"));
 
 	  // FIXME check this
 	  // if (!bfd_set_section_alignment (sec, class_align))
@@ -4829,7 +4829,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 							".sframe",
 							flags);
 	      if (sec == NULL)
-		info->callbacks->fatal (_("%P: failed to create second PLT .sframe section\n"));
+		info->callbacks->fatal (_("%F%P: failed to create second PLT .sframe section\n"));
 
 	      htab->plt_second_sframe = sec;
 	    }
@@ -4841,7 +4841,7 @@ _bfd_x86_elf_link_setup_gnu_properties
 							".sframe",
 							flags);
 	      if (sec == NULL)
-		info->callbacks->fatal (_("%P: failed to create PLT GOT .sframe section\n"));
+		info->callbacks->fatal (_("%F%P: failed to create PLT GOT .sframe section\n"));
 
 	      htab->plt_got_sframe = sec;
 	    }
diff --git a/bfd/linker.c b/bfd/linker.c
index 09e6e96f296..453adb154d5 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -3008,7 +3008,7 @@ _bfd_generic_section_already_linked (bfd *abfd ATTRIBUTE_UNUSED,
 
   /* This is the first section with this name.  Record it.  */
   if (!bfd_section_already_linked_table_insert (already_linked_list, sec))
-    info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
+    info->callbacks->fatal (_("%F%P: already_linked_table: %E\n"));
   return false;
 }
 
diff --git a/bfd/reloc.c b/bfd/reloc.c
index d3ddafb7305..75092da004c 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -8367,7 +8367,7 @@ bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
 {
   if (bfd_link_relocatable (link_info))
     link_info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   *again = false;
   return true;
diff --git a/bfd/reloc16.c b/bfd/reloc16.c
index 2a90a1d6577..5cc9cca9136 100644
--- a/bfd/reloc16.c
+++ b/bfd/reloc16.c
@@ -152,7 +152,7 @@ bfd_coff_reloc16_relax_section (bfd *abfd,
 
   if (bfd_link_relocatable (link_info))
     link_info->callbacks->fatal
-      (_("%P: --relax and -r may not be used together\n"));
+      (_("%P%F: --relax and -r may not be used together\n"));
 
   /* We only do global relaxation once.  It is not safe to do it multiple
      times (see discussion of the "shrinks" array below).  */
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index 9800c606bfb..02a21187970 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -4673,7 +4673,7 @@ xcoff_build_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg)
   if (hstub->target_section != NULL
       && hstub->target_section->output_section == NULL
       && info->non_contiguous_regions)
-    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%F%P: Could not assign `%pA' to an output section. "
 			      "Retry without --enable-non-contiguous-regions.\n"),
 			    hstub->target_section);
 
diff --git a/ld/emulparams/call_nop.sh b/ld/emulparams/call_nop.sh
index 7dd6dfb130c..450d05ab869 100644
--- a/ld/emulparams/call_nop.sh
+++ b/ld/emulparams/call_nop.sh
@@ -20,7 +20,7 @@ PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP='
 	      char *end;
 	      params.call_nop_byte = strtoul (optarg + 16 , &end, 0);
 	      if (*end)
-		fatal (_("%P: invalid number for -z call-nop=prefix-: %s\n"),
+		fatal (_("%F%P: invalid number for -z call-nop=prefix-: %s\n"),
 		       optarg + 16);
 	      params.call_nop_as_suffix = false;
 	    }
@@ -29,12 +29,12 @@ PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP='
 	      char *end;
 	      params.call_nop_byte = strtoul (optarg + 16, &end, 0);
 	      if (*end)
-		fatal (_("%P: invalid number for -z call-nop=suffix-: %s\n"),
+		fatal (_("%F%P: invalid number for -z call-nop=suffix-: %s\n"),
 		       optarg + 16);
 	      params.call_nop_as_suffix = true;
 	    }
 	  else
-	    fatal (_("%P: unsupported option: -z %s\n"), optarg);
+	    fatal (_("%F%P: unsupported option: -z %s\n"), optarg);
 	}
 '
 
diff --git a/ld/emulparams/cet.sh b/ld/emulparams/cet.sh
index e463441d176..824bcf0e69d 100644
--- a/ld/emulparams/cet.sh
+++ b/ld/emulparams/cet.sh
@@ -29,7 +29,7 @@ PARSE_AND_LIST_ARGS_CASE_Z_CET='
 				 | prop_report_ibt
 				 | prop_report_shstk);
 	  else
-	    fatal (_("%P: invalid option for -z cet-report=: %s\n"),
+	    fatal (_("%F%P: invalid option for -z cet-report=: %s\n"),
 		   optarg + 11);
 	}
 '
diff --git a/ld/emulparams/elf32mcore.sh b/ld/emulparams/elf32mcore.sh
index dc0f5d042e7..ae22c299901 100644
--- a/ld/emulparams/elf32mcore.sh
+++ b/ld/emulparams/elf32mcore.sh
@@ -42,6 +42,6 @@ PARSE_AND_LIST_ARGS_CASES='
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	fatal (_("%P: cannot open base file %s\n"), optarg);
+	fatal (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 '
diff --git a/ld/emulparams/x86-64-lam.sh b/ld/emulparams/x86-64-lam.sh
index 6e629ebbac8..8675a01f618 100644
--- a/ld/emulparams/x86-64-lam.sh
+++ b/ld/emulparams/x86-64-lam.sh
@@ -25,7 +25,7 @@ PARSE_AND_LIST_ARGS_CASE_Z_LAM='
 	  else if (strcmp (optarg + 15, "error") == 0)
 	    params.lam_u48_report = prop_report_error;
 	  else
-	    fatal (_("%P: invalid option for -z lam-u48-report=: %s\n"),
+	    fatal (_("%F%P: invalid option for -z lam-u48-report=: %s\n"),
 		   optarg + 15);
 	}
       else if (strcmp (optarg, "lam-u57") == 0)
@@ -39,7 +39,7 @@ PARSE_AND_LIST_ARGS_CASE_Z_LAM='
 	  else if (strcmp (optarg + 15, "error") == 0)
 	    params.lam_u57_report = prop_report_error;
 	  else
-	    fatal (_("%P: invalid option for -z lam-u57-report=: %s\n"),
+	    fatal (_("%F%P: invalid option for -z lam-u57-report=: %s\n"),
 		   optarg + 15);
 	}
       else if (strncmp (optarg, "lam-report=", 11) == 0)
@@ -60,7 +60,7 @@ PARSE_AND_LIST_ARGS_CASE_Z_LAM='
 	      params.lam_u57_report = prop_report_error;
 	    }
 	  else
-	    fatal (_("%P: invalid option for -z lam-report=: %s\n"),
+	    fatal (_("%F%P: invalid option for -z lam-report=: %s\n"),
 		   optarg + 11);
 	}
 '
diff --git a/ld/emulparams/x86-64-level-report.sh b/ld/emulparams/x86-64-level-report.sh
index 0463ad95269..8b946eb7655 100644
--- a/ld/emulparams/x86-64-level-report.sh
+++ b/ld/emulparams/x86-64-level-report.sh
@@ -16,7 +16,7 @@ PARSE_AND_LIST_ARGS_CASE_Z_X86_64_LEVEL_REPORT='
 	  else if (strcmp (optarg + 17, "used") == 0)
 	    params.isa_level_report = isa_level_report_used;
 	  else
-	    fatal (_("%P: invalid option for -z isa-level-report=: %s\n"),
+	    fatal (_("%F%P: invalid option for -z isa-level-report=: %s\n"),
 		   optarg + 17);
 	}
 '
diff --git a/ld/emulparams/x86-64-level.sh b/ld/emulparams/x86-64-level.sh
index 7e27cf1ea45..3002a1f7773 100644
--- a/ld/emulparams/x86-64-level.sh
+++ b/ld/emulparams/x86-64-level.sh
@@ -10,7 +10,7 @@ PARSE_AND_LIST_ARGS_CASE_Z_X86_64_LEVEL='
 	  char *end;
 	  unsigned int level = strtoul (optarg + 8 , &end, 10);
 	  if (*end != '\0' || level < 2 || level > 4)
-	    fatal (_("%P: invalid x86-64 ISA level: %s\n"), optarg);
+	    fatal (_("%F%P: invalid x86-64 ISA level: %s\n"), optarg);
 	  params.isa_level = level;
 	}
 '
diff --git a/ld/emultempl/aarch64elf.em b/ld/emultempl/aarch64elf.em
index afa91afb608..25fb211f871 100644
--- a/ld/emultempl/aarch64elf.em
+++ b/ld/emultempl/aarch64elf.em
@@ -324,7 +324,7 @@ aarch64_elf_create_output_section_statements (void)
 	 These will only be created if the output format is an AArch64 format,
 	 hence we do not support linking and changing output formats at the
 	 same time.  Use a link followed by objcopy to change output formats.  */
-      fatal (_("%P: error: cannot change output format "
+      fatal (_("%F%P: error: cannot change output format "
 	       "whilst linking %s binaries\n"), "AArch64");
       return;
     }
@@ -346,7 +346,7 @@ aarch64_elf_create_output_section_statements (void)
 			      bfd_get_arch (link_info.output_bfd),
 			      bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create BFD: %E\n"));
+      fatal (_("%F%P: can not create BFD: %E\n"));
       return;
     }
 
@@ -583,7 +583,7 @@ PARSE_AND_LIST_ARGS_CASES='
 
 	group_size = bfd_scan_vma (optarg, &end, 0);
 	if (*end)
-	  fatal (_("%P: invalid number `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid number `%s'\''\n"), optarg);
       }
       break;
 '
diff --git a/ld/emultempl/aix.em b/ld/emultempl/aix.em
index 7754c1607b3..b1ec67e93b0 100644
--- a/ld/emultempl/aix.em
+++ b/ld/emultempl/aix.em
@@ -307,7 +307,7 @@ read_file_list (const char *filename)
   f = fopen (filename, FOPEN_RT);
   if (f == NULL)
     {
-      fatal (_("%P: cannot open %s\n"), filename);
+      fatal (_("%F%P: cannot open %s\n"), filename);
       return;
     }
   if (fseek (f, 0L, SEEK_END) == -1)
@@ -355,7 +355,7 @@ read_file_list (const char *filename)
 
  error:
   fclose (f);
-  fatal (_("%P: cannot read %s\n"), optarg);
+  fatal (_("%F%P: cannot read %s\n"), optarg);
 }
 
 static bool
@@ -706,7 +706,7 @@ gld${EMULATION_NAME}_after_open (void)
       size = (p->count + 2) * 4;
       if (!bfd_xcoff_link_record_set (link_info.output_bfd, &link_info,
 				      p->h, size))
-	fatal (_("%P: bfd_xcoff_link_record_set failed: %E\n"));
+	fatal (_("%F%P: bfd_xcoff_link_record_set failed: %E\n"));
     }
 }
 
@@ -736,9 +736,9 @@ gld${EMULATION_NAME}_before_allocation (void)
 
       h = bfd_link_hash_lookup (link_info.hash, el->name, false, false, false);
       if (h == NULL)
-	fatal (_("%P: bfd_link_hash_lookup of export symbol failed: %E\n"));
+	fatal (_("%F%P: bfd_link_hash_lookup of export symbol failed: %E\n"));
       if (!bfd_xcoff_export_symbol (link_info.output_bfd, &link_info, h))
-	fatal (_("%P: bfd_xcoff_export_symbol failed: %E\n"));
+	fatal (_("%F%P: bfd_xcoff_export_symbol failed: %E\n"));
     }
 
   /* Track down all relocations called for by the linker script (these
@@ -821,7 +821,7 @@ gld${EMULATION_NAME}_before_allocation (void)
       (link_info.output_bfd, &link_info, libpath, entry_symbol.name,
        file_align, maxstack, maxdata, gc && !unix_ld,
        modtype, textro, flags, special_sections, rtld))
-    fatal (_("%P: failed to set dynamic section sizes: %E\n"));
+    fatal (_("%F%P: failed to set dynamic section sizes: %E\n"));
 
   /* Look through the special sections, and put them in the right
      place in the link ordering.  This is especially magic.  */
@@ -843,8 +843,8 @@ gld${EMULATION_NAME}_before_allocation (void)
       is = NULL;
       os = lang_output_section_get (sec->output_section);
       if (os == NULL)
-	fatal (_("%P: can't find output section %pA\n"),
-	       sec->output_section);
+	fatal (_("%F%P: can't find output section %s\n"),
+	       sec->output_section->name);
 
       for (pls = &os->children.head; *pls != NULL; pls = &(*pls)->header.next)
 	{
@@ -880,7 +880,8 @@ gld${EMULATION_NAME}_before_allocation (void)
 
       if (is == NULL)
 	{
-	  fatal (_("%P: can't find %pA in output section\n"), sec);
+	  fatal (_("%F%P: can't find %s in output section\n"),
+		 bfd_section_name (sec));
 	}
 
       /* Now figure out where the section should go.  */
@@ -1133,7 +1134,7 @@ gld${EMULATION_NAME}_after_allocation (void)
 
   /* Now that everything is in place, finalize the dynamic sections.  */
   if (!bfd_xcoff_build_dynamic_sections (link_info.output_bfd, &link_info))
-    fatal (_("%P: failed to layout dynamic sections: %E\n"));
+    fatal (_("%F%P: failed to layout dynamic sections: %E\n"));
 
   if (!bfd_link_relocatable (&link_info))
     {
@@ -1284,7 +1285,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
   if (f == NULL)
     {
       bfd_set_error (bfd_error_system_call);
-      fatal ("%P: %s: %E\n", filename);
+      fatal ("%F%P: %s: %E\n", filename);
       return;
     }
 
@@ -1346,7 +1347,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
 	      obstack_free (o, obstack_base (o));
 	    }
 	  else if (*s == '(')
-	    fatal (_("%P:%s:%d: #! ([member]) is not supported "
+	    fatal (_("%F%P:%s:%d: #! ([member]) is not supported "
 		     "in import files\n"),
 		   filename, linenumber);
 	  else
@@ -1363,7 +1364,7 @@ gld${EMULATION_NAME}_read_file (const char *filename, bool import)
 	      *s = '\0';
 	      if (!bfd_xcoff_split_import_path (link_info.output_bfd,
 						start, &imppath, &impfile))
-		fatal (_("%P: could not parse import path: %E\n"));
+		fatal (_("%F%P: could not parse import path: %E\n"));
 	      while (ISSPACE (cs))
 		{
 		  ++s;
@@ -1518,10 +1519,10 @@ gld${EMULATION_NAME}_find_relocs (lang_statement_union_type *s)
 
       rs = &s->reloc_statement;
       if (rs->name == NULL)
-	fatal (_("%P: only relocations against symbols are permitted\n"));
+	fatal (_("%F%P: only relocations against symbols are permitted\n"));
       if (!bfd_xcoff_link_count_reloc (link_info.output_bfd, &link_info,
 				       rs->name))
-	fatal (_("%P: bfd_xcoff_link_count_reloc failed: %E\n"));
+	fatal (_("%F%P: bfd_xcoff_link_count_reloc failed: %E\n"));
     }
 
   if (s->header.type == lang_assignment_statement_enum)
@@ -1550,7 +1551,7 @@ gld${EMULATION_NAME}_find_exp_assignment (etree_type *exp)
 	  if (!bfd_xcoff_record_link_assignment (link_info.output_bfd,
 						 &link_info,
 						 exp->assign.dst))
-	    fatal (_("%P: failed to record assignment to %s: %E\n"),
+	    fatal (_("%F%P: failed to record assignment to %s: %E\n"),
 		   exp->assign.dst);
 	}
       gld${EMULATION_NAME}_find_exp_assignment (exp->assign.src);
@@ -1645,7 +1646,7 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
 			     bfd_get_arch (link_info.output_bfd),
 			     bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create stub BFD: %E\n"));
+      fatal (_("%F%P: can not create stub BFD: %E\n"));
       return;
     }
 
@@ -1655,7 +1656,7 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
 
   /* Pass linker params to the back-end. */
   if (!bfd_xcoff_link_init (&link_info, &params))
-    fatal (_("%P: can not init BFD: %E\n"));
+    fatal (_("%F%P: can not init BFD: %E\n"));
 
   /* __rtinit */
   if (link_info.init_function != NULL
@@ -1672,7 +1673,7 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
 				  bfd_get_arch (link_info.output_bfd),
 				  bfd_get_mach (link_info.output_bfd)))
 	{
-	  fatal (_("%P: can not create BFD: %E\n"));
+	  fatal (_("%F%P: can not create BFD: %E\n"));
 	  return;
 	}
 
@@ -1682,7 +1683,7 @@ gld${EMULATION_NAME}_create_output_section_statements (void)
 					    link_info.fini_function,
 					    rtld))
 	{
-	  fatal (_("%P: can not create BFD: %E\n"));
+	  fatal (_("%F%P: can not create BFD: %E\n"));
 	  return;
 	}
 
diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em
index 6f652c59a3c..46306c82564 100644
--- a/ld/emultempl/armelf.em
+++ b/ld/emultempl/armelf.em
@@ -521,7 +521,7 @@ arm_elf_create_output_section_statements (void)
 	 These will only be created if the output format is an arm format,
 	 hence we do not support linking and changing output formats at the
 	 same time.  Use a link followed by objcopy to change output formats.  */
-      fatal (_("%P: error: cannot change output format "
+      fatal (_("%F%P: error: cannot change output format "
 	       "whilst linking %s binaries\n"), "ARM");
       return;
     }
@@ -532,10 +532,10 @@ arm_elf_create_output_section_statements (void)
 					bfd_get_target (link_info.output_bfd));
 
       if (params.in_implib_bfd == NULL)
-	fatal (_("%P: %s: can't open: %E\n"), in_implib_filename);
+	fatal (_("%F%P: %s: can't open: %E\n"), in_implib_filename);
 
       if (!bfd_check_format (params.in_implib_bfd, bfd_object))
-	fatal (_("%P: %s: not a relocatable file: %E\n"), in_implib_filename);
+	fatal (_("%F%P: %s: not a relocatable file: %E\n"), in_implib_filename);
     }
 
   bfd_elf32_arm_set_target_params (link_info.output_bfd, &link_info, &params);
@@ -549,7 +549,7 @@ arm_elf_create_output_section_statements (void)
 			      bfd_get_arch (link_info.output_bfd),
 			      bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create BFD: %E\n"));
+      fatal (_("%F%P: can not create BFD: %E\n"));
       return;
     }
 
@@ -709,7 +709,7 @@ PARSE_AND_LIST_ARGS_CASES='
 
 	group_size = bfd_scan_vma (optarg, &end, 0);
 	if (*end)
-	  fatal (_("%P: invalid number `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid number `%s'\''\n"), optarg);
       }
       break;
 
diff --git a/ld/emultempl/avrelf.em b/ld/emultempl/avrelf.em
index ad2de99feee..e1622674755 100644
--- a/ld/emultempl/avrelf.em
+++ b/ld/emultempl/avrelf.em
@@ -116,7 +116,7 @@ avr_elf_create_output_section_statements (void)
 
   if (bfd_get_flavour (link_info.output_bfd) != bfd_target_elf_flavour)
     {
-      fatal (_("%P: error: cannot change output format "
+      fatal (_("%F%P: error: cannot change output format "
 	       "whilst linking %s binaries\n"), "AVR");
       return;
     }
diff --git a/ld/emultempl/beos.em b/ld/emultempl/beos.em
index 4082449f461..25342a8d670 100644
--- a/ld/emultempl/beos.em
+++ b/ld/emultempl/beos.em
@@ -210,7 +210,7 @@ set_pe_subsystem (void)
 	  return;
 	}
     }
-  fatal (_("%P: invalid subsystem type %s\n"), optarg);
+  fatal (_("%F%P: invalid subsystem type %s\n"), optarg);
 }
 
 
@@ -220,7 +220,7 @@ set_pe_value (char *name)
   char *end;
   set_pe_name (name,  strtoul (optarg, &end, 0));
   if (end == optarg)
-    fatal (_("%P: invalid hex number for PE parameter '%s'\n"), optarg);
+    fatal (_("%F%P: invalid hex number for PE parameter '%s'\n"), optarg);
 
   optarg = end;
 }
@@ -235,7 +235,7 @@ set_pe_stack_heap (char *resname, char *comname)
       set_pe_value (comname);
     }
   else if (*optarg)
-    fatal (_("%P: strange hex info for PE parameter '%s'\n"), optarg);
+    fatal (_("%F%P: strange hex info for PE parameter '%s'\n"), optarg);
 }
 
 
@@ -250,7 +250,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	fatal (_("%P: cannot open base file %s\n"), optarg);
+	fatal (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 
       /* PE options */
@@ -359,7 +359,7 @@ gld${EMULATION_NAME}_after_open (void)
      FIXME: This should be done via a function, rather than by
      including an internal BFD header.  */
   if (!obj_pe (link_info.output_bfd))
-    fatal (_("%P: PE operations on non PE file\n"));
+    fatal (_("%F%P: PE operations on non PE file\n"));
 
   pe_data(link_info.output_bfd)->pe_opthdr = pe;
   pe_data(link_info.output_bfd)->dll = init[DLLOFF].value;
@@ -408,12 +408,12 @@ sort_by_file_name (const void *a, const void *b)
 
       if (!bfd_get_section_contents (sa->owner, sa, &a_sec, (file_ptr) 0,
 				     (bfd_size_type) sizeof (a_sec)))
-	fatal (_("%P: %pB: can't read contents of section .idata: %E\n"),
+	fatal (_("%F%P: %pB: can't read contents of section .idata: %E\n"),
 	       sa->owner);
 
       if (!bfd_get_section_contents (sb->owner, sb, &b_sec, (file_ptr) 0,
 				     (bfd_size_type) sizeof (b_sec)))
-	fatal (_("%P: %pB: can't read contents of section .idata: %E\n"),
+	fatal (_("%F%P: %pB: can't read contents of section .idata: %E\n"),
 	       sb->owner);
 
       i = a_sec < b_sec ? -1 : 0;
@@ -645,7 +645,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
   /* Everything from the '\$' on gets deleted so don't allow '\$' as the
      first character.  */
   if (*secname == '\$')
-    fatal (_("%P: section %s has '\$' as first character\n"), secname);
+    fatal (_("%F%P: section %s has '\$' as first character\n"), secname);
   if (strchr (secname + 1, '\$') == NULL)
     return NULL;
 
@@ -675,7 +675,7 @@ gld${EMULATION_NAME}_place_orphan (asection *s,
       }
   ps[0] = 0;
   if (l == NULL)
-    fatal (_("%P: *(%s\$) missing from linker script\n"), output_secname);
+    fatal (_("%F%P: *(%s\$) missing from linker script\n"), output_secname);
 
   /* Link the input section in and we're done for now.
      The sections still have to be sorted, but that has to wait until
diff --git a/ld/emultempl/cr16elf.em b/ld/emultempl/cr16elf.em
index 69ad393f124..2d677e89981 100644
--- a/ld/emultempl/cr16elf.em
+++ b/ld/emultempl/cr16elf.em
@@ -58,7 +58,7 @@ cr16_elf_after_open (void)
 	     COFF and ELF.  */
 	  if (bfd_get_flavour (abfd) != bfd_target_coff_flavour
 	      && bfd_get_flavour (abfd) != bfd_target_elf_flavour)
-	    fatal (_("%P: %pB: all input objects must be COFF or ELF "
+	    fatal (_("%F%P: %pB: all input objects must be COFF or ELF "
 		     "for --embedded-relocs\n"));
 
 	  datasec = bfd_get_section_by_name (abfd, ".data.rel");
@@ -82,7 +82,7 @@ cr16_elf_after_open (void)
 						      | SEC_IN_MEMORY))
 		  || !bfd_set_section_alignment (relsec, 2)
 		  || !bfd_set_section_size (relsec, datasec->reloc_count * 8))
-		fatal (_("%P: %pB: can not create .emreloc section: %E\n"));
+		fatal (_("%F%P: %pB: can not create .emreloc section: %E\n"));
 	    }
 
 	  /* Double check that all other data sections are empty, as is
diff --git a/ld/emultempl/cskyelf.em b/ld/emultempl/cskyelf.em
index 525e99b68fe..6baee999e53 100644
--- a/ld/emultempl/cskyelf.em
+++ b/ld/emultempl/cskyelf.em
@@ -151,7 +151,7 @@ csky_elf_create_output_section_statements (void)
 	  bfd_get_arch (link_info.output_bfd),
 	  bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create BFD: %E\n"));
+      fatal (_("%F%P: can not create BFD: %E\n"));
       return;
     }
 
@@ -318,7 +318,7 @@ PARSE_AND_LIST_ARGS_CASES='
 
       group_size = bfd_scan_vma (optarg, &end, 0);
       if (*end)
-	fatal (_("%P: invalid number `%s'\''\n"), optarg);
+	fatal (_("%F%P: invalid number `%s'\''\n"), optarg);
     }
     break;
 '
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
index a6383cc111f..05dc1aa681e 100644
--- a/ld/emultempl/elf.em
+++ b/ld/emultempl/elf.em
@@ -886,12 +886,12 @@ gld${EMULATION_NAME}_handle_option (int optc)
 	{
 #ifndef HAVE_ZSTD
 	  if (config.compress_debug == COMPRESS_DEBUG_ZSTD)
-	    fatal (_("%P: --compress-debug-sections=zstd: ld is not built "
+	    fatal (_("%F%P: --compress-debug-sections=zstd: ld is not built "
 		     "with zstd support\n"));
 #endif
 	}
       if (config.compress_debug == COMPRESS_UNKNOWN)
-	fatal (_("%P: invalid --compress-debug-sections option: \`%s'\n"),
+	fatal (_("%F%P: invalid --compress-debug-sections option: \`%s'\n"),
 	       optarg);
       break;
 
@@ -953,7 +953,7 @@ fragment <<EOF
 	  link_info.emit_gnu_hash = true;
 	}
       else
-	fatal (_("%P: invalid hash style \`%s'\n"), optarg);
+	fatal (_("%F%P: invalid hash style \`%s'\n"), optarg);
       break;
 
 EOF
@@ -973,7 +973,7 @@ fragment <<EOF
 	  link_info.maxpagesize = strtoul (optarg + 14, &end, 0);
 	  if (*end
 	      || (link_info.maxpagesize & (link_info.maxpagesize - 1)) != 0)
-	    fatal (_("%P: invalid maximum page size \`%s'\n"),
+	    fatal (_("%F%P: invalid maximum page size \`%s'\n"),
 		   optarg + 14);
 	  link_info.maxpagesize_is_set = true;
 	}
@@ -983,7 +983,7 @@ fragment <<EOF
 	  link_info.commonpagesize = strtoul (optarg + 17, &end, 0);
 	  if (*end
 	      || (link_info.commonpagesize & (link_info.commonpagesize - 1)) != 0)
-	    fatal (_("%P: invalid common page size \`%s'\n"),
+	    fatal (_("%F%P: invalid common page size \`%s'\n"),
 		   optarg + 17);
 	  link_info.commonpagesize_is_set = true;
 	}
@@ -992,7 +992,7 @@ fragment <<EOF
 	  char *end;
 	  link_info.stacksize = strtoul (optarg + 11, &end, 0);
 	  if (*end || link_info.stacksize < 0)
-	    fatal (_("%P: invalid stack size \`%s'\n"), optarg + 11);
+	    fatal (_("%F%P: invalid stack size \`%s'\n"), optarg + 11);
 	  if (!link_info.stacksize)
 	    /* Use -1 for explicit no-stack, because zero means
 	       'default'.   */
@@ -1031,7 +1031,7 @@ fragment <<EOF
 	  else if (strcmp (optarg, "start-stop-visibility=protected") == 0)
 	    link_info.start_stop_visibility = STV_PROTECTED;
 	  else
-	    fatal (_("%P: invalid visibility in \`-z %s'; "
+	    fatal (_("%F%P: invalid visibility in \`-z %s'; "
 		     "must be default, internal, hidden, or protected"),
 		   optarg);
 	}
diff --git a/ld/emultempl/hppaelf.em b/ld/emultempl/hppaelf.em
index 8dfa257b304..320108cdc11 100644
--- a/ld/emultempl/hppaelf.em
+++ b/ld/emultempl/hppaelf.em
@@ -82,7 +82,7 @@ hppaelf_create_output_section_statements (void)
 			      bfd_get_arch (link_info.output_bfd),
 			      bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create BFD: %E\n"));
+      fatal (_("%F%P: can not create BFD: %E\n"));
       return;
     }
 
@@ -346,7 +346,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	const char *end;
 	group_size = bfd_scan_vma (optarg, &end, 0);
 	if (*end)
-	  fatal (_("%P: invalid number `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid number `%s'\''\n"), optarg);
       }
       break;
 '
diff --git a/ld/emultempl/kvxelf.em b/ld/emultempl/kvxelf.em
index 186f1483037..c844eb38702 100644
--- a/ld/emultempl/kvxelf.em
+++ b/ld/emultempl/kvxelf.em
@@ -36,7 +36,7 @@ EOF
 if test x"${EMULATION_NAME}" != x"elf64kvx_linux"; then
 fragment <<EOF
   if (bfd_link_pie (&link_info))
-    fatal (_(":%P: -pie not supported\n"));
+    fatal (_("%F:%P: -pie not supported\n"));
 EOF
 fi
 fragment <<EOF
@@ -299,7 +299,7 @@ kvx_elf_create_output_section_statements (void)
   ldlang_add_file (stub_file);
 
   if (!kvx_elf${ELFSIZE}_init_stub_bfd (&link_info, stub_file->the_bfd))
-    einfo ("%P: can not init BFD: %E\n");
+    fatal ("%F%P: can not init BFD: %E\n");
 }
 
 
diff --git a/ld/emultempl/loongarchelf.em b/ld/emultempl/loongarchelf.em
index 928fd83ab15..04d282c8ad8 100644
--- a/ld/emultempl/loongarchelf.em
+++ b/ld/emultempl/loongarchelf.em
@@ -87,7 +87,7 @@ gld${EMULATION_NAME}_after_allocation (void)
       if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
 					      &link_info,
 					      NULL))
-	fatal (_("%P: map sections to segments failed: %E\n"));
+        fatal (_("%F%P: map sections to segments failed: %E\n"));
     }
 
   /* Adjust program header size and .eh_frame_hdr size before
diff --git a/ld/emultempl/m68hc1xelf.em b/ld/emultempl/m68hc1xelf.em
index 155b95349ab..50d1fef2240 100644
--- a/ld/emultempl/m68hc1xelf.em
+++ b/ld/emultempl/m68hc1xelf.em
@@ -159,7 +159,7 @@ m68hc11elf_create_output_section_statements (void)
 			     bfd_get_arch (link_info.output_bfd),
 			     bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create BFD: %E\n"));
+      fatal (_("%F%P: can not create BFD: %E\n"));
       return;
     }
 
diff --git a/ld/emultempl/m68kelf.em b/ld/emultempl/m68kelf.em
index 91fb3f8502a..76441cde4e9 100644
--- a/ld/emultempl/m68kelf.em
+++ b/ld/emultempl/m68kelf.em
@@ -82,7 +82,7 @@ m68k_elf_after_open (void)
 	  asection *datasec;
 
 	  if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
-	    fatal (_("%P: %pB: all input objects must be ELF "
+	    fatal (_("%F%P: %pB: all input objects must be ELF "
 		     "for --embedded-relocs\n"));
 
 	  datasec = bfd_get_section_by_name (abfd, ".data");
@@ -106,7 +106,7 @@ m68k_elf_after_open (void)
 	      if (relsec == NULL
 		  || !bfd_set_section_alignment (relsec, 2)
 		  || !bfd_set_section_size (relsec, datasec->reloc_count * 12))
-		fatal (_("%P: %pB: can not create .emreloc section: %E\n"));
+		fatal (_("%F%P: %pB: can not create .emreloc section: %E\n"));
 	    }
 
 	  /* Double check that all other data sections are empty, as is
diff --git a/ld/emultempl/metagelf.em b/ld/emultempl/metagelf.em
index b6e59273dda..79c3372116f 100644
--- a/ld/emultempl/metagelf.em
+++ b/ld/emultempl/metagelf.em
@@ -59,7 +59,7 @@ metagelf_create_output_section_statements (void)
 			      bfd_get_arch (link_info.output_bfd),
 			      bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create BFD: %E\n"));
+      fatal (_("%F%P: can not create BFD: %E\n"));
       return;
     }
 
@@ -305,7 +305,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	const char *end;
 	group_size = bfd_scan_vma (optarg, &end, 0);
 	if (*end)
-	  fatal (_("%P: invalid number `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid number `%s'\''\n"), optarg);
       }
       break;
 '
diff --git a/ld/emultempl/mipself.em b/ld/emultempl/mipself.em
index 9aa15bda6e9..16aaa0ca1b2 100644
--- a/ld/emultempl/mipself.em
+++ b/ld/emultempl/mipself.em
@@ -152,7 +152,7 @@ mips_add_stub_section (const char *stub_sec_name, asection *input_section,
 				 bfd_get_arch (link_info.output_bfd),
 				 bfd_get_mach (link_info.output_bfd)))
 	{
-	  fatal (_("%P: can not create BFD: %E\n"));
+	  fatal (_("%F%P: can not create BFD: %E\n"));
 	  return NULL;
 	}
       stub_bfd->flags |= BFD_LINKER_CREATED;
diff --git a/ld/emultempl/mmix-elfnmmo.em b/ld/emultempl/mmix-elfnmmo.em
index 72589416ef0..991f8a95a46 100644
--- a/ld/emultempl/mmix-elfnmmo.em
+++ b/ld/emultempl/mmix-elfnmmo.em
@@ -113,7 +113,7 @@ mmix_after_allocation (void)
     bfd_set_section_vma (sec, 0);
 
   if (!_bfd_mmix_after_linker_allocation (link_info.output_bfd, &link_info))
-    fatal (_("%P: can't finalize linker-allocated global registers\n"));
+    fatal (_("%F%P: can't finalize linker-allocated global registers\n"));
 }
 EOF
 
diff --git a/ld/emultempl/nds32elf.em b/ld/emultempl/nds32elf.em
index e8c72d934f8..fac249bd23f 100644
--- a/ld/emultempl/nds32elf.em
+++ b/ld/emultempl/nds32elf.em
@@ -44,7 +44,7 @@ nds32_elf_create_output_section_statements (void)
   if (strstr (bfd_get_target (link_info.output_bfd), "nds32") == NULL)
     {
       /* Check the output target is nds32.  */
-      fatal (_("%P: error: cannot change output format whilst "
+      fatal (_("%F%P: error: cannot change output format whilst "
 	       "linking %s binaries\n"), "NDS32");
       return;
     }
@@ -96,7 +96,7 @@ nds32_elf_after_open (void)
 	       && abi_ver != (elf_elfheader (abfd)->e_flags & EF_NDS_ABI))
 	{
 	  /* Incompatible objects.  */
-	  fatal (_("%P: %pB: ABI version of object files mismatched\n"),
+	  fatal (_("%F%P: %pB: ABI version of object files mismatched\n"),
 		 abfd);
 	}
     }
@@ -183,7 +183,7 @@ PARSE_AND_LIST_ARGS_CASES='
       {
 	sym_ld_script = fopen (optarg, FOPEN_WT);
 	if(sym_ld_script == NULL)
-	  fatal (_("%P: cannot open map file %s: %E\n"), optarg);
+	  fatal (_("%F%P: cannot open map file %s: %E\n"), optarg);
       }
     break;
   case OPTION_HYPER_RELAX:
diff --git a/ld/emultempl/nto.em b/ld/emultempl/nto.em
index ee00c79c3cd..68457fc8fc5 100644
--- a/ld/emultempl/nto.em
+++ b/ld/emultempl/nto.em
@@ -51,7 +51,7 @@ nto_create_QNX_note_section(int type)
      is called before this function, stub_file should already be defined.  */
   if (!stub_file)
     {
-      fatal (_("%P: cannot create .note section in stub BFD.\n"));
+      fatal (_("%F%P: cannot create .note section in stub BFD.\n"));
       return NULL;
     }
 
@@ -60,7 +60,7 @@ nto_create_QNX_note_section(int type)
   note_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd, ".note", flags);
   if (! note_sec)
     {
-      fatal (_("%P: failed to create .note section\n"));
+      fatal (_("%F%P: failed to create .note section\n"));
       return NULL;
     }
 
@@ -101,7 +101,7 @@ nto_lookup_QNX_note_section(int type)
       sec->contents = xmalloc(sec->size);
       if (!bfd_get_section_contents (sec->owner, sec, sec->contents, (file_ptr) 0,
 				     sec->size))
-	fatal (_("%P: %pB: can't read contents of section .note: %E\n"),
+	fatal (_("%F%P: %pB: can't read contents of section .note: %E\n"),
 	       sec->owner);
 
       e_note = (Elf_External_Note *) sec->contents;
@@ -144,7 +144,7 @@ nto_add_note_section (void) {
 
   if (nto_lazy_stack && !link_info.stacksize)
     {
-      fatal (_("%P: error: --lazy-stack must follow -zstack-size=<size>\n"));
+      fatal (_("%F%P: error: --lazy-stack must follow -zstack-size=<size>\n"));
       return;
     }
 
@@ -208,7 +208,7 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
 	char *end;
 	link_info.stacksize = strtoul (optarg, &end, 0);
 	if (*end || link_info.stacksize < 0)
-	  fatal (_("%P: invalid stack size `%s'\''\n"), optarg + 11);
+	  fatal (_("%F%P: invalid stack size `%s'\''\n"), optarg + 11);
 	if (!link_info.stacksize)
 	  /* Use -1 for explicit no-stack, because zero means
 	     'default'.   */
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 9a2b576a6ac..887122a861d 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -648,7 +648,7 @@ set_pe_subsystem (void)
 
       if (v[i].name == NULL)
 	{
-	  fatal (_("%P: invalid subsystem type %s\n"), optarg);
+	  fatal (_("%F%P: invalid subsystem type %s\n"), optarg);
 	  return;
 	}
 
@@ -669,7 +669,7 @@ set_pe_value (char *name)
   set_pe_name (name,  strtoul (optarg, &end, 0));
 
   if (end == optarg)
-    fatal (_("%P: invalid hex number for PE parameter '%s'\n"), optarg);
+    fatal (_("%F%P: invalid hex number for PE parameter '%s'\n"), optarg);
 
   optarg = end;
 }
@@ -686,7 +686,7 @@ set_pe_stack_heap (char *resname, char *comname)
       set_pe_value (comname);
     }
   else if (*optarg)
-    fatal (_("%P: strange hex info for PE parameter '%s'\n"), optarg);
+    fatal (_("%F%P: strange hex info for PE parameter '%s'\n"), optarg);
 }
 
 #define DEFAULT_BUILD_ID_STYLE	"md5"
@@ -702,7 +702,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	fatal (_("%P: cannot open base file %s\n"), optarg);
+	fatal (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 
       /* PE options.  */
@@ -1231,7 +1231,7 @@ make_runtime_ref (void)
     = bfd_wrapped_link_hash_lookup (link_info.output_bfd, &link_info,
 				    rr, true, false, true);
   if (!h)
-    fatal (_("%P: bfd_link_hash_lookup failed: %E\n"));
+    fatal (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
   else
     {
       if (h->type == bfd_link_hash_new)
@@ -1529,7 +1529,7 @@ gld${EMULATION_NAME}_after_open (void)
   if (bfd_get_flavour (link_info.output_bfd) != bfd_target_coff_flavour
       || coff_data (link_info.output_bfd) == NULL
       || !obj_pe (link_info.output_bfd))
-    fatal (_("%P: cannot perform PE operations on non PE output file '%pB'\n"),
+    fatal (_("%F%P: cannot perform PE operations on non PE output file '%pB'\n"),
 	   link_info.output_bfd);
 
   pe_data (link_info.output_bfd)->pe_opthdr = pe;
@@ -1602,7 +1602,7 @@ gld${EMULATION_NAME}_after_open (void)
 	 These will only be created if the output format is an arm format,
 	 hence we do not support linking and changing output formats at the
 	 same time.  Use a link followed by objcopy to change output formats.  */
-      fatal (_("%P: error: cannot change output format "
+      fatal (_("%F%P: error: cannot change output format "
 	       "whilst linking %s binaries\n"), "ARM");
       return;
     }
@@ -1662,7 +1662,7 @@ gld${EMULATION_NAME}_after_open (void)
 
 		    if (!bfd_generic_link_read_symbols (is->the_bfd))
 		      {
-			fatal (_("%P: %pB: could not read symbols: %E\n"),
+			fatal (_("%F%P: %pB: could not read symbols: %E\n"),
 			       is->the_bfd);
 			return;
 		      }
@@ -1849,7 +1849,7 @@ gld${EMULATION_NAME}_after_open (void)
 
 		if (!bfd_generic_link_read_symbols (is->the_bfd))
 		  {
-		    fatal (_("%P: %pB: could not read symbols: %E\n"),
+		    fatal (_("%F%P: %pB: could not read symbols: %E\n"),
 			   is->the_bfd);
 		    return;
 		  }
@@ -1960,7 +1960,7 @@ gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBU
 
 	      h = bfd_link_hash_lookup (link_info.hash, buf, true, true, true);
 	      if (h == (struct bfd_link_hash_entry *) NULL)
-		fatal (_("%P: bfd_link_hash_lookup failed: %E\n"));
+		fatal (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
 	      if (h->type == bfd_link_hash_new)
 		{
 		  h->type = bfd_link_hash_undefined;
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index 440c0bf5fc4..c53f3c1f90b 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -625,7 +625,7 @@ set_pep_subsystem (void)
 
       if (v[i].name == NULL)
 	{
-	  fatal (_("%P: invalid subsystem type %s\n"), optarg);
+	  fatal (_("%F%P: invalid subsystem type %s\n"), optarg);
 	  return;
 	}
 
@@ -646,7 +646,7 @@ set_pep_value (char *name)
   set_pep_name (name,  (bfd_vma) strtoull (optarg, &end, 0));
 
   if (end == optarg)
-    fatal (_("%P: invalid hex number for PE parameter '%s'\n"), optarg);
+    fatal (_("%F%P: invalid hex number for PE parameter '%s'\n"), optarg);
 
   optarg = end;
 }
@@ -663,7 +663,7 @@ set_pep_stack_heap (char *resname, char *comname)
       set_pep_value (comname);
     }
   else if (*optarg)
-    fatal (_("%P: strange hex info for PE parameter '%s'\n"), optarg);
+    fatal (_("%F%P: strange hex info for PE parameter '%s'\n"), optarg);
 }
 
 #define DEFAULT_BUILD_ID_STYLE	"md5"
@@ -680,7 +680,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
     case OPTION_BASE_FILE:
       link_info.base_file = fopen (optarg, FOPEN_WB);
       if (link_info.base_file == NULL)
-	fatal (_("%P: cannot open base file %s\n"), optarg);
+	fatal (_("%F%P: cannot open base file %s\n"), optarg);
       break;
 
       /* PE options.  */
@@ -1233,7 +1233,7 @@ make_runtime_ref (void)
     = bfd_wrapped_link_hash_lookup (link_info.output_bfd, &link_info,
 				    rr, true, false, true);
   if (!h)
-    fatal (_("%P: bfd_link_hash_lookup failed: %E\n"));
+    fatal (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
   else
     {
       if (h->type == bfd_link_hash_new)
@@ -1533,7 +1533,7 @@ gld${EMULATION_NAME}_after_open (void)
   if (bfd_get_flavour (link_info.output_bfd) != bfd_target_coff_flavour
       || coff_data (link_info.output_bfd) == NULL
       || !obj_pe (link_info.output_bfd))
-    fatal (_("%P: cannot perform PE operations on non PE output file '%pB'\n"),
+    fatal (_("%F%P: cannot perform PE operations on non PE output file '%pB'\n"),
 	   link_info.output_bfd);
 
   pe_data (link_info.output_bfd)->pe_opthdr = pep;
@@ -1645,7 +1645,7 @@ gld${EMULATION_NAME}_after_open (void)
 
 		    if (!bfd_generic_link_read_symbols (is->the_bfd))
 		      {
-			fatal (_("%P: %pB: could not read symbols: %E\n"),
+			fatal (_("%F%P: %pB: could not read symbols: %E\n"),
 			       is->the_bfd);
 			return;
 		      }
@@ -1849,7 +1849,7 @@ gld${EMULATION_NAME}_unrecognized_file (lang_input_statement_type *entry ATTRIBU
 
 	      h = bfd_link_hash_lookup (link_info.hash, buf, true, true, true);
 	      if (h == (struct bfd_link_hash_entry *) NULL)
-		fatal (_("%P: bfd_link_hash_lookup failed: %E\n"));
+		fatal (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
 	      if (h->type == bfd_link_hash_new)
 		{
 		  h->type = bfd_link_hash_undefined;
diff --git a/ld/emultempl/ppc32elf.em b/ld/emultempl/ppc32elf.em
index ae11bc9a072..9d4aebd34c0 100644
--- a/ld/emultempl/ppc32elf.em
+++ b/ld/emultempl/ppc32elf.em
@@ -366,7 +366,7 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
 	  char *end;
 	  unsigned long val = strtoul (optarg, &end, 0);
 	  if (*end || val > 5)
-	    fatal (_("%P: invalid --plt-align `%s'\''\n"), optarg);
+	    fatal (_("%F%P: invalid --plt-align `%s'\''\n"), optarg);
 	  params.plt_stub_align = val;
 	}
       else
@@ -399,7 +399,7 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
 	  if (*end
 	      || (params.pagesize < 4096 && params.pagesize != 0)
 	      || params.pagesize != (params.pagesize & -params.pagesize))
-	    fatal (_("%P: invalid pagesize `%s'\''\n"), optarg);
+	    fatal (_("%F%P: invalid pagesize `%s'\''\n"), optarg);
 	}
       break;
 
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index f7a8f1eb259..1b2f05c3b61 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -91,7 +91,7 @@ ppc_create_output_section_statements (void)
 			     bfd_get_arch (link_info.output_bfd),
 			     bfd_get_mach (link_info.output_bfd)))
     {
-      fatal (_("%P: can not create BFD: %E\n"));
+      fatal (_("%F%P: can not create BFD: %E\n"));
       return;
     }
 
@@ -101,7 +101,7 @@ ppc_create_output_section_statements (void)
   if (params.save_restore_funcs < 0)
     params.save_restore_funcs = !bfd_link_relocatable (&link_info);
   if (!ppc64_elf_init_stub_bfd (&link_info, &params))
-    fatal (_("%P: can not init BFD: %E\n"));
+    fatal (_("%F%P: can not init BFD: %E\n"));
 }
 
 /* Called after opening files but before mapping sections.  */
@@ -825,7 +825,7 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
 	const char *end;
 	params.group_size = bfd_scan_vma (optarg, &end, 0);
 	if (*end)
-	  fatal (_("%P: invalid number `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid number `%s'\''\n"), optarg);
       }
       break;
 
@@ -851,7 +851,7 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
 	  char *end;
 	  long val = strtol (optarg, &end, 0);
 	  if (*end || (unsigned long) val + 8 > 16)
-	    fatal (_("%P: invalid --plt-align `%s'\''\n"), optarg);
+	    fatal (_("%F%P: invalid --plt-align `%s'\''\n"), optarg);
 	  params.plt_stub_align = val;
 	}
       else
@@ -880,7 +880,7 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
 	  else if (strcasecmp (optarg, "no") == 0)
 	    params.power10_stubs = 0;
 	  else
-	    fatal (_("%P: invalid --power10-stubs argument `%s'\''\n"),
+	    fatal (_("%F%P: invalid --power10-stubs argument `%s'\''\n"),
 		   optarg);
 	}
       else
diff --git a/ld/emultempl/riscvelf.em b/ld/emultempl/riscvelf.em
index 78e1fcde68e..4ad1ef5932b 100644
--- a/ld/emultempl/riscvelf.em
+++ b/ld/emultempl/riscvelf.em
@@ -131,7 +131,7 @@ riscv_create_output_section_statements (void)
 	 These will only be created if the output format is a RISC-V format,
 	 hence we do not support linking and changing output formats at the
 	 same time.  Use a link followed by objcopy to change output formats.  */
-      fatal (_("%P: error: cannot change output format"
+      fatal (_("%F%P: error: cannot change output format"
 	       " whilst linking %s binaries\n"), "RISC-V");
       return;
     }
diff --git a/ld/emultempl/s390.em b/ld/emultempl/s390.em
index 1a4daf96987..0cfde40db11 100644
--- a/ld/emultempl/s390.em
+++ b/ld/emultempl/s390.em
@@ -34,7 +34,7 @@ static void
 s390_elf_create_output_section_statements (void)
 {
   if (!bfd_elf_s390_set_options (&link_info, &params))
-    fatal (_("%P: can not init BFD: %E\n"));
+    fatal (_("%F%P: can not init BFD: %E\n"));
 }
 
 EOF
diff --git a/ld/emultempl/scoreelf.em b/ld/emultempl/scoreelf.em
index fd67d5ceb94..f0ff12b93f9 100644
--- a/ld/emultempl/scoreelf.em
+++ b/ld/emultempl/scoreelf.em
@@ -62,7 +62,7 @@ score_elf_after_open (void)
 	 These will only be created if the output format is an score format,
 	 hence we do not support linking and changing output formats at the
 	 same time.  Use a link followed by objcopy to change output formats.  */
-      fatal (_("%P: error: cannot change output format "
+      fatal (_("%F%P: error: cannot change output format "
 	       "whilst linking %s binaries\n"), "S+core");
       return;
     }
diff --git a/ld/emultempl/spuelf.em b/ld/emultempl/spuelf.em
index cda9a06ac08..f08c972de49 100644
--- a/ld/emultempl/spuelf.em
+++ b/ld/emultempl/spuelf.em
@@ -202,7 +202,7 @@ spu_elf_load_ovl_mgr (void)
       /* User supplied __ovly_load.  */
     }
   else if (mgr_stream->start == mgr_stream->end)
-    fatal (_("%P: no built-in overlay manager\n"));
+    fatal (_("%F%P: no built-in overlay manager\n"));
   else
     {
       lang_input_statement_type *ovl_is;
@@ -379,7 +379,7 @@ spu_elf_open_overlay_script (void)
   if (script == NULL)
     {
     file_err:
-      fatal (_("%P: can not open script: %E\n"));
+      fatal (_("%F%P: can not open script: %E\n"));
     }
   return script;
 }
@@ -695,7 +695,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	    if (*end == 0)
 	      break;
 	  }
-	fatal (_("%P: invalid --local-store address range `%s'\''\n"), optarg);
+	fatal (_("%F%P: invalid --local-store address range `%s'\''\n"), optarg);
       }
       break;
 
@@ -731,12 +731,12 @@ PARSE_AND_LIST_ARGS_CASES='
       if (!num_lines_set)
 	params.num_lines = 32;
       else if ((params.num_lines & -params.num_lines) != params.num_lines)
-	fatal (_("%P: invalid --num-lines/--num-regions `%u'\''\n"),
+	fatal (_("%F%P: invalid --num-lines/--num-regions `%u'\''\n"),
 	       params.num_lines);
       if (!line_size_set)
 	params.line_size = 1024;
       else if ((params.line_size & -params.line_size) != params.line_size)
-	fatal (_("%P: invalid --line-size/--region-size `%u'\''\n"),
+	fatal (_("%F%P: invalid --line-size/--region-size `%u'\''\n"),
 	       params.line_size);
       break;
 
@@ -757,7 +757,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	    && (params.ovly_flavour != ovly_soft_icache
 		|| (params.num_lines & -params.num_lines) == params.num_lines))
 	  break;
-	fatal (_("%P: invalid --num-lines/--num-regions `%s'\''\n"), optarg);
+	fatal (_("%F%P: invalid --num-lines/--num-regions `%s'\''\n"), optarg);
       }
       break;
 
@@ -770,7 +770,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	    && (params.ovly_flavour != ovly_soft_icache
 		|| (params.line_size & -params.line_size) == params.line_size))
 	  break;
-	fatal (_("%P: invalid --line-size/--region-size `%s'\''\n"), optarg);
+	fatal (_("%F%P: invalid --line-size/--region-size `%s'\''\n"), optarg);
       }
       break;
 
@@ -779,7 +779,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	char *end;
 	params.auto_overlay_fixed = strtoul (optarg, &end, 0);
 	if (*end != 0)
-	  fatal (_("%P: invalid --fixed-space value `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid --fixed-space value `%s'\''\n"), optarg);
       }
       break;
 
@@ -788,7 +788,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	char *end;
 	params.auto_overlay_reserved = strtoul (optarg, &end, 0);
 	if (*end != 0)
-	  fatal (_("%P: invalid --reserved-space value `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid --reserved-space value `%s'\''\n"), optarg);
       }
       break;
 
@@ -797,7 +797,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	char *end;
 	params.extra_stack_space = strtol (optarg, &end, 0);
 	if (*end != 0)
-	  fatal (_("%P: invalid --extra-stack-space value `%s'\''\n"), optarg);
+	  fatal (_("%F%P: invalid --extra-stack-space value `%s'\''\n"), optarg);
       }
       break;
 
diff --git a/ld/emultempl/tic6xdsbt.em b/ld/emultempl/tic6xdsbt.em
index 4aec9aebe6f..225ebca7a57 100644
--- a/ld/emultempl/tic6xdsbt.em
+++ b/ld/emultempl/tic6xdsbt.em
@@ -59,7 +59,7 @@ tic6x_after_open (void)
   if (is_tic6x_target ())
     {
       if (params.dsbt_index >= params.dsbt_size)
-	fatal (_("%P: invalid --dsbt-index %d, outside DSBT size\n"),
+	fatal (_("%F%P: invalid --dsbt-index %d, outside DSBT size\n"),
 	       params.dsbt_index);
       elf32_tic6x_setup (&link_info, &params);
     }
@@ -184,7 +184,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	if (*end == 0
 	    && params.dsbt_index >= 0 && params.dsbt_index < 0x7fff)
 	  break;
-	fatal (_("%P: invalid --dsbt-index %s\n"), optarg);
+	fatal (_("%F%P: invalid --dsbt-index %s\n"), optarg);
       }
       break;
     case OPTION_DSBT_SIZE:
@@ -194,7 +194,7 @@ PARSE_AND_LIST_ARGS_CASES='
 	if (*end == 0
 	    && params.dsbt_size >= 0 && params.dsbt_size < 0x7fff)
 	  break;
-	fatal (_("%P: invalid --dsbt-size %s\n"), optarg);
+	fatal (_("%F%P: invalid --dsbt-size %s\n"), optarg);
       }
       break;
    case OPTION_NO_MERGE_EXIDX_ENTRIES:
diff --git a/ld/emultempl/ticoff.em b/ld/emultempl/ticoff.em
index 2e6a4a0ae6f..13139b6f09e 100644
--- a/ld/emultempl/ticoff.em
+++ b/ld/emultempl/ticoff.em
@@ -88,7 +88,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
 	  lang_add_output_format (buf, NULL, NULL, 0);
 	}
       else
-	fatal (_("%P: invalid COFF format version %s\n"), optarg);
+	fatal (_("%F%P: invalid COFF format version %s\n"), optarg);
       break;
     }
   return false;
diff --git a/ld/emultempl/v850elf.em b/ld/emultempl/v850elf.em
index 92a1ac4d784..4c2776b1bbf 100644
--- a/ld/emultempl/v850elf.em
+++ b/ld/emultempl/v850elf.em
@@ -63,7 +63,7 @@ v850_create_output_section_statements (void)
 	 These will only be created if the output format is an arm format,
 	 hence we do not support linking and changing output formats at the
 	 same time.  Use a link followed by objcopy to change output formats.  */
-      fatal (_("%P: error: cannot change output format"
+      fatal (_("%F%P: error: cannot change output format"
 	       " whilst linking %s binaries\n"), "V850");
       return;
     }
diff --git a/ld/emultempl/vms.em b/ld/emultempl/vms.em
index 5bb6ae2a430..55bca53dfab 100644
--- a/ld/emultempl/vms.em
+++ b/ld/emultempl/vms.em
@@ -200,7 +200,7 @@ gld${EMULATION_NAME}_before_allocation (void)
   if (bed->elf_backend_late_size_sections
       && !bed->elf_backend_late_size_sections (link_info.output_bfd,
 					       &link_info))
-    fatal (_("%P: failed to set dynamic section sizes: %E\n"));
+    fatal (_("%F%P: failed to set dynamic section sizes: %E\n"));
 
   before_allocation_default ();
 }
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index 027b7732d2d..fb53fef45cb 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -390,7 +390,7 @@ check_xtensa_info (bfd *abfd, asection *info_sec)
 
   data = xmalloc (info_sec->size);
   if (! bfd_get_section_contents (abfd, info_sec, data, 0, info_sec->size))
-    fatal (_("%P: %pB: cannot read contents of section %pA\n"), abfd, info_sec);
+    fatal (_("%F%P: %pB: cannot read contents of section %pA\n"), abfd, info_sec);
 
   if (info_sec->size > 24
       && info_sec->size >= 24 + bfd_get_32 (abfd, data + 4)
@@ -431,13 +431,13 @@ elf_xtensa_before_allocation (void)
   if (is_big_endian
       && link_info.output_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
     {
-      fatal (_("%P: little endian output does not match "
+      fatal (_("%F%P: little endian output does not match "
 	       "Xtensa configuration\n"));
     }
   if (!is_big_endian
       && link_info.output_bfd->xvec->byteorder == BFD_ENDIAN_BIG)
     {
-      fatal (_("%P: big endian output does not match "
+      fatal (_("%F%P: big endian output does not match "
 	       "Xtensa configuration\n"));
     }
 
@@ -456,7 +456,7 @@ elf_xtensa_before_allocation (void)
 	 cannot go any further if there are any mismatches.  */
       if ((is_big_endian && f->the_bfd->xvec->byteorder == BFD_ENDIAN_LITTLE)
 	  || (!is_big_endian && f->the_bfd->xvec->byteorder == BFD_ENDIAN_BIG))
-	fatal (_("%P: cross-endian linking for %pB not supported\n"),
+	fatal (_("%F%P: cross-endian linking for %pB not supported\n"),
 	       f->the_bfd);
 
       if (! first_bfd)
@@ -487,7 +487,7 @@ elf_xtensa_before_allocation (void)
       info_sec = bfd_make_section_with_flags (first_bfd, ".xtensa.info",
 					      SEC_HAS_CONTENTS | SEC_READONLY);
       if (! info_sec)
-	fatal (_("%P: failed to create .xtensa.info section\n"));
+	fatal (_("%F%P: failed to create .xtensa.info section\n"));
     }
   if (info_sec)
     {
@@ -1226,7 +1226,7 @@ ld_build_required_section_dependence (lang_statement_union_type *s)
       lang_statement_union_type *l = iter_stack_current (&stack);
 
       if (l == NULL && link_info.non_contiguous_regions)
-	fatal (_("%P: Relaxation not supported with "
+	fatal (_("%F%P: Relaxation not supported with "
 		 "--enable-non-contiguous-regions.\n"));
 
       if (l->header.type == lang_input_section_enum)
diff --git a/ld/emultempl/z80.em b/ld/emultempl/z80.em
index d566b9ac398..eda5657302c 100644
--- a/ld/emultempl/z80.em
+++ b/ld/emultempl/z80.em
@@ -48,7 +48,7 @@ z80_after_open (void)
       const bfd_arch_info_type *info;
       info = bfd_arch_get_compatible (link_info.output_bfd, abfd, false);
       if (info == NULL)
-	fatal (_("%P: %pB: Instruction sets of object files incompatible\n"),
+	fatal (_("%F%P: %pB: Instruction sets of object files incompatible\n"),
 	       abfd);
       else
         bfd_set_arch_info (link_info.output_bfd, info);
diff --git a/ld/ldcref.c b/ld/ldcref.c
index 5d7891f6321..4f89bb4835d 100644
--- a/ld/ldcref.c
+++ b/ld/ldcref.c
@@ -514,7 +514,7 @@ check_local_sym_xref (lang_input_statement_type *statement)
     return;
 
   if (!bfd_generic_link_read_symbols (abfd))
-    fatal (_("%P: %pB: could not read symbols: %E\n"), abfd);
+    fatal (_("%F%P: %pB: could not read symbols: %E\n"), abfd);
 
   for (syms = bfd_get_outsymbols (abfd); *syms; ++syms)
     {
@@ -625,7 +625,7 @@ check_refs (const char *name,
      BFD might contain a prohibited cross reference.  */
 
   if (!bfd_generic_link_read_symbols (abfd))
-    fatal (_("%P: %pB: could not read symbols: %E\n"), abfd);
+    fatal (_("%F%P: %pB: could not read symbols: %E\n"), abfd);
 
   info.sym_name = name;
   info.global = global;
@@ -687,14 +687,14 @@ check_reloc_refs (bfd *abfd, asection *sec, void *iarg)
 
   relsize = bfd_get_reloc_upper_bound (abfd, sec);
   if (relsize < 0)
-    fatal (_("%P: %pB: could not read relocs: %E\n"), abfd);
+    fatal (_("%F%P: %pB: could not read relocs: %E\n"), abfd);
   if (relsize == 0)
     return;
 
   relpp = (arelent **) xmalloc (relsize);
   relcount = bfd_canonicalize_reloc (abfd, sec, relpp, info->asymbols);
   if (relcount < 0)
-    fatal (_("%P: %pB: could not read relocs: %E\n"), abfd);
+    fatal (_("%F%P: %pB: could not read relocs: %E\n"), abfd);
 
   p = relpp;
   pend = p + relcount;
diff --git a/ld/ldelf.c b/ld/ldelf.c
index fa0ce329a16..04b7e85dd33 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -95,7 +95,7 @@ ldelf_after_parse (void)
       else if (!link_info.maxpagesize_is_set)
 	link_info.maxpagesize = link_info.commonpagesize;
       else
-	fatal (_("%P: common page size (0x%v) > maximum page size (0x%v)\n"),
+	fatal (_("%F%P: common page size (0x%v) > maximum page size (0x%v)\n"),
 	       link_info.commonpagesize, link_info.maxpagesize);
     }
 }
@@ -121,7 +121,7 @@ ldelf_load_symbols (lang_input_statement_type *entry)
 
   if (entry->flags.just_syms
       && (bfd_get_file_flags (entry->the_bfd) & DYNAMIC) != 0)
-    fatal (_("%P: %pB: --just-symbols may not be used on DSO\n"),
+    fatal (_("%F%P: %pB: --just-symbols may not be used on DSO\n"),
 	   entry->the_bfd);
 
   if (link_class == 0
@@ -321,7 +321,7 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux)
       struct bfd_link_needed_list *needs;
 
       if (! bfd_elf_get_bfd_needed_list (abfd, &needs))
-	fatal (_("%P: %pB: bfd_elf_get_bfd_needed_list failed: %E\n"), abfd);
+	fatal (_("%F%P: %pB: bfd_elf_get_bfd_needed_list failed: %E\n"), abfd);
 
       if (needs != NULL)
 	{
@@ -369,7 +369,7 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux)
      can only check that using stat.  */
 
   if (bfd_stat (abfd, &global_stat) != 0)
-    fatal (_("%P: %pB: bfd_stat failed: %E\n"), abfd);
+    fatal (_("%F%P: %pB: bfd_stat failed: %E\n"), abfd);
 
   /* First strip off everything before the last '/'.  */
   soname = lbasename (bfd_get_filename (abfd));
@@ -408,7 +408,7 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux)
 
   /* Add this file into the symbol table.  */
   if (! bfd_link_add_symbols (abfd, &link_info))
-    fatal (_("%P: %pB: error adding symbols: %E\n"), abfd);
+    fatal (_("%F%P: %pB: error adding symbols: %E\n"), abfd);
 
   return true;
 }
@@ -1206,7 +1206,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
 	  && elf_dt_name (abfd) != NULL)
 	{
 	  if (bfd_elf_add_dt_needed_tag (abfd, &link_info) < 0)
-	    fatal (_("%P: failed to add DT_NEEDED dynamic tag\n"));
+	    fatal (_("%F%P: failed to add DT_NEEDED dynamic tag\n"));
 	}
 
   link_info.input_bfds_tail = save_input_bfd_tail;
@@ -1257,7 +1257,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
 		     bfd_get_target (link_info.output_bfd));
 
       if (link_info.out_implib_bfd == NULL)
-	fatal (_("%P: %s: can't open for writing: %E\n"),
+	fatal (_("%F%P: %s: can't open for writing: %E\n"),
 	       command_line.out_implib_filename);
     }
 
@@ -1312,7 +1312,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
 	  && (elf_tdata (abfd)->elf_header->e_type == ET_EXEC
 	      || (elf_tdata (abfd)->elf_header->e_type == ET_DYN
 		  && elf_tdata (abfd)->is_pie)))
-	fatal (_("%P: cannot use executable file '%pB' as input to a link\n"),
+	fatal (_("%F%P: cannot use executable file '%pB' as input to a link\n"),
 	       abfd);
     }
 
@@ -1366,7 +1366,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
 		}
 	      else if (seen_type != type)
 		{
-		  fatal (_("%P: compact frame descriptions incompatible with"
+		  fatal (_("%F%P: compact frame descriptions incompatible with"
 			   " DWARF2 .eh_frame from %pB\n"),
 			 type == DWARF2_EH_HDR ? abfd : elfbfd);
 		  break;
@@ -1408,7 +1408,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
 
   if (link_info.eh_frame_hdr_type == COMPACT_EH_HDR)
     if (!bfd_elf_parse_eh_frame_entries (NULL, &link_info))
-      fatal (_("%P: failed to parse EH frame entries\n"));
+      fatal (_("%F%P: failed to parse EH frame entries\n"));
 
   ldelf_handle_dt_needed (htab, use_libpath, native, is_linux,
 			  is_freebsd, elfsize, prefix);
@@ -1667,7 +1667,7 @@ ldelf_find_exp_assignment (etree_type *exp)
 					       &link_info,
 					       exp->assign.dst, provide,
 					       exp->assign.hidden))
-	    fatal (_("%P: failed to record assignment to %s: %E\n"),
+	    fatal (_("%F%P: failed to record assignment to %s: %E\n"),
 		   exp->assign.dst);
 	}
       ldelf_find_exp_assignment (exp->assign.src);
@@ -1845,7 +1845,7 @@ ldelf_before_allocation (char *audit, char *depaudit,
 	  command_line.filter_shlib, audit, depaudit,
 	  (const char * const *) command_line.auxiliary_filters,
 	  &link_info, &sinterp)))
-    fatal (_("%P: failed to set dynamic section sizes: %E\n"));
+    fatal (_("%F%P: failed to set dynamic section sizes: %E\n"));
 
   if (sinterp != NULL)
     {
@@ -1882,8 +1882,8 @@ ldelf_before_allocation (char *audit, char *depaudit,
 	msg = (char *) xmalloc ((size_t) (sz + 1));
 	if (! bfd_get_section_contents (is->the_bfd, s,	msg,
 					(file_ptr) 0, sz))
-	  fatal (_("%P: %pB: can't read contents of section %pA: %E\n"),
-		 is->the_bfd, s);
+	  fatal (_("%F%P: %pB: can't read contents of section .gnu.warning: %E\n"),
+		 is->the_bfd);
 	msg[sz] = '\0';
 	(*link_info.callbacks->warning) (&link_info, msg,
 					 (const char *) NULL, is->the_bfd,
@@ -1910,7 +1910,7 @@ ldelf_before_allocation (char *audit, char *depaudit,
   before_allocation_default ();
 
   if (!bfd_elf_size_dynsym_hash_dynstr (link_info.output_bfd, &link_info))
-    fatal (_("%P: failed to set dynamic section sizes: %E\n"));
+    fatal (_("%F%P: failed to set dynamic section sizes: %E\n"));
 
   if (ehdr_start != NULL)
     {
diff --git a/ld/ldelfgen.c b/ld/ldelfgen.c
index 8e84b7a5b3f..f92a7a0403b 100644
--- a/ld/ldelfgen.c
+++ b/ld/ldelfgen.c
@@ -282,7 +282,7 @@ ldelf_map_segments (bool need_layout)
 		  if (os_info->ordered != os_info->count
 		      && bfd_link_relocatable (&link_info))
 		    {
-		      fatal (_("%P: "
+		      fatal (_("%F%P: "
 			       "%pA has both ordered and unordered sections\n"),
 			     os->bfd_section);
 		      return;
@@ -307,7 +307,7 @@ ldelf_map_segments (bool need_layout)
 	  if (!_bfd_elf_map_sections_to_segments (link_info.output_bfd,
 						  &link_info,
 						  &need_layout))
-	    fatal (_("%P: map sections to segments failed: %E\n"));
+	    fatal (_("%F%P: map sections to segments failed: %E\n"));
 
 	  if (phdr_size != elf_program_header_size (link_info.output_bfd))
 	    {
@@ -327,7 +327,7 @@ ldelf_map_segments (bool need_layout)
   while (need_layout && --tries);
 
   if (tries == 0)
-    fatal (_("%P: looping in map_segments\n"));
+    fatal (_("%F%P: looping in map_segments\n"));
 
   if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour
       && lang_phdr_list == NULL)
@@ -338,7 +338,7 @@ ldelf_map_segments (bool need_layout)
 	= get_elf_backend_data (link_info.output_bfd);
       if (bed->elf_backend_strip_zero_sized_dynamic_sections
 	  && !bed->elf_backend_strip_zero_sized_dynamic_sections (&link_info))
-	fatal (_("%P: failed to strip zero-sized dynamic sections\n"));
+	  fatal (_("%F%P: failed to strip zero-sized dynamic sections\n"));
     }
 }
 
@@ -416,7 +416,7 @@ ldelf_acquire_strings_for_ctf
     {
       if (ctf_link_add_strtab (ctf_output, ldelf_ctf_strtab_iter_cb,
 			       &args) < 0)
-	fatal (_("%P: warning: CTF strtab association failed; strings will "
+	fatal (_("%F%P: warning: CTF strtab association failed; strings will "
 		 "not be shared: %s\n"),
 	       ctf_errmsg (ctf_errno (ctf_output)));
     }
@@ -443,7 +443,7 @@ ldelf_new_dynsym_for_ctf (struct ctf_dict *ctf_output, int symidx,
       lsym.st_value = sym->st_value;
       if (ctf_link_add_linker_symbol (ctf_output, &lsym) < 0)
 	{
-	  fatal (_("%P: warning: CTF symbol addition failed; CTF will "
+	  fatal (_("%F%P: warning: CTF symbol addition failed; CTF will "
 		   "not be tied to symbols: %s\n"),
 		 ctf_errmsg (ctf_errno (ctf_output)));
 	}
@@ -453,7 +453,7 @@ ldelf_new_dynsym_for_ctf (struct ctf_dict *ctf_output, int symidx,
       /* Shuffle all the symbols.  */
 
       if (ctf_link_shuffle_syms (ctf_output) < 0)
-	fatal (_("%P: warning: CTF symbol shuffling failed; CTF will "
+	fatal (_("%F%P: warning: CTF symbol shuffling failed; CTF will "
 		 "not be tied to symbols: %s\n"),
 	       ctf_errmsg (ctf_errno (ctf_output)));
     }
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 8d97baa579c..b318a11f98d 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -282,7 +282,7 @@ definedness_newfunc (struct bfd_hash_entry *entry,
       bfd_hash_allocate (table, sizeof (struct definedness_hash_entry));
 
   if (ret == NULL)
-    fatal (_("%P: bfd_hash_allocate failed creating symbol %s\n"), name);
+    fatal (_("%F%P: bfd_hash_allocate failed creating symbol %s\n"), name);
 
   ret->by_object = 0;
   ret->iteration = 0;
@@ -313,7 +313,7 @@ update_definedness (const char *name, struct bfd_link_hash_entry *h)
     bfd_hash_lookup (&definedness_table, name, true, false);
 
   if (defentry == NULL)
-    fatal (_("%P: bfd_hash_lookup failed creating symbol %s\n"), name);
+    fatal (_("%F%P: bfd_hash_lookup failed creating symbol %s\n"), name);
 
   /* If the symbol was already defined, and not by a script, then it
      must be defined by an object file or by the linker target code.  */
@@ -638,7 +638,7 @@ fold_binary (etree_type *tree)
 	    expld.result.value = ((bfd_signed_vma) lhs.value
 				  % (bfd_signed_vma) expld.result.value);
 	  else if (expld.phase != lang_mark_phase_enum)
-	    fatal (_("%P:%pS %% by zero\n"), tree->binary.rhs);
+	    fatal (_("%F%P:%pS %% by zero\n"), tree->binary.rhs);
 	  arith_result_section (&lhs);
 	  break;
 
@@ -647,7 +647,7 @@ fold_binary (etree_type *tree)
 	    expld.result.value = ((bfd_signed_vma) lhs.value
 				  / (bfd_signed_vma) expld.result.value);
 	  else if (expld.phase != lang_mark_phase_enum)
-	    fatal (_("%P:%pS / by zero\n"), tree->binary.rhs);
+	    fatal (_("%F%P:%pS / by zero\n"), tree->binary.rhs);
 	  arith_result_section (&lhs);
 	  break;
 
@@ -761,7 +761,7 @@ fold_name (etree_type *tree)
 	  if (!h)
 	    {
 	      if (expld.phase != lang_first_phase_enum)
-		fatal (_("%P: bfd_link_hash_lookup failed: %E\n"));
+		fatal (_("%F%P: bfd_link_hash_lookup failed: %E\n"));
 	    }
 	  else if (h->type == bfd_link_hash_defined
 		   || h->type == bfd_link_hash_defweak)
@@ -789,7 +789,7 @@ fold_name (etree_type *tree)
 	  else if (expld.phase == lang_final_phase_enum
 		   || (expld.phase != lang_mark_phase_enum
 		       && expld.assigning_to_dot))
-	    fatal (_("%P:%pS: undefined symbol `%s'"
+	    fatal (_("%F%P:%pS: undefined symbol `%s'"
 		     " referenced in expression\n"),
 		   tree, tree->name.name);
 	  else if (h->type == bfd_link_hash_new)
@@ -827,7 +827,7 @@ fold_name (etree_type *tree)
 	  if (os == NULL)
 	    {
 	      if (expld.phase == lang_final_phase_enum)
-		fatal (_("%P:%pS: undefined section `%s'"
+		fatal (_("%F%P:%pS: undefined section `%s'"
 			 " referenced in expression\n"),
 		       tree, tree->name.name);
 	    }
@@ -845,7 +845,7 @@ fold_name (etree_type *tree)
 	  if (os == NULL)
 	    {
 	      if (expld.phase == lang_final_phase_enum)
-		fatal (_("%P:%pS: undefined section `%s'"
+		fatal (_("%F%P:%pS: undefined section `%s'"
 			 " referenced in expression\n"),
 		       tree, tree->name.name);
 	    }
@@ -873,7 +873,7 @@ fold_name (etree_type *tree)
 	  if (os == NULL)
 	    {
 	      if (expld.phase == lang_final_phase_enum)
-		fatal (_("%P:%pS: undefined section `%s'"
+		fatal (_("%F%P:%pS: undefined section `%s'"
 			 " referenced in expression\n"),
 		       tree, tree->name.name);
 	      new_number (0);
@@ -912,7 +912,7 @@ fold_name (etree_type *tree)
 	if (mem != NULL)
 	  new_number (mem->length);
 	else
-	  fatal (_("%P:%pS: undefined MEMORY region `%s'"
+	  fatal (_("%F%P:%pS: undefined MEMORY region `%s'"
 		   " referenced in expression\n"),
 		 tree, tree->name.name);
       }
@@ -926,7 +926,7 @@ fold_name (etree_type *tree)
 	if (mem != NULL)
 	  new_rel_from_abs (mem->origin);
 	else
-	  fatal (_("%P:%pS: undefined MEMORY region `%s'"
+	  fatal (_("%F%P:%pS: undefined MEMORY region `%s'"
 		   " referenced in expression\n"),
 		 tree, tree->name.name);
       }
@@ -938,7 +938,7 @@ fold_name (etree_type *tree)
       else if (strcmp (tree->name.name, "COMMONPAGESIZE") == 0)
 	new_number (link_info.commonpagesize);
       else
-	fatal (_("%P:%pS: unknown constant `%s' referenced in expression\n"),
+	fatal (_("%F%P:%pS: unknown constant `%s' referenced in expression\n"),
 	       tree, tree->name.name);
       break;
 
@@ -1086,7 +1086,7 @@ exp_fold_tree_1 (etree_type *tree)
       if (tree->assign.dst[0] == '.' && tree->assign.dst[1] == 0)
 	{
 	  if (tree->type.node_class != etree_assign)
-	    fatal (_("%P:%pS can not PROVIDE assignment to"
+	    fatal (_("%F%P:%pS can not PROVIDE assignment to"
 		     " location counter\n"), tree);
 	  if (expld.phase != lang_first_phase_enum)
 	    {
@@ -1119,11 +1119,11 @@ exp_fold_tree_1 (etree_type *tree)
 		  || expld.section == bfd_und_section_ptr)
 		{
 		  if (expld.phase != lang_mark_phase_enum)
-		    fatal (_("%P:%pS invalid assignment to"
+		    fatal (_("%F%P:%pS invalid assignment to"
 			     " location counter\n"), tree);
 		}
 	      else if (expld.dotp == NULL)
-		fatal (_("%P:%pS assignment to location counter"
+		fatal (_("%F%P:%pS assignment to location counter"
 			 " invalid outside of SECTIONS\n"), tree);
 
 	      /* After allocation, assignment to dot should not be
@@ -1142,7 +1142,7 @@ exp_fold_tree_1 (etree_type *tree)
 		    nextdot += expld.section->vma;
 		  if (nextdot < expld.dot
 		      && expld.section != bfd_abs_section_ptr)
-		    fatal (_("%P:%pS cannot move location counter backwards"
+		    fatal (_("%F%P:%pS cannot move location counter backwards"
 			     " (from %V to %V)\n"),
 			   tree, expld.dot, nextdot);
 		  else
@@ -1202,7 +1202,7 @@ exp_fold_tree_1 (etree_type *tree)
 		  h = bfd_link_hash_lookup (link_info.hash, tree->assign.dst,
 					    true, false, true);
 		  if (h == NULL)
-		    fatal (_("%P:%s: hash creation failed\n"),
+		    fatal (_("%F%P:%s: hash creation failed\n"),
 			   tree->assign.dst);
 		}
 
@@ -1578,7 +1578,7 @@ exp_get_vma (etree_type *tree, lang_output_section_statement_type *os,
       if (expld.result.valid_p)
 	return expld.result.value;
       else if (name != NULL && expld.phase != lang_mark_phase_enum)
-	fatal (_("%P:%pS: n[...]

[diff truncated at 100000 bytes]


More information about the Binutils-cvs mailing list