Commit 36b70d0
committed
Fix Windows build with LLVM 21 by matching the dynamic C runtime
The clang-builder LLVM 21 Windows libraries are built against the dynamic
UCRT, so their objects reference the C runtime through __imp_* import
stubs. DMD links the static CRT (libcmt) by default, so those stubs went
unresolved (LNK2019 on fputs, _write, _read, round, rand, ...), failing
the link with LNK1120. LDC already defaults to the dynamic runtime, which
is why only DMD failed to link.
- Link DMD against the dynamic runtime on Windows (-mscrtlib=msvcrt) and
add ntdll.lib for RtlGetLastNtStatus, referenced by LLVMSupport.
- Drop the LLVM execution engine / interpreter / JIT libraries from the
static libclang link. libclang never uses them, and they pulled their
own C runtime dependencies in (e.g. LLVMInterpreter's fputs/scanf).
- Move the Windows CI jobs back to LLVM 21.1.8 to exercise the fix.
The include-resolution unit test difference under libclang 21 is a
separate issue and is not addressed here.1 parent d52c4f5 commit 36b70d0
3 files changed
Lines changed: 16 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | 40 | | |
45 | 41 | | |
46 | 42 | | |
| |||
57 | 53 | | |
58 | 54 | | |
59 | 55 | | |
60 | | - | |
| 56 | + | |
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
64 | 60 | | |
65 | 61 | | |
66 | 62 | | |
67 | 63 | | |
68 | | - | |
| 64 | + | |
69 | 65 | | |
70 | 66 | | |
71 | 67 | | |
| |||
83 | 79 | | |
84 | 80 | | |
85 | 81 | | |
86 | | - | |
| 82 | + | |
87 | 83 | | |
88 | 84 | | |
89 | 85 | | |
| |||
145 | 141 | | |
146 | 142 | | |
147 | 143 | | |
148 | | - | |
149 | 144 | | |
150 | 145 | | |
151 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
546 | 546 | | |
547 | 547 | | |
548 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
549 | 558 | | |
550 | 559 | | |
551 | 560 | | |
552 | 561 | | |
| 562 | + | |
553 | 563 | | |
554 | 564 | | |
555 | 565 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
0 commit comments