summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2018-02-21 00:34:34 +0000
committerSam Clegg <sbc@chromium.org>2018-02-21 00:34:34 +0000
commit29b8feb615c9850f43b9ed5efb83e4ebed72d4da (patch)
tree710bccb68524e50ac25a40b18cfe6bf6fcdd494f
parent94a940d2b4094dc4b98a59367a72be8bbd270de7 (diff)
downloadbcm5719-llvm-29b8feb615c9850f43b9ed5efb83e4ebed72d4da.tar.gz
bcm5719-llvm-29b8feb615c9850f43b9ed5efb83e4ebed72d4da.zip
[WebAssembly] Use stable sort when sorting ctore functions
Patch by Nicholas Wilson! llvm-svn: 325656
-rw-r--r--lld/wasm/Writer.cpp8
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() {
OpenPOWER on IntegriCloud