fix(relinker): resolve Linux guest NID providers #16384
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16384"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by farosch on 2026-11-06T14:06:05Z.
What
Allow Linux guest conversion of identical SCE-qualified function aliases while retaining symbol indices for relocations and rejecting conflicting duplicates. When the runtime path contains libkernel_sys.prx and the title needs libkernel.prx, add the split provider to the process dependency graph so its NID exports are visible to guest modules.
Tested
Linux x86-64: relinker target built; CTests guest_host_libc, guest_export_lookup, and guest_module_directories passed; tools/check_conventions.py --base origin/main passed. GoY relinked with seven modules and its dependency graph includes libkernel_sys.prx. A short local smoke run passed symbol resolution but used a temporary category implementation that was removed after finding the firmware-based implementation in open PR 14216; the PR branch still needs that separate change. The run then reached the known sceRegMgrNonSysGetInt not implemented stub. /dev/gc is unavailable, so gameplay and GPU behavior were not tested.
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)Imported from boykopovar/AnyPS5. Originally posted by ahmadmuj on 2026-11-06T15:15:17Z.
Review: COMMENTED
Checked head
b0bc8c92e3a3d4f130426d0b8e6efaf9d47974a4against main7383be1a19c7fc2f8f1b8e8de1f1843e4a312976on Ubuntu 24.04.2/WSL2, GCC 13.3, Release. PR base:6ed10ccd1fd35e950f42ce9614981fb94d52ef6e.The new provider scan misses a valid later directory when the first run-path directory does not exist.
I used the actual relinker CLI with the existing
test_guest_host_libcfixture helpers: a main declaring alibkernel.prxdependency, oneother.prxguest module, and the test'slibkernel_sys.prxmarker. Each call passes--rpathwith two absolute components.libkernel.prx,libkernel_sys.prxlibkernel.prxonlylibkernel.prx,libkernel_sys.prxlibkernel.prxonly, as expectedEvery list starts with exactly
$ORIGIN/app0/sce_module/other.prx.guest.prx. All calls exit 0 and retain both components, in order, in DT_RUNPATH.The directory loop stops when
runDirectoriesExistbecomes false. The new scan therefore never sees the later provider. glibc's search continues after absent directories.Please collect all Linux run-path components while keeping the separate existence flag cumulative. A temporary two-line control does that and passes all four cases. Three extra
--omit-unavailable-dependenciescases also pass: an unused dependency disappears when both directories exist, but stays when either directory is missing. Restoring and rebuilding the exact head reproduces only the missing/provider failure; its binary hash matches the original.Exact head commands
The conventions command runs inside the head worktree. Main uses
worktrees/anyps5-pr-16384-mainandbuilds/anyps5-pr-16384-main. The correction and restoration rebuild the head target and rerun the focused tests and probe with separate receipts.The three existing tests pass on head, main, the temporary control and restored head. Conventions pass on restored head. Main omits the provider in all three positive cases because it lacks this feature.
The marker checks dependency selection only. No emitted guest program, runtime symbol binding, title, console, Windows or GPU execution is tested. No source change is included with this review.
Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T01:33:26Z.
Review: COMMENTED
Windows check of head
482c9af7ae, merged ontomain210676ad86(clean merge). #14216, listed under Depends on, is already merged.Setup: Windows 11, WinLibs GCC 15.2, Release, relinker-only.
windows_guest_export_aliases,guest_export_lookup,guest_host_libc,guest_module_directories,guest_needed_modules,guest_symbolic_modules,needed_librariesand thelinux_guest_*tests.mainrelinker:test_guest_export_lookup.py,test_guest_host_libc.pyandtest_guest_module_directories.pyfrom this PR fail, so they cover the change.test_guest_needed_modules.pypasses onmaintoo.Interaction with #15942. The two merge cleanly, but together they reject a module this PR accepts on its own. Here a Linux module may export the same stripped name twice when both entries are identical functions. #15942 emits one binding alias per exported symbol index, so that module gets two aliases with the same name and
LinuxGuestModuleWriterthrowsDuplicate or empty guest binding alias: entry#module0#guest. Repro:a.prxexportsentry#A#Aandentry#B#A(bothFUNC, section 1), andb.prxexportsentry. That converts with this PR alone and fails with both. Details and a two-line guard are in my comment on #15942.Minor, not blocking: the Linux provider rule adds
libkernel_sys.prxonly whenlibkernel.prxis needed. The Windows import builder covers the whole kernel family (libkernel,libkernel_sys,libkernel_web), so a title that needs onlylibkernel_sys.prxorlibkernel_web.prxtakes a different path on Linux.