Repository navigation
fix(relinker): convert guest modules with GNU hash tables - #4340
Conversation
|
I built the relinker from this PR on Linux (GCC 12.2, Release, Ninja) and ran the GNU-hash regression against it. |
|
Which title or homebrew ships a bundled module with |
…oykopovar#4501) (#439) * Port upstream boykopovar#4340 (GNU hash tables) by @ArjenS-LA Ported from boykopovar/AnyPS5 PR boykopovar#4340 (author @ArjenS-LA), applied as a patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port upstream boykopovar#4802 (output collisions) by @ArjenS-LA Ported from boykopovar/AnyPS5 PR boykopovar#4802 (author @ArjenS-LA), applied as a patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Port upstream boykopovar#4501 (SELF skip warning) by @devavijitsingh Ported from boykopovar/AnyPS5 PR boykopovar#4501 (author @devavijitsingh), applied as a patch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Adapt boykopovar#4802 port: hoist registry paths so the collision check runs before registries are written Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Update with shipped-bundle evidence for @oneandonlydean: Mari0 1.6.2 from ps5-payload-dev/websrv v0.34 reaches this path through its bundled
On main With this PR's patch from There are two earlier checks to account for when reproducing this. The untouched archive fails the syscall check first. Reproducer in PowerShell, with New-Item -ItemType Directory -Force -Path "$package/sce_module" | Out-Null
New-Item -ItemType Directory -Force -Path "$PWD/baseline-out", "$PWD/fixed-out" | Out-Null
& $baseline --trap-sdk-syscall-stubs --windows --sce-module-path $package --module-dir . "$package/love.elf" "$PWD/baseline-out/output.exe"
& $fixed --trap-sdk-syscall-stubs --windows --sce-module-path $package --module-dir . "$package/love.elf" "$PWD/fixed-out/output.exe"SHA-256: Test platform: Windows 11 Pro x64 (build 26200), WinLibs MinGW-w64 GCC 15.2.0, Release relinker-only builds, CMake 4.3.1 and Ninja 1.13.2. This establishes the shipped module reaching |
What
A guest ELF module that supplies DT_GNU_HASH but neither DT_HASH nor DT_SCE_SYMTABSZ fails conversion with
Missing dynamic symbol count. Retain DT_GNU_HASH and derive the symbol count from the last bucket's terminating chain, using the same bounded walk already used by CodeInstructionCollector after #3273. Existing SCE and SysV symbol-count precedence is preserved.The regression converts synthetic guest providers containing multiple buckets, one chain, one symbol, and no hashed symbols. On Windows it executes a converted executable that imports the last hashed guest function and checks its return value; Linux output inspection checks the complete resulting symbol count. Invalid headers and a chain that exceeds its mapped segment still fail.
Overlap review: inspected merged #3273 and issue #3224 (main-image code analysis), plus open #4091 (guest no-op relocation copying). #4091 edits a different block in GuestImageReader::Read and does not implement GNU hash symbol counting. No existing open PR in the complete changed-file inventory implements this behavior. Refreshed all 451 open PR file lists and relevant issues, reviews and discussions against current main; none addresses this regression.
Branch:
fix/guest-gnu-hash.Base:
d06c06565717961104edecdab46ce61c8cc72a70.Fixed commit:
100896c1dc00d337bdba4aa0be3f9511610db6ab.Tested
Shipped-homebrew conversion evidence is recorded in the Mari0 1.6.2 report: websrv v0.34 bundles GNU-hash-only
libOSMesa.so.8. Mainc13dc7e6b440725babd25ccec4262ccc4c78dfc3exits 2 withMissing dynamic symbol count; the same main plus this PR at100896c1dc00d337bdba4aa0be3f9511610db6ab(uncommitted fixed tree73eb5135fb14ec71e97ace360010b4e021d0ffd2) converts successfully. Both runs use--trap-sdk-syscall-stubs,--module-dir ., and a separate package copy with an added emptysce_moduledirectory; all original file paths and hashes are preserved. The report includes commands, hashes and Windows/WinLibs toolchain details. This is conversion evidence only: neither the game nor the generated executable was run, and maintainer assessment remains pending. The automated regression below uses generated fixtures; the standalone Lua binary in #3224 does not exercise this guest-module path.Windows x86-64, Windows build 10.0.26200; supported WinLibs MinGW-w64 GCC 15.2.0 (
x86_64-ucrt-posix-seh, r7). No title dump, GPU, or hardware measurements were used.python core/relinker/relinker/tests/test_guest_gnu_hash.py <baseline-relinker.exe>exits 1 because conversion reportsMissing dynamic symbol count.b42ef24e07725ba1166420073817d80a60ec9149;git diff b42ef24e07725ba1166420073817d80a60ec9149 2ccbd376f86a0ab2dafca98749585e281f37d599 -- core/relinkeris empty.cmake -S . -B build-relinker -G Ninja -DCMAKE_BUILD_TYPE=Release -DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON -DCMAKE_CXX_COMPILER=g++ -DPython3_EXECUTABLE=C:/Users/arjen/AppData/Local/Temp/anyps5-toolchain/python/python.execmake --build build-relinker --parallel 4succeeds.ctest --test-dir build-relinker -Nregisters 123 tests, includinginput_magicandguest_gnu_hash.ctest --test-dir build-relinker --output-on-failure -j 4 -E '^(pr_overlap_encoding|import_audit|conventions_function_bodies|conventions_wrapped_declarations)$': 119/119 pass in 17.52 seconds;guest_gnu_hashtakes 0.74 seconds. Four unrelated tooling groups were excluded because local commit-creation limits prohibit their temporary Git commits. Some existing platform-specific test scripts return early on Windows; their CTest pass status is not Linux/macOS execution evidence.git diff --checkpasses.python tools/check_conventions.py --base origin/mainpasses on the submitted commit.Linux guest execution, macOS guest execution, full library builds, and CI were not run for this relinker-only change.
After fast-forwarding to current main, the targeted regression passed again. Relinker builds reported no work because their sources and build configuration were unchanged. No upstream CI result is claimed.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)