[lld] r275712 - Print out file names for common symbols for --trace-symbol.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 17 10:36:22 PDT 2016
Author: ruiu
Date: Sun Jul 17 12:36:22 2016
New Revision: 275712
URL: http://llvm.org/viewvc/llvm-project?rev=275712&view=rev
Log:
Print out file names for common symbols for --trace-symbol.
Previously, there was no way to get a file name for a DefinedCommon
symbol. This patch adds it.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.cpp
lld/trunk/ELF/Symbols.h
lld/trunk/test/ELF/trace-symbols.s
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=275712&r1=275711&r2=275712&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Sun Jul 17 12:36:22 2016
@@ -306,7 +306,7 @@ Symbol *SymbolTable<ELFT>::addCommon(Str
int Cmp = compareDefined(S, WasInserted, Binding);
if (Cmp > 0) {
S->Binding = Binding;
- replaceBody<DefinedCommon>(S, N, Size, Alignment, StOther, Type);
+ replaceBody<DefinedCommon>(S, N, Size, Alignment, StOther, Type, File);
} else if (Cmp == 0) {
auto *C = dyn_cast<DefinedCommon>(S->body());
if (!C) {
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=275712&r1=275711&r2=275712&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Sun Jul 17 12:36:22 2016
@@ -224,9 +224,11 @@ DefinedSynthetic<ELFT>::DefinedSynthetic
Value(Value), Section(Section) {}
DefinedCommon::DefinedCommon(StringRef N, uint64_t Size, uint64_t Alignment,
- uint8_t StOther, uint8_t Type)
+ uint8_t StOther, uint8_t Type, InputFile *File)
: Defined(SymbolBody::DefinedCommonKind, N, StOther, Type),
- Alignment(Alignment), Size(Size) {}
+ Alignment(Alignment), Size(Size) {
+ this->File = File;
+}
std::unique_ptr<InputFile> Lazy::fetch() {
if (auto *S = dyn_cast<LazyArchive>(this))
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=275712&r1=275711&r2=275712&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Sun Jul 17 12:36:22 2016
@@ -169,7 +169,7 @@ public:
class DefinedCommon : public Defined {
public:
DefinedCommon(StringRef N, uint64_t Size, uint64_t Alignment, uint8_t StOther,
- uint8_t Type);
+ uint8_t Type, InputFile *File);
static bool classof(const SymbolBody *S) {
return S->kind() == SymbolBody::DefinedCommonKind;
Modified: lld/trunk/test/ELF/trace-symbols.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/trace-symbols.s?rev=275712&r1=275711&r2=275712&view=diff
==============================================================================
--- lld/trunk/test/ELF/trace-symbols.s (original)
+++ lld/trunk/test/ELF/trace-symbols.s Sun Jul 17 12:36:22 2016
@@ -16,7 +16,7 @@
# RUN: ld.lld -y foo -trace-symbol=common -trace-symbol=hsymbol \
# RUN: %t %t1 %t2 -o %t3 2>&1 | FileCheck -check-prefix=OBJECTDCOMMON %s
-# OBJECTDCOMMON-NOT: trace-symbols.s.tmp1: definition of common
+# OBJECTDCOMMON: trace-symbols.s.tmp1: definition of common
# RUN: ld.lld -y foo -y common %t %t2 %t1 -o %t3 2>&1 | \
# RUN: FileCheck -check-prefix=OBJECTD1FOO %s
More information about the llvm-commits
mailing list