[lld] r308056 - Pass OutputSectionCommand to forEachExecInputSection's callback.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 14 14:33:15 PDT 2017


Author: rafael
Date: Fri Jul 14 14:33:14 2017
New Revision: 308056

URL: http://llvm.org/viewvc/llvm-project?rev=308056&view=rev
Log:
Pass OutputSectionCommand to forEachExecInputSection's callback.

NFC, just makes the OutputSectionCommand available.

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

Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=308056&r1=308055&r2=308056&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Fri Jul 14 14:33:14 2017
@@ -1066,7 +1066,7 @@ std::pair<Thunk *, bool> ThunkCreator::g
 // InputSectionDescription::Sections.
 void ThunkCreator::forEachExecInputSection(
     ArrayRef<OutputSectionCommand *> OutputSections,
-    std::function<void(OutputSection *, std::vector<InputSection *> *,
+    std::function<void(OutputSectionCommand *, std::vector<InputSection *> *,
                        InputSection *)>
         Fn) {
   for (OutputSectionCommand *Cmd : OutputSections) {
@@ -1077,7 +1077,7 @@ void ThunkCreator::forEachExecInputSecti
       if (auto *ISD = dyn_cast<InputSectionDescription>(BC)) {
         CurTS = nullptr;
         for (InputSection *IS : ISD->Sections)
-          Fn(OS, &ISD->Sections, IS);
+          Fn(Cmd, &ISD->Sections, IS);
       }
   }
 }
@@ -1104,8 +1104,8 @@ bool ThunkCreator::createThunks(
   // ThunkSections back into the OutputSection as ThunkSections are not always
   // inserted into the same OutputSection as the caller.
   forEachExecInputSection(
-      OutputSections, [&](OutputSection *OS,  std::vector<InputSection*> *ISR,
-                          InputSection *IS) {
+      OutputSections, [&](OutputSectionCommand *Cmd,
+                          std::vector<InputSection *> *ISR, InputSection *IS) {
         for (Relocation &Rel : IS->Relocations) {
           SymbolBody &Body = *Rel.Sym;
           if (Thunks.find(&Body) != Thunks.end() ||
@@ -1118,9 +1118,9 @@ bool ThunkCreator::createThunks(
             // Find or create a ThunkSection for the new Thunk
             ThunkSection *TS;
             if (auto *TIS = T->getTargetInputSection())
-              TS = getISThunkSec(TIS, OS);
+              TS = getISThunkSec(TIS, Cmd->Sec);
             else
-              TS = getOSThunkSec(OS, ISR);
+              TS = getOSThunkSec(Cmd->Sec, ISR);
             TS->addThunk(T);
             Thunks[T->ThunkSym] = T;
           }

Modified: lld/trunk/ELF/Relocations.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.h?rev=308056&r1=308055&r2=308056&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.h (original)
+++ lld/trunk/ELF/Relocations.h Fri Jul 14 14:33:14 2017
@@ -138,7 +138,7 @@ private:
   ThunkSection *getISThunkSec(InputSection *IS, OutputSection *OS);
   void forEachExecInputSection(
       ArrayRef<OutputSectionCommand *> OutputSections,
-      std::function<void(OutputSection *, std::vector<InputSection *> *,
+      std::function<void(OutputSectionCommand *, std::vector<InputSection *> *,
                          InputSection *)>
           Fn);
   std::pair<Thunk *, bool> getThunk(SymbolBody &Body, uint32_t Type);




More information about the llvm-commits mailing list