Make sure that there is no case where a signal can occur leaving a partially
written output file.  This is important because crashing testcases often write
part of a file out, and the testing harness decides the file is up-to-date next
time the test is run.

llvm-svn: 2303
diff --git a/llvm/tools/gccld/gccld.cpp b/llvm/tools/gccld/gccld.cpp
index 11595f7..1e16aa1 100644
--- a/llvm/tools/gccld/gccld.cpp
+++ b/llvm/tools/gccld/gccld.cpp
@@ -24,6 +24,7 @@
 #include "llvm/Transforms/ConstantMerge.h"
 #include "llvm/Transforms/IPO/GlobalDCE.h"
 #include "Support/CommandLine.h"
+#include "Support/Signals.h"
 #include <fstream>
 #include <memory>
 #include <algorithm>
@@ -161,6 +162,9 @@
   }
   Passes.add(new WriteBytecodePass(&Out));        // Write bytecode to file...
 
+  // Make sure that the Out file gets unlink'd from the disk if we get a SIGINT
+  RemoveFileOnSignal(OutputFilename+".bc");
+
   // Run our queue of passes all at once now, efficiently.
   Passes.run(Composite.get());
   Out.close();