https://github.com/tru updated https://github.com/llvm/llvm-project/pull/102103
>From aa3bbf147fbbd289485e7bdf12d27c1d3c0169c6 Mon Sep 17 00:00:00 2001 From: Rainer Orth <r...@gcc.gnu.org> Date: Tue, 6 Aug 2024 09:08:41 +0200 Subject: [PATCH] [BinaryFormat] Disable MachOTest.UnalignedLC on SPARC (#100086) As discussed in Issue #86793, the `MachOTest.UnalignedLC` test dies with `SIGBUS` on SPARC, a strict-alignment target. It simply cannot work there. Besides, the test invokes undefined behaviour on big-endian targets, so this patch disables it on all of those. Tested on `sparcv9-sun-solaris2.11` and `amd64-pc-solaris2.11`. (cherry picked from commit 3a226dbe27ac7c7d935bc0968e84e31798a01207) --- llvm/unittests/BinaryFormat/MachOTest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/llvm/unittests/BinaryFormat/MachOTest.cpp b/llvm/unittests/BinaryFormat/MachOTest.cpp index 391298ff38d764..78b20c28a9549a 100644 --- a/llvm/unittests/BinaryFormat/MachOTest.cpp +++ b/llvm/unittests/BinaryFormat/MachOTest.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/bit.h" #include "llvm/BinaryFormat/MachO.h" #include "llvm/TargetParser/Triple.h" #include "gtest/gtest.h" @@ -13,7 +14,15 @@ using namespace llvm; using namespace llvm::MachO; -TEST(MachOTest, UnalignedLC) { +#if BYTE_ORDER == BIG_ENDIAN +// As discussed in Issue #86793, this test cannot work on a strict-alignment +// targets like SPARC. Besides, it's undefined behaviour on big-endian hosts. +#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, _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits