MSYS2-packages/llvm/0005-LLVM-adjust-lit.cfg.py-for-Cygwin-151416.patch
Jeremy Drake 0586ad6beb llvm: update to 21.1.0
add an msysize patch to deal with the fallout of teaching the Cygwin
driver how to call the linker directly instead of using GCC to do it
2025-08-27 17:57:40 -07:00

75 lines
3.4 KiB
Diff

From f85691109c0733f5cbf352a482b6d264ccb6459a Mon Sep 17 00:00:00 2001
From: jeremyd2019 <github@jdrake.com>
Date: Sat, 2 Aug 2025 10:31:46 -0700
Subject: [PATCH] [LLVM] adjust lit.cfg.py for Cygwin (#151416)
Cygwin is like Windows in that it uses COFF, and doesn't emit
.debug_frame on 64-bit architectures.
However, if -elf is appended to the target triple on Cygwin MCJIT remote
tests fail due to `__register_frame` not being defined. Only one test
fails without -elf that succeeds with it, so mark just that test as
XFAIL on Cygwin.
---
llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll | 4 +++-
llvm/test/lit.cfg.py | 14 ++++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll b/llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll
index 513e252a98..9522bfa42a 100644
--- a/llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll
+++ b/llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll
@@ -1,5 +1,7 @@
; RUN: %lli -jit-kind=mcjit -disable-lazy-compilation=false -relocation-model=pic -code-model=small %s
-; XFAIL: target={{(mips|mipsel)-.*}}, target={{(i686|i386).*}}, target={{(aarch64|arm).*}}
+; XFAIL: target={{(mips|mipsel)-.*}}, target={{(i686|i386).*}}, target={{(aarch64|arm).*}}, target={{.*-(cygwin|windows-cygnus)}}
+; This test segfaults on cygwin, but succeeds with cygwin-elf. Unfortunately,
+; cygwin-elf breaks the remote tests due to lack of __register_frame.
define i32 @main() nounwind {
entry:
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index bd6e37c848..2b782b9711 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -100,7 +100,12 @@ lli_args = []
# we don't support COFF in MCJIT well enough for the tests, force ELF format on
# Windows. FIXME: the process target triple should be used here, but this is
# difficult to obtain on Windows.
-if re.search(r"cygwin|windows-gnu|windows-msvc", config.host_triple):
+# Cygwin is excluded from this workaround, even though it is COFF, because this
+# breaks remote tests due to not having a __register_frame function. The only
+# test that succeeds with cygwin-elf but fails with cygwin is
+# test/ExecutionEngine/MCJIT/stubs-sm-pic.ll so this test is marked as XFAIL
+# for cygwin targets.
+if re.search(r"windows-gnu|windows-msvc", config.host_triple):
lli_args = ["-mtriple=" + config.host_triple + "-elf"]
llc_args = []
@@ -377,10 +382,11 @@ if config.target_triple:
else:
config.available_features.add("target-byteorder-little-endian")
-if sys.platform in ["win32"]:
+if sys.platform in ["win32", "cygwin"]:
# ExecutionEngine, no weak symbols in COFF.
config.available_features.add("uses_COFF")
-else:
+
+if sys.platform not in ["win32"]:
# Others/can-execute.txt
config.available_features.add("can-execute")
@@ -651,7 +657,7 @@ if not hasattr(sys, "getwindowsversion") or sys.getwindowsversion().build >= 170
# .debug_frame is not emitted for targeting Windows x64, aarch64/arm64, AIX, or Apple Silicon Mac.
if not re.match(
- r"^(x86_64|aarch64|arm64|powerpc|powerpc64).*-(windows-gnu|windows-msvc|aix)",
+ r"^(x86_64|aarch64|arm64|powerpc|powerpc64).*-(windows-cygnus|windows-gnu|windows-msvc|aix)",
config.target_triple,
) and not re.match(r"^arm64(e)?-apple-(macos|darwin)", config.target_triple):
config.available_features.add("debug_frame")
--
2.51.0.windows.1