[llvm] [BinaryFormat] Disable MachOTest.UnalignedLC on SPARC (PR #100086)

Rainer Orth via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 02:13:51 PDT 2024


https://github.com/rorth created https://github.com/llvm/llvm-project/pull/100086

As discussed in Issue #86793, the `MachOTest.UnalignedLC` test dies with `SIGBUS` on SPARC, a strict-alignment target.  It simply cannot work there, so this patch disables it.

Given that there's doubt about the test's correctnes, one might consider disabling it wholesale.

Tested on `sparcv9-sun-solaris2.11` and `amd64-pc-solaris2.11`.

>From 76aac12c26e68a19ab95e99c9f9d2d214bcad744 Mon Sep 17 00:00:00 2001
From: Rainer Orth <ro at gcc.gnu.org>
Date: Tue, 23 Jul 2024 11:10:12 +0200
Subject: [PATCH] [BinaryFormat] Disable MachOTest.UnalignedLC on SPARC

As discussed in Issue #86793, the `MachOTest.UnalignedLC` test dies with
SIGBUS on SPARC, a strict-alignment target.  It simply cannot work there,
so this patch disables it.

Given that there's doubt about the test's correctnes, one might consider
disabling it wholesale.

Tested on `sparcv9-sun-solaris2.11` and `amd64-pc-solaris2.11`.
---
 llvm/unittests/BinaryFormat/MachOTest.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/llvm/unittests/BinaryFormat/MachOTest.cpp b/llvm/unittests/BinaryFormat/MachOTest.cpp
index 391298ff38d76..b64efce52d321 100644
--- a/llvm/unittests/BinaryFormat/MachOTest.cpp
+++ b/llvm/unittests/BinaryFormat/MachOTest.cpp
@@ -13,7 +13,15 @@
 using namespace llvm;
 using namespace llvm::MachO;
 
-TEST(MachOTest, UnalignedLC) {
+#if defined(__sparc__)
+// As discussed in Issue #86793, this test cannot work on a strict-alignment
+// targets like SPARC.  The test may even be invalid.
+#define MAYBE_UnalignedLC DISABLED_UnalignedLC
+#else
+#define MAYBE_UnalignedLC UnalignedLC
+#endif
+
+TEST(MachOTest, MAYBE_UnalignedLC) {
   unsigned char Valid32BitMachO[] = {
       0xCE, 0xFA, 0xED, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
       0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,



More information about the llvm-commits mailing list