[lld] r251192 - ELF2: Rename StringTableSection::getFileOff -> getOffset.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 24 10:44:52 PDT 2015


Author: ruiu
Date: Sat Oct 24 12:44:52 2015
New Revision: 251192

URL: http://llvm.org/viewvc/llvm-project?rev=251192&view=rev
Log:
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.

Modified:
    lld/trunk/ELF/OutputSections.cpp
    lld/trunk/ELF/OutputSections.h
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=251192&r1=251191&r2=251192&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Sat Oct 24 12:44:52 2015
@@ -548,10 +548,10 @@ template <class ELFT> void DynamicSectio
     // 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 DynamicSectio
 
   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>::writeLoca
         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>::writeGlob
     }
 
     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;

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=251192&r1=251191&r2=251192&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Sat Oct 24 12:44:52 2015
@@ -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;
 

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=251192&r1=251191&r2=251192&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sat Oct 24 12:44:52 2015
@@ -741,7 +741,7 @@ template <class ELFT> void Writer<ELFT>:
   // 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++);
   }
 }




More information about the llvm-commits mailing list