gas -Z flag

Message ID 20200210041400.GO5669@bubble.grove.modra.org
State New
Headers show
Series
  • gas -Z flag
Related show

Commit Message

Alan Modra Feb. 10, 2020, 4:14 a.m.
-Z is supposed to "generate object file even after errors".  It
doesn't do so at the moment, unless you count a zero length object
file as useful output.  Fixed for most targets as follows.
I suspect avr and pru might need target patches.

	* output-file.c (output_file_close): Do a normal close when
	flag_always_generate_output.
	* write.c (write_object_file): Don't stop output when
	flag_always_generate_output.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/gas/output-file.c b/gas/output-file.c
index 1781d82f22..573598101c 100644
--- a/gas/output-file.c
+++ b/gas/output-file.c
@@ -58,7 +58,7 @@  output_file_close (const 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);
diff --git a/gas/write.c b/gas/write.c
index 5d9a239422..dfbbc7cb9b 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -2429,7 +2429,7 @@  write_object_file (void)
 #endif
 
   /* Stop if there is an error.  */
-  if (had_errors ())
+  if (!flag_always_generate_output && had_errors ())
     return;
 
   /* Now that all the sizes are known, and contents correct, we can