From 8e232573a8ae5da87c51cf03166f668ba361744c Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 3 Nov 2016 20:48:57 +0000 Subject: [PATCH] Simplify now that this is only used for global symbols. llvm-svn: 285966 --- lld/ELF/InputFiles.cpp | 6 ++---- lld/ELF/InputFiles.h | 2 +- lld/ELF/Relocations.cpp | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index a56361c..4a27854 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -117,10 +117,8 @@ ELFFileBase::ELFFileBase(Kind K, MemoryBufferRef MB) : InputFile(K, MB) { } template -typename ELFT::SymRange ELFFileBase::getElfSymbols(bool OnlyGlobals) { - if (OnlyGlobals) +typename ELFT::SymRange ELFFileBase::getGlobalSymbols() { return makeArrayRef(Symbols.begin() + FirstNonLocal, Symbols.end()); - return Symbols; } template @@ -647,7 +645,7 @@ template void SharedFile::parseRest() { const Elf_Versym *Versym = nullptr; std::vector Verdefs = parseVerdefs(Versym); - Elf_Sym_Range Syms = this->getElfSymbols(true); + Elf_Sym_Range Syms = this->getGlobalSymbols(); for (const Elf_Sym &Sym : Syms) { unsigned VersymIndex = 0; if (Versym) { diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index b45643d..63f9fff 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -108,7 +108,7 @@ public: uint32_t getSectionIndex(const Elf_Sym &Sym) const; - Elf_Sym_Range getElfSymbols(bool OnlyGlobals); + Elf_Sym_Range getGlobalSymbols(); protected: ArrayRef Symbols; diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp index 23d929f..bf9eac2 100644 --- a/lld/ELF/Relocations.cpp +++ b/lld/ELF/Relocations.cpp @@ -402,7 +402,7 @@ template static void addCopyRelSymbol(SharedSymbol *SS) { // Look through the DSO's dynamic symbol table for aliases and create a // dynamic symbol for each one. This causes the copy relocation to correctly // interpose any aliases. - for (const Elf_Sym &S : SS->file()->getElfSymbols(true)) { + for (const Elf_Sym &S : SS->file()->getGlobalSymbols()) { if (S.st_shndx != Shndx || S.st_value != Value) continue; auto *Alias = dyn_cast_or_null>( -- 2.7.4