[PATCH] [lld] COFF: Implement SymbolBody::getDebugName() for DefinedBitcode symbols.
Peter Collingbourne
peter at pcc.me.uk
Mon Jun 29 17:35:52 PDT 2015
Hi ruiu,
http://reviews.llvm.org/D10827
Files:
COFF/InputFiles.cpp
COFF/Symbols.cpp
COFF/Symbols.h
test/COFF/Inputs/conflict.ll
test/COFF/conflict.test
Index: COFF/InputFiles.cpp
===================================================================
--- COFF/InputFiles.cpp
+++ COFF/InputFiles.cpp
@@ -291,7 +291,8 @@
} 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));
}
}
Index: COFF/Symbols.cpp
===================================================================
--- COFF/Symbols.cpp
+++ COFF/Symbols.cpp
@@ -138,6 +138,9 @@
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;
}
Index: COFF/Symbols.h
===================================================================
--- COFF/Symbols.h
+++ COFF/Symbols.h
@@ -27,6 +27,7 @@
using llvm::object::coff_import_header;
class ArchiveFile;
+class BitcodeFile;
class InputFile;
class ObjectFile;
class SymbolBody;
@@ -333,15 +334,19 @@
};
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
Index: test/COFF/Inputs/conflict.ll
===================================================================
--- /dev/null
+++ test/COFF/Inputs/conflict.ll
@@ -0,0 +1,3 @@
+define void @foo() {
+ ret void
+}
Index: test/COFF/conflict.test
===================================================================
--- test/COFF/conflict.test
+++ 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:
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10827.28736.patch
Type: text/x-patch
Size: 2555 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150630/fdd20b4e/attachment.bin>
More information about the llvm-commits
mailing list