| Flag | Meaning |
--target <system-arch> | The system and architecture to compile for; the default is the current machine. linux-x86_64, windows-x86_64 (a .exe, linked with lld-link, Win64 calling convention) and linux-aarch64. The compiler predefines the target's macros (__unix__/__linux__ or _WIN32/_WIN64, __x86_64__ or __aarch64__). From a machine of another architecture the program is linked with lld; an aarch64 binary built on x86_64 runs under qemu-aarch64. libstd works on aarch64 too: every Linux back end has an aarch64 version (system calls with svc; open, stat, access, dup2, pipe, readlink and fork, which aarch64 does not have, go through openat, newfstatat, faccessat, dup3, pipe2, readlinkat and clone). A module with libextern (sqlite3, mysql, vulkan, xlib) needs the aarch64 build of its library and of libc, looked up in /usr/lib/aarch64-linux-gnu, /lib/aarch64-linux-gnu and /usr/aarch64-linux-gnu/lib. With TRYC_TEST_EXTRA_ARGS="--target linux-aarch64" the test runners build for aarch64 and run the binaries under qemu-aarch64. |
--llvm-static | If the program declares libextern on a libLLVM*.so (the self-hosted compiler does, to run LLVM in-process), replace the shared library with the static archives of the target architecture's component (x86 or aarch64) and of passes and irreader from llvm-config --link-static (the llvm-config of the toolchain that resolved libLLVM.so, see FFI). Loading libLLVM.so costs about 12 ms per process start (350,000 relocations, 8 MB of .data.rel.ro copied on write, 590 constructors); a static non-PIE binary has none of that. TryC symbols that collide with libc/libstdc++ exports (strlen, memcpy, open, ...) are renamed tryc__name with objcopy so LLVM keeps using its own, and a small C glue object provides _start (running .init_array, which nobody else does without libc) and __dso_handle. Cost: about 46 MB on disk. |
| Flag | Meaning |
--bss-size N | Number of blocks in chunk 0 of the arena (default 4096 = 2 MB with 512-byte blocks). Without --noheap it is also the size of every chunk the pool maps when the current one is full, and it sizes alloc_log and the checkpoint stack: how many allocations can be alive at the same time, not how many bytes in total (both grow through mmap when needed). |
--block-size N | Bytes per arena block (default 512, a power of two). Every allocation occupies a whole number of blocks: a 40-byte string kept alive still costs a block. Smaller blocks reduce memory (64-byte blocks cut the self-hosted compiler's RSS from 72 to 54 MB) but the bitmap scans cost the same, so wall time does not change. |
--hugepages | Ask the kernel for transparent huge pages (2 MB, madvise(MADV_HUGEPAGE)) on the three large BSS buffers of the runtime: the allocation hash table (8 MB) and chunk 0 of the arena and of the string-builder pool (2 MB each). Worth it only for programs that allocate a lot (the self-hosted compiler: page faults 5,201 → 153, −9% time); a hello world pays the zeroing of whole 2 MB pages instead (0.2 → 1.4 ms), hence opt-in. |
--noheap | The program never uses the heap: no mmap/munmap is ever emitted, every allocation (new, string concatenation, buffers) comes from the fixed BSS pool sized by --bss-size, and running out of it is a fatal error rather than a growth. raw_alloc()/raw_free() (used by libstd/thread and libstd/process) are refused. For targets where memory syscalls do not exist yet: a kernel in its first instructions. |
--nosyscall | The program never executes a syscall instruction, explicitly or implicitly: _start no longer installs the SIGSEGV handler (sigaction/sigaltstack) and ends with a cli; hlt loop instead of exit_group. Only for freestanding ring-0 targets: hlt is privileged and would #GP in a normal Linux process. Every function gets noredzone and the runtime is linked in its nosyscall variant (built with -mno-red-zone and the portable vector code instead of AVX2): without an operating system an interrupt arrives on the stack of the code it interrupts, and the CPU writes its frame over the 128 bytes below rsp that the System V ABI otherwise lets a function use without reserving them. Independent from --noheap; the two combine for a real bare-metal target. |
--linker-script FILE | Link with a GNU ld script (-Wl,-T): the script decides addresses, section order and output format. For a freestanding target such as the kernel in kernel/, loaded by its bootloader at a fixed physical address (its linker.ld puts a small header first, with the address of _start and the bounds of .bss, which the bootloader zeroes). Not on Windows: lld-link does not read GNU scripts. |
--no_stdlib | Do not make the standard library available (no #include <libstd/...>). Useful for kernel code. |
--no_startfile | Do not emit the _start procedure; the program supplies its own entry point and declares the runtime globals as extern. |
| Flag | Meaning |
--check-arena | Build against the verification runtime (-D CHECK_ARENA when assembling the runtime): every allocation lives on pages of its own with canaries in front of it and after it, freed pages become inaccessible and are never reused while in quarantine. A use-after-free or an overflow becomes a SIGSEGV with a report naming the allocation, the function that allocated it and the one that freed it; a double free or the promotion of a freed pointer aborts with exit code 134. At exit (also when main simply returns) it checks the canaries once more and lists on stderr the allocations still pinned, grouped by the place that pinned them. About 7× slower and memory hungry: for tests only. Incompatible with --noheap. See Memory safety. |
--legacy-casts | Accept pointer-to-integer, integer-to-pointer and as ptr T casts outside unsafe:, and a long where a ref is expected, for a source not yet migrated to ref. A transition flag: the casts still pin as before, but nothing is checked. |
--check-arena-guard | Like --check-arena plus a PROT_NONE guard page after every allocation, so that even a read past the end faults immediately. Two kernel VMAs per live allocation: programs with many live allocations need a higher vm.max_map_count. |
| Constant | Default | Meaning |
SINGLE_BLOCK_SIZE_HEAP_BSS | 512 | Block size (--block-size). |
TOTAL_BLOCKS | 4096 | Blocks per chunk (--bss-size; always injected by the compiler). |
RT_HASH_BITS | 20 | Maximum size of the allocation lookup table (220 slots, 8 MB reserved in .bss). |
RT_HASH_MIN_BITS | 16 | Size the lookup table starts at (216 slots, 512 KB); it doubles when more than one slot in eight is live. |
SCOPE_CKPT_DEPTH | 16384 | Maximum number of simultaneously open scopes (a runaway recursion hits this first). |
MAX_POOL_CHUNKS | 4096 | Maximum number of mapped chunks. |
BT_STACK_DEPTH | 500 | Depth of the function history printed in crash reports. |
CHECK_QUARANTINE, CHECK_QUARANTINE_PAGES | 16384, 16384 | Verification runtime: how many freed ranges (and pages, 64 MB) stay protected before being recycled. |
POOL_FREE_LIST | off | Enable the free-run list in the pool allocator (measured slower than the next-fit hint, kept for experiments). |