Skip to content

Bootstrap: CallArgv LLVM global leaks across JIT Context — bootstrap-aot-link segfault (#197) #14459

Description

@PurHur

Problem

make bootstrap-aot-link fails: every AOT fixture compile segfaults (exit 139) in Runtime::standalone()JITContext construction.

Root cause: CallArgv::$htGlobal is a process-wide static initialized on the first LLVM module, but nested JIT helper compilation during defineBuiltins() (e.g. WeakRefRegistryRuntime::ensureJitHelperCompiled) can emit CallArgv::emitStore() on a different JIT\Context module. FFI then passes incompatible LLVMOpaqueValue* handles (LLVMBuildStore / segfault).

Reference pattern

LateStaticBindingGlobals already guards with $classIdModule — static Value must not leak across Context instances.

Repro

source script/php-env.sh
php bin/compile.php -o /tmp/echo_hello test/bootstrap-aot/echo_hello.php
# Segmentation fault (core dumped), exit 139

EMBED mode surfaces the FFI error:

FFI\Exception: Passing incompatible argument 3 of C function 'LLVMBuildStore' ...
#0 lib/JIT/Builtin/CallArgv.php(38)

Done when

  • php bin/compile.php -o /tmp/echo_hello test/bootstrap-aot/echo_hello.php succeeds
  • make bootstrap-aot-link green (or first failing fixture documented if separate)
  • Existing func_get_args JIT tests still pass

Refs #197, #10916, #1492

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions