Repository navigation
Link mimalloc into binaries embedding PHP - #1253
Merged
Merged
Conversation
Since the link closure only walks dependencies of the target, and nothing depends on mimalloc, MIMALLOC builds compiled libmimalloc.a but never linked it, so the binaries kept the system allocator.
henderkes
approved these changes
Oct 11, 2026
crazywhalecc
approved these changes
Oct 11, 2026
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 does this PR do?
Builds with
mimalloccompilelibmimalloc.abut never link it, so the resulting binaries silently keep the system allocator.Since 01a1db85,
SPCConfigUtil::configForResolvedBuild()builds the link line from the dependency closure of the target instead of every resolved package. Nothing depends on mimalloc, so it drops out of that closure and the existing "mimalloc must come first" handling never triggers. This affects frankenphp as well as the php cli, micro and embed targets.This PR adds mimalloc to the
phplink override when it was resolved. Every binary that links PHP gets it, while shared extensions and library builds, whose closures don't go throughphp, are unchanged. A unit test covers both sides, and it fails without the change.Checked with FrankenPHP static musl builds (arm64, PHP 8.5.11) using a spc binary built from this branch:
CGO_LDFLAGSfromfrankenphp build-infoMIMALLOC_VERBOSE=1 frankenphp version-L.../buildroot/lib -lphp ...-L.../buildroot/lib .../buildroot/lib/libmimalloc.a -lphp ...mimalloc: v2.5.2, release-L.../buildroot/lib .../buildroot/lib/libmimalloc.a -lphp ...mimalloc: v3.5.4, releaseWith the current nightly, the mimalloc builds look like the first row.
Checklist before merging
*.phpor*.yml, run them locally to ensure your changes are valid:composer cs-fixcomposer analysecomposer testbin/spc dev:lint-config(no config changes)