Freestanding builds
Vile uses the same runtime and both source syntaxes in hosted and freestanding builds. On Linux AMD64 and ARM64, the C backend links a static executable without libc or an ELF interpreter. On macOS AMD64, it links a raw Mach-O executable without libSystem, dyld or imported runtime symbols. macOS ARM64 retains libSystem for startup and platform services.
These builds require V's freestanding arena, native TLS, portable math, descriptor and
synchronization support, in addition to the strings.Buffer API required by Vile.
Use a V checkout containing those changes.
v -cc clang -freestanding -gc none -o vile main.v
./vile -s -e '(+ 20 22)'
./vile -v -e '"hello " + "λ"'
-prod is optional. No source feature flag or restricted Scheme environment is selected.
Libraries, macros, continuations, GOOPS, Unicode, numeric operations and port protocols use
the same compiler and VM. File ports use the standard V descriptor APIs; the syscall-only math
backend uses V's portable math kernels. A host can still register native V callbacks,
reenter either syntax and choose an arena lifetime for the VM and its values.
With -gc none, keep values within their owning arena's lifetime. Copy a result into its
host allocator after popping the region and before resetting or freeing it, as shown in
the arena host example.
Run the integration test with a hosted compiler:
v -gc none freestanding_test.v
It builds and executes debug and production CLI and embedding programs. The embedding
program checks both frontend fixture sets, stored independent big-number and complex-number results,
native reentry, multishot continuations, tail calls, GOOPS, file ports and repeated arena resets.
It also checks live host environment updates across VM arena lifetimes and source includes through
directory symlinks with parent components.
Linux outputs are checked for an ELF interpreter and dynamic library dependencies.
macOS AMD64 outputs must have a raw Mach-O entry point, no dynamic loader or dylib load commands,
and no imported runtime symbols. The gate passes on native macOS AMD64 in debug and production.
The standalone programs keep their checks active under -prod.
The embedding fixture also runs a bounded VM. It saves a closure, rejects a 32 MiB bytevector under a 16 MiB arena limit, and invokes the saved closure. This path requires V's freestanding panic recovery. The native macOS AMD64 gate exercises it in debug and production.
Environment updates use process-owned storage, independent of the active VM arena. Reads return
owned snapshots in the caller's allocator; freeing a VM arena preserves environment changes made
through V's os APIs. Path identities follow symlinks, and loading sources preserves parent
components until the filesystem resolves them. The integration gate covers the Vile runtime and
documented host examples; other V host services need their own validation.
Cross-compilation needs a target C toolchain and its arithmetic runtime. GCC/Clang drivers
that expose an archive through -print-libgcc-file-name are queried with their target and
compile/link flags. For toolchains that do not expose an archive, pass the target runtime
in -ldflags. A compiler runtime built to depend on libc's stack protector or other hosted
services cannot be used as a freestanding runtime unchanged.