Fix places in the AArch64 opcodes library code where a call to assert() has side...
[binutils-gdb.git] / gas / output-file.c
index 94dbc2e8c01b0549d1d548ac091b5c832ca2623d..a4b21f18cbc21d76c42357f32434a82a709c9081 100644 (file)
@@ -1,5 +1,5 @@
 /* output-file.c -  Deal with the output file
-   Copyright (C) 1987-2015 Free Software Foundation, Inc.
+   Copyright (C) 1987-2021 Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
 
@@ -28,7 +28,7 @@
 bfd *stdoutput;
 
 void
-output_file_create (char *name)
+output_file_create (const char *name)
 {
   if (name[0] == '-' && name[1] == '\0')
     as_fatal (_("can't open a bfd on stdout %s"), name);
@@ -50,7 +50,7 @@ output_file_create (char *name)
 }
 
 void
-output_file_close (char *filename)
+output_file_close (const char *filename)
 {
   bfd_boolean res;
 
@@ -58,7 +58,7 @@ output_file_close (char *filename)
     return;
 
   /* Close the bfd.  */
-  if (had_errors ())
+  if (!flag_always_generate_output && had_errors ())
     res = bfd_cache_close_all ();
   else
     res = bfd_close (stdoutput);
@@ -68,6 +68,5 @@ output_file_close (char *filename)
   stdoutput = NULL;
 
   if (! res)
-    as_fatal (_("can't close %s: %s"), filename,
-             bfd_errmsg (bfd_get_error ()));
+    as_fatal ("%s: %s", filename, bfd_errmsg (bfd_get_error ()));
 }