[lld] r358049 - Rename a variable and add a comment.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 23:32:05 PDT 2019
Author: ruiu
Date: Tue Apr 9 23:32:05 2019
New Revision: 358049
URL: http://llvm.org/viewvc/llvm-project?rev=358049&view=rev
Log:
Rename a variable and add a comment.
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/InputFiles.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=358049&r1=358048&r2=358049&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Apr 9 23:32:05 2019
@@ -279,7 +279,7 @@ ObjFile<ELFT>::ObjFile(MemoryBufferRef M
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:
Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=358049&r1=358048&r2=358049&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Tue Apr 9 23:32:05 2019
@@ -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;
More information about the llvm-commits
mailing list