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:
1
examples/expected/1188-diagnostics-run-no-main.exit
Normal file
1
examples/expected/1188-diagnostics-run-no-main.exit
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
1
examples/expected/1188-diagnostics-run-no-main.stderr
Normal file
1
examples/expected/1188-diagnostics-run-no-main.stderr
Normal file
@@ -0,0 +1 @@
|
||||
error: no 'main' function found — 'sx run' requires a top-level 'main' entry point
|
||||
1
examples/expected/1188-diagnostics-run-no-main.stdout
Normal file
1
examples/expected/1188-diagnostics-run-no-main.stdout
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user