Repository navigation
fix(relinker): preserve weak imports in macOS guest modules - #6105
Merged
adriadam10 merged 1 commit intoOct 17, 2026
Merged
Conversation
Zinebyte
marked this pull request as ready for review
October 14, 2026 22:26
9 tasks done
This was referenced Oct 15, 2026
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
This was referenced Oct 15, 2026
Zinebyte
force-pushed
the
fix/macos-guest-weak-imports
branch
from
October 15, 2026 17:31
0705b4f to
5c378ec
Compare
11 tasks done
Collaborator
|
Checked: |
12 tasks done
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 18, 2026
…rve weak imports in macOS guest modules (@Zinebyte) Taken from the open upstream pull request so the macOS integration branch carries every piece of the port that is already under review, instead of re-implementing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
A converted macOS guest module currently emits strong Mach-O binds for both weak and global undefined ELF symbols. An optional symbol therefore becomes a mandatory import, even though the macOS executable writer already preserves weak binding.
Pass the guest symbol's
STB_WEAKbinding to the existing Mach-O bind writer. Add a focused guest-module regression that checks the weak/strong opcodes and declared library dependency on all hosts. On macOS it also compiles a small x86-64 loader and providers with the system Clang, then checks missing/present weak imports, missing strong imports, and missing declared libraries in fresh processes.The native probe uses
RTLD_NOW | RTLD_LOCAL, matching the guest dynamic-loader API. It runs directly on Intel or through already-installed Rosetta on Apple Silicon. Local machines without x86-64 execution can skip native controls; hosted Darwin CI fails rather than skipping them. No Rosetta installation or workflow changes are added.Tested
Linux x86-64, Release relinker-only build at upstream
fa9365ca74: all 182 CTests pass (12.89 s). The new regression is also selected byctest -L '^relinker$' -R '^macos_guest_weak_imports$'and passes. The standalone metadata regression fails against unchanged production on the optional import's strong bind opcode (0x40instead of0x41). The required import remains strong and the declared host library remains required. Independent adversarial review checked the fixture, branch displacements, runpaths, missing-import controls and hosted native-execution guard.Hosted Build 38778017732 passed for PR head
5c378ece, merged into current main: Linux 183/183 tests, Windows 178/178 and macOS 174/174. The focused regression took 0.05 s, 0.25 s and 2.83 s respectively. The macOS probe passed all five native loader controls: 42 with the weak import absent, 77 with its provider present, and failure for missing required/global imports or a declared library. Hosted Darwin cannot skip these controls. Production and regression code are unchanged from the previously green revision; this update adds the component test label and rebases onto current main. Conventions passed. No retail-title result is claimed.Manual review of all 21 peers named in the partial-comparison notice against main
fa9365ca74found no new conflict blocks from this PR. The macOS preinit metadata in #6112 composes with the weak bind flag; the other shared changes register unrelated tests or organize components. Their existing conflicts with main remain unchanged. The test now carries therelinkerlabel so it also remains included in component-filtered runs if #6044 lands; this uses existing CMake functionality and does not depend on that PR.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository