]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Don't use bfd_error_handler in bfd_abort
authorAlan Modra <amodra@gmail.com>
Tue, 5 Mar 2024 04:03:40 +0000 (14:33 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 6 Mar 2024 00:52:29 +0000 (11:22 +1030)
We don't want to lose an abort message when bfd_set_error_handler has
been called to ignore or cache errors.

PR ld/31444
* bfd.c (_bfd_abort): Don't use _bfd_error_handler.

bfd/bfd.c

index 6c822656cc89d115654184f1d1001b7aac3e16cf..71732a0f92b13d9829b65b3e7f890b8976459938 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -2050,17 +2050,17 @@ bfd_assert (const char *file, int line)
 void
 _bfd_abort (const char *file, int line, const char *fn)
 {
+  fflush (stdout);
+
   if (fn != NULL)
-    _bfd_error_handler
-      /* xgettext:c-format */
-      (_("BFD %s internal error, aborting at %s:%d in %s\n"),
-       BFD_VERSION_STRING, file, line, fn);
+    fprintf (stderr, _("%s: BFD %s internal error, aborting at %s:%d in %s\n"),
+            _bfd_get_error_program_name (), BFD_VERSION_STRING,
+            file, line, fn);
   else
-    _bfd_error_handler
-      /* xgettext:c-format */
-      (_("BFD %s internal error, aborting at %s:%d\n"),
-       BFD_VERSION_STRING, file, line);
-  _bfd_error_handler (_("Please report this bug.\n"));
+    fprintf (stderr, _("%s: BFD %s internal error, aborting at %s:%d\n"),
+            _bfd_get_error_program_name (), BFD_VERSION_STRING,
+            file, line);
+  fprintf (stderr, _("Please report this bug.\n"));
   _exit (EXIT_FAILURE);
 }