[PATCH] D22617: [ELF] - Linkerscript: add InputSectionDescription command to LS parser.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 21 06:01:37 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:234
@@ -236,9 +233,3 @@
   // in script, so correct input section order is maintained by design.
-  for (SectionRule &R : Opt.Sections)
-    for (const std::unique_ptr<ObjectFile<ELFT>> &F :
-         Symtab<ELFT>::X->getObjectFiles())
-      for (InputSectionBase<ELFT> *S : F->getSections())
-        if (!isDiscarded(S) && !S->OutSec &&
-            globMatch(R.SectionPattern, S->getSectionName()))
-          // Add single input section to output section.
-          AddInputSec(S, R.Dest);
+  for (const std::unique_ptr<BaseCommand> &Base : Opt.Commands) {
+    auto *OutCmd = dyn_cast<OutputSectionCommand>(Base.get());
----------------
This change will make this function too long, but that's probably okay for now. I'll try to split it up.

================
Comment at: ELF/LinkerScript.cpp:259
@@ +258,3 @@
+            AddInputSec(S, OutCmd->Name);
+            break;
+          }
----------------
`break` at end of a for-loop?

================
Comment at: ELF/LinkerScript.cpp:261-262
@@ +260,4 @@
+          }
+        }
+    }
+  }
----------------
If you need {}, please put {} all inner loops.


https://reviews.llvm.org/D22617





More information about the llvm-commits mailing list