Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the Darwin symbol-filtering change.
No open issues 🎉
What changed in this PR
Fixes Darwin dynamic-symbol exports for static PHP builds, addressing the macOS linker failure reported in #1294 and incorporating the regression test from #1295.
Changes:
- Extracts symbol parsing into a testable
parseDynamicSymbols()method. - Filters Darwin exports to underscore-prefixed symbols while preserving behavior on other platforms.
- Adds a regression test verifying that malformed archive-header fragments are excluded.
| File | Description |
|---|---|
tests/StaticPHP/Util/UnixUtilTest.php |
Tests Darwin symbol filtering with archive-header fragments. |
src/StaticPHP/Util/System/UnixUtil.php |
Extracts parsing and adds Darwin-only underscore filtering. |
Review effort: Balanced
This branch has not been deployed
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 upon the test added in #1295 and fixes #1294 by ensuring that on Darwin (
SystemTarget::getTargetOS() === 'Darwin'),UnixUtilfilters out any symbol not starting with an underscore (_).Background
In Darwin Mach-O ABI, all C identifiers are prefixed with
_. Non-_entries resulting from line wrapping or extended BSD archive (#1/<len>) headers cause Apple'sldto fail with<initial-undefines>when passed via-Wl,-exported_symbols_list.Filtering
$definedon Darwin ensures only valid Mach-O symbols are exported, resolving FrankenPHP / embed static build failures on macOS.Closes #1294
Companion test PR: #1295
Note on Testing & Debugging
Note
All testing, reproduction, and debugging for this PR were conducted with the assistance of AI (Google Antigravity).