Skip to content

php: build eight of the nine optional extensions phoronix lists - #734

Merged
staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd
Nov 5, 2026
Merged

staalmannen merged 1 commit into
mainfrom
claude/upgrade-ape-c-library-mmZGd

Conversation

@staalmannen

Copy link
Copy Markdown
Owner

posix, pcntl, bz2, readline, openssl (LibreSSL), curl, sqlite3 and zip, against libraries this tree already builds. 579 translation units compile with 0 errors on the host mirror, and the link wants 1166 symbols from outside php of which the sweep resolves 1120; the remaining 46 are all data, assembly or macro-hidden and each was opened by hand.

GD is left out and it is not a choice: there is no libgd here, only libpng. ext/sockets is deferred to a libap change -- no struct cmsghdr', no CMSG_* macros, no msg_flags', sendmsg' a stub and recvmsg' declared by the header and defined nowhere. 0.6's inventory has the mechanism and what it would cost.

THE FIRST MEASUREMENT WAS AN EMPTY TRANSLATION UNIT, FIVE TIMES. Each of these extensions wraps its whole body in #ifdef HAVE_<X>', so with the name unanswered the file compiles to nothing and reports 0 errors. Counting TEXT symbols does not separate them either -- kencc emits php's header static inline's that gcc at -O2 discards, putting the floor at about 360 for empty and non-empty alike. The discriminator that works is whether the assembly mentions `_module_entry': 0 against 10-14, one grep.

Three findings, all upstream's:

  • LibreSSL has no *_new_reserve' family, so openssl_backend_common.c:714' does not compile. The call is a capacity hint before a sk_X509_push' loop, so sk_X509_new_null()' is the same program; guarded on LIBRESSL_VERSION_NUMBER, which is php's own convention in that file.

  • ext/readline reaches php_cli_get_shell_callbacks' through dlsym'. Upstream's own commented-out direct call is the fix for a static build. Including APE's <dlfcn.h> instead would have compiled and linked and then installed no callbacks at all, since its dlsym' is return NULL' -- php -a without readline and nothing printed to say so.

  • `return ;' in a void function (pcntl.c:1495), which C11 6.8.6.4p1 forbids and gcc accepts. Fixed as two statements; the kencc deviation is recorded in 0.6 and not taken, because ORETURN with a left operand means "compute into the return location", so accepting void is a statement-tree rewrite rather than a relaxed check.

Every config.h answer is derived: function questions from apfunc-sweep.py with the library's own tree as a --root, macro and struct questions from a compile against the real APE headers. WIFCONTINUED exists and WCONTINUED does not, which looks like a typo and is not. The TLS feature macros are deliberately NOT answered -- xp_ssl.c computes them from the version macros itself.

All six libraries come in by #pragma lib' from their own headers, checked rather than asserted, so there is still no LIB=' line.

Two instrument faults fixed, both in php-mirror.sh's --undefined arm: kencc's diag() writes to STDOUT, which under -S is the assembly, so a failing unit saved empty diagnostics and a real error read as exit 1 with no message -- the same trap hostkencc.sh --probe already carries. The repair then needed || true' under set -e', since the recompile is expected to fail; without it the script died silently. The positive control caught that, after two controls of my own that were never planted.

php-smoke.php gains Section 8: every extension does something through its library -- bz2 and zlib round-trip bytes, sqlite3 creates and queries, openssl digests, zip writes and reads an archive -- rather than only reporting `extension_loaded'. 0 failures on host php 8.3.6. The registration list is asserted on Plan9 only, following Section 7's rule, since no build host is an oracle for this port's module table.

Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs

posix, pcntl, bz2, readline, openssl (LibreSSL), curl, sqlite3 and
zip, against libraries this tree already builds.  579 translation
units compile with 0 errors on the host mirror, and the link wants
1166 symbols from outside php of which the sweep resolves 1120; the
remaining 46 are all data, assembly or macro-hidden and each was
opened by hand.

GD is left out and it is not a choice: there is no libgd here, only
libpng.  ext/sockets is deferred to a libap change -- no `struct
cmsghdr', no CMSG_* macros, no `msg_flags', `sendmsg' a stub and
`recvmsg' declared by the header and defined nowhere.  0.6's
inventory has the mechanism and what it would cost.

***THE FIRST MEASUREMENT WAS AN EMPTY TRANSLATION UNIT, FIVE TIMES.***
Each of these extensions wraps its whole body in `#ifdef HAVE_<X>',
so with the name unanswered the file compiles to nothing and reports
0 errors.  Counting TEXT symbols does not separate them either --
kencc emits php's header `static inline's that gcc at -O2 discards,
putting the floor at about 360 for empty and non-empty alike.  The
discriminator that works is whether the assembly mentions
`<ext>_module_entry': 0 against 10-14, one grep.

Three findings, all upstream's:

  * LibreSSL has no `*_new_reserve' family, so
    `openssl_backend_common.c:714' does not compile.  The call is a
    capacity hint before a `sk_X509_push' loop, so `sk_X509_new_null()'
    is the same program; guarded on LIBRESSL_VERSION_NUMBER, which is
    php's own convention in that file.

  * ext/readline reaches `php_cli_get_shell_callbacks' through
    `dlsym'.  Upstream's own commented-out direct call is the fix for
    a static build.  Including APE's <dlfcn.h> instead would have
    compiled and linked and then installed no callbacks at all, since
    its `dlsym' is `return NULL' -- php -a without readline and
    nothing printed to say so.

  * `return <void expr>;' in a void function (pcntl.c:1495), which C11
    6.8.6.4p1 forbids and gcc accepts.  Fixed as two statements; the
    kencc deviation is recorded in 0.6 and not taken, because ORETURN
    with a left operand means "compute into the return location", so
    accepting void is a statement-tree rewrite rather than a relaxed
    check.

Every config.h answer is derived: function questions from
apfunc-sweep.py with the library's own tree as a --root, macro and
struct questions from a compile against the real APE headers.
WIFCONTINUED exists and WCONTINUED does not, which looks like a typo
and is not.  The TLS feature macros are deliberately NOT answered --
xp_ssl.c computes them from the version macros itself.

All six libraries come in by `#pragma lib' from their own headers,
checked rather than asserted, so there is still no `LIB=' line.

Two instrument faults fixed, both in php-mirror.sh's --undefined arm:
kencc's diag() writes to STDOUT, which under -S is the assembly, so a
failing unit saved empty diagnostics and a real error read as exit 1
with no message -- the same trap hostkencc.sh --probe already carries.
The repair then needed `|| true' under `set -e', since the recompile
is expected to fail; without it the script died silently.  The
positive control caught that, after two controls of my own that were
never planted.

php-smoke.php gains Section 8: every extension does something through
its library -- bz2 and zlib round-trip bytes, sqlite3 creates and
queries, openssl digests, zip writes and reads an archive -- rather
than only reporting `extension_loaded'.  0 failures on host php 8.3.6.
The registration list is asserted on Plan9 only, following Section 7's
rule, since no build host is an oracle for this port's module table.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGAwvvTwDg2yknFkmZ3qzs
@staalmannen
staalmannen merged commit 2959ce5 into main Nov 5, 2026
1 check passed
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.

2 participants