export fn and finch build --shared, in the compiler written in Finch; FINCH_PATH, FINCH_RT, FINCH_CC

export fn name(...) is a C function of a library; build --shared makes lib<name>.so with no main and a
finch_module_on_fatal(handler) the host can take runtime errors over with. Ported from the embed work (the
runtime, its test and the docs are that work's; the compiler side is new).

The driver reads FINCH_PATH (more module folders), FINCH_RT (the runtime's file) and FINCH_CC (the clang).
tests/boot.sh also runs tests/shared.sh with the compiler under test. 41 passed.
This commit is contained in:
Nexoniarz 2026-10-25 21:03:05 +01:00
commit dd9cbe7611
13 changed files with 212 additions and 13 deletions

View file

@ -60,5 +60,13 @@ for f in tests/new/fail/*.fch; do
echo "$got" | head -3
fi
done
# a library a C program loads (finch build --shared), with the compiler under test
if FINCH_RT="$PWD/runtime/finch_rt.c" FINCH="$boot" tests/shared.sh > "$tmp/shared.out" 2>&1; then
pass=$((pass + 1))
else
failed=$((failed + 1))
echo "FAIL tests/shared.sh"
head -5 "$tmp/shared.out"
fi
echo "self-hosted compiler: $pass passed, $failed failed, $skipped skipped (features it doesn't have)"
[ $failed -eq 0 ]