From 947bdb69cb18a4176a0f6de9aa9df284eaf42ad7 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 25 Nov 2014 20:52:49 +0000 Subject: [PATCH] gold plugin: call llvm_shutdown so that -stats works. llvm-svn: 222787 --- llvm/test/tools/gold/stats.ll | 5 +++++ llvm/tools/gold/gold-plugin.cpp | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 llvm/test/tools/gold/stats.ll diff --git a/llvm/test/tools/gold/stats.ll b/llvm/test/tools/gold/stats.ll new file mode 100644 index 000000000000..5a6e6f965f2c --- /dev/null +++ b/llvm/test/tools/gold/stats.ll @@ -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 diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp index 6d9d6a29d2cf..b7d8c5e14c68 100644 --- a/llvm/tools/gold/gold-plugin.cpp +++ b/llvm/tools/gold/gold-plugin.cpp @@ -28,6 +28,7 @@ #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" @@ -838,6 +839,8 @@ static ld_plugin_status all_symbols_read_hook(void) { Ret = allSymbolsReadHook(&ApiFile); } + llvm_shutdown(); + if (options::TheOutputType == options::OT_BC_ONLY || options::TheOutputType == options::OT_DISABLE) exit(0);