Skip to content

fix(libSceLibcInternal): keep the named _Pad exports from binding to themselves - #22440

Closed
Krille2004zzz wants to merge 1 commit into
boykopovar:mainfrom
Krille2004zzz:fix/libc-internal-pad-self-imports
Closed

Krille2004zzz wants to merge 1 commit into
boykopovar:mainfrom
Krille2004zzz:fix/libc-internal-pad-self-imports

Conversation

@Krille2004zzz

Copy link
Copy Markdown
Contributor

What

patched_self_imports fails on main since #22248 (merged 2026-11-17):

libSceLibcInternal.prx imports H7-7Z3ixv-w, a name it also exports, so the import can bind to its own export
libSceLibcInternal.prx imports PBbZjsL6nfc, a name it also exports, so the import can bind to its own export
libSceLibcInternal.prx imports uhnb6dnXOnc, a name it also exports, so the import can bind to its own export

#22248 added libSceLibcInternal exports for _Pad::_Pad(const char*) (uhnb6dnXOnc), _Pad::_Launch(const char*, pthread**) (PBbZjsL6nfc) and _Pad::_Launch(const char*, pthread_attr**, pthread**) (H7-7Z3ixv-w). Each one forwards to libc's _nid_postfix function with the same NID. After NID patching, each import has the same name as libSceLibcInternal's own export. So when libSceLibcInternal comes before libc in the lookup scope, the forwarder calls itself. This is the case #13730 fixed for the other forwarders, and this PR uses the same pattern:

  • libc keeps the named constructor's body in ConstructNamedPad_nid_no_patch. _ZNSt4_PadC2EPKc_nid_postfix now calls it.
  • libc's existing LaunchPad_nid_no_patch is no longer static. Both helpers are declared in libc/include/General.hpp.
  • The three libSceLibcInternal exports call the helpers instead of the patched names.

No behaviour changes, with one exception. A null pad passed to the named constructor now names ConstructNamedPad_nid_no_patch in the std::invalid_argument message. Before, it named _ZNSt4_PadC2EPKc_nid_postfix. _ZNSt4_PadD1Ev (XyJPhPqpzMw) forwards to _ZNSt4_PadD2Ev, which libSceLibcInternal does not export, so it is unchanged.

Tested

Linux x86-64 (Debian, GCC 14.2.0), Release, BUILD_TESTING=ON, on current main (1adc0e2f4b). No title tested.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

…themselves

libSceLibcInternal exports _Pad::_Pad(const char*) and the two named
_Pad::_Launch overloads by forwarding to libc's functions of the same
NIDs. After NID patching each import has the name of the library's own
export, so when libSceLibcInternal comes before libc in the lookup scope
the forwarder calls itself. libc now keeps the named constructor body in
ConstructNamedPad_nid_no_patch and exposes LaunchPad_nid_no_patch, and
the libSceLibcInternal exports call those, as boykopovar#13730 does for
the other forwarders. patched_self_imports passes again on Linux.
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 17300 _ZNSt4_PadC2EPKc

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.

Pull request Shared files not compared
PR 1835 core/libs/prx/libc/src/Threads.cpp
PR 9447 core/libs/prx/libc/include/General.hpp
core/libs/prx/libc/src/Threads.cpp
PR 11446 core/libs/prx/libc/include/General.hpp
PR 17300 core/libs/prx/libSceLibcInternal/Pad.cpp
PR 18347 core/libs/prx/libc/src/Threads.cpp
PR 20315 core/libs/prx/libc/include/General.hpp
PR 22380 core/libs/prx/libc/src/Threads.cpp
PR 22515 core/libs/prx/libc/src/Threads.cpp

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 17, 2026
@Krille2004zzz

Copy link
Copy Markdown
Contributor Author

Superseded by #22500, which landed the same no_patch forwarding for the three named _Pad exports. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant