libc: __umodti3 is absent (Kart PS5's stop after __divti3, PS5CEMU-HAR); fix branch ready #4460
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 screamm on 2026-10-12T12:22:46Z.
libc lacks
__umodti3(NIDELSr5qm4K1M). Kart PS5 (PPSA99611) stops on it right after__divti3, as open #4037 reports in its body ("with this change it passes__divti3and stops atELSr5qm4K1M(__umodti3)"); PS5CEMU-HAR (PPSA99360) imports it too (registry index 359, predictedFAIL: unresolved ELF import ELSr5qm4K1M from libSceLibcInternal.prx).Fix branch ready:
screamm:feat/libc-umodti3(2d3ac3d5, one commit onmainffa19840). I cannot open it as a PR under the intake rule while #4081 is open; anyone eligible is welcome to carry it, keeping the commit as is. It is the natural follow-up to #4037 (__divti3): both add a function afterSonyUdivti3inSonyCrt.hppand extendGuestCrt.cppat the same spot, so whichever merges second gets a small conflict; #4037'sSonyDivti3still works on top of this refactor.SonyUdivti3moves into a sharedSonyUdivmod128helper returning quotient and remainder (SonyUdivti3unchanged, same throw);SonyUmodti3returns the remainder, per compiler-rtlib/builtins/umodti3.cat0ee439b7(the commit #3161 cited). A zero divisor throws__umodti3: integer divide by zero (0x<dividend> % 0), where compiler-rt'sudivmodti4would reach a native divide that traps. Exported from libc next to__udivti3(the relinker routeslibSceLibcInternalimports tolibc.prx);__modti3/__udivmodti4are not added because no title imports them. TechnicalDebt bullet beside the__udivti3one.guest_crtchecks literal remainders: small cases, 2^100 % 3, (2^128-1) % 10, (2^128-1) % 2^64, two divisors above 2^64, divisor 1, equal operands, a dividend below the divisor, (2^128-1) % 2^127, and the zero-divisor message through the export.Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, full build includinglibs:guest_crt3/3;ctest -j8 -E "^agc_driver_|^video_out_flip"606/606; withmain'sSonyCrt.hppthe branch no longer compiles (the export needs the helper), so the negative check is by construction;tools/check_conventions.py --base mainandgit diff --checkpass. Not run on Linux; the titles were not relinked.Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-12T12:28:23Z.
Carried in #4462, keeping your commit and authorship. #4037 had merged in the meantime, so I resolved the conflict you expected in
SonyCrt.hppandGuestCrt.cpp(the PR lists exactly what changed) and checked it on Linux with GCC 13.3:guest_crtpasses, it doesn't link without your__umodti3, and all 304guest_*tests pass. Thanks for the branch.AI-assisted: yes