Commit f661260
committed
fix cenv: the freestanding branch must emit -fno-short-wchar unconditionally
bb0437d dropped the freestanding ? 32 : native_wchar_bits(os) special
case that 7097acd had added, on the grounds that it was wrong on
Windows hosts. That is right for the -U_<WIN32>-stripped probe, but
for the REAL compile (the one whose cflags the engine broadcasts to
the package's own translation units) the toolchain's freestanding
default on Windows is host-contaminated: clang on Windows emits a
16-bit wchar_t by default for -target=riscv64-none-elf unless told
otherwise. So a declaration of wchar=32 needs -fno-short-wchar on
every freestanding target regardless of what native_wchar_bits(os)
says, and the previous "if (decl.wcharBits != native)" gate lets a
32-bit declaration through to a 16-bit compile on Windows freestanding.
Symmetric for wchar=16: a freestanding Linux/macOS host's default
wchar is 32, and the declaration 16 needs -fshort-wchar. The
"hosted" branch (the else-if) keeps the old behaviour; only the
freestanding branch is restructured.
Verified locally with openkal-musl#37 and openkal-llvm-runtime#24's
matrix against mcpp built from this branch.1 parent 534b1ee commit f661260
1 file changed
Lines changed: 27 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
391 | 395 | | |
392 | 396 | | |
393 | | - | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
398 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
399 | 404 | | |
400 | | - | |
401 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
402 | 416 | | |
403 | 417 | | |
404 | 418 | | |
| |||
0 commit comments