diff --git a/.github/workflows/cross-build-test.yml b/.github/workflows/cross-build-test.yml index be57dd3a..0699b233 100644 --- a/.github/workflows/cross-build-test.yml +++ b/.github/workflows/cross-build-test.yml @@ -11,6 +11,7 @@ name: cross-build-test # target | toolchain | host→target | run # ----------------------|----------------------------------|---------------|----- # aarch64-linux-musl | aarch64-linux-musl-gcc@16.1.0 | x86_64→arm64 | qemu +# riscv64-linux-musl | riscv64-linux-musl-gcc@16.1.0 | x86_64→riscv64| qemu # x86_64-w64-mingw32 | mingw-cross-gcc@16.1.0 (MSVCRT) | linux→windows | wine # x86_64-linux-musl | x86_64-linux-musl-gcc@16.1.0 | windows→linux | linux job # @@ -44,8 +45,6 @@ name: cross-build-test # yet inject `-target ` + a cross sysroot for a # clang toolchain; cross `--target` resolves to gcc musl # only. Wire the clang cross path first, then add a row. -# * riscv64-linux-musl: add once xim:riscv64-linux-musl-gcc ships to -# xlings-res + xim-pkgindex. on: push: @@ -70,6 +69,9 @@ jobs: - target: aarch64-linux-musl file_arch: "ARM aarch64" qemu_bin: qemu-aarch64-static + - target: riscv64-linux-musl + file_arch: "UCB RISC-V" + qemu_bin: qemu-riscv64-static env: MCPP_HOME: /home/runner/.mcpp # Verbose every mcpp invocation for richer CI diagnostics (src/cli.cppm). diff --git a/README.md b/README.md index 2e8c76ab..6da9f8d8 100644 --- a/README.md +++ b/README.md @@ -308,7 +308,7 @@ the right toolchain payload is resolved and installed automatically. | `x86_64-windows-gnu` | gcc 16 MinGW-w64 — native on Windows, cross from Linux (wine-verified) *(Windows default without Visual Studio)* | ✅ | | `x86_64-windows-msvc` | `msvc@system` (detected VS/BuildTools) or llvm ¹ *(Windows default with Visual Studio)* | ✅ | | `aarch64-macos` | llvm *(macOS default)* | ✅ | -| `riscv64-linux-musl` | — | 🔄 | +| `riscv64-linux-musl` | gcc 16, fully static — cross from x86_64 (qemu-verified); base `rv64gc`/`lp64d` ISA, optional extensions (`-march=rv64gcv`, Zb*) pass through | ✅ | | `aarch64-linux-gnu` | — | 🔄 | | `x86_64-macos` | — | 🔄 | diff --git a/README.zh-CN.md b/README.zh-CN.md index be4ac637..81795f56 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -303,7 +303,7 @@ mcpp 的身份模型是两条正交轴:**工具链** = `family@version`(family | `x86_64-windows-gnu` | gcc 16 MinGW-w64——Windows 原生,Linux 交叉(wine 实测)(*无 Visual Studio 时的 Windows 默认*) | ✅ | | `x86_64-windows-msvc` | `msvc@system`(探测 VS/BuildTools)或 llvm ¹(*有 Visual Studio 时的 Windows 默认*) | ✅ | | `aarch64-macos` | llvm(*macOS 默认*) | ✅ | -| `riscv64-linux-musl` | — | 🔄 | +| `riscv64-linux-musl` | gcc 16,全静态——x86_64 交叉(qemu 实测);基础 `rv64gc`/`lp64d` ISA,可选扩展(`-march=rv64gcv`、Zb*)自行指定 | ✅ | | `aarch64-linux-gnu` | — | 🔄 | | `x86_64-macos` | — | 🔄 | diff --git a/docs/03-toolchains.md b/docs/03-toolchains.md index 416cadcd..351085eb 100644 --- a/docs/03-toolchains.md +++ b/docs/03-toolchains.md @@ -101,7 +101,8 @@ Targets: * x86_64-linux-musl static gcc 16.1.0 installed x86_64-windows-gnu PE, static, cross gcc 16.1.0 installed aarch64-linux-musl static, cross gcc 16.1.0 available - riscv64-linux-musl static, cross — planned + riscv64-linux-musl static, cross gcc 16.1.0 available + aarch64-linux-gnu cross — planned Available toolchains (run `mcpp toolchain install `): gcc 15.1.0 / 13.3.0 / 11.5.0 / 9.4.0 diff --git a/docs/zh/03-toolchains.md b/docs/zh/03-toolchains.md index 20912eb4..deac0675 100644 --- a/docs/zh/03-toolchains.md +++ b/docs/zh/03-toolchains.md @@ -99,7 +99,8 @@ Targets: * x86_64-linux-musl static gcc 16.1.0 installed x86_64-windows-gnu PE, static, cross gcc 16.1.0 installed aarch64-linux-musl static, cross gcc 16.1.0 available - riscv64-linux-musl static, cross — planned + riscv64-linux-musl static, cross gcc 16.1.0 available + aarch64-linux-gnu cross — planned Available toolchains (run `mcpp toolchain install `): gcc 15.1.0 / 13.3.0 / 11.5.0 / 9.4.0 diff --git a/src/toolchain/triple.cppm b/src/toolchain/triple.cppm index 676ae858..07289711 100644 --- a/src/toolchain/triple.cppm +++ b/src/toolchain/triple.cppm @@ -106,7 +106,7 @@ inline constexpr TargetInfo kKnownTargets[] = { { "x86_64-windows-gnu", "verified", "PE", "gcc@16.1.0", true }, { "x86_64-windows-msvc", "verified", "PE", "", false }, { "aarch64-macos", "verified", "", "", false }, - { "riscv64-linux-musl", "planned", "", "", true }, + { "riscv64-linux-musl", "verified", "", "gcc@16.1.0", true }, { "aarch64-linux-gnu", "planned", "", "", false }, { "x86_64-macos", "planned", "", "", false }, }; diff --git a/tests/e2e/103_target_vocabulary.sh b/tests/e2e/103_target_vocabulary.sh index 0e53f724..914a676c 100755 --- a/tests/e2e/103_target_vocabulary.sh +++ b/tests/e2e/103_target_vocabulary.sh @@ -26,11 +26,23 @@ grep -q "did you mean 'x86_64-linux-musl'" "$TMP/typo.log" || { echo "FAIL: missing did-you-mean suggestion"; cat "$TMP/typo.log"; exit 1; } # ── 2. planned tier: registered but unsupported → error, not a host build ─── -if "$MCPP" build --target riscv64-linux-musl > "$TMP/planned.log" 2>&1; then - echo "FAIL: planned-tier target built"; cat "$TMP/planned.log"; exit 1 +# The target is read out of `toolchain list` rather than hardcoded: this +# assertion is about the TIER, not about any particular triple, and every time a +# target gets promoted the hardcoded spelling stops being planned and the check +# silently becomes a test of something else (riscv64-linux-musl was the second +# one to go that way). +planned=$("$MCPP" toolchain list --no-color 2>/dev/null \ + | awk '$NF == "planned" { print $1; exit }') +if [[ -z "$planned" ]]; then + echo "(no planned-tier target registered — step 2 skipped)" +else + if "$MCPP" build --target "$planned" > "$TMP/planned.log" 2>&1; then + echo "FAIL: planned-tier target '$planned' built"; cat "$TMP/planned.log"; exit 1 + fi + grep -q "not yet supported" "$TMP/planned.log" || { + echo "FAIL: missing planned-tier error for '$planned'" + cat "$TMP/planned.log"; exit 1; } fi -grep -q "not yet supported" "$TMP/planned.log" || { - echo "FAIL: missing planned-tier error"; cat "$TMP/planned.log"; exit 1; } # ── 3. escape hatch: custom triple with an explicit [target.X] section ────── # (pin the host gcc so resolution succeeds; the point is validation lets an diff --git a/tests/unit/test_linkmodel.cpp b/tests/unit/test_linkmodel.cpp index a4f3b5c2..5131e73c 100644 --- a/tests/unit/test_linkmodel.cpp +++ b/tests/unit/test_linkmodel.cpp @@ -42,6 +42,8 @@ TEST(LoaderFilename, TripleMap) { EXPECT_EQ(tc::loader_filename("aarch64-linux-gnu"), "ld-linux-aarch64.so.1"); EXPECT_EQ(tc::loader_filename("x86_64-linux-musl"), "ld-musl-x86_64.so.1"); EXPECT_EQ(tc::loader_filename("aarch64-linux-musl"), "ld-musl-aarch64.so.1"); + EXPECT_EQ(tc::loader_filename("riscv64-linux-musl"), "ld-musl-riscv64.so.1"); + EXPECT_EQ(tc::loader_filename("riscv64-linux-gnu"), "ld-linux-riscv64-lp64d.so.1"); EXPECT_EQ(tc::loader_filename("wasm32-unknown-unknown"), ""); }