From 17a113d26bb1838e0523d9eb97ded7529ce69a4d Mon Sep 17 00:00:00 2001 From: Michael Kuperstein Date: Thu, 12 Feb 2015 18:21:50 +0000 Subject: [PATCH] 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228946 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/gold/gold-plugin.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp index dd6d47f5d70..b1a28c52290 100644 --- a/tools/gold/gold-plugin.cpp +++ b/tools/gold/gold-plugin.cpp @@ -869,8 +869,13 @@ 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) + // Remove the output file here since ld.bfd creates the output file + // early. + sys::fs::remove(output_name); exit(0); + } return Ret; } -- 2.34.1