feat: auto-generate and verify TCC C API syscall numbers

This commit is contained in:
2026-06-21 12:32:22 +02:00
parent e0db67cb79
commit 4cda83aa58
4 changed files with 315 additions and 102 deletions
+13 -2
View File
@@ -89,7 +89,7 @@ CONFIGDIR := data/config
CONFIGSRC := $(wildcard $(CONFIGDIR)/*.toml)
CONFIGDST := $(patsubst $(CONFIGDIR)/%,$(BINDIR)/config/%,$(CONFIGSRC))
.PHONY: all clean 2048 doom fetch wiki wikipedia weather imageviewer fontpreview spreadsheet wordprocessor pdfviewer disks devexplorer installer audio music video bluetooth network terminal klog procmgr calculator login desktop shell rpgdemo paint tcc lua screenshot texteditor mandelbrot printers timezone printd printctl dialogs icons fonts configs bearssl libc tls libjpeg libjpegwrite install-apps libloader libs libhello test_dialogs test_dl crashpad
.PHONY: all clean 2048 doom fetch wiki wikipedia weather imageviewer fontpreview spreadsheet wordprocessor pdfviewer disks devexplorer installer audio music video bluetooth network terminal klog procmgr calculator login desktop shell rpgdemo paint tcc lua screenshot texteditor mandelbrot printers timezone printd printctl dialogs icons fonts configs bearssl libc tls libjpeg libjpegwrite install-apps libloader libs libhello test_dialogs test_dl crashpad check-syscalls gen-syscalls
all: bearssl libc libjpeg libjpegwrite tls libloader libs libhello $(TARGETS) fetch wiki wikipedia weather imageviewer fontpreview spreadsheet wordprocessor pdfviewer disks devexplorer installer audio music video bluetooth network terminal klog procmgr calculator 2048 doom rpgdemo paint tcc lua screenshot texteditor mandelbrot printers timezone printd printctl dialogs login desktop shell icons fonts install-apps test_dialogs test_dl crashpad $(MANDST) $(WWWDST) $(CA_CERTS) $(CONFIGDST) $(FWDST)
@@ -278,8 +278,19 @@ doom: libc
screenshot: libc libjpegwrite libloader dialogs
$(MAKE) -C src/screenshot
# Verify the TCC C API header (libc/montauk.h) exposes every kernel syscall with
# matching numbers. Fails the build on drift; 'make gen-syscalls' refreshes them.
check-syscalls:
python3 ../scripts/montauk-syscalls.py check
# Regenerate the MTK_SYS_* number block in libc/montauk.h from Api/Syscall.hpp.
# Wrapper functions stay hand-written; this only updates the numbers.
gen-syscalls:
python3 ../scripts/montauk-syscalls.py gen
# Build TCC (Tiny C Compiler) via its own Makefile (depends on libc).
tcc: libc
# check-syscalls guards against shipping a stale C API header into the ramdisk.
tcc: libc check-syscalls
$(MAKE) -C src/tcc
mkdir -p $(BINDIR)/lib/tcc/include
cp -r src/tcc/tcc_include/* $(BINDIR)/lib/tcc/include/