[PATCH] D24576: Change how we compute offsets with linker scripts

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 14 12:47:09 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:149
@@ -147,3 +148,3 @@
 
 // Returns input sections filtered by given glob patterns.
 template <class ELFT>
----------------
Update this comment.

================
Comment at: ELF/LinkerScript.cpp:151-152
@@ -149,4 +150,4 @@
 template <class ELFT>
-std::vector<InputSectionBase<ELFT> *>
-LinkerScript<ELFT>::getInputSections(const InputSectionDescription *I) {
+void LinkerScript<ELFT>::getInputSections(InputSectionDescription *I,
+                                          ConstraintKind Constraint) {
   const Regex &Re = I->SectionRe;
----------------
`get` is not an appropriate prefix for this function as this now returns nothing.

================
Comment at: ELF/LinkerScript.cpp:160
@@ -158,3 +159,3 @@
             const_cast<Regex &>(Re).match(S->Name))
-          Ret.push_back(S);
+          V.push_back(S);
 
----------------
Remove `V` and add directly to `I->Sections`? `V` seems useless.

================
Comment at: ELF/LinkerScript.cpp:165-166
@@ +164,4 @@
+
+  if (!matchConstraints<ELFT>(V, Constraint))
+    V.clear();
+
----------------
clear and then early return?

================
Comment at: ELF/LinkerScript.cpp:321-323
@@ +320,5 @@
+template <class ELFT> void LinkerScript<ELFT>::output(InputSection<ELFT> *S) {
+  if (!AlreadyOutputIS.insert(S).second)
+    return;
+  AlreadyOutputIS.insert(S);
+  bool IsTbss =
----------------
You can remove the second `insert`.


https://reviews.llvm.org/D24576





More information about the llvm-commits mailing list