[lld] r241029 - COFF: Implement SymbolBody::getDebugName() for DefinedBitcode symbols.
Peter Collingbourne
peter at pcc.me.uk
Mon Jun 29 17:47:52 PDT 2015
Author: pcc
Date: Mon Jun 29 19:47:52 2015
New Revision: 241029
URL: http://llvm.org/viewvc/llvm-project?rev=241029&view=rev
Log:
COFF: Implement SymbolBody::getDebugName() for DefinedBitcode symbols.
Differential Revision: http://reviews.llvm.org/D10827
Added:
lld/trunk/test/COFF/Inputs/conflict.ll
Modified:
lld/trunk/COFF/InputFiles.cpp
lld/trunk/COFF/Symbols.cpp
lld/trunk/COFF/Symbols.h
lld/trunk/test/COFF/conflict.test
Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=241029&r1=241028&r2=241029&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Mon Jun 29 19:47:52 2015
@@ -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));
}
}
Modified: lld/trunk/COFF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.cpp?rev=241029&r1=241028&r2=241029&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.cpp (original)
+++ lld/trunk/COFF/Symbols.cpp Mon Jun 29 19:47:52 2015
@@ -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;
}
Modified: lld/trunk/COFF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Symbols.h?rev=241029&r1=241028&r2=241029&view=diff
==============================================================================
--- lld/trunk/COFF/Symbols.h (original)
+++ lld/trunk/COFF/Symbols.h Mon Jun 29 19:47:52 2015
@@ -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
Added: lld/trunk/test/COFF/Inputs/conflict.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/Inputs/conflict.ll?rev=241029&view=auto
==============================================================================
--- lld/trunk/test/COFF/Inputs/conflict.ll (added)
+++ lld/trunk/test/COFF/Inputs/conflict.ll Mon Jun 29 19:47:52 2015
@@ -0,0 +1,3 @@
+define void @foo() {
+ ret void
+}
Modified: lld/trunk/test/COFF/conflict.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/conflict.test?rev=241029&r1=241028&r2=241029&view=diff
==============================================================================
--- lld/trunk/test/COFF/conflict.test (original)
+++ lld/trunk/test/COFF/conflict.test Mon Jun 29 19:47:52 2015
@@ -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:
More information about the llvm-commits
mailing list