feat(libc): implement __isinf #2931

Merged
reyani-dev merged 1 commit from upstream-pr/2931 into main 2026-10-10 20:05:37 +00:00
reyani-dev commented 2026-10-10 18:33:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T18:33:42Z.


Resubmission of #2174, which was closed because no title was shown stopping on it. The title evidence has since been posted there by @babyhuey (run):

On main c963432d, ProsperoTV (PPSA99003), Jelly5 (PPSA99505) and Emby5 (PPSA99515) stop at __isinf (V02oFv+-JzA): Windows FAIL: unresolved ELF import V02oFv+-JzA (__isinf) from libSceLibcInternal.prx, Linux undefined symbol: V02oFv+-JzA. With this change each moves on to its next import.

The function is still absent on current main, and no open PR implements it. The branch is rebased onto current main. Windows 11 (WinLibs GCC 15.2.0), Release: guest_math passes 3/3, check_conventions.py passes, and pr_overlap.py reports no overlap.


What

Exports __isinf(double) next to __isnan and __isfinite. Like the existing __isinff, it returns 1 for either infinity and 0 otherwise, which is what FreeBSD's lib/libc/gen/isinf.c does. glibc's isinf returns -1 for negative infinity instead, so the test pins the sign behaviour.

Titles: open-source homebrew from the #1578 catalog audit imports it from libSceLibcInternal (resolved through libc.prx): PPSA74126 Stremio Plus, PPSA92280 Capy Mobile, PPSA99003 ProsperoTV, PPSA99039 EVO Player, PPSA99082 OpenNOW, PPSA99169 RetroArch, PPSA99177 PS5VR, PPSA99420 PS5MC, PPSA99505 Jelly5 and PPSA99515 Emby5. I haven't run any of these titles.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, Release, -DBUILD_TESTING=ON:

  • New checks in guest_math_tests, next to the __isinff ones: ±infinity and an overflowed product return 1; NaN, 0 and DBL_MAX return 0.
  • Mutation check: a glibc-style -1 for negative infinity, or x > DBL_MAX (which misses -inf), makes guest_math fail.
  • cmake --build build --target libs: the patched libc.prx exports the NID.
  • tools/check_conventions.py passes, and tools/pr_overlap.py --branch reports no overlap. This branch also merges cleanly with my #2158, #2166, #2167 and #2173.

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
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4813520266 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2931). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-10T18:33:42Z. --- Resubmission of #2174, which was closed because no title was shown stopping on it. The title evidence has since been posted there by @babyhuey ([run](https://github.com/boykopovar/AnyPS5/pull/2174#issuecomment-6092621912)): On `main` c963432d, ProsperoTV (PPSA99003), Jelly5 (PPSA99505) and Emby5 (PPSA99515) stop at `__isinf` (`V02oFv+-JzA`): Windows `FAIL: unresolved ELF import V02oFv+-JzA (__isinf) from libSceLibcInternal.prx`, Linux `undefined symbol: V02oFv+-JzA`. With this change each moves on to its next import. The function is still absent on current `main`, and no open PR implements it. The branch is rebased onto current `main`. Windows 11 (WinLibs GCC 15.2.0), Release: `guest_math` passes 3/3, `check_conventions.py` passes, and `pr_overlap.py` reports no overlap. --- ### What Exports `__isinf(double)` next to `__isnan` and `__isfinite`. Like the existing `__isinff`, it returns 1 for either infinity and 0 otherwise, which is what FreeBSD's `lib/libc/gen/isinf.c` does. glibc's `isinf` returns -1 for negative infinity instead, so the test pins the sign behaviour. Titles: open-source homebrew from the #1578 catalog audit imports it from `libSceLibcInternal` (resolved through `libc.prx`): PPSA74126 Stremio Plus, PPSA92280 Capy Mobile, PPSA99003 ProsperoTV, PPSA99039 EVO Player, PPSA99082 OpenNOW, PPSA99169 RetroArch, PPSA99177 PS5VR, PPSA99420 PS5MC, PPSA99505 Jelly5 and PPSA99515 Emby5. I haven't run any of these titles. ### Tested Windows 11, WinLibs GCC 15.2.0 r7, Release, `-DBUILD_TESTING=ON`: - New checks in `guest_math_tests`, next to the `__isinff` ones: ±infinity and an overflowed product return 1; NaN, 0 and `DBL_MAX` return 0. - Mutation check: a glibc-style -1 for negative infinity, or `x > DBL_MAX` (which misses -inf), makes `guest_math` fail. - `cmake --build build --target libs`: the patched `libc.prx` exports the NID. - `tools/check_conventions.py` passes, and `tools/pr_overlap.py --branch` reports no overlap. This branch also merges cleanly with my #2158, #2166, #2167 and #2173. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
reyani-dev commented 2026-10-10 18:58:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T18:58:02Z.


Full Linux and Windows builds and tests for this head (e7311656), using the project's Build workflow. I can't start the upstream manual run, so I ran the same build.yml in my fork through a mirror PR. Like the upstream run, the jobs check out the PR head merged into current main (bf6e25a1):

Job Result
linux success; full build, ctest: 703/703 passed
windows success; full build, ctest: 711/711 passed
relinker (Linux, Windows, macOS) success

Run: https://github.com/AchrafReyani/AnyPS5/actions/runs/38076392087

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101055911 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2931#issuecomment-6101055911). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-10T18:58:02Z. --- Full Linux and Windows builds and tests for this head (`e7311656`), using the project's Build workflow. I can't start the upstream manual run, so I ran the same `build.yml` in my fork through a mirror PR. Like the upstream run, the jobs check out the PR head merged into current `main` (`bf6e25a1`): | Job | Result | |---|---| | [linux](https://github.com/AchrafReyani/AnyPS5/actions/runs/38076392087/job/114284141085) | success; full build, `ctest`: 703/703 passed | | [windows](https://github.com/AchrafReyani/AnyPS5/actions/runs/38076392087/job/114284141069) | success; full build, `ctest`: 711/711 passed | | relinker (Linux, Windows, macOS) | success | Run: https://github.com/AchrafReyani/AnyPS5/actions/runs/38076392087
github-actions[bot] commented 2026-10-10 19:00:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T19:00:16Z.


Progress report (1476f76 → e731165)

➖ System libraries: 84.56% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libc __isinf_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101076265 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2931#issuecomment-6101076265). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T19:00:16Z. --- <!-- progress-report --> ### Progress report (1476f76 → e731165) ➖ **System libraries**: 84.56% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libc | `__isinf_nid_postfix` | </details>
babyhuey commented 2026-10-10 19:09:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T19:09:30Z.


Heads-up so the evidence here isn't read against the wrong layout: the runs of mine linked in the description are from main c963432d, before #2605. Since #2605 each title's sce_module/libc.prx has to be unwrapped, and that module is the SDK shim whose exports point 1872 libc functions at one return-0 stub (#2652). So on current main (9c5d67fb, catalog run with the module unwrapped) ProsperoTV (PPSA99003) stops at arc4random_buf (#2865) instead of __isinf. The stop comes back once the shim's return-0 exports are left out, which is what the closed #2705 did; its table lists ProsperoTV at __isinf (V02oFv+-JzA).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101159396 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2931#issuecomment-6101159396). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-10T19:09:30Z. --- Heads-up so the evidence here isn't read against the wrong layout: the runs of mine linked in the description are from `main` c963432d, before #2605. Since #2605 each title's `sce_module/libc.prx` has to be unwrapped, and that module is the SDK shim whose exports point 1872 libc functions at one return-0 stub (#2652). So on current `main` (9c5d67fb, catalog run with the module unwrapped) ProsperoTV (PPSA99003) stops at `arc4random_buf` (#2865) instead of `__isinf`. The stop comes back once the shim's return-0 exports are left out, which is what the closed #2705 did; its table lists ProsperoTV at `__isinf` (`V02oFv+-JzA`).
reyani-dev commented 2026-10-10 19:17:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-10T19:17:27Z.


Thanks @babyhuey, that's an important caveat. These titles' imports declare libSceLibcInternal, so on current main they bind to the bundled SDK shim's return-0 export (#1497/#2652) instead of failing at load, which hides the stop. Once #1529 keeps libSceLibcInternal-declared imports host-bound, the stop comes back, as the closed #2705 table showed. Either way, these titles call the real function, so on main they currently get 0 from it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6101231104 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2931#issuecomment-6101231104). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-10T19:17:27Z. --- Thanks @babyhuey, that's an important caveat. These titles' imports declare `libSceLibcInternal`, so on current `main` they bind to the bundled SDK shim's return-0 export (#1497/#2652) instead of failing at load, which hides the stop. Once #1529 keeps `libSceLibcInternal`-declared imports host-bound, the stop comes back, as the closed #2705 table showed. Either way, these titles call the real function, so on `main` they currently get 0 from it.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2931
No description provided.