[PATCH] D14281: [ELF2] Sort dynamic symbols according to the MIPS requirements.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 3 10:41:15 PST 2015


ruiu added inline comments.

================
Comment at: ELF/OutputSections.cpp:925-926
@@ -924,2 +924,4 @@
   }
+  assert(!(Out<ELFT>::GnuHashTab && Config->EMachine == EM_MIPS) &&
+         "Conflict in sorting requirements.");
   if (Out<ELFT>::GnuHashTab)
----------------
This assert is probably too much, so remove that.

================
Comment at: ELF/OutputSections.cpp:933-938
@@ -928,1 +932,8 @@
+    // their positions in the GOT.
+    std::stable_sort(Symbols.begin(), Symbols.end(),
+                     [](SymbolBody *L, SymbolBody *R) {
+                       if (!L->isInGot() || !R->isInGot())
+                         return R->isInGot();
+                       return L->GotIndex < R->GotIndex;
+                     });
   size_t I = 0;
----------------
Can you make this a separate non-member function so that we can write

  std::stable_sort(Symbols.begin(), Symbols.end(), sortMipsSymbols<ELFT>);


http://reviews.llvm.org/D14281





More information about the llvm-commits mailing list