gold plugin: call llvm_shutdown so that -stats works.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 25 Nov 2014 20:52:49 +0000 (20:52 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 25 Nov 2014 20:52:49 +0000 (20:52 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222787 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/gold/stats.ll [new file with mode: 0644]
tools/gold/gold-plugin.cpp

diff --git a/test/tools/gold/stats.ll b/test/tools/gold/stats.ll
new file mode 100644 (file)
index 0000000..5a6e6f9
--- /dev/null
@@ -0,0 +1,5 @@
+; RUN: llvm-as %s -o %t.o
+; RUN: ld -plugin %llvmshlibdir/LLVMgold.so  -shared \
+; RUN:    -plugin-opt=-stats %t.o -o %t2 2>&1 | FileCheck %s
+
+; CHECK: Statistics Collected
index 6d9d6a29d2cfc2138059a85210c98b83b0f8b2be..b7d8c5e14c688ee3fc350a992742aa41cba3b79a 100644 (file)
@@ -28,6 +28,7 @@
 #include "llvm/PassManager.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/Host.h"
 #include "llvm/PassManager.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/Host.h"
+#include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Support/TargetSelect.h"
@@ -838,6 +839,8 @@ static ld_plugin_status all_symbols_read_hook(void) {
     Ret = allSymbolsReadHook(&ApiFile);
   }
 
     Ret = allSymbolsReadHook(&ApiFile);
   }
 
+  llvm_shutdown();
+
   if (options::TheOutputType == options::OT_BC_ONLY ||
       options::TheOutputType == options::OT_DISABLE)
     exit(0);
   if (options::TheOutputType == options::OT_BC_ONLY ||
       options::TheOutputType == options::OT_DISABLE)
     exit(0);