Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Commit

Permalink
Rename a variable and add a comment.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@358049 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
rui314 committed Apr 10, 2019
1 parent cb175ef commit fca6cb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ELF/InputFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ ObjFile<ELFT>::ObjFile(MemoryBufferRef M, StringRef ArchiveName)
template <class ELFT>
uint32_t ObjFile<ELFT>::getSectionIndex(const Elf_Sym &Sym) const {
return CHECK(
this->getObj().getSectionIndex(&Sym, getELFSyms<ELFT>(), SymtabSHNDX),
this->getObj().getSectionIndex(&Sym, getELFSyms<ELFT>(), ShndxTable),
this);
}

Expand Down Expand Up @@ -479,7 +479,7 @@ void ObjFile<ELFT>::initializeSections(
this->initSymtab<ELFT>(ObjSections, &Sec);
break;
case SHT_SYMTAB_SHNDX:
SymtabSHNDX = CHECK(Obj.getSHNDXTable(Sec, ObjSections), this);
ShndxTable = CHECK(Obj.getSHNDXTable(Sec, ObjSections), this);
break;
case SHT_STRTAB:
case SHT_NULL:
Expand Down
14 changes: 13 additions & 1 deletion ELF/InputFiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,19 @@ template <class ELFT> class ObjFile : public ELFFileBase {
bool shouldMerge(const Elf_Shdr &Sec);
Symbol *createSymbol(const Elf_Sym *Sym);

ArrayRef<Elf_Word> SymtabSHNDX;
// Each ELF symbol contains a section index which the symbol belongs to.
// However, because the number of bits dedicated for that is limited, a
// symbol can directly point to a section only when the section index is
// equal to or smaller than 65280.
//
// If an object file contains more than 65280 sections, the file must
// contain .symtab_shndxr section. The section contains an array of
// 32-bit integers whose size is the same as the number of symbols.
// Nth symbol's section index is in the Nth entry of .symtab_shndxr.
//
// The following variable contains the contents of .symtab_shndxr.
// If the section does not exist (which is common), the array is empty.
ArrayRef<Elf_Word> ShndxTable;

// .shstrtab contents.
StringRef SectionStringTable;
Expand Down

0 comments on commit fca6cb6

Please sign in to comment.