@@ -323,14 +323,28 @@ obligation rather than a convenience: `memcpy`, `memmove`, `memset` and `memcmp`
323323must exist because the compiler lowers structure assignment and array
324324initialisation onto them. ` std-freestanding-nolibc ` supplies those and ` strlen ` .
325325
326- ⚠️ ` std-freestanding ` and ` std-freestanding-nolibc ` serve ** mutually exclusive**
327- arrangements. The subset needs the C library's headers — measured: on the
328- zero-libc tier it fails at compile with ` 'inttypes.h' file not found ` — so a
329- project that can use the subset has a C library and does not need the five
330- functions, while a project on the zero-libc tier cannot use the subset at all.
331-
332- ⚠️ That package is for the zero-libc tier only, and using it alongside a C
333- library fails silently rather than loudly. A C library ships as an archive, and
326+ The subset composes with this tier rather than excluding it. ` std-freestanding `
327+ with ` features = ["nolibc"] ` compiles against no C library at all, and measured,
328+ ** 94 of its 103 headers** do. The obstacle was never that the subset wants a C
329+ library: libc++ ships wrappers for the C headers — ` string.h ` and its siblings —
330+ which reach the real header through ` #include_next ` to obtain ` size_t ` ,
331+ ` mbstate_t ` , ` time_t ` and ` EOF ` . With no C library the chain has nothing to
332+ continue to, and the wrapper fails on a missing * type* rather than a missing
333+ header, which is why the cause is not evident from the error. Four small headers
334+ restore the chain, and the feature is what pulls them in.
335+
336+ A board-support package can serve this tier too, and for the same reason it is
337+ worth having one at all. Where a machine's UART is, where its RAM begins and
338+ which emulator boots it are not C library facts:
339+
340+ ``` toml
341+ [dependencies ]
342+ riscv-virt-rt = { version = " 0.5.0" , features = [" nolibc" ] }
343+ ```
344+
345+ ⚠️ ` std-freestanding-nolibc ` is what that feature resolves to, and adding it
346+ ** directly** alongside a C library fails silently rather than loudly. A C library
347+ ships as an archive, and
334348an archive member is pulled only while the symbol is still undefined; a
335349dependency package's object files enter the link unconditionally. The package
336350therefore defines ` memcpy ` first, the C library's member is never pulled, and
0 commit comments