Skip to content

Conversation

@alx32
Copy link
Contributor

@alx32 alx32 commented Dec 20, 2024

Previously, the test llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml was disabled due to failing on Linux.

The issue is that the merged functions appear in a different order in the final produced gSYM.
To ensure deterministic ordering of merged functions, we change the sorting of functions to use the stable_sort algorithm. Before merged functions, this was not an issue as the address is used as a comparator in the sorting algorithm so there was no chance of two functions testing as identical according to the comparator.

Confirmed that test now passes locally with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON.

@alx32 alx32 requested a review from clayborg December 20, 2024 21:31
@alx32 alx32 force-pushed the 04_gsymutil_merged_nondet branch from 53428e2 to 8d64a8e Compare December 20, 2024 21:32
@alx32 alx32 marked this pull request as ready for review December 20, 2024 21:32
@llvmbot
Copy link
Member

llvmbot commented Dec 20, 2024

@llvm/pr-subscribers-debuginfo

Author: None (alx32)

Changes

Previously, the test llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml was disabled due to failing on Linux.

The issue is that the merged functions appear in a different order in the final produced gSYM.
To ensure deterministic ordering of merged functions, we change the sorting of functions to use the stable_sort algorithm. Before merged functions, this was not an issue as the address is used as a comparator in the sorting algorithm so there was no chance of two functions testing as identical according to the comparator.


Full diff: https://github.com/llvm/llvm-project/pull/120796.diff

2 Files Affected:

  • (modified) llvm/lib/DebugInfo/GSYM/GsymCreator.cpp (+2-2)
  • (modified) llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml (-4)
diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
index eb26c637a2ca36..14078f5aaf9a46 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp
@@ -200,8 +200,8 @@ void GsymCreator::prepareMergedFunctions(OutputAggregator &Out) {
   if (Funcs.size() < 2)
     return;
 
-  // Sort the function infos by address range first
-  llvm::sort(Funcs);
+  // Sort the function infos by address range first, preserving input order
+  llvm::stable_sort(Funcs);
   std::vector<FunctionInfo> TopLevelFuncs;
 
   // Add the first function info to the top level functions
diff --git a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml
index 001145c01398c5..4cecc79c72b4b3 100644
--- a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml
+++ b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml
@@ -1,7 +1,3 @@
-# FIXME: Currently disabled as it fails on some Linux hosts
-# UNSUPPORTED: true
-
-
 ## Test that reconstructs a dSYM file from YAML and generates a gsym from it. The gsym has callsite info and merged functions.
 
 # RUN: split-file %s %t

@alx32 alx32 merged commit 96839a4 into llvm:main Dec 21, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants