Flash 21 lines
// `linksection("…")`: place a symbol in a named section. The definition side
// of a kernel's layout contract — a large scratch buffer pushed into its own
// NOLOAD section so the loader never touches it, and a .rodata pad pinned
// where the linker script expects it. The attribute sits between the type
// and `=` on a binding (and between the parameter list and any `callconv`
// on a fn); the section name passes through verbatim.
//
// Lives in examples/register/ (post-v0.5 grammar — the frozen stage0
// bootstrap compiler cannot parse it; gated by `zig build fixpoint`).
const SCRATCH_BLOCKS u32 = 128 * 1024
var scratch [#as(usize, SCRATCH_BLOCKS) * 512]u8 linksection(".sdscratch") = undefined
const PAD [4096]u8 linksection(".rodata") = .{0xAB} ** 4096
pub fn keep() *[4096]u8 {
_ = &scratch
return &PAD
}