Goal
Remove the last hand-written C runtime translation unit from the AOT link by emitting the async-signal-safe SIGSEGV handler directly in LLVM IR from PHP lowering (PHP-in-PHP, #1492).
Current behavior
AOT links a bundled C TU that installs a SIGSEGV handler which prints the last progress breadcrumb ("phpc_last_progress") and exits 139.
Change
- Emit
phpc_segv_handler in LLVM IR (write(2)+_exit only)
- Install handler during
__init__ emission (no __attribute__((constructor)))
- Keep progress breadcrumb globals in LLVM (existing
ProgressNoteRuntime)
- Make
lib/AOT/Linker.php ship no bundled C runtime sources
Why this is safe
The handler stays async-signal-safe (no malloc/stdio); only write + _exit.
Verification
./script/docker-exec.sh ./script/check-aot-build-smoke.sh
./script/docker-exec.sh php vendor/bin/phpunit --filter 'AotRuntimeInventoryTest|RuntimeShrinkCloseoutTest|ProgressNoteRuntimeStandaloneTest|ExecJitRuntimeShrinkTest|GettextJitRuntimeShrinkTest|ProgressNoteRuntimeShrinkTest'
Notes
If we need portability beyond Linux, a follow-up could avoid hardcoding SIGSEGV=11 in IR.
Goal
Remove the last hand-written C runtime translation unit from the AOT link by emitting the async-signal-safe SIGSEGV handler directly in LLVM IR from PHP lowering (PHP-in-PHP, #1492).
Current behavior
AOT links a bundled C TU that installs a SIGSEGV handler which prints the last progress breadcrumb ("phpc_last_progress") and exits 139.
Change
phpc_segv_handlerin LLVM IR (write(2)+_exit only)__init__emission (no__attribute__((constructor)))ProgressNoteRuntime)lib/AOT/Linker.phpship no bundled C runtime sourcesWhy this is safe
The handler stays async-signal-safe (no malloc/stdio); only
write+_exit.Verification
./script/docker-exec.sh ./script/check-aot-build-smoke.sh./script/docker-exec.sh php vendor/bin/phpunit --filter 'AotRuntimeInventoryTest|RuntimeShrinkCloseoutTest|ProgressNoteRuntimeStandaloneTest|ExecJitRuntimeShrinkTest|GettextJitRuntimeShrinkTest|ProgressNoteRuntimeShrinkTest'Notes
If we need portability beyond Linux, a follow-up could avoid hardcoding SIGSEGV=11 in IR.