[clang] [Clang][Driver] Revise Cygwin ToolChain to call linker directly (PR #147960)

via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 11 05:47:36 PDT 2026


================
@@ -684,6 +684,8 @@ static StringRef getArchNameForCompilerRTLib(const ToolChain &TC,
 StringRef ToolChain::getOSLibName() const {
   if (Triple.isOSDarwin())
     return "darwin";
+  if (Triple.isWindowsCygwinEnvironment())
+    return "cygwin";
----------------
tyan0 wrote:

My apologies for replying so late.

ToolChain::getOS() returns "windows", since the Triple is "x86_64-pc-windows-cygnus".

After investigating the issue again, I found that the problem was simply caused by llvm/clang being built with `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON` while compiler-rt was built with `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF`.
Setting both to `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON` works.
Therefore, this fix is not necessary.

However, setting `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF` for both does not work. I still investigation that. It seems that clang ignores `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF`.

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


More information about the cfe-commits mailing list