diff options
Diffstat (limited to 'lld/ELF/OutputSections.cpp')
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index c1a05aca34f..b6b17878398 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -772,8 +772,9 @@ template <class ELFT> void OutputSection<ELFT>::sortByPriority() { std::vector<Pair> V; for (InputSection<ELFT> *S : Sections) V.push_back({getPriority(S->getSectionName()), S}); - std::sort(V.begin(), V.end(), - [](const Pair &A, const Pair &B) { return A.first < B.first; }); + std::stable_sort(V.begin(), V.end(), [](const Pair &A, const Pair &B) { + return A.first < B.first; + }); Sections.clear(); for (Pair &P : V) Sections.push_back(P.second); |

