feat(libc): export the std::__sce_v2 _Stollx, _Stoullx, _Stolx and _Stoulx parsers #15683
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15683"
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 Danigamer05 on 2026-11-04T04:25:00Z.
What
Export the versioned
std::__sce_v2_Stollx,_Stoullx,_Stolxand_Stoulxfrom libc._ZNSt8__sce_v27_StollxEPKcPPciPi9kHKVS+3PzY0x10A7D0_ZNSt8__sce_v28_StoullxEPKcPPciPiXORecIx0t+c0x10A910_ZNSt8__sce_v26_StolxEPKcPPciPibearuT1s7C00xF4090_ZNSt8__sce_v27_StoulxEPKcPPciPil9qFfwjoLF00xF41C0The behavior comes from the
libc.prxbundled with PPSA03671 v01.001.005 (J03848509, SHA-256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6).They are not forwards to the unversioned
_Stollxfamily. In the module, the versioned calls are the older Dinkumware parser, built on the module's fixed C-locale tables, and they differ from the unversioned ones: an invalid base returns 0 with no error, where the unversioned calls reportEINVAL. #9526 lists these four as left out of that PR. As in the module:0xor0Xprefix for base 16 (base 0 picks 16, 8 or 10 from the prefix);errnotoERANGEand the error to 1, and returns all ones; a negative text is negated otherwise;- 5parses as -5 and--5overflows. A result out of the signed range returns the lowest or highest value withERANGE;_Stolxand_Stoulxwork on 32 bits, with the 32-bit table, and return the value zero-extended to 64 bits, as the module's 32-bit registers do. So_Stolx("-5")returns0xFFFFFFFB.VersionedUnsignedandVersionedSignedsit inDinkumwareInternals.cppbeside the unversioned calls, templated on the 64- or 32-bit unsigned type.Tested
Windows x86-64, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, mainc2eafe4461b. Exact tested commit:5aef7e58920.Built libc, libkernel, their NID-patched production libraries and the related tests. The new
guest_sce_v2_string_to_integer,guest_dinkumware_internals,public_headers,guest_math_exactand the otherguest_dinkumware_*CTests pass, along with the otherguest_sce_v2_*CTests.The new test checks 43 texts through all four calls, with the value, the end, the error and
errno, and again with null end and error pointers: decimal, signed, hexadecimal and octal texts, base 36, bases 1, 37 and -1, empty texts, a sign alone, a space after the sign, two signs, every C space and a no-break space, leading zeros, and the edges of the 64- and 32-bit signed and unsigned ranges in bases 2, 10, 16 and 36. Every expected value was taken from the original module, not from this implementation.The original functions were loaded from the bundled module with their relocations applied. Their imports were bound by NID to this branch's libc and libkernel, with
__stack_chk_guardpointing at a local value; the module's own_Getpctype,_Getptolowerandmemchrran from the module.Side by side with the patched production library, the value, the end, the error, an unchanged text,
errno, MXCSR and the x87 control and status words agree in all 20,020,800 calls over two seeds. The inputs mixed fixed edge texts, random bytes, spaces, one to three signs, prefixes, runs of zeros, digit counts around both overflow limits, mixed-case digits and trailing characters, with bases 0 to 36, invalid and random bases, and null or real end and error pointers.Negative control: five lines were altered one at a time:
The new CTest failed on each, and the side-by-side run reported differences each time. The source was then restored byte for byte (SHA-256 checked) and rebuilt, and the test and side-by-side run passed again.
Code conventions and
git diff --checkpass.tools/pr_overlap.pyread 1,831 open PRs at the tested commit and reports no overlap. It keeps exit 2 for 49 branches that already conflict with main. None of them adds a line naming these exports or helpers; #13486 is a relinker change that also touchesDinkumwareInternals.cpp. Merging each of the 49 with this branch and with main usinggit merge-treegives the same conflict blocks. The branch also merges cleanly with #15336, #15471, #15484, #15490, #15501, #15519, #15552, #15561, #15602, #15614 and #15667.Not tested: Linux, macOS, another SDK, a game, GPU or console. No game compatibility claim. No original module, extracted bytes, harness or log is committed or uploaded.
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)🤖 Generated with Claude Code