summaryrefslogtreecommitdiff
path: root/lld/ELF/InputFiles.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
-rw-r--r--lld/ELF/InputFiles.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 2006b3ba3520..0714c8ce6c16 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -528,7 +528,7 @@ template <class ELFT> void ELFFileBase::init(InputFile::Kind k) {
Fatal(ctx) << this << ": invalid sh_info in symbol table";
elfSyms = reinterpret_cast<const void *>(eSyms.data());
- numELFSyms = uint32_t(eSyms.size());
+ numSymbols = eSyms.size();
stringTable = CHECK2(obj.getStringTableForSymtab(*symtabSec, sections), this);
}
@@ -1089,10 +1089,8 @@ InputSectionBase *ObjFile<ELFT>::createInputSection(uint32_t idx,
template <class ELFT>
void ObjFile<ELFT>::initializeSymbols(const object::ELFFile<ELFT> &obj) {
ArrayRef<Elf_Sym> eSyms = this->getELFSyms<ELFT>();
- if (numSymbols == 0) {
- numSymbols = eSyms.size();
+ if (!symbols)
symbols = std::make_unique<Symbol *[]>(numSymbols);
- }
// Some entries have been filled by LazyObjFile.
auto *symtab = ctx.symtab.get();
@@ -1432,8 +1430,6 @@ template <class ELFT> void SharedFile::parse() {
const Elf_Shdr *versymSec = nullptr;
const Elf_Shdr *verdefSec = nullptr;
const Elf_Shdr *verneedSec = nullptr;
-
- numSymbols = numELFSyms;
symbols = std::make_unique<Symbol *[]>(numSymbols);
// Search for .dynsym, .dynamic, .symtab, .gnu.version and .gnu.version_d.
@@ -1457,7 +1453,7 @@ template <class ELFT> void SharedFile::parse() {
}
}
- if (versymSec && numELFSyms == 0) {
+ if (versymSec && numSymbols == 0) {
ErrAlways(ctx) << "SHT_GNU_versym should be associated with symbol table";
return;
}
@@ -1500,7 +1496,7 @@ template <class ELFT> void SharedFile::parse() {
// Parse ".gnu.version" section which is a parallel array for the symbol
// table. If a given file doesn't have a ".gnu.version" section, we use
// VER_NDX_GLOBAL.
- size_t size = numELFSyms - firstGlobal;
+ size_t size = numSymbols - firstGlobal;
std::vector<uint16_t> versyms(size, VER_NDX_GLOBAL);
if (versymSec) {
ArrayRef<Elf_Versym> versym =