diff options
-rw-r--r-- | lld/wasm/Writer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index ffb987ea5b7..6ffce929bb0 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -871,10 +871,10 @@ void Writer::calculateInitFunctions() { } // Sort in order of priority (lowest first) so that they are called // in the correct order. - std::sort(InitFunctions.begin(), InitFunctions.end(), - [](const WasmInitFunc &L, const WasmInitFunc &R) { - return L.Priority < R.Priority; - }); + std::stable_sort(InitFunctions.begin(), InitFunctions.end(), + [](const WasmInitFunc &L, const WasmInitFunc &R) { + return L.Priority < R.Priority; + }); } void Writer::run() { |