You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9cd8638
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/22-target-side.md
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -361,11 +361,42 @@ that names no C library:
361
361
| Target | Request | Realisation |
362
362
|---|---|---|
363
363
| Linux |`posix` / `arch-default`| the default triple already satisfies it |
364
-
| macOS |`posix` / `arch-default`| the default triple already satisfies it |
364
+
| macOS |`posix` / `arch-default`| one token, `-D__unix__` — Apple's clang predefines `__APPLE__`/`__MACH__` on its default triple, never `__unix__`|
365
+
| freestanding |`posix` / `arch-default`| the same one token, `-D__unix__`, for the same reason: nothing here defines it either |
365
366
| Windows |`posix` / `arch-default`| Cygwin-flavoured: `--target=x86_64-pc-cygwin` on the compile line only; `__CYGWIN__`/`__CYGWIN32__` are left defined (see the note below); `data-model` becomes LP64 as a consequence of the triple, not a separate flag |
366
367
| any |`builtins = "iso"`| turns off code-generation idioms that assume a platform C library — `-fno-builtin-memset_pattern16` on Apple targets is the one this survey measured; see `src/toolchain/cenv.cppm` for what else was checked and found not to apply |
367
368
| anything else || refused, naming the target, the request and what is missing — never a silent downgrade |
368
369
370
+
**The macOS and freestanding rows are a correction, not the design's original
371
+
text (coordinator revision, caught by real builds within a day of
372
+
2026.9.18.1 shipping).** The rule realising `presents = "posix"` follows is:
373
+
the SAME observable fact on every target — `__unix__` defined, `_WIN32`
374
+
not — and targets differ only in what realising it COSTS. The original text
375
+
assumed macOS's default triple already presented it, the way Linux's does;
376
+
the verification probe (below) caught that assumption as false on a real
377
+
build — declared defined, measured undefined — which is precisely the class
378
+
of error that probe exists to catch. The original text also refused a
379
+
freestanding target outright for asking `presents = "posix"` at all, which
380
+
blocked a whole target (`riscv64-none-elf`, openkal-llvm-runtime) rather
381
+
than realising a fact this engine can in fact deliver: a freestanding target
382
+
starts with neither macro defined, exactly like macOS's default triple, so
383
+
the fix costs it the identical token. Known cost, left to the mcpp-index
384
+
30-member measurement to weigh: portable code written
385
+
`#ifdef __unix__ ... #elif defined(__APPLE__)` now takes the Unix branch on
386
+
macOS too, correct only if that branch is written to also be correct there.
387
+
388
+
**A compiler is refused only when the realisation actually needs a token it
389
+
cannot take — not merely because `[c-abi]` is declared.**`cenv::realise`
390
+
(above) runs first, as a pure function of the declaration and the target;
391
+
the Clang-only requirement is checked second, and only fires when the
392
+
resulting tokens are non-empty. openkal-musl's own declaration on Linux —
0 commit comments