Repository navigation
fix(relinker): accept matching defined relative symbols - #6357
adriadam10 merged 1 commit into
Conversation
|
I manually checked the shared |
jotitadev
left a comment
There was a problem hiding this comment.
Ran this on macOS, including executing the Mach-O output under Rosetta 2, since the PR's native load check only runs on Linux.
Setup: Apple M2 Max, macOS 27.2, head 32fe3aa8b merged without a commit onto main b7cedd900 (clean). Relinker-only Release builds for arm64 and for x86_64 under Rosetta (/usr/bin/python3 3.9.6).
- Full relinker-only suite: arm64 173/173. x86_64 170/173; the 3 failures (
pr_overlap_tools,release_package,linux_fixed_base) fail the same way onmain(Python 3.9 issues unrelated to this PR). guest_none_relocationswith only the test change applied tomainfails on both arches withRELATIVE relocation has a symbolforrelative-defined-symbol; with the fix it passes.
Execution of the macOS output: for baseline, relative-defined-symbol, relative-defined-object and mixed, each with SysV and SCE dynamic tables (8 cases), I converted the test's module with --macos, put an empty x86_64 libkernel.prx dylib in libs/ to satisfy the @rpath/libkernel.prx load command, and dlopened module.prx.guest.prx from an x86_64 Python under Rosetta. In all 8 cases dyld rebased the image to a slid address, shared#guest returned 42, the slot at TARGET held the slid function address, and calling through that pointer returned 42. Same result with the arm64-built and the x86_64-built relinker.
So the canonicalized symbol-index RELATIVE entry is rebased correctly by dyld on macOS, not only by the Linux loader.
Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
|
Thanks for checking the generated Mach-O on Apple silicon and under Rosetta 2. That adds useful execution coverage beyond the Linux load test. |
|
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.
|
|
I checked the overlap notice against both heads. #6977 independently contains the same matching-defined-symbol |
|
Windows check of 32fe3aa merged onto current Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7 UCRT, Ninja, Release,
Negative control: with Not run: titles or homebrew. AI-assisted: yes |
|
Second-title data point: Hasbro Family Fun Pack (CUSA03312, my own dump) needs this PR, on Linux and Windows. Relinker-only Release build, Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7. Starting from With #5138 also in the stack, the two conflict in The other members each stop at their own step, so every one of them is needed for this title; the whole table is on #6977. AI-assisted: yes (Claude Code) |
|
Thanks for the second-title report. The leave-one-out conversions show Hasbro Family Fun Pack needs this relative-defined-symbol handling on both Linux and Windows within the composed dependency stack, and the omission control stops at the reported relocation in |
What
Some PS4
libc.prxfiles useR_X86_64_RELATIVErelocations with a nonzero symbol index. The six reported entries reference defined function or object symbols whosest_valueequals the nonnegative relocation addend. The relocation still resolves to the module base plus that addend, so the guest reader can canonicalize this exact form to a symbol-zero RELATIVE entry, and code analysis can follow the same target.The reader rejects undefined symbols and defined symbols whose value differs from the addend. The change is related to #3093. It does not claim the remaining PS4 relinker work in that issue is complete.
Tested
Linux x86-64, GCC 12.2.0, Release, relinker-only build:
relinkertarget.ctest --test-dir /tmp/AnyPS5-3093-build --output-on-failure -R '^(guest_none_relocations|none_relocations)$'— 2/2 passed.guest_none_relocationscovers SysV and SCE dynamic tables, function and object symbols, and generated ELF, PE and Mach-O outputs. Native execution was tested on Linux only.python3 tools/check_conventions.py --base upstream/main --head HEADandgit diff --check upstream/main...HEADpassed.Checklist
main; no open PR implements this matching-defined-symbol case.mdfiles or images added