Skip to content

Commit 98eb476

Browse files
authored
Fix stmt-seq-macho.test for little endian platforms (llvm#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
1 parent bdf21ca commit 98eb476

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test

+6-2
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,17 @@ ld64.lld \
8383

8484
# Convert executable to YAML for the test
8585
echo "#--- stmt_seq_macho.o.yaml"
86-
obj2yaml stmt_seq_macho.o
86+
obj2yaml stmt_seq_macho.o | sed '1a\
87+
IsLittleEndian: true'
8788
echo ""
8889
echo "#--- stmt_seq_macho.exe.yaml"
89-
obj2yaml stmt_seq_macho.exe
90+
obj2yaml stmt_seq_macho.exe | sed '1a\
91+
IsLittleEndian: true'
9092

9193
#--- stmt-seq-macho.yaml
9294
#--- stmt_seq_macho.o.yaml
9395
--- !mach-o
96+
IsLittleEndian: true
9497
FileHeader:
9598
magic: 0xFEEDFACF
9699
cputype: 0x100000C
@@ -1564,6 +1567,7 @@ DWARF:
15641567

15651568
#--- stmt_seq_macho.exe.yaml
15661569
--- !mach-o
1570+
IsLittleEndian: true
15671571
FileHeader:
15681572
magic: 0xFEEDFACF
15691573
cputype: 0x100000C

0 commit comments

Comments
 (0)