summaryrefslogtreecommitdiff
path: root/gas/output-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'gas/output-file.c')
-rw-r--r--gas/output-file.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gas/output-file.c b/gas/output-file.c
index e993033f48..3e871f0db7 100644
--- a/gas/output-file.c
+++ b/gas/output-file.c
@@ -59,7 +59,10 @@ output_file_close (char *filename)
return;
/* Close the bfd. */
- res = bfd_close (stdoutput);
+ if (had_errors ())
+ res = bfd_cache_close_all ();
+ else
+ res = bfd_close (stdoutput);
/* Prevent an infinite loop - if the close failed we will call as_fatal
which will call xexit() which may call this function again... */