-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Fix stmt-seq-macho.test for little endian platforms #137017
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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/pr-subscribers-debuginfo Author: None (alx32) ChangesThe 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 endiadness is because the endiadness is set as an optional parameter and therefore it won't be specified if it matches the platform default. Ref:
Full diff: https://github.com/llvm/llvm-project/pull/137017.diff 1 Files Affected:
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
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should fix the problem on big-endian platforms. LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; thanks!
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
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
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
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 endiadness is because the endiadness is set as an optional parameter and therefore it won't be specified if it matches the platform default. Ref:
llvm-project/llvm/lib/ObjectYAML/MachOYAML.cpp
Line 105 in d7215c0