Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/wasix-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
sysroot-tag: v2026-02-16.1
version: v0.3.0
version: v0.4.1

- name: Tool Versions
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ config.h.in
/scripts/php-config
/scripts/phpize
php
php-debug.wasm
php.wasm

# ------------------------------------------------------------------------------
Expand Down
31 changes: 27 additions & 4 deletions wasix-build-eh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,36 @@ set -eou

make -j16

wasm-opt -O3 \
--emit-exnref \
# Some wasm-opt passes are not compatible with EH.
# When generating debug info, we don't need to disable them but without debug info we do, otherwise wasm-opt crashes.
Comment on lines +7 to +8
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states that passes need to be disabled "without debug info" to avoid crashes, but in the actual implementation below, these passes are skipped in BOTH wasm-opt runs (both the one WITH debug info on line 13-26 and the one WITHOUT debug info on line 30-39). This creates an inconsistency between the comment and the implementation. Either the comment should be updated to reflect that passes are always skipped for EH compatibility, or the first wasm-opt run should not skip these passes if they're only problematic without debug info.

Suggested change
# Some wasm-opt passes are not compatible with EH.
# When generating debug info, we don't need to disable them but without debug info we do, otherwise wasm-opt crashes.
# Some wasm-opt passes are not compatible with EH, so we always disable them in this script
# to avoid issues (they have been observed to crash in certain configurations).

Copilot uses AI. Check for mistakes.
# The offending passes are flatten, dae-optimizing and inlining-optimizing.

# First asyncify while preserving debug info
# O4 is only here for good measure, the important part is asyncify
wasm-opt -g \
-O4 \
--no-validation \
--all-features \
--strip-debug \
--disable-gc \
--closed-world \
--skip-pass=flatten \
--skip-pass=dae-optimizing \
--skip-pass=inlining-optimizing \
--asyncify \
--pass-arg=asyncify-imports@wasix_32v1.proc_snapshot \
--pass-arg=asyncify-ignore-indirect \
--pass-arg=max-func-params@32 \
sapi/cli/php -o sapi/cli/php.wasm
sapi/cli/php -o sapi/cli/php-debug.wasm

# A second wasm-opt run for stripping debug
# info and running full O4
wasm-opt --strip-debug \
-O4 \
--no-validation \
--all-features \
--disable-gc \
--closed-world \
--skip-pass=flatten \
--skip-pass=dae-optimizing \
--skip-pass=inlining-optimizing \
sapi/cli/php-debug.wasm -o sapi/cli/php.wasm
Comment on lines +28 to +39
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second wasm-opt run is missing the --asyncify flag and related pass arguments (asyncify-imports, asyncify-ignore-indirect, max-func-params) that are present in the first run. Since this second run takes the output of the first asyncified run as input, this is likely intentional. However, the comment on line 28-29 doesn't mention this and only talks about stripping debug info and running full O4. Consider updating the comment to clarify that asyncify transformation has already been applied and doesn't need to be reapplied.

Copilot uses AI. Check for mistakes.
8 changes: 4 additions & 4 deletions wasix-configure-eh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ export \
NM="wasixnm" \
CC="wasixcc" \
CXX="wasixcc++" \
CFLAGS="-g -flto -O2" \
CXXFLAGS="-g -flto -O2" \
LIBS="-L$PHP_WASIX_DEPS/lib-eh --no-wasm-opt" \
CFLAGS="-g -flto -O4" \
CXXFLAGS="-g -flto -O4" \
LIBS="-L$PHP_WASIX_DEPS/lib-eh --no-wasm-opt -g -flto -O4" \
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LIBS environment variable now includes compiler flags (-g -flto -O4) mixed with linker flags. This is semantically incorrect as LIBS should only contain library-related linker flags (like -L and -l flags). The compiler flags should be specified in CFLAGS and CXXFLAGS (which they already are), not in LIBS. This could potentially cause issues with build tools that expect LIBS to contain only linker flags.

Suggested change
LIBS="-L$PHP_WASIX_DEPS/lib-eh --no-wasm-opt -g -flto -O4" \
LIBS="-L$PHP_WASIX_DEPS/lib-eh --no-wasm-opt" \

Copilot uses AI. Check for mistakes.
WASIXCC_INCLUDE_CPP_SYMBOLS="yes" \
WASIXCC_WASM_EXCEPTIONS="yes" \
PROG_SENDMAIL="/usr/bin/sendmail"
Expand All @@ -64,7 +64,7 @@ export \
--enable-bcmath --enable-tidy --enable-gd --enable-exif --with-jpeg --with-freetype --with-webp \
--enable-fiber-asm --with-curl --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zip --with-sodium \
--with-pgsql="$PHP_WASIX_DEPS"/pgsql-eh --with-pdo-pgsql="$PHP_WASIX_DEPS"/pgsql-eh --enable-intl \
--with-pdo-sqlite --enable-ftp --enable-igbinary --with-imagick \
--with-pdo-sqlite --enable-ftp --enable-igbinary --with-imagick --enable-debug \
--program-suffix=".wasm"

./wasix-build-eh.sh