[lld] r344074 - Simplify. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 9 13:16:17 PDT 2018
Author: ruiu
Date: Tue Oct 9 13:16:16 2018
New Revision: 344074
URL: http://llvm.org/viewvc/llvm-project?rev=344074&view=rev
Log:
Simplify. NFC.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=344074&r1=344073&r2=344074&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Oct 9 13:16:16 2018
@@ -234,11 +234,10 @@ std::pair<Symbol *, bool> SymbolTable::i
if (!File || File->kind() == InputFile::ObjKind)
S->IsUsedInRegularObj = true;
- if (!WasInserted && S->Type != Symbol::UnknownType &&
- ((Type == STT_TLS) != S->isTls())) {
+ bool HasTlsAttr = !WasInserted && (!S->isLazy() || S->isTls());
+ if (HasTlsAttr && (Type == STT_TLS) != S->isTls())
error("TLS attribute mismatch: " + toString(*S) + "\n>>> defined in " +
toString(S->File) + "\n>>> defined in " + toString(File));
- }
return {S, WasInserted};
}
@@ -566,7 +565,7 @@ void SymbolTable::addLazyArchive(StringR
bool WasInserted;
std::tie(S, WasInserted) = Symtab->insert(Name);
if (WasInserted) {
- replaceSymbol<LazyArchive>(S, File, Symbol::UnknownType, Sym);
+ replaceSymbol<LazyArchive>(S, File, STT_NOTYPE, Sym);
return;
}
if (!S->isUndefined())
@@ -590,7 +589,7 @@ void SymbolTable::addLazyObject(StringRe
bool WasInserted;
std::tie(S, WasInserted) = Symtab->insert(Name);
if (WasInserted) {
- replaceSymbol<LazyObject>(S, File, Symbol::UnknownType, Name);
+ replaceSymbol<LazyObject>(S, File, STT_NOTYPE, Name);
return;
}
if (!S->isUndefined())
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=344074&r1=344073&r2=344074&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Tue Oct 9 13:16:16 2018
@@ -195,13 +195,6 @@ public:
// True if this symbol is defined by a linker script.
unsigned ScriptDefined : 1;
- // The Type field may also have this value. It means that we have not yet seen
- // a non-Lazy symbol with this name, so we don't know what its type is. The
- // Type field is normally set to this value for Lazy symbols unless we saw a
- // weak undefined symbol first, in which case we need to remember the original
- // symbol's type in order to check for TLS mismatches.
- enum { UnknownType = 255 };
-
bool isSection() const { return Type == llvm::ELF::STT_SECTION; }
bool isTls() const { return Type == llvm::ELF::STT_TLS; }
bool isFunc() const { return Type == llvm::ELF::STT_FUNC; }
More information about the llvm-commits
mailing list