[PHP.wasm] Export Zend symbols for compiling PHP extensions - #3584
Merged
Conversation
adamziel
force-pushed
the
adamziel/php84-a1
branch
from
May 1, 2026 19:48
d6e9afe to
d85a9e7
Compare
5.2 doesn't have zend_ce_exception, zend_ce_throwable, zend_string_init_interned, zend_empty_string, zend_one_char_string, zend_get_executed_scope, or zval_ptr_dtor (it has _zval_ptr_dtor instead). Guard the side-module export list both in the Dockerfile and zend-side-module-exports.c by PHP version. Also switch the 5.2 Dockerfile's config.guess/config.sub fetches from the broken cgit/plain endpoint to a working gitweb URL, and only inject the zend-side-module-exports.c source when building with JSPI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Exports the Zend symbols that PHP extension side modules need from the JSPI
PHP.wasm main modules.
This covers the committed JSPI artifacts for web and Node across PHP
5.2,7.4, and8.0-8.5. It does not add asyncify support for these sidemodule exports.
Rationale
MAIN_MODULE=2only exposes explicitly requested symbols. PHP internals andstatically linked extensions can still work without these exports, but dynamic
WASM side modules need the main module to expose the Zend class entries,
globals, handlers, and function addresses they import through the WASM ABI.
Implementation
Adds JSPI-only
.WASM_ABI_EXPORTSentries guarded by PHP version. PHP7.4-8.5also compile a smallzend-side-module-exports.chelper into themain module so the linker keeps the referenced Zend symbols visible.
Symbols added for PHP
5.2JSPI:Symbols added for PHP
7.4-8.5JSPI:Additional PHP
8.0-8.5JSPI symbols:Additional PHP
8.1-8.5JSPI symbols:The PHP
5.2build also switches theconfig.guessandconfig.subdownloadURLs to Savannah
gitwebblob_plainendpoints to avoid the failing cgitplain-file endpoint during rebuilds.
Testing instructions
Rebuilt JSPI PHP artifacts for web and Node:
Also verified the rebuilt JSPI WASM files export the expected symbols with
wasm-objdump, and rangit diff --check.CI currently passes except for
test-legacy-wp-version-boot, which fails ontrunkwith the sameWP 6.2 (PHP 7.4)Vite worker-load timeout.