[PATCH] D102972: [lld-macho][nfc] Sort OutputSections based on explicit order of command-line inputs

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 22 20:06:49 PDT 2021


int3 added inline comments.


================
Comment at: lld/MachO/OutputSegment.h:47
       llvm::function_ref<bool(OutputSection *, OutputSection *)> comparator) {
-    llvm::stable_sort(sections, comparator);
+    llvm::sort(sections, comparator);
   }
----------------
alexshap wrote:
> the presence of `comparator` and `inputOrder`, perhaps, deserves some comments
> (e.g. are there any places where sections are sorted using different comparators ?)
> otherwise this probably can be simplified a bit.
There's only one comparator... I think this only exists so that all the segment+section sorting code could live together in Writer.cpp. But yeah we can simplify it by moving all the sorting code into OutputSegment.cpp instead. Out of scope for this diff though


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102972/new/

https://reviews.llvm.org/D102972



More information about the llvm-commits mailing list