feat(libc): export Dinkumware thread primitives from libc.prx #8148
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8148"
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 hamb3r on 2026-10-20T00:22:55Z.
What
libSceAmpr(core/libs/prx/libSceAmpr/Export.cpp) tolibc(core/libs/prx/libc/src/Threads.cpp) where guest titles (such as Unity IL2CPP modules in PPSA28997) import them fromlibc.prx:_ZNSt4_PadC2Ev(dGYo9mE8K2A)_ZNSt4_PadD2Ev(gjLRZgfb3i0)_ZNSt4_Pad8_ReleaseEv(a-z7wxuYO2E)_ZNSt4_Pad7_LaunchEPP7pthread(xZqiZvmcp9k)_Thrd_join(YvmY5Jf0VYU)_Thrd_id(np6xXcXEnXE)_ZSt16_Throw_Cpp_errori(W0j6vCxh9Pc)libcandlibkernel:libkernelregisterspthread_create_nid_postfixandpthread_join_nid_postfixwithlibcon load viaRegisterPthreadCreate_nid_no_patchandRegisterPthreadJoin_nid_no_patch(core/libs/prx/libc/include/General.hpp,core/libs/prx/libkernel/Pthread/Posix/Thread.cpp), and_Pad::_Launchand_Thrd_jointhrowstd::runtime_errorif called when unregistered.PadLaunchAndJoinincore/libs/tests/GuestLibcThreads.cpp(linked only againstlibc) covering both the unregistered callbackstd::runtime_errorpaths and registeredstd::_Padlaunch, release, destruction, and_Thrd_join.docs/dev/debt/libSceAmpr.mdtodocs/dev/debt/libc.md.Tested
cmake --build build-portable --target libc libkernel libSceAmpr guest_libc_threads_tests guest_ampr_threads_tests guest_ampr_cpp_error_tests -j 16ctest --test-dir build-portable -R "^(guest_libc_threads|guest_ampr_threads|guest_ampr_cpp_error)$" --output-on-failure -V-> 3/3 passed (guest_libc_threadsfails to link onmainwithout this change).eboot.elf+Il2cppUserAssemblies.prx): verified that all 7libc.prximports (dGYo9mE8K2A,gjLRZgfb3i0,a-z7wxuYO2E,xZqiZvmcp9k,YvmY5Jf0VYU,np6xXcXEnXE,W0j6vCxh9Pc) resolve cleanly at startup and the title transfers control to the ELF entry point (and together with #8137 reaches the main menu at 60 FPS).Before (
main):After (this PR):
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 github-actions[bot] on 2026-10-20T00:23:30Z.
Progress report (
34b1b77→387be86)➖ System libraries: 80.13% (+0.0%, +6 implemented, +1 declared, -7 removed functions)
✅ 6 implemented
_Thrd_join_nid_postfix_ZNSt4_Pad7_LaunchEPP7pthread_nid_postfix_ZNSt4_Pad8_ReleaseEv_nid_postfix_ZNSt4_PadC2Ev_nid_postfix_ZNSt4_PadD2Ev_nid_postfix_ZSt16_Throw_Cpp_errori_nid_postfix🆕 1 declared as stubs
_Thrd_id_nid_postfix🗑️ 7 removed
_Thrd_id_nid_postfix_Thrd_join_nid_postfix_ZNSt4_Pad7_LaunchEPP7pthread_nid_postfix_ZNSt4_Pad8_ReleaseEv_nid_postfix_ZNSt4_PadC2Ev_nid_postfix_ZNSt4_PadD2Ev_nid_postfix_ZSt16_Throw_Cpp_errori_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T00:34:24Z.
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.
main)docs/dev/debt/libc.mdL127docs/dev/debt/libc.mdL122-123docs/dev/debt/libc.mdL122-123core/libs/prx/libSceAmpr/Export.cppL229-240, L277-303, L908-960core/libs/tests/GuestLibcThreads.cppL19, L185, L191core/libs/prx/libSceAmpr/Export.cppL272-275Some 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.
core/libs/prx/libc/src/Threads.cppcore/libs/prx/libc/src/Threads.cppdocs/dev/debt/libc.mdcore/libs/tests/GuestLibcThreads.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/prx/libSceAmpr/Export.cppdocs/dev/debt/libc.mdcore/libs/prx/libc/src/Threads.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdImported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-20T06:53:32Z.
Linux run of this head (
387be8600), since the description covers Windows only and this changes howlibcandlibkernellink. Merged ontomain15da28937(clean merge). Ubuntu 24.04 container, GCC 13, Release,BUILD_TESTING=ON, full build.Threads.cpp,Pthread/Posix/Thread.cpp,GuestLibcThreads.cppor thelibSceAmprexport.guest_libc_threads,guest_ampr_threadsandguest_ampr_cpp_erroreach pass 5 of 5 (--repeat until-fail:5).Imported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-20T11:29:57Z.
Windows run of
387be8600merged ontomain02fb1ce53(clean merge). Windows 11 (10.0.26300), Ryzen 5 9600X, WinLibs GCC 15.2.0 UCRT, Release,BUILD_TESTING=ON.ctest -R "^(guest_libc_threads|guest_ampr)": 4 of 4 pass, 3 runs out of 3. The build log has no warnings. With the four changed sources reverted,guest_libc_threads_testsdoes not link, andguest_ampr_threads/guest_ampr_cpp_errorexit0xc0000139.objdump -pof the built.prxfiles:libc.prxnow exports the seven_nid_postfixnames, andlibSceAmpr.prxexports none of them.libSceAmpr:d991cdccfadded the_Padexports tolibSceAmprbecause Deathloop (PPSA01670) and Minecraft Legends (PPSA05510) import them from there. On Windows such an import still resolves after the move, becauseWindowsEntryStubBuilder.cpp(L172-176 onmain) appendslibc.prxto the search order of every import from a host module. On Linux the import is found by symbol name, and the relinker adds no per-library symbol versions. I could not run either title, so this is from the code only.tools/nid_names.py compute_nid, and the same in aerolib):_Thrd_joinisYvmY5Jf0VYU,_ZSt16_Throw_Cpp_erroriisW0j6vCxh9Pc,_ZNSt4_Pad8_ReleaseEvisa-z7wxuYO2E, and_ZNSt4_Pad7_LaunchEPP7pthreadisxZqiZvmcp9k. The "Before" log listsj43330743sY, which is not in aerolib and is not the NID of any of the seven names, and it leaves outYvmY5Jf0VYU. The log in #8137 for the same title listsYvmY5Jf0VYU. The code is correct; only the description needs the corrected pairs.AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by hamb3r on 2026-10-20T11:40:37Z.
Thanks @wachi35676 for the careful catch on the NID pairings in the PR description — updated the description so each symbol and
Before (main)log line matches its exact NID inData.h. Also thank you @babyhuey for testing on Linux!