summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LTO.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/LTO.cpp')
-rw-r--r--lld/ELF/LTO.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lld/ELF/LTO.cpp b/lld/ELF/LTO.cpp
index 9f2457f1277..8ff90f61cc1 100644
--- a/lld/ELF/LTO.cpp
+++ b/lld/ELF/LTO.cpp
@@ -18,6 +18,7 @@
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/CodeGen/CommandFlags.h"
#include "llvm/CodeGen/ParallelCG.h"
+#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Linker/IRMover.h"
#include "llvm/Support/StringSaver.h"
@@ -100,6 +101,10 @@ void BitcodeCompiler::add(BitcodeFile &F) {
if (M.getDataLayoutStr().empty())
fatal("invalid bitcode file: " + F.getName() + " has no datalayout");
+ // Discard non-compatible debug infos if necessary.
+ M.materializeMetadata();
+ UpgradeDebugInfo(M);
+
// If a symbol appears in @llvm.used, the linker is required
// to treat the symbol as there is a reference to the symbol
// that it cannot see. Therefore, we can't internalize.
OpenPOWER on IntegriCloud