From 9fbb3d8850c32708426c00d8965eb94c01774bd2 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sat, 24 Oct 2015 17:44:52 +0000 Subject: [PATCH] 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 --- lld/ELF/OutputSections.cpp | 10 +++++----- lld/ELF/OutputSections.h | 2 +- lld/ELF/Writer.cpp | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 5b0d7a8963ee..ff80e651a407 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -548,10 +548,10 @@ template void DynamicSection::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::DynStrTab->getFileOff(Config->RPath)); + Out::DynStrTab->getOffset(Config->RPath)); if (!Config->SoName.empty()) - WriteVal(DT_SONAME, Out::DynStrTab->getFileOff(Config->SoName)); + WriteVal(DT_SONAME, Out::DynStrTab->getOffset(Config->SoName)); auto WriteArray = [&](int32_t T1, int32_t T2, const OutputSectionBase *Sec) { @@ -566,7 +566,7 @@ template void DynamicSection::writeTo(uint8_t *Buf) { for (const std::unique_ptr> &F : SymTab.getSharedFiles()) if (F->isNeeded()) - WriteVal(DT_NEEDED, Out::DynStrTab->getFileOff(F->getSoName())); + WriteVal(DT_NEEDED, Out::DynStrTab->getOffset(F->getSoName())); if (InitSym) WritePtr(DT_INIT, getSymVA(*InitSym)); @@ -910,7 +910,7 @@ void SymbolTableSection::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::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; diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index df4aaf0e79fd..4892e7d8fb28 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -267,7 +267,7 @@ public: typedef typename llvm::object::ELFFile::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; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 229d2fe55728..e21a45d68a37 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -741,7 +741,7 @@ template void Writer::writeHeader() { // First entry is null. ++SHdrs; for (OutputSectionBase *Sec : OutputSections) { - Sec->setNameOffset(Out::ShStrTab->getFileOff(Sec->getName())); + Sec->setNameOffset(Out::ShStrTab->getOffset(Sec->getName())); Sec->writeHeaderTo(SHdrs++); } }