[clang] [Clang][Driver] Fix compiler-rt library directory for cygwin (PR #208925)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 11 09:26:51 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: tyan0

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/208925.diff


1 Files Affected:

- (modified) clang/lib/Driver/ToolChain.cpp (+2) 


``````````diff
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:

``````````

</details>


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


More information about the cfe-commits mailing list