summaryrefslogtreecommitdiff
path: root/tools/gold/gold-plugin.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-10-03 00:07:30 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-10-03 00:07:30 +0000
commit75a641c910adb9df1de015de41cbf02570677bf8 (patch)
treea59cdd68dd71af6c4b7093a734edd5d8aae45988 /tools/gold/gold-plugin.cpp
parent4897e263906aa3c88e0a135f18ea9bd2af2676e5 (diff)
Dispose the codegen even when just writing the bitcode file.
This makes it possible to add timers to the code generator and still use them with -plugin-opt=emit-llvm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold/gold-plugin.cpp')
-rw-r--r--tools/gold/gold-plugin.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 77717098d61..bd11d1b5556 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -417,8 +417,10 @@ static ld_plugin_status all_symbols_read_hook(void) {
bool err = lto_codegen_write_merged_modules(code_gen, path.c_str());
if (err)
(*message)(LDPL_FATAL, "Failed to write the output file.");
- if (options::generate_bc_file == options::BC_ONLY)
+ if (options::generate_bc_file == options::BC_ONLY) {
+ lto_codegen_dispose(code_gen);
exit(0);
+ }
}
const char *objPath;
if (lto_codegen_compile_to_file(code_gen, &objPath)) {