Description
The clang gnu driver lacks many of options specific to clang-cl, which makes cross-compiling --target=*-pc-windows-msvc
an extreme pain.
- clang does not support
-winsysroot
, which is fine for native compilation, clang can still find the Windows SDK, but it won't work when cross compilation, so users has to hack to provideLIB
INCLUDE
to clang. The UsersManual also mentionsWindowsSdkDir
environment variable, but that is not implemented. - clang does not support
-mguard=cf
and-mguard=ehcont
, so users need to pass-Xclang -cfguard -Xclang -ehcontguard
to cc manually, and then pass-Wl,-guard:ehcont,longjump
to lld-link manually. - clang still use MSVC-style linker (lld-link) when using MSVC target, and silently ignoring
--ld-path
makes it impossible to transparently replace incompatible flags via a wrapper, which makes the clang gnu driver pointless: still incompatible with build systems that unspported MSVC.
My use case is cross compilation, since MinGW can't keep up with modern Windows these days, and even has a long history of antimalware false positives, and is not supported by giants like Google, Microsoft, NVIDIA, etc., I've tried to migrate to Windows SDK, but clang-cl is still not able to build much of what MinGW can build. Although there are vcpkg ports or similar package managers, I prefer to build everything from git master, so any patches and third-party ports are impractical for such use cases.
Ideally, I'd like some interoperability between clang and clang-cl, as well as ld.lld and lld-link, or at least some common options between them.