[lld] r330339 - Rename MergeInputSection::getOffset.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 09:05:07 PDT 2018


Author: rafael
Date: Thu Apr 19 09:05:07 2018
New Revision: 330339

URL: http://llvm.org/viewvc/llvm-project?rev=330339&view=rev
Log:
Rename MergeInputSection::getOffset.

Unlike the getOffset in the base class, this one computes the offset
in the parent synthetic section, not the final output section.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=330339&r1=330338&r2=330339&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Thu Apr 19 09:05:07 2018
@@ -156,8 +156,9 @@ uint64_t SectionBase::getOffset(uint64_t
   case Merge:
     const MergeInputSection *MS = cast<MergeInputSection>(this);
     if (InputSection *IS = MS->getParent())
-      return cast<InputSection>(IS->Repl)->OutSecOff + MS->getOffset(Offset);
-    return MS->getOffset(Offset);
+      return cast<InputSection>(IS->Repl)->OutSecOff +
+             MS->getParentOffset(Offset);
+    return MS->getParentOffset(Offset);
   }
   llvm_unreachable("invalid section kind");
 }
@@ -972,7 +973,7 @@ SectionPiece *MergeInputSection::getSect
 // Returns the offset in an output section for a given input offset.
 // Because contents of a mergeable section is not contiguous in output,
 // it is not just an addition to a base output offset.
-uint64_t MergeInputSection::getOffset(uint64_t Offset) const {
+uint64_t MergeInputSection::getParentOffset(uint64_t Offset) const {
   // Find a string starting at a given offset.
   auto It = OffsetMap.find(Offset);
   if (It != OffsetMap.end())

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=330339&r1=330338&r2=330339&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Thu Apr 19 09:05:07 2018
@@ -229,9 +229,9 @@ public:
       LiveOffsets.insert(Offset);
   }
 
-  // Translate an offset in the input section to an offset
-  // in the output section.
-  uint64_t getOffset(uint64_t Offset) const;
+  // Translate an offset in the input section to an offset in the parent
+  // MergeSyntheticSection.
+  uint64_t getParentOffset(uint64_t Offset) const;
 
   // Splittable sections are handled as a sequence of data
   // rather than a single large blob of data.




More information about the llvm-commits mailing list