Reduce sizeof(Symbol) from 104 bytes to 88 bytes.
Finding aliases for shared symbols doesn't need st_shndx because
we can just compare st_value.
llvm-svn: 316848
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index a6af92a..92bd9bc 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -469,7 +469,7 @@
std::vector<SharedSymbol *> Ret;
for (const Elf_Sym &S : File->getGlobalELFSyms()) {
- if (S.st_shndx != SS->Shndx || S.st_value != SS->Value)
+ if (S.st_shndx == 0 || S.st_value != SS->Value)
continue;
StringRef Name = check(S.getName(File->getStringTable()));
SymbolBody *Sym = Symtab->find(Name);
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index 34cd2f8..9f64746 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -517,8 +517,7 @@
if (WasInserted || ((Body->isUndefined() || Body->isLazy()) &&
Body->getVisibility() == STV_DEFAULT)) {
replaceBody<SharedSymbol>(S, File, Name, Sym.st_other, Sym.getType(),
- Sym.st_value, Sym.st_size, Alignment,
- Sym.st_shndx, Verdef);
+ Sym.st_value, Sym.st_size, Alignment, Verdef);
if (!S->isWeak())
File->IsUsed = true;
}
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h
index 7fb9852..0970354 100644
--- a/lld/ELF/Symbols.h
+++ b/lld/ELF/Symbols.h
@@ -219,11 +219,9 @@
static bool classof(const SymbolBody *S) { return S->kind() == SharedKind; }
SharedSymbol(StringRef Name, uint8_t StOther, uint8_t Type, uint64_t Value,
- uint64_t Size, uint32_t Alignment, uint64_t Shndx,
- const void *Verdef)
+ uint64_t Size, uint32_t Alignment, const void *Verdef)
: Defined(SharedKind, Name, /*IsLocal=*/false, StOther, Type),
- Verdef(Verdef), Value(Value), Size(Size), Shndx(Shndx),
- Alignment(Alignment) {
+ Verdef(Verdef), Value(Value), Size(Size), Alignment(Alignment) {
// GNU ifunc is a mechanism to allow user-supplied functions to
// resolve PLT slot values at load-time. This is contrary to the
// regualr symbol resolution scheme in which symbols are resolved just
@@ -257,8 +255,7 @@
InputSection *CopyRelSec = nullptr;
uint64_t Value; // st_value
- uint64_t Size; // st_size
- uint64_t Shndx; // st_shndx
+ uint32_t Size; // st_size
uint32_t Alignment;
};