summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/test/Linker/Inputs/drop-debug.bcbin0 -> 1152 bytes
-rw-r--r--llvm/test/Linker/drop-debug.ll6
-rw-r--r--llvm/tools/gold/gold-plugin.cpp8
-rw-r--r--llvm/tools/llvm-link/llvm-link.cpp6
4 files changed, 17 insertions, 3 deletions
diff --git a/llvm/test/Linker/Inputs/drop-debug.bc b/llvm/test/Linker/Inputs/drop-debug.bc
new file mode 100644
index 00000000000..f9c471f8e0d
--- /dev/null
+++ b/llvm/test/Linker/Inputs/drop-debug.bc
Binary files differ
diff --git a/llvm/test/Linker/drop-debug.ll b/llvm/test/Linker/drop-debug.ll
new file mode 100644
index 00000000000..9c1072a75de
--- /dev/null
+++ b/llvm/test/Linker/drop-debug.ll
@@ -0,0 +1,6 @@
+; RUN: llvm-link %p/Inputs/drop-debug.bc -o %t 2>&1 | FileCheck %s
+
+;; drop-debug.bc was created from "void f(void) {}" with clang 3.5 and
+; -gline-tables-only, so it contains old debug info.
+
+; CHECK: warning: ignoring debug info with an invalid version (1) in {{.*}}/Inputs/drop-debug.bc
diff --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index 93ce3bc0f44..16e5045bcb9 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -20,7 +20,6 @@
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/CommandFlags.h"
-#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
@@ -603,8 +602,11 @@ getModuleForFile(LLVMContext &Context, claimed_file &F,
Module &M = Obj.getModule();
- M.materializeMetadata();
- UpgradeDebugInfo(M);
+ // Fixme (pr23045). We would like to upgrade the metadata with something like
+ // Result->materializeMetadata();
+ // UpgradeDebugInfo(*Result);
+ // but that fails to drop old debug info from function bodies.
+ M.materializeAllPermanently();
SmallPtrSet<GlobalValue *, 8> Used;
collectUsedGlobalVariables(M, Used, /*CompilerUsed*/ false);
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index e52191a267b..a15855b392a 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -69,6 +69,12 @@ loadFile(const char *argv0, const std::string &FN, LLVMContext &Context) {
if (!Result)
Err.print(argv0, errs());
+ // Fixme (pr23045). We would like to upgrade the metadata with something like
+ // Result->materializeMetadata();
+ // UpgradeDebugInfo(*Result);
+ // but that fails to drop old debug info from function bodies.
+ Result->materializeAllPermanently();
+
return Result;
}
OpenPOWER on IntegriCloud