[llvm] r228946 - gold-plugin: delete the output file for OT_DISABLE

Michael Kuperstein michael.m.kuperstein at intel.com
Thu Feb 12 10:21:50 PST 2015


Author: mkuper
Date: Thu Feb 12 12:21:50 2015
New Revision: 228946

URL: http://llvm.org/viewvc/llvm-project?rev=228946&view=rev
Log:
gold-plugin: delete the output file for OT_DISABLE

bfd creates the output file early, so calling exit(0) is not enough, the file needs to be explicitly deleted.

Patch by: H.J. Lu <hjl.tools at gmail.com>

Modified:
    llvm/trunk/tools/gold/gold-plugin.cpp

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=228946&r1=228945&r2=228946&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Feb 12 12:21:50 2015
@@ -869,8 +869,13 @@ static ld_plugin_status all_symbols_read
   llvm_shutdown();
 
   if (options::TheOutputType == options::OT_BC_ONLY ||
-      options::TheOutputType == options::OT_DISABLE)
+      options::TheOutputType == options::OT_DISABLE) {
+    if (options::TheOutputType == options::OT_DISABLE)
+      // Remove the output file here since ld.bfd creates the output file
+      // early.
+      sys::fs::remove(output_name);
     exit(0);
+  }
 
   return Ret;
 }





More information about the llvm-commits mailing list