Commit 6e46b00
feat: support *-pc-windows-gnullvm targets
The winfsp DLL ships only MSVC-format .lib import libraries, but
lld-link (used by both *-pc-windows-msvc and *-pc-windows-gnullvm Rust
toolchains) consumes those COFF imports natively. The previous build
gates on `target_env == "msvc"` and panics on every other env, even
though gnullvm is fully capable of linking against the same archives.
Changes:
* winfsp-sys/build.rs:
- Introduce a `LinkEnv { Msvc, GnuLlvm }` enum so the linkage env
flows through the build script as a typed value rather than
stringly-typed flags. Architecture/clang-target selection and
delay-load syntax both branch on the enum, which flattens the
nested arch/env match logic and makes each case explicit.
- Detect gnullvm via target_env=="gnu" + target_abi=="llvm" and
use mingw clang target strings (`aarch64-w64-mingw32` etc.) for
bindgen so it picks up llvm-mingw's bundled `windows.h` instead
of the absent MSVC SDK headers; struct layout stays MS-ABI.
- Force C11 + auto-include `<assert.h>` for gnullvm so the
`static_assert(...)` in winfsp/fsctl.h parses (mingw clang
defaults to C99).
- Skip `delayimp` on gnullvm (rustc has no search path for it; the
lld-link `--delayload` lowering provides the helper itself).
- Emit `-Wl,--delayload=foo.dll` for gnullvm vs `/DELAYLOAD:foo.dll`
for msvc — ld.lld in mingw mode rejects the MSVC slash form.
- `system()` now tries `SOFTWARE\\WinFsp` as a fallback after
`SOFTWARE\\WOW6432Node\\WinFsp`, so ARM64 native installs (which
register outside WOW6432Node) still resolve headers and libs.
* winfsp/src/init.rs:
- Mirror the typed `LinkEnv` in winfsp_link_delayload, with explicit
Msvc / GnuLlvm cases — no fallthrough to GNU linkage; anything
that isn't one of the two recognised envs panics with
`unsupported triple`.
- Read CARGO_CFG_TARGET_* instead of cfg!() so cross-built build
scripts get the target's view rather than the host's.
- get_system_winfsp() falls back to `SOFTWARE\\WinFsp` after the
WOW6432Node lookup, mirroring the build-time change.1 parent b266475 commit 6e46b00
2 files changed
Lines changed: 142 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
| |||
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
84 | 126 | | |
85 | 127 | | |
86 | 128 | | |
| |||
95 | 137 | | |
96 | 138 | | |
97 | 139 | | |
| 140 | + | |
98 | 141 | | |
99 | 142 | | |
100 | 143 | | |
101 | 144 | | |
102 | 145 | | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
103 | 149 | | |
104 | 150 | | |
105 | 151 | | |
106 | 152 | | |
107 | 153 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
115 | 158 | | |
116 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
117 | 163 | | |
118 | 164 | | |
119 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
120 | 179 | | |
121 | 180 | | |
122 | 181 | | |
| |||
142 | 201 | | |
143 | 202 | | |
144 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
145 | 216 | | |
146 | 217 | | |
147 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
45 | 43 | | |
46 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
116 | 136 | | |
117 | 137 | | |
118 | | - | |
| 138 | + | |
| 139 | + | |
119 | 140 | | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
128 | 161 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
132 | 170 | | |
133 | | - | |
134 | | - | |
135 | 171 | | |
136 | 172 | | |
0 commit comments