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

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 13 13:45:32 PDT 2025


================
@@ -1504,6 +1506,7 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
   switch (Type) {
   case ToolChain::CST_Libcxx:
     CmdArgs.push_back("-lc++");
+    CmdArgs.push_back("-lc++abi");
----------------
mstorsjo wrote:

libc++abi and libc++ have circular dependencies - these are fine on ELF platforms, but for PE/COFF they're very problematic. (Theoretically it is possible to link DLLs with circular dependencies, but in practice, we'd rather not do that.)

Therefore, in practice, the most practical solution is to just merge libc++abi into libc++, like we do in all build configurations for mingw. That way, the compiler driver never needs to see or care about libc++abi.

Therefore, I'm against adding a `if (getTriple().isOSWindows()) CmdArgs.push_back("-lc++abi");` - that would significantly break all existing mingw build configurations.

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


More information about the cfe-commits mailing list