[PATCH] D37627: [LLD][ELF] Rename variables and add comments to getISThunkSec [NFC]

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 8 09:04:01 PDT 2017


peter.smith created this revision.
Herald added a subscriber: emaste.

Some refactoring split out from https://reviews.llvm.org/D34691 that isn't strictly relating to it. It covers the renaming of some variables as Commands were moved to OutputSections the existing ones still imply commands. I've also tidied up the comments.


https://reviews.llvm.org/D37627

Files:
  ELF/Relocations.cpp


Index: ELF/Relocations.cpp
===================================================================
--- ELF/Relocations.cpp
+++ ELF/Relocations.cpp
@@ -1023,15 +1023,18 @@
   return CurTS;
 }
 
+// Add a Thunk that needs to be placed in a ThunkSection that immediately
+// precedes its Target.
 ThunkSection *ThunkCreator::getISThunkSec(InputSection *IS, OutputSection *OS) {
   ThunkSection *TS = ThunkedSections.lookup(IS);
   if (TS)
     return TS;
 
-  // Find InputSectionRange within TOS that IS is in
-  OutputSection *C = IS->getParent();
+  // Find InputSectionRange within Target Output Section (TOS) that the
+  // InputSection (IS) that we need to precede is in.
+  OutputSection *TOS = IS->getParent();
   std::vector<InputSection *> *Range = nullptr;
-  for (BaseCommand *BC : C->Commands)
+  for (BaseCommand *BC : TOS->Commands)
     if (auto *ISD = dyn_cast<InputSectionDescription>(BC)) {
       InputSection *first = ISD->Sections.front();
       InputSection *last = ISD->Sections.back();
@@ -1041,7 +1044,7 @@
         break;
       }
     }
-  TS = addThunkSection(C, Range, IS->OutSecOff);
+  TS = addThunkSection(TOS, Range, IS->OutSecOff);
   ThunkedSections[IS] = TS;
   return TS;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37627.114372.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170908/ea9846e5/attachment.bin>


More information about the llvm-commits mailing list