Repository navigation
fix(relinker): share guest modules between executables that need different system libraries - #5443
Merged
oneandonlydean merged 1 commit intoOct 14, 2026
Conversation
…erent system libraries On Linux and macOS every guest module listed the converting executable's own DT_NEEDED system libraries, so its bytes could depend on which executable converted it. --executable then failed with "Guest modules convert differently" when the executables need different system libraries that the modules do not, or the same ones in another order. It is the error METAL GEAR SOLID: Peace Walker (PPSA18216, boykopovar#5268) reports on Linux for its launcher and mgspw.elf. Guest modules now list only the system libraries the guest modules themselves need, with the libSceLibcInternal.prx to libc.prx rule. The executable's own DT_NEEDED is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
11 tasks done
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
--executable(#4786) converts a title's other executables in the same run. Every guest module must come out byte-identical for each of them. On Linux and macOS that could fail when the executables need different system libraries that the modules do not, or the same ones in another order. InGuestModuleBuilder, every guest module'sDT_NEEDED(LC_LOAD_DYLIBon macOS) got the converting executable's own system libraries:hostLibrariesstarts with the executable'sDT_NEEDED. So a module's bytes could depend on which executable converted it.This is the error in blocker 1 of METAL GEAR SOLID: Peace Walker - Master Collection Version (PPSA18216, #5268) on Linux.
relinker --executable mgspw/mgspw.elffails withGuest modules convert differently for mgspw/mgspw.elf, so it cannot share them with the input executable. The report guesses that the modules each executable needs at start-up differ. On Linux and macOS that changes only the executable'sDT_NEEDED, not the modules. On Windows it changes the modules, and it stays an error there, as #4786 describes.Guest modules now list only the system libraries that the guest modules themselves need, so that list no longer depends on the executable. It is the union of the modules' own dependencies, in the order of the module paths, keeping the existing
libSceLibcInternal.prx→libc.prxrule.DT_NEEDEDis unchanged. It still lists its own system libraries and the modules' ones, so the libraries loaded at start-up are the same.Two inputs still depend on the executable, and they still give the error:
DT_NEEDEDadds as an alias.Tested
Ubuntu 24.04, GCC 13.3, Release with
BUILD_TESTING=ON, onmaindacd785. Locally, the libusb lines were removed fromCMakeLists.txt, because the libusb submodule isn't checked out here.relinker_executablesgains two cases, each converted for Linux, macOS (--macos) and Windows. In both, the input executable needslibScePad.prxandlibSceVideoOut.prx, andpicker/picker.binneeds either:libScePad.prxonly, orBoth cases must convert and share one
bundled.prx.guest.prx. On Linux, the module'sDT_NEEDEDmust not list the executables' libraries, and each executable must keep its own.On
main, the Linux case fails withFAIL: Guest modules convert differently for picker/picker.bin, so it cannot share them with the input executable.guest_host_libcgains a case where only a guest module needslibSceLibcInternal.prx. The module must listlibSceLibcInternal.prxandlibc.prx, but not the executable'slibkernel.prx, and the executable keeps all three. Onmainthe module also listslibkernel.prx. With the module-sidelibc.prxline deleted, the module lists onlylibSceLibcInternal.prx, and the test fails.A wider run converted 15 cases with a module that needs no system library: a picker whose list is identical, a subset, a superset, reordered or empty, each for Linux, macOS and Windows. On
main, every Linux and macOS case with a differing list fails with that error, and Windows passes. With this change all 15 pass.Other checks:
test_guest_needed_modulesstill requires a module's own system libraries in itsDT_NEEDED.test_guest_host_libcand the other relinker tests pass.ctestat this head: 1,069 of 1,071 pass, 7 of them skipping themselves (VideoOut without a display,agc_driver_stencil_ref_export).guest_usbdandpatched_librariesare not built here, because of the missing libusb submodule.ctest -j6,guest_kernel_fcntlaborted once. Run alone, it then passed 45 times out of 45, and it does not use the relinker.GuestModuleBuilder.cppand merges cleanly with this. fix(relinker): validate Linux guest runpaths with target syntax #4801 already conflicts withmainin this file; this branch does not add to that conflict.tools/check_conventions.pyfrommainpasses with this title and body.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code