]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR 32603, more ld -w misbehaviour
authorAlan Modra <amodra@gmail.com>
Sun, 16 Feb 2025 13:04:55 +0000 (23:34 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 22 Apr 2025 02:58:06 +0000 (12:28 +0930)
Commit 8d97c1a53f3d claimed to replace all einfo calls using %F with
a call to fatal.  It did so only for the ld/ directory.  This patch
adds a "fatal" to linker callbacks, and replaces those calls in bfd/
too.

(cherry picked from commit d26161914cf286171b29767916a212685f9aadf3)

34 files changed:
bfd/archive.c
bfd/coff-aarch64.c
bfd/coffgen.c
bfd/elf-ifunc.c
bfd/elf-m10300.c
bfd/elf-properties.c
bfd/elf.c
bfd/elf32-arm.c
bfd/elf32-avr.c
bfd/elf32-csky.c
bfd/elf32-frv.c
bfd/elf32-hppa.c
bfd/elf32-i386.c
bfd/elf32-m68hc11.c
bfd/elf32-m68hc12.c
bfd/elf32-metag.c
bfd/elf32-spu.c
bfd/elf64-ia64-vms.c
bfd/elf64-ppc.c
bfd/elf64-x86-64.c
bfd/elflink.c
bfd/elfnn-aarch64.c
bfd/elfnn-ia64.c
bfd/elfnn-kvx.c
bfd/elfnn-loongarch.c
bfd/elfxx-aarch64.c
bfd/elfxx-sparc.c
bfd/elfxx-x86.c
bfd/linker.c
bfd/reloc.c
bfd/reloc16.c
bfd/xcofflink.c
include/bfdlink.h
ld/ldmain.c

index ef0109599e15d5eaaae0d0ab81ad2f124b21f6e7..6cda73ce90313d27e44112a199403041dc737c62 100644 (file)
@@ -744,8 +744,8 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos,
            case bfd_error_system_call:
              if (info != NULL)
                {
-                 info->callbacks->einfo
-                   (_("%F%P: %pB(%s): error opening thin archive member: %E\n"),
+                 info->callbacks->fatal
+                   (_("%P: %pB(%s): error opening thin archive member: %E\n"),
                     archive, filename);
                  break;
                }
index 60cd6f8847341f1867fbef5f8e6c6535b0c27639..af4a44dede0b9c734e7075944477f2680e1cf00a 100644 (file)
@@ -907,10 +907,8 @@ coff_pe_aarch64_relocate_section (bfd *output_bfd,
          }
 
        default:
-         info->callbacks->einfo (_("%F%P: Unhandled relocation type %u\n"),
+         info->callbacks->fatal (_("%P: Unhandled relocation type %u\n"),
                                  rel->r_type);
-         BFD_FAIL ();
-         return false;
        }
     }
 
index d8c60e263426ee72d41c6c289aff9ab684154fc8..d03effd351a83c0928ca6077bf6ce90efb744d4f 100644 (file)
@@ -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->einfo (_("%F%P: already_linked_table: %E\n"));
+    info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
   return false;
 }
 
index f9569b85e652558c944d98d27a114cfa86f79ac0..96b828812e986cc51bb9242b978c311636d7455a 100644 (file)
@@ -139,9 +139,9 @@ _bfd_elf_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
          || info->export_dynamic)
       && h->pointer_equality_needed)
     {
-      info->callbacks->einfo
+      info->callbacks->fatal
        /* xgettext:c-format */
-       (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
+       (_("%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,
index 409804ecd386d1030dd0eb96b494e7ea227e3734..368ff7e708cb70178bf2c6c49b5f7ac5d734fbca 100644 (file)
@@ -2646,8 +2646,8 @@ mn10300_elf_relax_section (bfd *abfd,
   bfd_vma align_gap_adjustment;
 
   if (bfd_link_relocatable (link_info))
-    (*link_info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    link_info->callbacks->fatal
+      (_("%P: --relax and -r may not be used together\n"));
 
   /* Assume nothing changes.  */
   *again = false;
index 23634a9d9c911aa54cddbaa50e87c4feeb019e85..79741395f5e652144878455def864ba0c3cc73e2 100644 (file)
@@ -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->einfo (_("%F%P: failed to create GNU property section\n"));
+    info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
 
   if (!bfd_set_section_alignment (sec,
                                  elfclass == ELFCLASS64 ? 3 : 2))
-    info->callbacks->einfo (_("%F%pA: failed to align section\n"),
+    info->callbacks->fatal (_("%pA: failed to align section\n"),
                            sec);
 
   elf_section_type (sec) = SHT_NOTE;
index 1f2b82bfe92066e5f4314a89f08d677a3ac626e7..22282561de958974cc7196f29f2985a43dbf9ad6 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5009,8 +5009,8 @@ _bfd_elf_map_sections_to_segments (bfd *abfd,
          && need_layout != NULL
          && bed->size_relative_relocs
          && !bed->size_relative_relocs (info, need_layout))
-       info->callbacks->einfo
-         (_("%F%P: failed to size relative relocations\n"));
+       info->callbacks->fatal
+         (_("%P: failed to size relative relocations\n"));
     }
 
   if (no_user_phdrs && bfd_count_sections (abfd) != 0)
index d66e7324b5a0f1150d32eac8bda563c909387c25..b9c3b4bb1e9a14f70c7293d7c657e3576d412cea 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            stub_entry->target_section);
 
index b0826bde03ac26dd9d63f843039f3ceeb8a76ca1..52c439ac8018b2965f195874a15b9caf362a23cf 100644 (file)
@@ -2479,8 +2479,8 @@ elf32_avr_relax_section (bfd *abfd,
     shrinkable = false;
 
   if (bfd_link_relocatable (link_info))
-    (*link_info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    link_info->callbacks->fatal
+      (_("%P: --relax and -r may not be used together\n"));
 
   htab = avr_link_hash_table (link_info);
   if (htab == NULL)
index 5cb45e1a426c3db61df3ac9b68eb24d94a86c07e..bb70169ce7baa2454311d44545353d857e6e8f0e 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            stub_entry->target_section);
 
index 142b5a201b32dbf65ef3d6fd3b4be0b5c2ccba36..04d812b97fb465a2f516da4cea717e6c59659393 100644 (file)
@@ -5617,8 +5617,8 @@ elf32_frvfdpic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec,
   struct _frvfdpic_dynamic_got_plt_info gpinfo;
 
   if (bfd_link_relocatable (info))
-    (*info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    info->callbacks->fatal
+      (_("%P: --relax and -r may not be used together\n"));
 
   /* If we return early, we didn't change anything.  */
   *again = false;
index af11e0d15f0485f5baff4e7154fa75d9db25506f..ecfc8c4a8f3aac09db7948f6cd37327d9b631d54 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output "
+       info->callbacks->fatal (_("%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->einfo (_("%F%P: Could not assign `%pA' to an output "
+       info->callbacks->fatal (_("%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->einfo (_("%F%P: Could not assign `%pA' to an output "
+       info->callbacks->fatal (_("%P: Could not assign `%pA' to an output "
                                  "section. Retry without "
                                  "--enable-non-contiguous-regions.\n"),
                                hsh->target_section);
index 81301bf3a57a7cdf3010a45c6dba7721e63e07ef..e34296a0e5dcf6903131eac63b62d0b99ed2bf78 100644 (file)
@@ -4099,8 +4099,8 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
     {
       if (bfd_is_abs_section (htab->elf.splt->output_section))
        {
-         info->callbacks->einfo
-           (_("%F%P: discarded output section: `%pA'\n"),
+         info->callbacks->fatal
+           (_("%P: discarded output section: `%pA'\n"),
             htab->elf.splt);
          return false;
        }
index 3b564c99afff655149d13c6ab90cee76db905eba..f70716d66a2bf8b8722c2825806b7db96f9cffd7 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            stub_entry->target_section);
 
index 43e550c8956bb00288dd696c2239e874edaf68dc..f8619896978754c3abee33eebc92b083cf000fee 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            stub_entry->target_section);
 
index 93069948fc0f390e06a0c257432771a8497158f6..838ec2dd41a99972730dc56a8387c1aea86ca3bc 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            hsh->target_section);
 
index da54bf7019e85a3f537113ebe228550cd530a019..bd5c457ebaf0801d1eb8ed472f44e93c6afb8690 100644 (file)
@@ -4685,8 +4685,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
  file_err:
   bfd_set_error (bfd_error_system_call);
  err_exit:
-  info->callbacks->einfo (_("%F%P: auto overlay error: %E\n"));
-  xexit (1);
+  info->callbacks->fatal (_("%P: auto overlay error: %E\n"));
 }
 
 /* Provide an estimate of total stack required.  */
@@ -4739,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->einfo (_("%F%P: can not build overlay stubs: %E\n"));
+    info->callbacks->fatal (_("%P: can not build overlay stubs: %E\n"));
 
   return bfd_elf_final_link (output_bfd, info);
 }
index d7165e371f00d15e20740dab0b0938084039a235..558ce95e99667360449529fcb1f1e8128605b8a9 100644 (file)
@@ -361,8 +361,8 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
   *again = false;
 
   if (bfd_link_relocatable (link_info))
-    (*link_info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    link_info->callbacks->fatal
+      (_("%P: --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))
index 44861a058521b46754ebaa191034782cb185c757..c273973408efee220c5abd3ac8006f6260539021 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            stub_entry->group->stub_sec);
 
index 2afc594286e57fdf3fff08f04abd284c55de08cf..7baae66cca690e689b72b1163671683b8d162466 100644 (file)
@@ -3790,8 +3790,8 @@ elf_x86_64_relocate_section (bfd *output_bfd,
                              || (roff - 3 + 22) > input_section->size)
                            {
                            corrupt_input:
-                             info->callbacks->einfo
-                               (_("%F%P: corrupt input: %pB\n"),
+                             info->callbacks->fatal
+                               (_("%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->einfo (_("%F%pB: PC-relative offset overflow in PLT entry for `%s'\n"),
+       info->callbacks->fatal (_("%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->einfo (_("%F%pB: branch displacement overflow in PLT entry for `%s'\n"),
+               info->callbacks->fatal (_("%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->einfo (_("%F%pB: PC-relative offset overflow in GOT PLT entry for `%s'\n"),
+       info->callbacks->fatal (_("%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,
@@ -5165,8 +5165,8 @@ elf_x86_64_finish_dynamic_sections (bfd *output_bfd,
     {
       if (bfd_is_abs_section (htab->elf.splt->output_section))
        {
-         info->callbacks->einfo
-           (_("%F%P: discarded output section: `%pA'\n"),
+         info->callbacks->fatal
+           (_("%P: discarded output section: `%pA'\n"),
             htab->elf.splt);
          return false;
        }
index 91c77c211ef065a77883004eb696adacd92a00be..384fafb9e04be2de0b771204ff128c91eeaf36f3 100644 (file)
@@ -4334,8 +4334,8 @@ elf_link_add_to_first_hash (bfd *abfd, struct bfd_link_info *info,
     = ((struct elf_link_first_hash_entry *)
        bfd_hash_lookup (htab->first_hash, name, true, copy));
   if (e == NULL)
-    info->callbacks->einfo
-      (_("%F%P: %pB: failed to add %s to first hash\n"), abfd, name);
+    info->callbacks->fatal
+      (_("%P: %pB: failed to add %s to first hash\n"), abfd, name);
 
   if (e->abfd == NULL)
     /* Store ABFD in abfd.  */
@@ -4402,8 +4402,8 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
              || !bfd_hash_table_init
                   (htab->first_hash, elf_link_first_hash_newfunc,
                    sizeof (struct elf_link_first_hash_entry)))
-           info->callbacks->einfo
-             (_("%F%P: first_hash failed to create: %E\n"));
+           info->callbacks->fatal
+             (_("%P: first_hash failed to create: %E\n"));
        }
     }
   else
@@ -13074,8 +13074,8 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
   if (info->enable_dt_relr
       && bed->finish_relative_relocs
       && !bed->finish_relative_relocs (info))
-    info->callbacks->einfo
-      (_("%F%P: %pB: failed to finish relative relocations\n"), abfd);
+    info->callbacks->fatal
+      (_("%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->einfo (_("%F%P: corrupt input: %pB\n"),
+         info->callbacks->fatal (_("%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->einfo (_("%F%P: %pB(%pA): error: "
+             info->callbacks->fatal (_("%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->einfo (_("%F%P: already_linked_table: %E\n"));
+    info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
   return sec->output_section == bfd_abs_section_ptr;
 }
 
index 65182f49070d50a8b24881087f88f9d24bf788b9..ff4eb4ce9ac1958ba5a6e861bef3a02d1ea1dfa5 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without "
                              "--enable-non-contiguous-regions.\n"),
                            stub_entry->target_section);
@@ -8926,9 +8926,9 @@ elfNN_aarch64_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
        asection *s = p->sec->output_section;
        if (s != NULL && (s->flags & SEC_READONLY) != 0)
          {
-           info->callbacks->einfo
+           info->callbacks->fatal
                /* xgettext:c-format */
-               (_ ("%F%P: %pB: copy relocation against non-copyable "
+               (_ ("%P: %pB: copy relocation against non-copyable "
                    "protected symbol `%s'\n"),
                 p->sec->owner, h->root.root.string);
            return false;
index d80fc425642b527ba7394c5301a7a5663e2528ce..8c7302a14d562c9eed19a8b3af15409d2e6cfb48 100644 (file)
@@ -361,8 +361,8 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
   *again = false;
 
   if (bfd_link_relocatable (link_info))
-    (*link_info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    link_info->callbacks->fatal
+      (_("%P: --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))
index a8d2317ba5e7d766a992b8c1c6aa147d90e5d700..4f181b7c68a401959f6b4a8401fe2e95ee392bbb 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign '%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign '%pA' to an output section. "
                              "Retry without "
                              "--enable-non-contiguous-regions.\n"),
                            stub_entry->target_section);
index a04f00d1b841d5fb3818b442b473e646567ac22e..b24fbd189f8417a8461c86caa4c435d16a696b10 100644 (file)
@@ -1699,9 +1699,9 @@ local_allocate_ifunc_dyn_relocs (struct bfd_link_info *info,
          || info->export_dynamic)
       && h->pointer_equality_needed)
     {
-      info->callbacks->einfo
+      info->callbacks->fatal
        /* xgettext:c-format.  */
-       (_("%F%P: dynamic STT_GNU_IFUNC symbol `%s' with pointer "
+       (_("%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,
index e3795be2c2ccfdfbb3dd16488af5995fa5668d90..04c65a01788807c4c4eae119cf8d095f121f5fdf 100644 (file)
@@ -744,13 +744,11 @@ _bfd_aarch64_elf_create_gnu_property_section (struct bfd_link_info *info,
                                      | SEC_HAS_CONTENTS
                                      | SEC_DATA));
   if (sec == NULL)
-    info->callbacks->einfo (
-      _("%F%P: failed to create GNU property section\n"));
+    info->callbacks->fatal (_("%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->einfo (_("%F%pA: failed to align section\n"),
-                           sec);
+    info->callbacks->fatal (_("%pA: failed to align section\n"), sec);
 
   elf_section_type (sec) = SHT_NOTE;
 }
index 91ffece38d043a6523ade68aab6f2844327bbb05..bf4e34e15593b3e13be85a85d275fdb5c5d87cb1 100644 (file)
@@ -2676,8 +2676,8 @@ _bfd_sparc_elf_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
                              bool *again)
 {
   if (bfd_link_relocatable (link_info))
-    (*link_info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    link_info->callbacks->fatal
+      (_("%P: --relax and -r may not be used together\n"));
 
   *again = false;
   sec_do_relax (section) = 1;
index cd47575f58910f7cf6be63a68a18219d70b6d888..f785d11b0a9176d32997c7cfae9f30455ab732d6 100644 (file)
@@ -529,9 +529,9 @@ elf_x86_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
          asection *s = p->sec->output_section;
          if (s != NULL && (s->flags & SEC_READONLY) != 0)
            {
-             info->callbacks->einfo
+             info->callbacks->fatal
                /* xgettext:c-format */
-               (_("%F%P: %pB: copy relocation against non-copyable "
+               (_("%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);
@@ -1039,9 +1039,9 @@ elf_x86_relative_reloc_record_add
 
   if (relative_reloc->data == NULL)
     {
-      info->callbacks->einfo
+      info->callbacks->fatal
        /* xgettext:c-format */
-       (_("%F%P: %pB: failed to allocate relative reloc record\n"),
+       (_("%P: %pB: failed to allocate relative reloc record\n"),
         info->output_bfd);
       return false;
     }
@@ -1398,9 +1398,9 @@ elf64_dt_relr_bitmap_add
 
   if (bitmap->u.elf64 == NULL)
     {
-      info->callbacks->einfo
+      info->callbacks->fatal
        /* xgettext:c-format */
-       (_("%F%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
+       (_("%P: %pB: failed to allocate 64-bit DT_RELR bitmap\n"),
         info->output_bfd);
     }
 
@@ -1434,9 +1434,9 @@ elf32_dt_relr_bitmap_add
 
   if (bitmap->u.elf32 == NULL)
     {
-      info->callbacks->einfo
+      info->callbacks->fatal
        /* xgettext:c-format */
-       (_("%F%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
+       (_("%P: %pB: failed to allocate 32-bit DT_RELR bitmap\n"),
         info->output_bfd);
     }
 
@@ -1573,9 +1573,9 @@ elf_x86_size_or_finish_relative_reloc
                          if (!_bfd_elf_mmap_section_contents (sec->owner,
                                                               sec,
                                                               &contents))
-                           info->callbacks->einfo
+                           info->callbacks->fatal
                              /* xgettext:c-format */
-                             (_("%F%P: %pB: failed to allocate memory for section `%pA'\n"),
+                             (_("%P: %pB: failed to allocate memory for section `%pA'\n"),
                               info->output_bfd, sec);
 
                          /* Cache the section contents for
@@ -1760,9 +1760,9 @@ elf_x86_compute_dl_relr_bitmap
          *need_layout = true;
        }
       else
-       info->callbacks->einfo
+       info->callbacks->fatal
          /* xgettext:c-format */
-         (_("%F%P: %pB: size of compact relative reloc section is "
+         (_("%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);
@@ -1782,9 +1782,9 @@ elf_x86_write_dl_relr_bitmap (struct bfd_link_info *info,
 
   contents = (unsigned char *) bfd_alloc (sec->owner, size);
   if (contents == NULL)
-    info->callbacks->einfo
+    info->callbacks->fatal
       /* xgettext:c-format */
-      (_("%F%P: %pB: failed to allocate compact relative reloc section\n"),
+      (_("%P: %pB: failed to allocate compact relative reloc section\n"),
        info->output_bfd);
 
   /* Cache the section contents for elf_link_input_bfd.  */
@@ -2251,9 +2251,9 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
          else
            name = bfd_elf_sym_name (input_section->owner, symtab_hdr,
                                     sym, NULL);
-         info->callbacks->einfo
+         info->callbacks->fatal
            /* xgettext:c-format */
-           (_("%F%P: %pB: relocation %s against absolute symbol "
+           (_("%P: %pB: relocation %s against absolute symbol "
               "`%s' in section `%pA' is disallowed\n"),
             input_section->owner, internal_reloc.howto->name, name,
             input_section);
@@ -3592,9 +3592,9 @@ _bfd_x86_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
            s = p->sec->output_section;
            if (s != NULL && (s->flags & SEC_READONLY) != 0)
              {
-               info->callbacks->einfo
+               info->callbacks->fatal
                  /* xgettext:c-format */
-                 (_("%F%P: %pB: copy relocation against non-copyable "
+                 (_("%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->einfo (_("%F%P: failed to create GNU property section\n"));
+           info->callbacks->fatal (_("%P: failed to create GNU property section\n"));
 
          if (!bfd_set_section_alignment (sec, class_align))
            {
            error_alignment:
-             info->callbacks->einfo (_("%F%pA: failed to align section\n"),
+             info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create VxWorks dynamic sections\n"));
+      info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create GOT sections\n"));
+    info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create ifunc sections\n"));
+    info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create GOT PLT section\n"));
+           info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create IBT-enabled PLT section\n"));
+                   info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create PLT .eh_frame section\n"));
+           info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create GOT PLT .eh_frame section\n"));
+               info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create the second PLT .eh_frame section\n"));
+               info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create PLT .sframe section\n"));
+           info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create second PLT .sframe section\n"));
+               info->callbacks->fatal (_("%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->einfo (_("%F%P: failed to create PLT GOT .sframe section\n"));
+               info->callbacks->fatal (_("%P: failed to create PLT GOT .sframe section\n"));
 
              htab->plt_got_sframe = sec;
            }
index 8b3579dc6586fdac894d7172d094284d2eaebc2a..09e6e96f296ba86a90c244efe55d50aadf7f0b04 100644 (file)
@@ -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->einfo (_("%F%P: already_linked_table: %E\n"));
+    info->callbacks->fatal (_("%P: already_linked_table: %E\n"));
   return false;
 }
 
index cbb56dd767951de4f99528693ffe291ce8c0db5f..d3ddafb7305794d5a1d595363bd6cbe4eeb0673a 100644 (file)
@@ -8366,8 +8366,8 @@ bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED,
                           bool *again)
 {
   if (bfd_link_relocatable (link_info))
-    (*link_info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    link_info->callbacks->fatal
+      (_("%P: --relax and -r may not be used together\n"));
 
   *again = false;
   return true;
index e77a2374f9bc18034d21ed5535ac5e3bcfba68e8..2a90a1d65777d7af3f930971975302d694b94dfe 100644 (file)
@@ -151,8 +151,8 @@ bfd_coff_reloc16_relax_section (bfd *abfd,
   long reloc_count;
 
   if (bfd_link_relocatable (link_info))
-    (*link_info->callbacks->einfo)
-      (_("%P%F: --relax and -r may not be used together\n"));
+    link_info->callbacks->fatal
+      (_("%P: --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).  */
index 502cd08a8915bbdaccbfa4c1ef9438bcbd52b69c..9800c606bfbfc9b859aa02dc8b2abbc9f26a1a75 100644 (file)
@@ -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->einfo (_("%F%P: Could not assign `%pA' to an output section. "
+    info->callbacks->fatal (_("%P: Could not assign `%pA' to an output section. "
                              "Retry without --enable-non-contiguous-regions.\n"),
                            hstub->target_section);
 
index ae451075996498eb2c20ea28180dd67489724583..3d4d71b3347474f39394cff81b6b9860060859c4 100644 (file)
@@ -877,6 +877,9 @@ struct bfd_link_callbacks
     (struct bfd_link_info *, struct bfd_link_hash_entry *h,
      struct bfd_link_hash_entry *inh,
      bfd *abfd, asection *section, bfd_vma address, flagword flags);
+  /* Fatal error.  */
+  void (*fatal)
+    (const char *fmt, ...) ATTRIBUTE_NORETURN;
   /* Error or warning link info message.  */
   void (*einfo)
     (const char *fmt, ...);
index cb5e58d8f36b83a71702f01501d63159e628d7b3..54a834e42a61ff03cbcf8cba3c435b238c91549b 100644 (file)
@@ -148,6 +148,7 @@ static struct bfd_link_callbacks link_callbacks =
   reloc_dangerous,
   unattached_reloc,
   notice,
+  fatal,
   einfo,
   info_msg,
   minfo,