[llvm] [LLVM] adjust lit.cfg.py for Cygwin (PR #151416)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 1 10:36:27 PDT 2025


https://github.com/jeremyd2019 updated https://github.com/llvm/llvm-project/pull/151416

>From be3a7ee0c89488d8f5d52b9dd6c783d8b1644f23 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github at jdrake.com>
Date: Wed, 30 Jul 2025 15:52:57 -0700
Subject: [PATCH 1/3] [LLVM] adjust lit.cfg.py for Cygwin

Cygwin is like Windows in that it uses COFF, and doesn't emit
.debug_frame on 64-bit architectures.

However, more tests fail if -elf is appended to the target triple on
Cygwin than if it is not, so remove cygwin from that case rather than
adding windows-cygnus to it.
---
 llvm/test/lit.cfg.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 143cc3817bd08..f02f74289dcb4 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -107,7 +107,7 @@ def get_asan_rtlib():
 # 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):
+if re.search(r"windows-gnu|windows-msvc", config.host_triple):
     lli_args = ["-mtriple=" + config.host_triple + "-elf"]
 
 llc_args = []
@@ -385,10 +385,11 @@ def version_int(ver):
     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")
 
@@ -659,7 +660,7 @@ def host_unwind_supports_jit():
 
 # .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")

>From 569965dfcaa1cd9b342dccd98845d57c5f0f7a62 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github at jdrake.com>
Date: Thu, 31 Jul 2025 15:54:20 -0700
Subject: [PATCH 2/3] add comment and XFAIL of cygwin target

---
 llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll | 4 +++-
 llvm/test/lit.cfg.py                            | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll b/llvm/test/ExecutionEngine/MCJIT/stubs-sm-pic.ll
index 513e252a988c1..9522bfa42a456 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 f02f74289dcb4..ca79180ddd420 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -107,6 +107,11 @@ def get_asan_rtlib():
 # 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.
+# 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"]
 

>From a97a2d1a0d5bcda1ed6eb596906e38d690b48ed0 Mon Sep 17 00:00:00 2001
From: Jeremy Drake <github at jdrake.com>
Date: Fri, 1 Aug 2025 10:36:05 -0700
Subject: [PATCH 3/3] super-nitpick

---
 llvm/test/lit.cfg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index ca79180ddd420..c78731a5283bf 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -111,7 +111,7 @@ def get_asan_rtlib():
 # 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
+# for cygwin targets.
 if re.search(r"windows-gnu|windows-msvc", config.host_triple):
     lli_args = ["-mtriple=" + config.host_triple + "-elf"]
 



More information about the llvm-commits mailing list