[PATCH] D149270: [LLD][MachO] Do not run Mach-O tests on big-endian hosts

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 10:10:49 PDT 2023


uweigand created this revision.
uweigand added reviewers: int3, gkm, smeenai.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
uweigand requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Currently, most Mach-O tests fail when executed on a big-endian host.  This is because the Mach-O back-end does not perform the necessary byte swaps when accessing the (little-endian) binary file format.

To fix this properly would either require use of the various swapStruct routines from the BinaryFormat/MachO.h header, or else a re-write of those headers to use ulittle32 etc. data types.

For now, simply consider all Mach-O tests unsupported on big-endian hosts (specifically, SystemZ), to enable running the test suite at all on such hosts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149270

Files:
  lld/test/MachO/lit.local.cfg
  lld/test/lit.site.cfg.py.in


Index: lld/test/lit.site.cfg.py.in
===================================================================
--- lld/test/lit.site.cfg.py.in
+++ lld/test/lit.site.cfg.py.in
@@ -15,6 +15,7 @@
 config.lld_obj_root = "@LLD_BINARY_DIR@"
 config.lld_libs_dir = lit_config.substitute("@CURRENT_LIBS_DIR@")
 config.lld_tools_dir = lit_config.substitute("@CURRENT_TOOLS_DIR@")
+config.host_triple = "@LLVM_HOST_TRIPLE@"
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lld/test/MachO/lit.local.cfg
===================================================================
--- lld/test/MachO/lit.local.cfg
+++ lld/test/MachO/lit.local.cfg
@@ -2,6 +2,12 @@
 
 import os
 
+# FIXME: The MachO back-end currently does not respect endianness when
+# accessing binary data structures, and therefore only works correctly
+# on little-endian host systems.  Skip all tests on big-endian hosts.
+if 's390x' in config.host_triple:
+    config.unsupported = True
+
 # We specify the most commonly-used archs and platform versions in our tests
 # here. Tests which need different settings can just append to this, as only
 # the last value will be used.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149270.517220.patch
Type: text/x-patch
Size: 1216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230426/51095f82/attachment.bin>


More information about the llvm-commits mailing list