[llvm] 98eb476 - Fix stmt-seq-macho.test for little endian platforms (#137017)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 23 11:06:59 PDT 2025
Author: alx32
Date: 2025-04-23T11:06:56-07:00
New Revision: 98eb4761c8640968a922dab417dfa42ef2621c43
URL: https://github.com/llvm/llvm-project/commit/98eb4761c8640968a922dab417dfa42ef2621c43
DIFF: https://github.com/llvm/llvm-project/commit/98eb4761c8640968a922dab417dfa42ef2621c43.diff
LOG: Fix stmt-seq-macho.test for little endian platforms (#137017)
The test YAML was created on a little-endian system, so its data is
stored in little-endian order. When the test runs on a big-endian host,
yaml2obj defaults to the host’s byte order, misreading the file as
big-endian and causing a failure.
This change explicitly marks the YAML as little-endian, guaranteeing
that yaml2obj always uses the correct byte order, no matter which
machine runs the test.
The reason that during creation, obj2yaml doesn't specify the endianness
is because the endianness is set as an optional parameter and therefore
it won't be specified if it matches the platform default. Ref:
https://github.com/llvm/llvm-project/blob/d7215c0ee2e4bca1ce87b956335ef6a2cddaf16f/llvm/lib/ObjectYAML/MachOYAML.cpp#L105
Added:
Modified:
llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
Removed:
################################################################################
diff --git a/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test b/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
index 1e08bc07e14cb..f2fe794e1b484 100644
--- a/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
+++ b/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
@@ -83,14 +83,17 @@ ld64.lld \
# Convert executable to YAML for the test
echo "#--- stmt_seq_macho.o.yaml"
-obj2yaml stmt_seq_macho.o
+obj2yaml stmt_seq_macho.o | sed '1a\
+IsLittleEndian: true'
echo ""
echo "#--- stmt_seq_macho.exe.yaml"
-obj2yaml stmt_seq_macho.exe
+obj2yaml stmt_seq_macho.exe | sed '1a\
+IsLittleEndian: true'
#--- stmt-seq-macho.yaml
#--- stmt_seq_macho.o.yaml
--- !mach-o
+IsLittleEndian: true
FileHeader:
magic: 0xFEEDFACF
cputype: 0x100000C
@@ -1564,6 +1567,7 @@ DWARF:
#--- stmt_seq_macho.exe.yaml
--- !mach-o
+IsLittleEndian: true
FileHeader:
magic: 0xFEEDFACF
cputype: 0x100000C
More information about the llvm-commits
mailing list