<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91216>91216</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang msvc target gnu driver is missing a lot of options
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Andarwinux
</td>
</tr>
</table>
<pre>
The clang gnu driver lacks many of options specific to clang-cl, which makes cross-compiling `--target=*-pc-windows-msvc` an extreme pain.
1. 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 provide `LIB` `INCLUDE` to clang. The UsersManual also mentions `WindowsSdkDir` environment variable, but that is not implemented.
2. 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.
3. 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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VcFy2zgM_Rr5gpFHlhMnPviQxpuOZ5teum33CpOwhJoiNQRl13-_A1F2mk5nL2GiAODDw3sginDjiTbF_YfifjvDIbUhbp68xXhmP_yc7YO9bP5pCYxD30DjB7CRTxTBoTkKdOgvEA4Q-sTBC0hPhg9sIIWcUhpX1M9wbtm00OGRBEwMIqUJX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