feat(libc): implement index string search #8842
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8842"
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 UnhealthyKraken on 2026-10-21T02:32:24Z.
What
Adds the legacy
index(const char*, int)string search to the common libc exports, beside the existingstrchrandrindex. It returns the first matching byte, including the terminating NUL, by forwarding to the existingstrchrimplementation. There is no allocation or new mutable state.Name and NID
t3RFHn0bTPgappear in the public PS5 3.20 libSceLibcInternal inventory. The public PS5 payload SDK declaration supplies the prototype. FreeBSD 11.4 strchr.c makesindexa weak alias ofstrchr. These establish the public interface and reference behavior; this was not measured on a PS5, and the inventory does not establish module/library versions. Null string pointers are outside the reference function's defined input domain.Tested
Windows x86-64, supported WinLibs MinGW-w64 GCC 15.2.0, Release full configuration with
BUILD_TESTING=ONin an independent checkout ofcd700fe9ec.^(guest_index|guest_allocating_strings|guest_strings|guest_wide_strings)$.guest_indexfails withindex is missing from libc. Candidate: all four pass, no skips. The new test covers first matches, absence, empty strings, NUL, high bytes, integer conversion from -512 through 512 and INT_MIN/INT_MAX, unchanged input, returned original writable storage, and 257 string lengths ending immediately before a protected page.t3RFHn0bTPgin its PE export table.libstarget and ranctest -R '^patched_libraries$' -V: all 354 patched libraries loaded, zero failed. This is structural/load validation. Configuration initially inherited an empty processor name from the tool environment; a fresh configure with the verifiedPROCESSOR_ARCHITECTURE=AMD64restored selected mimalloc's correct x64 redirect dependency, with no source changes.tools/pr_overlap.py --branch feat/libc-index --repo boykopovar/AnyPS5completed after fetching missing partial-clone objects. It reported no confirmed same-export or merge collisions, but could not compare shared files for 12 PRs already conflicting with main (#3965, #5021, #6044, #6819, #6879, #7081, #7201, #7715, #8150, #8352, #8520, #8711). Manually inspected their shared-file diffs: none addsindex, changes the strchr/rindex region, or adds this test. #6044 reorganizes test paths and registration, so that broad reorganization would require integrating this new test if it lands later.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-21T02:33:00Z.
Progress report (
cd700fe→20e9537)➖ System libraries: 62.76% (+0.0%, +1 implemented functions)
✅ 1 implemented
index_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-21T02:45:01Z.
Some 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/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/src/Strings.cppcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/src/Strings.cppcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/src/Strings.cppcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/CMakeLists.txtcore/libs/prx/libc/src/Strings.cppcore/libs/prx/libc/src/Strings.cpp