* elf-bfd.h (struct elf_obj_tdata): Move find_line_info, local_stubs,
[binutils-gdb.git] / gas / output-file.c
index e993033f4812ed967572a25c4ec36acac222afda..25bd291d98a6613479ee314a7a3c64fe20d79371 100644 (file)
@@ -57,9 +57,12 @@ output_file_close (char *filename)
 
   if (stdoutput == NULL)
     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...  */