Skip to content

Commit 3a226db

Browse files
authored
[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`.
1 parent 6e4c580 commit 3a226db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

llvm/unittests/BinaryFormat/MachOTest.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9+
#include "llvm/ADT/bit.h"
910
#include "llvm/BinaryFormat/MachO.h"
1011
#include "llvm/TargetParser/Triple.h"
1112
#include "gtest/gtest.h"
1213

1314
using namespace llvm;
1415
using namespace llvm::MachO;
1516

16-
TEST(MachOTest, UnalignedLC) {
17+
#if BYTE_ORDER == BIG_ENDIAN
18+
// As discussed in Issue #86793, this test cannot work on a strict-alignment
19+
// targets like SPARC. Besides, it's undefined behaviour on big-endian hosts.
20+
#define MAYBE_UnalignedLC DISABLED_UnalignedLC
21+
#else
22+
#define MAYBE_UnalignedLC UnalignedLC
23+
#endif
24+
25+
TEST(MachOTest, MAYBE_UnalignedLC) {
1726
unsigned char Valid32BitMachO[] = {
1827
0xCE, 0xFA, 0xED, 0xFE, 0x07, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
1928
0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,

0 commit comments

Comments
 (0)