diff options
author | Rui Ueyama <ruiu@google.com> | 2019-04-10 06:32:05 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2019-04-10 06:32:05 +0000 |
commit | 0c01607bbff3d58bc11c701b3657c7a02e036d7e (patch) | |
tree | c72a4cc98767ac140696dd956ee5d5e489e9e0b7 | |
parent | 60c3a3b6d0f18a0deb226c545251f83d167e087a (diff) | |
download | bcm5719-llvm-0c01607bbff3d58bc11c701b3657c7a02e036d7e.tar.gz bcm5719-llvm-0c01607bbff3d58bc11c701b3657c7a02e036d7e.zip |
Rename a variable and add a comment.
llvm-svn: 358049
-rw-r--r-- | lld/ELF/InputFiles.cpp | 4 | ||||
-rw-r--r-- | lld/ELF/InputFiles.h | 14 |
2 files changed, 15 insertions, 3 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index e5a2f0c0def..d8856d06628 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -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); } @@ -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: diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 05bc82fc5f7..1b9de7183c1 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -253,7 +253,19 @@ private: 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; |