Rename NonLocal -> Global.
NonLocal is technically more accurate, but we already use the term "Global" to specify the non-local part of the symbol table, and Local <-> Global is easier to digest. llvm-svn: 328740
This commit is contained in:
parent
6a1ca2627a
commit
efe9af9f07
|
@ -233,7 +233,7 @@ ELFFileBase<ELFT>::ELFFileBase(Kind K, MemoryBufferRef MB) : InputFile(K, MB) {
|
|||
|
||||
template <class ELFT>
|
||||
typename ELFT::SymRange ELFFileBase<ELFT>::getGlobalELFSyms() {
|
||||
return makeArrayRef(ELFSyms.begin() + FirstNonLocal, ELFSyms.end());
|
||||
return makeArrayRef(ELFSyms.begin() + FirstGlobal, ELFSyms.end());
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
@ -244,9 +244,9 @@ uint32_t ELFFileBase<ELFT>::getSectionIndex(const Elf_Sym &Sym) const {
|
|||
template <class ELFT>
|
||||
void ELFFileBase<ELFT>::initSymtab(ArrayRef<Elf_Shdr> Sections,
|
||||
const Elf_Shdr *Symtab) {
|
||||
FirstNonLocal = Symtab->sh_info;
|
||||
FirstGlobal = Symtab->sh_info;
|
||||
ELFSyms = CHECK(getObj().symbols(Symtab), this);
|
||||
if (FirstNonLocal == 0 || FirstNonLocal > ELFSyms.size())
|
||||
if (FirstGlobal == 0 || FirstGlobal > ELFSyms.size())
|
||||
fatal(toString(this) + ": invalid sh_info in symbol table");
|
||||
|
||||
StringTable =
|
||||
|
@ -262,11 +262,11 @@ ObjFile<ELFT>::ObjFile(MemoryBufferRef M, StringRef ArchiveName)
|
|||
template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getLocalSymbols() {
|
||||
if (this->Symbols.empty())
|
||||
return {};
|
||||
return makeArrayRef(this->Symbols).slice(1, this->FirstNonLocal - 1);
|
||||
return makeArrayRef(this->Symbols).slice(1, this->FirstGlobal - 1);
|
||||
}
|
||||
|
||||
template <class ELFT> ArrayRef<Symbol *> ObjFile<ELFT>::getGlobalSymbols() {
|
||||
return makeArrayRef(this->Symbols).slice(this->FirstNonLocal);
|
||||
return makeArrayRef(this->Symbols).slice(this->FirstGlobal);
|
||||
}
|
||||
|
||||
template <class ELFT>
|
||||
|
@ -796,14 +796,14 @@ template <class ELFT> void SharedFile<ELFT>::parseSoName() {
|
|||
// Parses ".gnu.version" section which is a parallel array for the symbol table.
|
||||
// If a given file doesn't have ".gnu.version" section, returns VER_NDX_GLOBAL.
|
||||
template <class ELFT> std::vector<uint32_t> SharedFile<ELFT>::parseVersyms() {
|
||||
size_t Size = this->ELFSyms.size() - this->FirstNonLocal;
|
||||
size_t Size = this->ELFSyms.size() - this->FirstGlobal;
|
||||
if (!VersymSec)
|
||||
return std::vector<uint32_t>(Size, VER_NDX_GLOBAL);
|
||||
|
||||
const char *Base = this->MB.getBuffer().data();
|
||||
const Elf_Versym *Versym =
|
||||
reinterpret_cast<const Elf_Versym *>(Base + VersymSec->sh_offset) +
|
||||
this->FirstNonLocal;
|
||||
this->FirstGlobal;
|
||||
|
||||
std::vector<uint32_t> Ret(Size);
|
||||
for (size_t I = 0; I < Size; ++I)
|
||||
|
@ -1178,11 +1178,11 @@ template <class ELFT> void LazyObjFile::addElfSymbols() {
|
|||
continue;
|
||||
|
||||
typename ELFT::SymRange Syms = CHECK(Obj.symbols(&Sec), this);
|
||||
uint32_t FirstNonLocal = Sec.sh_info;
|
||||
uint32_t FirstGlobal = Sec.sh_info;
|
||||
StringRef StringTable =
|
||||
CHECK(Obj.getStringTableForSymtab(Sec, Sections), this);
|
||||
|
||||
for (const typename ELFT::Sym &Sym : Syms.slice(FirstNonLocal))
|
||||
for (const typename ELFT::Sym &Sym : Syms.slice(FirstGlobal))
|
||||
if (Sym.st_shndx != SHN_UNDEF)
|
||||
Symtab->addLazyObject<ELFT>(CHECK(Sym.getName(StringTable), this),
|
||||
*this);
|
||||
|
@ -1212,11 +1212,11 @@ template <class ELFT> void elf::readJustSymbolsFile(MemoryBufferRef MB) {
|
|||
continue;
|
||||
|
||||
Elf_Sym_Range Syms = CHECK(Obj.symbols(&Sec), ObjName);
|
||||
uint32_t FirstNonLocal = Sec.sh_info;
|
||||
uint32_t FirstGlobal = Sec.sh_info;
|
||||
StringRef StringTable =
|
||||
CHECK(Obj.getStringTableForSymtab(Sec, Sections), ObjName);
|
||||
|
||||
for (const Elf_Sym &Sym : Syms.slice(FirstNonLocal))
|
||||
for (const Elf_Sym &Sym : Syms.slice(FirstGlobal))
|
||||
if (Sym.st_shndx != SHN_UNDEF)
|
||||
Symtab->addRegular(CHECK(Sym.getName(StringTable), ObjName),
|
||||
Sym.st_other, Sym.getType(), Sym.st_value,
|
||||
|
|
|
@ -142,7 +142,7 @@ public:
|
|||
|
||||
protected:
|
||||
ArrayRef<Elf_Sym> ELFSyms;
|
||||
uint32_t FirstNonLocal = 0;
|
||||
uint32_t FirstGlobal = 0;
|
||||
ArrayRef<Elf_Word> SymtabSHNDX;
|
||||
StringRef StringTable;
|
||||
void initSymtab(ArrayRef<Elf_Shdr> Sections, const Elf_Shdr *Symtab);
|
||||
|
|
Loading…
Reference in New Issue