Skip to content

feat: the kernel headers are the kernel-abi layer's; platform keys on every row; a row's interfaces; a generated unit's origin - #1006

Open
Sunrisepeak wants to merge 18 commits into
mainfrom
feat/kernel-abi-supplier
Open

Sunrisepeak wants to merge 18 commits into
mainfrom
feat/kernel-abi-supplier

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Implements the mcpp part of the design record .agents/docs/2026-11-22-kernel-interface-and-derived-state-ecosystem-design.md (v6).

The kernel headers (§3.1–§3.9, mcpp#988)

  • The system row's kernel-abi data states how a system's kernel headers are measured (header, version macros, packed widths, layout, package). Linux states it; macOS, Windows and FreeBSD do not, and refuse the prebuilt forms (target-base).
  • [target.<selector>.layers] kernel-abi accepts "xim:linux-headers@<version>" and { path = "<dir>" }. kernel-abi = false states the layer absent.
  • One function decides the headers after the target side: the statement; else the base's own headers; else the toolchain's declared linux-headers. The shared view is neither read nor written. With no answer, the build is refused before it compiles.
  • The decision is measured by preprocessing <linux/version.h>; a stated version that the measurement contradicts is refused. It is wired by the link model with -isystem ahead of the base in every mode. The two former checks (C library name, linux/limits.h presence) are removed.
  • A payload with arch/<arch>/include serves a cross build (xim-pkgindex#1251: linux-headers 6.18.64 revision 1, 7.3.5).

Platform keys on every row (§3.2)

layers, tools and link from the project and config.toml apply on a row without a platform; carrier there is a warning (platform/carrier).

Interfaces (§3.17, mcpp#1005 item 1)

System rows and target rows state interfaces. cfg(interface = …), layers[].interfaces and MCPP_KERNEL_ABI_INTERFACES read the provider's list, then the row's, then the system's.

Generated units (§3.14, mcpp#1004)

mcpp::action::origin() and ide.generated[].origin; a generated unit that declares a module's primary name is module-interface; the duplicate-provider error names the origin relation.

Rows and runners (§3.10, §3.18)

  • riscv64-linux-musl is a preview row: the musl cross payload (gcc@16.1.0) builds it and qemu-user (xim:qemu-user-riscv64@7.2.0) runs it. kernel-abi = false decides and measures no kernel headers.
  • The iOS simulator rows state simctl-run as their runner (xim:apple-simulator-tools@0.3.0), enabled on request.
  • openkal-platform 0.32.0 is the default platform of the openkal rows. A bare-metal row that a platform defines, with or without a machine description, is compiled, linked and verified for its clang-triple (riscv64-none-musl).

Store roots (§3.12)

A build registers a root for each payload of the home store that its graph names (xlings store-roots specification); mcpp cache gc releases the roots unused for --older-than and asks the provider to collect the store. The handshake requires xlings 2026.11.23.1 (store_roots, protocol 1.19); mcpplibs.os 0.4.8 reads the link's own time.

Infrastructure faults (§3.21, mcpp#1007, mcpp#1009)

  • One function gives a row's view under its provider (view_of) for the built-in table, a non-default provider and a platform-defined row; a platform row's linkage = "static" reaches the build, and a DJGPP program packs with no closure.
  • path:<dir> parses as a platform reference, so a path platform's provider is selected.
  • --all-programs on wasm32-emscripten stages every program's module.
  • The ELF closure expands $ORIGIN at the directory the loader opened a library in (mcpp#1009).
  • A macOS link names its target whenever the compile does (x86_64-macos on Apple silicon, asserted under Rosetta in ci-macos-ios).
  • runner = true in [target.<selector>] is a known key.

Tests

  • Unit: modules/toolchain-model/tests/test_kernel_headers.cpp, tests/unit/test_linkmodel.cpp, tests/unit/test_build_directives.cpp, tests/unit/test_elf_runtime.cpp, tests/unit/test_platform.cpp, tests/unit/test_manifest.cpp, tests/unit/test_network.cpp.
  • e2e: tests/e2e/targets/kernel.cpp (1147–1151), tests/e2e/cdb/emit.cpp (1152), tests/e2e/targets/rows.cpp (1153), tests/e2e/web/emscripten.cpp (1155), tests/e2e/pack/modes.cpp (1156), tests/e2e/openkal/platforms.cpp (1157).

Specs: SPEC-002 v1.12, SPEC-004 v1.29, SPEC-005 v1.10, SPEC-006 v0.14, SPEC-013 v1.17, SPEC-016 v1.9.

The release version is filled in by the release commit of this PR.

…ld on every row, a row states its interfaces, a generated unit names its origin

- [target.<selector>.layers] kernel-abi takes "xim:linux-headers@<version>" or { path } on a
  system whose row states how its kernel headers are measured; the headers are decided once after
  the target side, measured by preprocessing, wired ahead of the base with -isystem, and reported
  (layers[].version). Without a statement the base's own headers answer, then the toolchain's
  declaration; the shared view is no longer read or written (mcpp#988).
- The project's and the machine's [target.<selector>] layers, tools and link take effect on a row
  without a platform; carrier there is a warning.
- System and target rows state interfaces; cfg(interface = ...) and layers[].interfaces read the
  provider's list, else the row's, else the system's (mcpp#1005).
- mcpp::action::origin() and ide.generated[].origin; a generated unit that declares a module's
  primary name is its interface (mcpp#1004).
…load 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.
…d on request

The apple provider's device row and simulator rows are two entries: the simulator rows carry runner { simctl-run, same-arch, xim:apple-simulator-tools@0.3.0, enabled = false }. ci-macos-ios asserts the refusal before consent and the run once enabled.
… gc collects the store

A build registers a root (registry/data/roots/mcpp/<store-name>@<version>, xlings' store-roots specification) for each payload of the home store its graph names, by replacing the link so that its own time is the last use; a build that reuses its graph renews them from roots.list. mcpp toolchain install holds the toolchain it installs, and a home without roots has one made for every payload, once. mcpp cache gc releases the roots unused for --older-than and then asks the provider to collect the store; --dry-run removes nothing. The link's own time is read with mcpplibs.os 0.4.8. The kernel-headers refusal names its row as [target.<triple>].
…form's provider is selected, every web program packs its module, $ORIGIN is the directory a library was opened in, and a macOS link names its target (mcpp#1007)

- One function gives a row's view under its provider (view_of), for the built-in table, a
  non-default provider and a row a platform package defines; the latter's `linkage = "static"`
  now reaches the build, and the default pack mode packs a static program of a format without a
  dynamic linker (DJGPP) with no closure.
- `path:<dir>`, the reference text a path platform's provider names its package by, parses; the
  selection no longer leaves that provider out.
- `--all-programs` on wasm32-emscripten stages each program's module.
- The ELF closure model expands `$ORIGIN` at the directory the loader opened a library in, not at
  the target of the link it was reached through (compat.curand under LLVM).
- On a macOS host the link names the target whenever the compile does (x86_64-macos on Apple
  silicon); the row stays planned, its C++ link lacking an x86_64 libc++.
- e2e 103 and 300 take i686 as the planned example now that riscv64-linux-musl is preview;
  new e2e 1155 and 1156, unit tests for both parsers and the closure.
… (store_roots, 2026.11.23.1); roots and the kernel probe narrow no path

- kXlingsVersion is 2026.11.23.1 and the handshake requires `store_roots` (protocol 1.19): an
  earlier xlings collects without reading the roots builds register, so it is refused at the
  handshake rather than asked by `mcpp cache gc`.
- mcpp.provider.roots keeps store names and versions as paths and writes them as UTF-8; the
  kernel-header probe renders its paths with the engine's one spelling (no_escape).
- `kernel-abi.packed` is read by a function of its own (loops nest at most two levels); an
  action's origin is looked up among its inputs with ranges::any_of.
…s; the path-dependency CRC measurement (mcpp#1008)
… its clang-triple, with or without a machine description; runner = true is a known key

- mcpp::freestanding::Spec carries `target`, the row's clang-triple else the row, which every
  `--target=` of a bare-metal compile, link and the c-abi verification probe uses. A defined
  bare-metal row with no `march` and no `link-emulation` resolves to a Spec with its target
  alone; before it resolved to none, and the probe refused riscv64-none-musl.
- The unknown-key sweep of a [target.<selector>] table asks the key's name, not the value's
  type: `runner = true` was reported as unsupported.
- The handshake unit test names `store_roots`.
@Sunrisepeak
Sunrisepeak marked this pull request as ready for review November 23, 2026 07:10
…ires; the pack launchers build on mcpplibs.os 0.4.8
… keys on every row, a row's interfaces, a generated unit's origin, store roots, riscv64-linux-musl and the iOS simulator runner, openkal-platform 0.32.0 (mcpp#988, #1004, #1005, #1007, #1009)
… arch layout links (xim-pkgindex#1251); the surface golden names cache gc --dry-run
…s); e2e 1154 D and 1158 assert every build registers its roots
…oved, and a cut removal's remainder is removed by the next build (e2e 936 H)

This branch has not been deployed

No deployments
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.

1 participant