[llvm] [llvm-gsymutil] Ensure gSYM creation determinism with merged functions (PR #122921)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 14 07:40:18 PST 2025


https://github.com/alx32 updated https://github.com/llvm/llvm-project/pull/122921

>From d07231d32b7d7ddde7149f9bad587454c20faafc Mon Sep 17 00:00:00 2001
From: Alex B <alexborcan at meta.com>
Date: Tue, 14 Jan 2025 07:32:20 -0800
Subject: [PATCH] [llvm-gsymutil] Ensure gSYM creation determinism with merged
 functions

---
 llvm/lib/DebugInfo/GSYM/GsymCreator.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
index 14078f5aaf9a46..93ff3b924db324 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
@@ -275,8 +275,9 @@ llvm::Error GsymCreator::finalize(OutputAggregator &Out) {
   // object.
   if (!IsSegment) {
     if (NumBefore > 1) {
-      // Sort function infos so we can emit sorted functions.
-      llvm::sort(Funcs);
+      // Sort function infos so we can emit sorted functions. Use stable sort to
+      // ensure determinism.
+      llvm::stable_sort(Funcs);
       std::vector<FunctionInfo> FinalizedFuncs;
       FinalizedFuncs.reserve(Funcs.size());
       FinalizedFuncs.emplace_back(std::move(Funcs.front()));



More information about the llvm-commits mailing list