53c8531eabb96b1d0ca216f9ac8664c6df198002
System-headers-only harness timing the five L1 string functions (strlen, strcmp, memcpy, memmove, memset) at 8- and 64-byte inputs. Calls go through volatile function pointers to defeat builtin substitution and LICM hoisting; correctness self-asserts route through the same pointers. Prints FUNC@SIZE ns/call lines. bench_string uses empty per-target CPPFLAGS (no -I include) so it links against whichever libc --with-libc= selects; the bench target runs it always and bench_vlibc only under BENCH_LINK_VLIBC. Both programs relink when config.status changes, so a reconfigure cannot silently reuse a binary from the previous libc. Measured vs glibc 2.44 (median of 3 runs): mem* 1.0-3.3x, strlen/strcmp 3.2-3.9x — word-at-a-time vs AVX2, all sane. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <[email protected]>
vlibc
A modern replacement for glibc: a performant, standard-conforming C library with modern extensions and high glibc compatibility.
vlibc is written in C (C23, with C2y/C29 opt-in), built with Autotools and a single compiler (GCC, no fallback). Full static linking is a first-class, required capability.
Capabilities
- Five compatibility profiles, from the lightest to the most compatible:
--enable-onlyposix— pure POSIX, nothing more.--enable-muslmimic— musl-like, light and musl-compatible.--enable-muslext— musl-extended.--enable-spoof— a glibc replica, for drop-in compatibility with scripts and programs that rely on long-standing glibc behavior.- (default) — vlibc: glibc-extended, without the spoofing layer, but with extended standard features and high glibc compatibility.
- Profiles 1-3 are functional.
--enable-onlyposix,--enable-muslmimic, and--enable-muslextbuild with real build-time profile gating: a generatedinclude/vlibc/features.hexposesVLIBC_LEVEL, the public<stddef.h>and<string.h>headers are gated by it, and an initial string slice (memcpy,memmove,memset,strlen,strcmp,strlcpy,strlcat,strcasestr) is compiled per level. Profiles 4 and 5 (spoof,vlibc) remain configure-level declarations in this increment. - Two install methods (
--with-install=):alongside(default) — install next to the system libc, under a vlibc-specific tree; the system libc is left untouched.overwrite— replace the system libc in place.
vlibc-gccandvlibc-clangcompiler drivers, so consuming projects build against vlibc with either compiler.- Full static linking is required for every profile except
spoof. - Compiler intent is declared on the public API (e.g.
__attribute__((const))) so the compiler can fold and eliminate calls, keeping statically linked binaries small.
Build
./autogen.sh # regenerate build system + configure
make # build
make debug # build with -O0 -g3 into bin/debug/
make release # build with -O3 into bin/release/
make bench # build and run benchmarks
make clean # remove build artifacts
make compile-commands # regenerate compile_commands.json (needs bear)
Common configure options:
./autogen.sh --enable-spoof # glibc replica profile
./autogen.sh --with-install=overwrite # replace system libc
./autogen.sh --with-libc=glibc # benchmark against glibc
./autogen.sh --enable-c29 # experimental C2y (C29)
User-provided CFLAGS and LDFLAGS are honored.
Layout
include/ public headers (mandatory)
src/ implementation sources
benchmarks/ benchmark harnesses (vs. glibc/musl)
docs/ behavior and glibc-difference documentation
thirdparty/ vendored third-party libraries
tools/ vlibc-gcc / vlibc-clang driver templates
bin/{release,debug}/ build outputs
Documentation
docs/overview.md— what vlibc is and how it behaves.docs/compatibility.md— the five profiles and glibc differences.docs/install.md— the two install methods.CONTRIBUTING.md— how to contribute.STYLEGUIDE.md— how code should look.
Languages
C
96.9%
Makefile
1.7%
Assembly
0.6%
M4
0.5%
Shell
0.3%