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

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 05:35:37 PDT 2016


grimar 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)
----------------
evgeny777 wrote:
> Looks like findSection is not called by anyone. I suggest removing it
Right, missed it, removed.

================
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,
----------------
evgeny777 wrote:
> This code doesn't sort orphan sections, which might make sense on some occasions.
> What is the reason for that?
Because from my understanding we do not need to care about orphans.
I tried to separate the logic of script from anything other as much I could. Just I think it
is easier to process them separatelly.
So since we do not care about orphans, we do not need to sort them.


https://reviews.llvm.org/D19976





More information about the llvm-commits mailing list