[lld] r316848 - Reduce sizeof(Symbol) from 104 bytes to 88 bytes.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 28 15:18:17 PDT 2017
Author: ruiu
Date: Sat Oct 28 15:18:17 2017
New Revision: 316848
URL: http://llvm.org/viewvc/llvm-project?rev=316848&view=rev
Log:
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.
Modified:
lld/trunk/ELF/Relocations.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=316848&r1=316847&r2=316848&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Sat Oct 28 15:18:17 2017
@@ -469,7 +469,7 @@ static std::vector<SharedSymbol *> getSy
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);
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=316848&r1=316847&r2=316848&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Sat Oct 28 15:18:17 2017
@@ -517,8 +517,7 @@ void SymbolTable::addShared(StringRef Na
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;
}
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=316848&r1=316847&r2=316848&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Sat Oct 28 15:18:17 2017
@@ -219,11 +219,9 @@ public:
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 @@ public:
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;
};
More information about the llvm-commits
mailing list