ELF2: Rename StringTableSection::getFileOff -> getOffset.

getFileOff functions defined for other classes return an offset
from beginning of the file. StringTableSection's getFileOff however
returned an offset from beginning of the section. That was confusing.

llvm-svn: 251192
This commit is contained in:
Rui Ueyama
2015-10-24 17:44:52 +00:00
parent 27d742da59
commit 9fbb3d8850
3 changed files with 7 additions and 7 deletions

View File

@@ -548,10 +548,10 @@ template <class ELFT> void DynamicSection<ELFT>::writeTo(uint8_t *Buf) {
// dependencies of the object it's contained in, while
// DT_RPATH is used for indirect dependencies as well.
WriteVal(Config->EnableNewDtags ? DT_RUNPATH : DT_RPATH,
Out<ELFT>::DynStrTab->getFileOff(Config->RPath));
Out<ELFT>::DynStrTab->getOffset(Config->RPath));
if (!Config->SoName.empty())
WriteVal(DT_SONAME, Out<ELFT>::DynStrTab->getFileOff(Config->SoName));
WriteVal(DT_SONAME, Out<ELFT>::DynStrTab->getOffset(Config->SoName));
auto WriteArray = [&](int32_t T1, int32_t T2,
const OutputSectionBase<ELFT> *Sec) {
@@ -566,7 +566,7 @@ template <class ELFT> void DynamicSection<ELFT>::writeTo(uint8_t *Buf) {
for (const std::unique_ptr<SharedFile<ELFT>> &F : SymTab.getSharedFiles())
if (F->isNeeded())
WriteVal(DT_NEEDED, Out<ELFT>::DynStrTab->getFileOff(F->getSoName()));
WriteVal(DT_NEEDED, Out<ELFT>::DynStrTab->getOffset(F->getSoName()));
if (InitSym)
WritePtr(DT_INIT, getSymVA<ELFT>(*InitSym));
@@ -910,7 +910,7 @@ void SymbolTableSection<ELFT>::writeLocalSymbols(uint8_t *&Buf) {
ESym->st_shndx = OutSec->SectionIndex;
VA += OutSec->getVA() + Section->getOffset(Sym);
}
ESym->st_name = StrTabSec.getFileOff(SymName);
ESym->st_name = StrTabSec.getOffset(SymName);
ESym->st_size = Sym.st_size;
ESym->setBindingAndType(Sym.getBinding(), Sym.getType());
ESym->st_value = VA;
@@ -950,7 +950,7 @@ void SymbolTableSection<ELFT>::writeGlobalSymbols(uint8_t *Buf) {
}
StringRef Name = Body->getName();
ESym->st_name = StrTabSec.getFileOff(Name);
ESym->st_name = StrTabSec.getOffset(Name);
unsigned char Type = STT_NOTYPE;
uintX_t Size = 0;

View File

@@ -267,7 +267,7 @@ public:
typedef typename llvm::object::ELFFile<ELFT>::uintX_t uintX_t;
StringTableSection(StringRef Name, bool Dynamic);
void add(StringRef S) { StrTabBuilder.add(S); }
size_t getFileOff(StringRef S) const { return StrTabBuilder.getOffset(S); }
size_t getOffset(StringRef S) const { return StrTabBuilder.getOffset(S); }
StringRef data() const { return StrTabBuilder.data(); }
void writeTo(uint8_t *Buf) override;

View File

@@ -741,7 +741,7 @@ template <class ELFT> void Writer<ELFT>::writeHeader() {
// First entry is null.
++SHdrs;
for (OutputSectionBase<ELFT> *Sec : OutputSections) {
Sec->setNameOffset(Out<ELFT>::ShStrTab->getFileOff(Sec->getName()));
Sec->setNameOffset(Out<ELFT>::ShStrTab->getOffset(Sec->getName()));
Sec->writeHeaderTo(SHdrs++);
}
}