Skip to content

AOT Docker: bundle libjansson for ld, fix CFG branches, add HelloWorld PHPT#239

Merged
PurHur merged 1 commit into
masterfrom
feat/aot-docker-link-jumpfix
May 19, 2026
Merged

AOT Docker: bundle libjansson for ld, fix CFG branches, add HelloWorld PHPT#239
PurHur merged 1 commit into
masterfrom
feat/aot-docker-link-jumpfix

Conversation

@PurHur
Copy link
Copy Markdown
Owner

@PurHur PurHur commented May 19, 2026

Summary

  • Linking in Docker/harness: script/install-llvm9.sh now bundles libjansson.so.4 (required by the Debian binutils ld pulled into .llvm/). The Ubuntu 22.04 dev image also installs libjansson4 via apt.
  • Harness CI: script/docker-ci-local.sh verifies the bind-mount is non-empty before using it; otherwise it falls through to the existing tar-pipe path (Runforge workspaces).
  • LLVM CFG: TYPE_JUMP / TYPE_JUMPIF / TYPE_RETURN* emit terminators on the current insert block instead of the CFG block’s original LLVM BB, so inline builtins (e.g. array_pop) do not leave merge blocks without terminators.
  • Coverage: New PHPT test/fixtures/aot/cases/hello_world_example.phpt (matches examples/000-HelloWorld).

Test output (local Docker, php-compiler:22.04-dev)

Harness host (bind-mount empty); repo copied via tar:

tar -cf - --exclude='.git' --exclude='.llvm' . | docker run --rm -i -w /compiler php-compiler:22.04-dev \
  bash -c 'tar -xf - && script/install-llvm9.sh && script/apply-patches.sh && php vendor/bin/phpunit --group llvm test/aot/'

Before this PR: all 42 AOT tests failed at link time:

Linking failed (exit 127): .../ld: error while loading shared libraries: libjansson.so.4: cannot open shared object file

After this PR:

Tests: 43, Assertions: 82, Failures: 8.
  • 35 PHPT cases + 5 PHPUnit classes in test/aot/ now compile, link, and run (including ExampleWebAotTest, StdlibWebBuiltinsTest, hello_world_example.phpt).
  • 8 known failures (pre-existing CFG/ternary issues): array_key_exists_get, array_pop, boolval, empty, explode, getenv_missing, str_ends_with, str_starts_with — LLVM verify: Basic Block ... does not have terminator on block_1 or array_pop_done*.

Full local CI on harness:

./script/docker-ci-local.sh
# or: make test-docker   # after make docker-build-22 if Dockerfile changed

Follow-up

  • Fix remaining terminator gaps for ternary/JUMPIF CFG layout (8 PHPTs above).
  • Rebuild and publish php-compiler:22.04-dev / ghcr.io/PurHur/php-compiler:dev with libjansson4 in the image layer.

Made with Cursor

Bundle libjansson for the LLVM 9 linker, detect empty bind-mounts in docker-ci-local.sh, branch from the current insert block after inline builtins, and add a HelloWorld AOT PHPT fixture.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur PurHur merged commit 6cd328e into master May 19, 2026
@PurHur PurHur deleted the feat/aot-docker-link-jumpfix branch May 19, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant