RustForge

foundry

Foundry OS: the operating system built on the Rustbelt kernel

foundry / c / README.md
973 bytes ยท raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# c/: small C programs of our own

Built by `make` (target `cprogs`) with `toolchain/foundry-cc`: gcc + our
musl (`make musl` builds it into `out/sysroot`), as **static-PIEs**. They
are installed in `/bin` and the self-test runs them (the "Foundry OS" block
at the end of `rootfs/scripts/selftest.sh`; expected output in
`scripts/expect-foundry.txt`).

- `hello-musl.c`: prints `hello from musl on Rustbelt 0.21.0 (Foundry OS, static-PIE)`.
- `fprobe.c`: the libc self-check, a small, deterministic cousin of
  Clarke's `mprobe2` probe (clarke-scratch/exp16..exp19). 40 checks: ELF
  and auxv, files in /tmp, fork/exec/wait, pipes, signals, threads and
  TLS, mmap/mremap/malloc, clocks, and timerfd (new in Rustbelt 0.20.0).
  Each prints `ok` or `FAIL`; the last line is `fprobe: all 40 checks passed`.

Both also run on a Linux PC: `toolchain/foundry-cc -O2 -pthread c/fprobe.c -o out/fprobe && out/fprobe`.

Adding a program: see docs/porting.md, "Our own C programs".