fix: diagnose missing 'main' instead of segfaulting on 'sx run' (issue 0137)

A program with no 'main' reached the JIT entry-point call with a garbage
address (ORC reports lookup success but leaves main_addr degenerate), then
called it -> SIGSEGV. Add a pre-JIT entry-point check in main.zig that emits
'error: no main function found' and exits non-zero before codegen, plus a
defensive main_addr==0 guard in target.zig runJITFromObject as a backstop.

Regression: examples/1188-diagnostics-run-no-main.sx
This commit is contained in:
agra
2026-06-21 09:10:30 +03:00
parent 11dc6a3299
commit 6ed29621ad
8 changed files with 72 additions and 0 deletions

View File

@@ -0,0 +1 @@
1

View File

@@ -0,0 +1 @@
error: no 'main' function found — 'sx run' requires a top-level 'main' entry point

View File

@@ -0,0 +1 @@