1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +01:00

[llvm-objdump/mac] Print symbols at the same address deterministically

By using stable_sort.

Added a test case which previously failed when expensive checks were
enabled.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D105240
This commit is contained in:
Jez Ng 2021-06-30 22:38:07 -04:00
parent e735ac1e0d
commit 69e52cdafc
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,14 @@
# RUN: llvm-mc %s --triple x86_64-apple-darwin -filetype=obj -o %t.o
# RUN: llvm-objdump --macho -d %t.o | FileCheck %s
_foo:
_bar:
_baz:
_qux:
nop
## Ensure symbols with the same address are printed in a deterministic order
# CHECK: _foo
# CHECK-NEXT: _bar
# CHECK-NEXT: _baz
# CHECK-NEXT: _qux

View File

@ -7318,7 +7318,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
BaseSegmentAddress);
// Sort the symbols by address, just in case they didn't come in that way.
llvm::sort(Symbols, SymbolSorter());
llvm::stable_sort(Symbols, SymbolSorter());
// Build a data in code table that is sorted on by the address of each entry.
uint64_t BaseAddress = 0;