Skip to content

Commit 54ae9ef

Browse files
committed
feat: riscv64-linux-musl is a preview row built by the musl cross payload and run under qemu-user; kernel-abi = false decides no headers
The row's provider pins gcc@16.1.0 and states its runner (xim:qemu-user-riscv64@7.2.0, linux-x86_64). The snapshot records the new tier, the pin and the requests it answers; the linux-musl set now includes the row. A statement of kernel-abi = false, as a freestanding platform writes, decides and measures no kernel headers.
1 parent cdf43d3 commit 54ae9ef

13 files changed

Lines changed: 71 additions & 29 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
start) and on `wasm32-emscripten`. `cfg(interface = "...")` reads the provider's list, else the
2525
row's, else the system's, so it holds on a row without openkal as well. The same list is in
2626
`layers[].interfaces` and `MCPP_KERNEL_ABI_INTERFACES` (mcpp#1005).
27+
- `riscv64-linux-musl` is a `preview` row: the musl cross payload `gcc@16.1.0` builds it on a
28+
Linux x86_64 machine, and `mcpp run` starts its static programs under qemu-user
29+
(`xim:qemu-user-riscv64@7.2.0`, installed on the first run). The `linux-musl` target set now
30+
includes it (mcpp#1005).
2731
- `mcpp::action::origin(path)` names the authored file a generated unit is a transformed copy
2832
of, one of the action's inputs, on a `source` action. The build database gives it as
2933
`ide.generated[].origin`. A generated unit that declares a module's primary name is a

‎README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ list` reports for this machine):
458458
| `aarch64-windows-gnu` | llvm 23 with `xim:mingw-w64-sysroot` (llvm-mingw's target side) — built on any host; the same base serves `x86_64-windows-gnu` where no gcc payload exists | preview |
459459
| `x86_64-freebsd` · `aarch64-freebsd` | the platform that serves them, over `xim:<arch>-freebsd-sysroot` ([22](docs/22-target-side.md)) | preview |
460460
| `x86_64-freebsd-musl` · `aarch64-freebsd-musl` | llvm 23 — a static FreeBSD program with a musl C library over openkal-freebsd, built on any host *(what `<arch>-freebsd` is with no platform chosen)* | preview |
461-
| `riscv64-linux-musl` · `x86_64-macos` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
461+
| `riscv64-linux-musl` | gcc 16 musl cross from Linux x86_64; `mcpp run` starts it under qemu-user (`xim:qemu-user-riscv64`) | preview |
462+
| `x86_64-macos` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
462463
| `x86_64-openkal` · `aarch64-openkal` | llvm 23 — an ok image: one artifact per architecture, run by `okrun` on Linux, macOS and Windows; the C library and C++ run-time inside it are packages ([24](docs/24-openkal-cross.md)) | verified |
463464
| `wasm32-emscripten` | `emsdk@6.0.9` — Emscripten ships its own sysroot and its own libc++ module surface; `mcpp run` executes the module with the `node` the payload declares (`xim:node`), not one found on PATH | verified |
464465
| `x86_64-linux-android` | `android-ndk@30.0.16248370` — bionic from the NDK, one payload for both ABIs; ran on an API 24 x86_64 emulator image | verified |

‎README.zh-CN.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ mcpp 的身份模型有两条正交的轴:**工具链**是 `family@version`(
407407
| `aarch64-windows-gnu` | llvm 23 加 `xim:mingw-w64-sysroot`(llvm-mingw 的目标侧);任意宿主可构建;没有 gcc 载荷之处同一基座也服务 `x86_64-windows-gnu` | preview |
408408
| `x86_64-freebsd` · `aarch64-freebsd` | 服务它们的平台,基于 `xim:<arch>-freebsd-sysroot`([22](docs/zh/22-target-side.md)) | preview |
409409
| `x86_64-freebsd-musl` · `aarch64-freebsd-musl` | llvm 23;openkal-freebsd 之上带 musl C 库的静态 FreeBSD 程序,任意宿主可构建 *(未选平台时 `<arch>-freebsd` 即此身份)* | preview |
410-
| `riscv64-linux-musl` · `x86_64-macos` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
410+
| `riscv64-linux-musl` | gcc 16 musl 交叉工具链,宿主为 Linux x86_64;`mcpp run` 经 qemu-user(`xim:qemu-user-riscv64`)启动 | preview |
411+
| `x86_64-macos` · `i686-linux-musl` · `i686-linux-gnu` · `i686-openkal` | — | planned |
411412
| `x86_64-openkal` · `aarch64-openkal` | llvm 23;ok 映像:每种架构一个产物,由 `okrun` 在 Linux、macOS 与 Windows 上运行;映像内的 C 库与 C++ 运行时是包([24](docs/zh/24-openkal-cross.md)) | verified |
412413
| `wasm32-emscripten` | `emsdk@6.0.9`;Emscripten 自带 sysroot 与 libc++ 模块接口;`mcpp run` 使用 payload 声明的 `node`(`xim:node`)运行模块,不使用 PATH 上的 `node` | verified |
413414
| `x86_64-linux-android` | `android-ndk@30.0.16248370`;bionic 来自 NDK,一个 payload 服务两个 ABI;已在 API 24 的 x86_64 模拟器镜像上运行 | verified |

‎docs/20-toolchains.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Targets:
346346
* x86_64-linux-musl static gcc 16.1.0 installed
347347
x86_64-windows-gnu PE, static, cross gcc 16.1.0 installed
348348
aarch64-linux-musl static, cross gcc 16.1.0 available
349-
riscv64-linux-musl static, cross — planned
349+
riscv64-linux-musl static, cross gcc 16.1.0 available
350350
351351
Available toolchains (run `mcpp toolchain install <family> <version>`):
352352
gcc 15.1.0 / 13.3.0 / 11.5.0 / 9.4.0

‎docs/21-the-target-triple.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ this mcpp builds. The environment is completed as above (`linux` is
212212
| Set | Members (2026.10.30.1, openkal-platform 0.18.0) |
213213
|---|---|
214214
| `openkal` | `x86_64-openkal`, `aarch64-openkal` |
215-
| `linux-musl` | `x86_64-linux-musl`, `aarch64-linux-musl` |
215+
| `linux-musl` | `x86_64-linux-musl`, `aarch64-linux-musl`, `riscv64-linux-musl` |
216216
| `linux` | `x86_64-linux-gnu`, `aarch64-linux-gnu` |
217217

218218
Every member must select the same platform; a set whose members select
@@ -545,7 +545,7 @@ provider's runner ([41](41-devices.md)).
545545
| `aarch64-linux-gnu` | preview | `llvm@23.1.3` | base package | payload | — | — |
546546
| `x86_64-linux-musl` | verified | `gcc@16.1.0` | payload | payload | — | payload |
547547
| `aarch64-linux-musl` | verified | `gcc@16.1.0` | payload | payload | — | — |
548-
| `riscv64-linux-musl` | planned | — | planned | planned | planned | planned |
548+
| `riscv64-linux-musl` | preview | `gcc@16.1.0` | payload | — | — | — |
549549
| `i686-linux-musl`, `i686-linux-gnu` | planned | — | planned | planned | planned | planned |
550550
| `x86_64-windows-gnu` | verified | `gcc@16.1.0` | payload | payload | base | payload |
551551
| `aarch64-windows-gnu` | preview | `llvm@23.1.3` | base | base | base | base |

‎docs/specs/target-sets.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
| 写法 | 展开(mcpp 2026.10.30.1 的目标表与 openkal-platform 0.18.0) |
5353
|---|---|
5454
| `openkal` | `x86_64-openkal`、`aarch64-openkal` |
55-
| `linux-musl` | `x86_64-linux-musl`、`aarch64-linux-musl`(`planned` 的行不在内) |
55+
| `linux-musl` | `x86_64-linux-musl`、`aarch64-linux-musl`、`riscv64-linux-musl`(`planned` 的行不在内) |
5656
| `linux` | `x86_64-linux-gnu`、`aarch64-linux-gnu` |
5757

5858
### 1.4 一条命令的腿

‎docs/zh/20-toolchains.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Targets:
293293
* x86_64-linux-musl static gcc 16.1.0 installed
294294
x86_64-windows-gnu PE, static, cross gcc 16.1.0 installed
295295
aarch64-linux-musl static, cross gcc 16.1.0 available
296-
riscv64-linux-musl static, cross — planned
296+
riscv64-linux-musl static, cross gcc 16.1.0 available
297297
298298
Available toolchains (run `mcpp toolchain install <family> <version>`):
299299
gcc 15.1.0 / 13.3.0 / 11.5.0 / 9.4.0

‎docs/zh/21-the-target-triple.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ mcpp 构建的全部行。环境按上一节补全(`linux` 即 `linux-gnu`,`
188188
| 集合 | 成员(2026.10.30.1,openkal-platform 0.18.0) |
189189
|---|---|
190190
| `openkal` | `x86_64-openkal`、`aarch64-openkal` |
191-
| `linux-musl` | `x86_64-linux-musl`、`aarch64-linux-musl` |
191+
| `linux-musl` | `x86_64-linux-musl`、`aarch64-linux-musl`、`riscv64-linux-musl` |
192192
| `linux` | `x86_64-linux-gnu`、`aarch64-linux-gnu` |
193193

194194
全部成员必须选到同一个平台;成员选到不同平台时命令被拒绝,消息写出每个成员
@@ -495,7 +495,7 @@ docs/22。
495495
| `aarch64-linux-gnu` | preview | `llvm@23.1.3` | 基座包 | 载荷 | — | — |
496496
| `x86_64-linux-musl` | verified | `gcc@16.1.0` | 载荷 | 载荷 | — | 载荷 |
497497
| `aarch64-linux-musl` | verified | `gcc@16.1.0` | 载荷 | 载荷 | — | — |
498-
| `riscv64-linux-musl` | planned | — | planned | planned | planned | planned |
498+
| `riscv64-linux-musl` | preview | `gcc@16.1.0` | payload | — | — | — |
499499
| `i686-linux-musl`、`i686-linux-gnu` | planned | — | planned | planned | planned | planned |
500500
| `x86_64-windows-gnu` | verified | `gcc@16.1.0` | 载荷 | 载荷 | 基座 | 载荷 |
501501
| `aarch64-windows-gnu` | preview | `llvm@23.1.3` | 基座 | 基座 | 基座 | 基座 |

‎modules/toolchain-model/data/builtin.toml‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,12 @@ triple = "aarch64-macos-musl"
219219
tier = "preview"
220220
standard = false
221221

222+
# Served by the musl cross payload from x86_64 and run there under qemu-user
223+
# (design 2026-11-22 §3.19): measured building, linking statically and running.
222224
[[platform.define]]
223225
triple = "riscv64-linux-musl"
224226
loader = "/lib/ld-musl-riscv64.so.1"
225-
tier = "planned"
227+
tier = "preview"
226228
standard = true
227229

228230
# 32-BIT ROWS (E11): registered intent, refused until served. No payload of the
@@ -622,11 +624,13 @@ toolchain = "gcc@16.1.0"
622624
linkage = "static"
623625

624626
[[platform.provider]]
625-
name = "musl-gcc"
626-
serves = ["riscv64-linux-musl"]
627-
priority = 100
628-
hosts = ["linux-{arch}", "linux-x86_64"]
629-
linkage = "static"
627+
name = "musl-gcc"
628+
serves = ["riscv64-linux-musl"]
629+
priority = 100
630+
hosts = ["linux-{arch}", "linux-x86_64"]
631+
toolchain = "gcc@16.1.0"
632+
linkage = "static"
633+
runner = { cmd = ["qemu-riscv64-static", "{}"], hosts = ["linux-x86_64"], requires = ["xim:qemu-user-riscv64@7.2.0"] }
630634

631635
# MinGW-w64: gcc, or clang with the payload as its sysroot (SPEC-016 §6).
632636
# On an x86_64 Linux machine a Windows program runs through Wine (design

‎tests/e2e/openkal/sets.cpp‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ void needs_image_row() {
3131
// The system's word of a POSIX launcher (`case "$(uname -s)"`), or "".
3232
std::string posix_system() { return s::on_linux() ? "linux" : s::on_macos() ? "macos" : ""; }
3333

34-
std::uint32_t machine_of(std::string_view arch) { return arch == "x86_64" ? s::elf_machine::x86_64 : s::elf_machine::aarch64; }
34+
std::uint32_t machine_of(std::string_view arch) {
35+
return arch == "x86_64" ? s::elf_machine::x86_64 : arch == "riscv64" ? s::elf_machine::riscv : s::elf_machine::aarch64;
36+
}
3537

3638
// `env -i HOME="$HOME" PATH=/usr/bin:/bin <program> <args>`: the program with nothing installed.
3739
e2e::outcome run_bare(const fs::path& program, std::vector<std::string> args) {
@@ -297,7 +299,7 @@ E2E sets{"sets", s::home_fixture, timeout{std::chrono::minutes{45}}, [] {
297299
};
298300

299301
"984 a set of programs is a package per leg"_test[s::gcc][s::python3] = [] {
300-
// `--target linux-musl`: A a package per leg named by its triple below the `-o`
302+
// `--target linux-musl` (x86_64, aarch64, riscv64): A a package per leg named by its triple below the `-o`
301303
// directory, each holding the program of its architecture; B `-o` naming one file is
302304
// refused before a build; C the JSON envelope lists both packages and legs.
303305
if (!s::on_linux()) skip("the linux-musl rows are built on Linux");
@@ -307,7 +309,7 @@ E2E sets{"sets", s::home_fixture, timeout{std::chrono::minutes{45}}, [] {
307309
if (!e2e::succeeded(r) && s::has_line(s::text(r), "cannot be built on this host|install_packages failed|not found in the synced index"))
308310
skip("a linux-musl row cannot be built here");
309311
expect(fatal(e2e::succeeded(r))) << "A: pack --target linux-musl: " << s::text(r);
310-
for (std::string_view arch : {"x86_64", "aarch64"}) {
312+
for (std::string_view arch : {"x86_64", "aarch64", "riscv64"}) {
311313
const auto f = app.at(std::format("out/per-0.1.0-{}-linux-musl-static.tar.gz", arch));
312314
expect(fatal(fs::is_regular_file(f))) << "A: no " << f << ": " << s::text(r);
313315
std::string member;
@@ -330,8 +332,8 @@ E2E sets{"sets", s::home_fixture, timeout{std::chrono::minutes{45}}, [] {
330332
const auto d = s::json(r.out)["data"];
331333
auto legs = strings(d["legs"]);
332334
std::ranges::sort(legs);
333-
expect(fatal(legs == std::vector<std::string>{"aarch64-linux-musl", "x86_64-linux-musl"})) << "C: " << d["legs"].dump();
334-
expect(fatal(d["artifacts"].size() == 2u)) << "C: " << d["artifacts"].dump();
335+
expect(fatal(legs == std::vector<std::string>{"aarch64-linux-musl", "riscv64-linux-musl", "x86_64-linux-musl"})) << "C: " << d["legs"].dump();
336+
expect(fatal(d["artifacts"].size() == 3u)) << "C: " << d["artifacts"].dump();
335337
};
336338

337339
"985 a format list writes each container of one tree"_test[s::llvm][s::python3][s::unix_shell] = [] {

0 commit comments

Comments
 (0)