feat(libc): implement atol and atoll #2932
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2932"
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 reyani-dev on 2026-10-10T18:33:46Z.
Resubmission of #2186, which was closed because no title was shown stopping on it. The title evidence has since been posted there by @babyhuey (run):
On
mainc963432d, PSXS5 (PPSA97510), SwanStationPS5 (PPSA98510), EVO Player (PPSA99039) and Nuvio PS5 (PPSA99997) stop atatoll(fLcU5G6Qrjs), and ProsperoPuzzles (PPSA99006) and PSBox Cloud Gaming (PPSA99810) stop atatol(+my9jdHCMIQ): WindowsFAIL: unresolved ELF import fLcU5G6Qrjs (atoll) from libSceLibcInternal.prx, Linuxundefined symbol: fLcU5G6Qrjs. With this change each moves on to its next import, and OpenRCT2 (PPSA99728) reachesatolafterllroundf.The function is still absent on current
main, and no open PR implements it. The branch is rebased onto currentmain. Windows 11 (WinLibs GCC 15.2.0), Release:guest_mathpasses 3/3,check_conventions.pypasses, andpr_overlap.pyreports no overlap.What
Exports
atolandatoll. FreeBSD defines them asstrtol(str, NULL, 10)andstrtoll(str, NULL, 10). The guestlongis 64 bits (asstrtol_nid_postfixalready assumes), soatolcallsstd::strtollrather than the hostatol, whoselongis 32 bits on Windows.Titles: from the #1578 audit, imported from
libSceLibcInternal(resolved throughlibc.prx):atoll(fLcU5G6Qrjs): PPSA99039 EVO Player, which stops on Windows withFAIL: unresolved ELF import fLcU5G6Qrjs from libSceLibcInternal.prx; also Stremio Plus, RetroArch, PS5MC, Porpoiseatol: PPSA74126 Stremio Plus, PPSA92280 Capy Mobile, PPSA99169 RetroArch, PPSA99420 PS5MCI haven't run any of these titles.
Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release,
-DBUILD_TESTING=ON:guest_math_tests, next to thestrtolcases:-4294967296,INT64_MAX,INT64_MIN,4294967297x);"0x10"→ 0,"010"→ 10);std::atol(32-bitlongon Windows) andstrtoll(..., 0)each makeguest_mathfail.cmake --build build --target libs: the patchedlibc.prxexports+my9jdHCMIQ(atol) andfLcU5G6Qrjs(atoll).tools/check_conventions.pypasses, andtools/pr_overlap.py --branchreports no overlap.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T18:57:47Z.
Full Linux and Windows builds and tests for this head (
90915850), using the project's Build workflow. I can't start the upstream manual run, so I ran the samebuild.ymlin my fork through a mirror PR. Like the upstream run, the jobs check out the PR head merged into currentmain(bf6e25a1):ctest: 703/703 passedctest: 711/711 passedRun: https://github.com/AchrafReyani/AnyPS5/actions/runs/38076396830
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T19:00:14Z.
Progress report (
1476f76→9091585)📈 System libraries: 84.57% (+0.01%, +2 implemented functions)
✅ 2 implemented
atol_nid_postfixatoll_nid_postfixImported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T19:09:32Z.
Heads-up so the evidence here isn't read against the wrong layout: the runs of mine linked in the description are from
mainc963432d, before #2605. Since #2605 each title'ssce_module/libc.prxhas to be unwrapped, and that module is the SDK shim whose exports point 1872 libc functions at one return-0 stub (#2652). So on currentmain(9c5d67fb, catalog run with the module unwrapped) PSXS5 (PPSA97510) and SwanStationPS5 (PPSA98510) stop atutime(#2967), ProsperoPuzzles (PPSA99006) at_umtx_op(#1482) and EVO Player (PPSA99039) atTf9-yOJwF-A(#2887), none atatoloratoll. The stop comes back once the shim's return-0 exports are left out, which is what the closed #2705 did; its table lists PSXS5, SwanStationPS5 and EVO Player atatolland ProsperoPuzzles atatol.Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T19:17:28Z.
Thanks @babyhuey, that's an important caveat. These titles' imports declare
libSceLibcInternal, so on currentmainthey bind to the bundled SDK shim's return-0 export (#1497/#2652) instead of failing at load, which hides the stop. Once #1529 keepslibSceLibcInternal-declared imports host-bound, the stop comes back, as the closed #2705 table showed. Either way, these titles call the real function, so onmainthey currently get 0 from it.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T21:53:26Z.
Checked on current main:
guest_mathpasses, and without the change the test fails to link (atol/atollundefined).atol/atollasstrtoll(str, nullptr, 10)matches FreeBSD'sstrtol(str, NULL, 10)with a 64-bit guestlong. Edge rows (±2^63, >32 bits, base 10 only, empty) are pinned. Merging.