Add vlibc scaffold, build system, and documentation

Establish the repository layout per Vox guidelines (layouts/C.md,
building/C.md): Autotools build (GCC-only, C23), five compatibility
profiles (--enable-onlyposix/--enable-muslmimic/--enable-muslext/
--enable-spoof, default vlibc), alongside/overwrite install methods,
vlibc-gcc/vlibc-clang drivers, static-linking requirement (except
spoof), benchmark harness, and tooling (.clang-format/.clang-tidy/
.clangd + compile_commands.json).
This commit is contained in:
2026-08-31 17:06:01 -04:00
parent 3f63ae1cdd
commit 180c1107b6
25 changed files with 17796 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
# Compatibility
vlibc offers five compatibility profiles, selected at configure time. They are
mutually exclusive; the default is `vlibc`.
| Level | Flag | Profile | What it provides |
|-------|----------------------|-------------|---------------------------------------------------------|
| 1 | `--enable-onlyposix` | `onlyposix` | Pure POSIX, nothing more — the lightest possible build. |
| 2 | `--enable-muslmimic` | `muslmimic` | musl-like, still light, with musl-compatible features. |
| 3 | `--enable-muslext` | `muslext` | An extension of musl, adding more. |
| 4 | `--enable-spoof` | `spoof` | A glibc replica: emulates glibc for drop-in compatibility, higher than `muslext` or `vlibc` full. |
| 5 | *(default)* | `vlibc` | glibc-extended: glibc minus its baggage, plus extended standard features. High (but not spoof-level) glibc compatibility. |
## Differences from glibc
- **No legacy baggage.** vlibc targets modern, standard-conforming behavior and
drops glibc's deprecated and non-standard behaviors unless a profile
explicitly restores them.
- **Extended standard features.** The `vlibc` profile adds extensions on top of
the C and POSIX standards that glibc does not provide.
- **Spoofing is opt-in.** The `--enable-spoof` profile re-enables the
long-standing legacy behaviors that scripts rely on, for drop-in
compatibility with existing binaries and build systems.
## Full static linking
Every profile except `spoof` must be able to link fully statically. The
`spoof` profile is exempt: its glibc-emulation layer depends on dynamic
facilities (e.g. `dlopen`-based compatibility shims) that a static build cannot
provide.
+43
View File
@@ -0,0 +1,43 @@
# Install methods
vlibc has two install methods, selected with `--with-install=`.
## Alongside (default)
```sh
./autogen.sh --with-install=alongside
make
make install
```
- Does **not** replace the system libc.
- Installs headers and libraries under a vlibc-specific tree:
`$prefix/lib/vlibc/include` and `$prefix/lib/vlibc/lib`.
- Consuming projects use the shipped drivers:
```sh
vlibc-gcc -o app app.c # GCC backend
vlibc-clang -o app app.c # Clang backend
```
## Overwrite
```sh
./autogen.sh --with-install=overwrite
make
make install
```
- Replaces the system libc in place: headers go to `$prefix/include`, libraries
to `$prefix/lib`.
- The shipped drivers then use the system include/lib paths directly.
## Compiler drivers
`vlibc-gcc` and `vlibc-clang` are thin wrappers generated by `configure`. They
add vlibc's include and library paths (according to the install method) and
delegate to `gcc` / `clang`.
> **Note:** the drivers are currently stubs. Full sysroot handling for
> `overwrite` installs and cross-compilation, and the `-static`/`-lvlibc`
> wiring, are added as the library's ABI matures.
+46
View File
@@ -0,0 +1,46 @@
# Overview
vlibc is Vox's replacement for glibc: a C and POSIX library that is modern,
standard-conforming, and fast. The behavior of the software and its
differences from glibc are documented here so they can be understood without
reading optimized source.
## Goals
- **Replace glibc** for the programs that want a lighter, faster, and cleaner
libc, while retaining high compatibility.
- **Be benchmarkable**: every component is measured against glibc (and musl);
a component slower than what it replaces is considered failing
(`musts/BENCHMARKING.md`).
- **Static-linking first**: fully static linking is a hard requirement for
every profile except `spoof`.
- **Honor user flags**: `CFLAGS` and `LDFLAGS` are respected; the build uses
exactly one compiler (GCC) with no fallback.
## Compatibility profiles
See `docs/compatibility.md` for the five profiles (`onlyposix`, `muslmimic`,
`muslext`, `spoof`, `vlibc`) and their differences from glibc.
## Install methods
See `docs/install.md` for the `alongside` and `overwrite` install methods and
the `vlibc-gcc` / `vlibc-clang` drivers.
## Compiler intent
Static linking pulls a whole library into every binary, which is expensive in
size. To offset this, the public API declares *intent* to the compiler via
attributes such as `__attribute__((const))` and `__attribute__((pure))`. When
the compiler knows a call has no side effects and a predictable result, it can
fold or eliminate it during optimization, shrinking the final binary even when
vlibc is statically linked in full.
This is a deliberate design constraint: every public function carries the
tightest correct intent attribute (see `STYLEGUIDE.md`).
## Status
This repository is currently a stub — the layout, build system, documentation,
and a minimal public API (`vlibc_version()`) are in place. Individual library
components are added incrementally, each with benchmarks.