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

Tomohiro Kashiwada via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 18 19:52:20 PDT 2025


kikairoya wrote:

> * LLD requires passing `-u _Znwm` and other operators explicitly, otherwise [`default_cygwin_cxx_malloc` defined in `libcygwin.a`](https://github.com/mirror/newlib-cygwin/blob/1b7c72fdcc4bde7520407d2d3364146f04fb8312/winsup/cygwin/cxx.cc#L92) pulls wrong reference (at least as of a month ago), due to [different handling of `--wrap` compared to GNU ld](https://maskray.me/blog/2020-12-19-lld-and-gnu-linker-incompatibilities). This may surface in `check-cxx` failures.

This also happened today, and not only with LLD but also with BFD, so "due to different handling of `--wrap` compared to GNU ld" seems wrong. Unfortunately, I couldn't create a minimal reproducer, so I can't tell whether the issue lies in the linkers, libc++, or libcygwin.a.
Other functionalities look good to me; this patch enables bootstrapping using LLD without hacky linker flags.

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


More information about the cfe-commits mailing list