@@ -1468,11 +1468,9 @@ Error Object::removeSymbols(function_ref<bool(const Symbol &)> ToRemove) {
14681468void Object::sortSections () {
14691469 // Put all sections in offset order. Maintain the ordering as closely as
14701470 // possible while meeting that demand however.
1471- auto CompareSections = [](const SecPtr &A, const SecPtr &B) {
1471+ llvm::stable_sort (Sections, [](const SecPtr &A, const SecPtr &B) {
14721472 return A->OriginalOffset < B->OriginalOffset ;
1473- };
1474- std::stable_sort (std::begin (this ->Sections ), std::end (this ->Sections ),
1475- CompareSections);
1473+ });
14761474}
14771475
14781476static uint64_t alignToAddr (uint64_t Offset, uint64_t Addr, uint64_t Align) {
@@ -1490,8 +1488,7 @@ static uint64_t alignToAddr(uint64_t Offset, uint64_t Addr, uint64_t Align) {
14901488
14911489// Orders segments such that if x = y->ParentSegment then y comes before x.
14921490static void orderSegments (std::vector<Segment *> &Segments) {
1493- std::stable_sort (std::begin (Segments), std::end (Segments),
1494- compareSegmentsByOffset);
1491+ llvm::stable_sort (Segments, compareSegmentsByOffset);
14951492}
14961493
14971494// This function finds a consistent layout for a list of segments starting from
@@ -1746,8 +1743,7 @@ Error BinaryWriter::finalize() {
17461743 for (Segment *Seg : OrderedSegments)
17471744 Seg->PAddr = Seg->VAddr ;
17481745
1749- std::stable_sort (std::begin (OrderedSegments), std::end (OrderedSegments),
1750- compareSegmentsByPAddr);
1746+ llvm::stable_sort (OrderedSegments, compareSegmentsByPAddr);
17511747
17521748 // Because we add a ParentSegment for each section we might have duplicate
17531749 // segments in OrderedSegments. If there were duplicates then LayoutSegments
0 commit comments