[PATCH] D19976: [ELF, WIP] - Prototype of possible linkerscript redesign.

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 04:54:09 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/LinkerScript.cpp:191
@@ +190,3 @@
+static OutputSectionBase<ELFT> *
+findSection(ArrayRef<OutputSectionBase<ELFT> *> V, StringRef Name) {
+  for (OutputSectionBase<ELFT> *Sec : V)
----------------
Looks like findSection is not called by anyone. I suggest removing it

================
Comment at: ELF/LinkerScript.cpp:375
@@ -301,7 +374,3 @@
 template <class ELFT>
-int LinkerScript<ELFT>::compareSections(StringRef A, StringRef B) {
-  int I = getSectionIndex(A);
-  int J = getSectionIndex(B);
-  if (I == INT_MAX && J == INT_MAX)
-    return 0;
-  return I < J ? -1 : 1;
+void LinkerScript<ELFT>::sort(std::vector<OutputSectionBase<ELFT> *> &S) {
+  std::stable_sort(S.begin(), S.end(), [this](OutputSectionBase<ELFT> *A,
----------------
This code doesn't sort orphan sections, which might make sense on some occasions.
What is the reason for that?


https://reviews.llvm.org/D19976





More information about the llvm-commits mailing list