Skip to content

feat: std-freestanding 0.2.0 + riscv-virt-rt 0.3.0 — the target owns its C library - #220

Draft
Sunrisepeak wants to merge 2 commits into
mainfrom
feat/std-freestanding
Draft

feat: std-freestanding 0.2.0 + riscv-virt-rt 0.3.0 — the target owns its C library#220
Sunrisepeak wants to merge 2 commits into
mainfrom
feat/std-freestanding

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Aug 19, 2026

Copy link
Copy Markdown
Member

Both packages declared xim:picolibc-riscv@1.8.12, and the standard-library
subset also declared xim:llvm. That pinned a board package and an
implementation-neutral library alike to one C library, one architecture, one
toolchain and one version of each — none of which is a property of either.

mcpp 2026.8.19.4 resolves the target's C library from the target's own row, the
way it resolves the compiler: a hosted project never declared glibc, and a
bare-metal one no longer declares picolibc. So:

  • std-freestanding 0.2.0 declares NOTHING. It asks mcpp where the toolchain's
    headers are, and the target's C headers are already on the compile line.
  • riscv-virt-rt 0.3.0 declares only the emulator, which is the one xim
    package that really is a board fact. Its linker line is bare names now,
    because the search path is there before it says anything.

riscv-virt-rt 0.1.0 and 0.2.0 stay listed — published versions someone may have
pinned. std-freestanding 0.1.0 is replaced rather than kept: it never reached
this index, and it is wrong by construction.

Both new versions require mcpp >= 2026.8.19.4.

…d library

`import std;` is one module over the whole library, so there is no subset of IT
to build without an OS — mcpp turns it off on a freestanding target and says
so. But libc++'s HEADERS are almost entirely freestanding-capable already; what
stops them is one per-target file, `__config_site`, which the toolchain ships
only for its own host triple. Synthesising that file is this package's job.

103 of libc++'s 110 headers compile for riscv64-none-elf. The other 7
(generator, hazard_pointer, rcu, spanstream, stacktrace, stdfloat,
text_encoding) fail on an x86_64 host with full libc++ and glibc too — they are
headers libc++ has not implemented, so the freestanding loss at compile time is
zero. The package's regeneration script prints that control group on every run.

Verified running under qemu: array, span, optional, atomic, string_view, and
ranges::sort with a projection.

`xim:llvm` is an install-time dependency because that is where libc++'s headers
live. Nothing is linked from it — the package includes them privately and
exports a module — but without the payload there is nothing to include, and the
failure would surface as "file not found" inside a module compile instead of as
a missing dependency.

Requires mcpp >= 2026.8.19.4: earlier versions do not put `-fno-exceptions` on
a freestanding target, and `std::optional::value()` alone then pulls in
`__cxa_throw` and three more symbols that cannot exist without an unwinder.
@Sunrisepeak
Sunrisepeak marked this pull request as draft August 19, 2026 05:01
…its C library

Both packages declared `xim:picolibc-riscv@1.8.12`, and the standard-library
subset also declared `xim:llvm`. That pinned a board package and an
implementation-neutral library alike to one C library, one architecture, one
toolchain and one version of each — none of which is a property of either.

mcpp 2026.8.19.4 resolves the target's C library from the target's own row, the
way it resolves the compiler: a hosted project never declared glibc, and a
bare-metal one no longer declares picolibc. So:

  * std-freestanding 0.2.0 declares NOTHING. It asks mcpp where the toolchain's
    headers are, and the target's C headers are already on the compile line.
  * riscv-virt-rt 0.3.0 declares only the emulator, which is the one xim
    package that really is a board fact. Its linker line is bare names now,
    because the search path is there before it says anything.

riscv-virt-rt 0.1.0 and 0.2.0 stay listed — published versions someone may have
pinned. std-freestanding 0.1.0 is replaced rather than kept: it never reached
this index, and it is wrong by construction.

Both new versions require mcpp >= 2026.8.19.4.
@Sunrisepeak Sunrisepeak changed the title feat: std-freestanding 0.1.0 — the freestanding subset of the standard library feat: std-freestanding 0.2.0 + riscv-virt-rt 0.3.0 — the target owns its C library Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants