summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/COFF/InputFiles.cpp3
-rw-r--r--lld/COFF/Symbols.cpp3
-rw-r--r--lld/COFF/Symbols.h9
-rw-r--r--lld/test/COFF/Inputs/conflict.ll3
-rw-r--r--lld/test/COFF/conflict.test7
5 files changed, 21 insertions, 4 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 2819d393e65..47a6d0a9819 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -291,7 +291,8 @@ std::error_code BitcodeFile::parse() {
} else {
bool Replaceable = (SymbolDef == LTO_SYMBOL_DEFINITION_TENTATIVE ||
(Attrs & LTO_SYMBOL_COMDAT));
- SymbolBodies.push_back(new (Alloc) DefinedBitcode(SymName, Replaceable));
+ SymbolBodies.push_back(new (Alloc) DefinedBitcode(this, SymName,
+ Replaceable));
}
}
diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp
index 4f7d9191c13..883666e5780 100644
--- a/lld/COFF/Symbols.cpp
+++ b/lld/COFF/Symbols.cpp
@@ -138,6 +138,9 @@ std::string SymbolBody::getDebugName() {
if (auto *D = dyn_cast<DefinedCOFF>(this)) {
N += " ";
N += D->File->getShortName();
+ } else if (auto *D = dyn_cast<DefinedBitcode>(this)) {
+ N += " ";
+ N += D->File->getShortName();
}
return N;
}
diff --git a/lld/COFF/Symbols.h b/lld/COFF/Symbols.h
index 58e025689fe..6710698d666 100644
--- a/lld/COFF/Symbols.h
+++ b/lld/COFF/Symbols.h
@@ -28,6 +28,7 @@ using llvm::object::coff_import_header;
using llvm::object::coff_symbol_generic;
class ArchiveFile;
+class BitcodeFile;
class InputFile;
class ObjectFile;
class SymbolBody;
@@ -334,15 +335,19 @@ private:
};
class DefinedBitcode : public Defined {
+ friend SymbolBody;
public:
- DefinedBitcode(StringRef N, bool IsReplaceable)
- : Defined(DefinedBitcodeKind, N) {
+ DefinedBitcode(BitcodeFile *F, StringRef N, bool IsReplaceable)
+ : Defined(DefinedBitcodeKind, N), File(F) {
this->IsReplaceable = IsReplaceable;
}
static bool classof(const SymbolBody *S) {
return S->kind() == DefinedBitcodeKind;
}
+
+private:
+ BitcodeFile *File;
};
} // namespace coff
diff --git a/lld/test/COFF/Inputs/conflict.ll b/lld/test/COFF/Inputs/conflict.ll
new file mode 100644
index 00000000000..b758d4a0c08
--- /dev/null
+++ b/lld/test/COFF/Inputs/conflict.ll
@@ -0,0 +1,3 @@
+define void @foo() {
+ ret void
+}
diff --git a/lld/test/COFF/conflict.test b/lld/test/COFF/conflict.test
index ba11989adfe..3768377a9d3 100644
--- a/lld/test/COFF/conflict.test
+++ b/lld/test/COFF/conflict.test
@@ -3,7 +3,12 @@
# RUN: not lld -flavor link2 /out:%t.exe %t1.obj %t2.obj >& %t.log
# RUN: FileCheck %s < %t.log
-# CHECK: duplicate symbol: foo {{.+}} and foo {{.+}}
+# RUN: llvm-as -o %t.lto1.obj %S/Inputs/conflict.ll
+# RUN: llvm-as -o %t.lto2.obj %S/Inputs/conflict.ll
+# RUN: not lld -flavor link2 /out:%t.exe %t.lto1.obj %t.lto2.obj >& %t.log
+# RUN: FileCheck %s < %t.log
+
+# CHECK: duplicate symbol: foo {{.+}}1.obj and foo {{.+}}2.obj
---
header:
OpenPOWER on IntegriCloud