fix(libs): give each .native wrapper a dependency edge to its plain twin #1009
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1009"
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 Dextroid17 on 2026-10-06T23:13:54Z.
What
Gives each
.nativewrapper aDT_NEEDEDedge to its plain twin (the first option in #906). Closes #906.A guest module's
DT_NEEDEDnames the.nativewrapper, but symbols that only the plain twin exports were unreachable — the wrapper had no edge to the twin, so the defining object never entered the new module's lookup scope andRTLD_NOWbinding failed:All nine wrappers lacked the edge (
libSceAjm.native,libSceAudiodec.native,libSceAvPlayer.native,libSceFont.native,libSceMsgDialog.native,libSceNgs2.native,libSceSaveDataDialog.native,libSceSaveData.native,libSceShare.native), and all nine plain twins exist.The change links each
.nativelibrary against its plain twin on ELF targets. Windows is left alone: PE resolution binds against every module already loaded and the relinker points guest imports at the implementing library, so the edge is not needed there.This is option 1 of the three listed in the issue; option 2 (the relinker emits the implementing library in the converted guest module's
DT_NEEDED) would also work and touches the relinker instead of the library graph. Happy to switch if you prefer that direction.Tested
readelf -don all nine wrappers: noNEEDED libSceX.prxbefore the change, present after.dlopenprobe withRTLD_LOCAL(the way a guest module binds), checking/proc/self/maps:dlopen(libSceMsgDialog.native.prx)leaveslibSceMsgDialog.prxunmappedlibSceAudiodec.nativeandlibSceAjm.native)cmake --build build --target libs→ 106.prxbuilt.ctest --test-dir build -j 8 --timeout 120→ 369/369 pass.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)Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-06T23:14:45Z.
Closing this: @jeffrey12cali measured on PPSA28997 that this exact approach regresses the title (see #906).
Pulling the plain twin in through a
DT_NEEDEDedge puts it in the executable's global scope on Linux, and the pairs share NIDs (libSceAvPlayer30/30 overlapping,libSceSaveData14/41,libSceMsgDialog6/7), so other modules rebind to the wrong implementation and the title fails earlier than before. The static checks in the description (readelf,dlopen) all pass and are exactly why they are not sufficient here — the edge is added, and that is the problem.The twin has to stay out of the global scope. I will pick this up again on that basis — most likely the relinker emitting the implementing library in the converted guest module's
DT_NEEDED(the issue's option 2, which is also the stopgap described in #906) rather than a library-graph edge, or the wrapper re-exporting what the plain library provides.Branch
fix/native-wrapper-dependency-edgeis left in place for reference. Sorry for the noise, and thank you for the measurement.Pull request closed