[llvm] Fix stmt-seq-macho.test for little endian platforms (PR #137017)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 23 11:00:48 PDT 2025
https://github.com/alx32 updated https://github.com/llvm/llvm-project/pull/137017
>From 1c9662dc43c9b3e558719424cacc0a427d202be3 Mon Sep 17 00:00:00 2001
From: alx32 <103613512+alx32 at users.noreply.github.com>
Date: Wed, 23 Apr 2025 09:33:07 -0700
Subject: [PATCH 1/2] Fix stmt-seq-macho.test for little endian platforms
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
---
llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test b/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
index 1e08bc07e14cb..07659d95270cd 100644
--- a/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
+++ b/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
@@ -83,14 +83,15 @@ 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 +1565,7 @@ DWARF:
#--- stmt_seq_macho.exe.yaml
--- !mach-o
+IsLittleEndian: true
FileHeader:
magic: 0xFEEDFACF
cputype: 0x100000C
>From e220bd8d766fb313e6755358bf6662bed6128764 Mon Sep 17 00:00:00 2001
From: Alex B <alexborcan at meta.com>
Date: Wed, 23 Apr 2025 11:00:37 -0700
Subject: [PATCH 2/2] Fix Sed Syntax
---
llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test b/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
index 07659d95270cd..f2fe794e1b484 100644
--- a/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
+++ b/llvm/test/tools/dsymutil/ARM/stmt-seq-macho.test
@@ -83,10 +83,12 @@ ld64.lld \
# Convert executable to YAML for the test
echo "#--- stmt_seq_macho.o.yaml"
-obj2yaml stmt_seq_macho.o | sed '1a IsLittleEndian: true'
+obj2yaml stmt_seq_macho.o | sed '1a\
+IsLittleEndian: true'
echo ""
echo "#--- stmt_seq_macho.exe.yaml"
-obj2yaml stmt_seq_macho.exe | sed '1a IsLittleEndian: true'
+obj2yaml stmt_seq_macho.exe | sed '1a\
+IsLittleEndian: true'
#--- stmt-seq-macho.yaml
#--- stmt_seq_macho.o.yaml
More information about the llvm-commits
mailing list