[PATCH] Call sys::fs::remove for options::OT_DISABLE

H.J. Lu hjl.tools at gmail.com
Thu Feb 12 05:29:10 PST 2015


Gold plugin calls exit(0) for options::OT_DISABLE to avoid generating
output.  But it isn't very reliable.  This patch calls sys::fs::remove
directly to remove output.

H.J.
---
 tools/gold/gold-plugin.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index dd6d47f..a068c22 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -869,8 +869,11 @@ static ld_plugin_status all_symbols_read_hook(void) {
   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)
+      sys::fs::remove(output_name);
     exit(0);
+  }
 
   return Ret;
 }
-- 
2.1.0




More information about the llvm-commits mailing list