[PATCH] D37815: [ELF] - Simplify adjustSectionsBeforeSorting().

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 09:57:49 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

Does not seem we need to set `SectionIndex` here.
It is set in `finalizeSections()` later.


https://reviews.llvm.org/D37815

Files:
  ELF/LinkerScript.cpp


Index: ELF/LinkerScript.cpp
===================================================================
--- ELF/LinkerScript.cpp
+++ ELF/LinkerScript.cpp
@@ -667,9 +667,8 @@
   // '.' is assigned to, but creating these section should not have any bad
   // consequeces and gives us a section to put the symbol in.
   uint64_t Flags = SHF_ALLOC;
-
-  for (int I = 0, E = Opt.Commands.size(); I != E; ++I) {
-    auto *Sec = dyn_cast<OutputSection>(Opt.Commands[I]);
+  for (BaseCommand * Cmd : Opt.Commands) {
+    auto *Sec = dyn_cast<OutputSection>(Cmd);
     if (!Sec)
       continue;
     if (Sec->Live) {
@@ -681,7 +680,6 @@
       continue;
 
     Sec->Live = true;
-    Sec->SectionIndex = I;
     Sec->Flags = Flags;
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37815.115062.patch
Type: text/x-patch
Size: 743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170913/c2e4af18/attachment.bin>


More information about the llvm-commits mailing list