summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2018-10-09 20:16:16 +0000
committerRui Ueyama <ruiu@google.com>2018-10-09 20:16:16 +0000
commit714abece2ba7d80e29f5c40b0e29b4bcf3dd2b50 (patch)
treed56a14f01a16851179e6876033b96fbb9536b787
parent839ec9d9a4119e29d82d26fb9eaf348631c4f203 (diff)
downloadbcm5719-llvm-714abece2ba7d80e29f5c40b0e29b4bcf3dd2b50.tar.gz
bcm5719-llvm-714abece2ba7d80e29f5c40b0e29b4bcf3dd2b50.zip
Simplify. NFC.
llvm-svn: 344074
-rw-r--r--lld/ELF/SymbolTable.cpp9
-rw-r--r--lld/ELF/Symbols.h7
2 files changed, 4 insertions, 12 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index 746b352a318..5e40f2f8fcb 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -234,11 +234,10 @@ std::pair<Symbol *, bool> SymbolTable::insert(StringRef Name, uint8_t Type,
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(StringRef Name, ArchiveFile &File,
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(StringRef Name, LazyObjFile &File) {
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())
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index ca037816783..7bae77378b3 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -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; }
OpenPOWER on IntegriCloud