https://github.com/tyan0 created 
https://github.com/llvm/llvm-project/pull/208925

If compiler-rt is built with `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF`, its 
search directory is incorrect.

Specifically, `ToolChain::getOSLibName()` returns `windows` instead of `cygwin` 
in a Cygwin environment, due to falling back to getOS(). This results in a link 
error against compiler-rt.

This patch makes `getOSLibName()` return `cygwin`, ensuring that compiler-rt is 
linked correctly.

>From c528a4f05c0039c5a67ae82fd569ac71ccdfec31 Mon Sep 17 00:00:00 2001
From: Takashi Yano <[email protected]>
Date: Sun, 12 Jul 2026 01:00:33 +0900
Subject: [PATCH] Fix compiler-rt library directory for cygwin

If compiler-rt is built with LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF,
its search directory is incorrect.

Specifically, ToolChain::getOSLibName() returns `windows` instead
of `cygwin` in a Cygwin environment, due to falling back to getOS().
This results in a link error against compiler-rt.

This patch makes getOSLibName() return `cygwin`, ensuring that
compiler-rt is linked correctly.

Signed-off-by: Takashi Yano <[email protected]>
---
 clang/lib/Driver/ToolChain.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 3f9b808b2722e..745275a236ed3 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -684,6 +684,8 @@ static StringRef getArchNameForCompilerRTLib(const 
ToolChain &TC,
 StringRef ToolChain::getOSLibName() const {
   if (Triple.isOSDarwin())
     return "darwin";
+  if (Triple.isWindowsCygwinEnvironment())
+    return "cygwin";
 
   switch (Triple.getOS()) {
   case llvm::Triple::FreeBSD:

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to