feat(libc): implement __std_calloc_crt allocation wrapper #12184
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12184"
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 laloerraz on 2026-10-28T01:33:53Z.
What
Provide missing libc export __std_calloc_crt (NID 1a7K+jO+ST0) through the existing guest calloc implementation. The signature and forwarding contract follow Microsoft STL; the name/NID occur in the public PS5 ps5rs inventory. The source-derived alias is an inference rather than a PS5 measurement; record unverified native allocator routing and error behavior in libc debt. This does not claim that a title is unblocked.
Tested
Windows x86-64, WinLibs GCC 15.2.0 POSIX/DWARF, Release full CMake configuration. Built application_heap_tests and patched libc.prx. CTest -R ^application_heap_ --output-on-failure -j1 --timeout25: 9/9 passed, 0 failures, 0.32 seconds, including replacement, invalid_metadata, default, exit_order, scripting, lazy and three stats modes. Tests exercise zeroed storage, 64-bit multiplication overflow, zero dimensions, existing guest deallocation/reallocation and callback allocation failure. Public-header audit and conventions passed. Patched output exports the expected NID. No game, PS5 module or console run; actual native allocator-domain/error equivalence remains unverified.
Sources:
github.com/microsoft/STL@b6f01e438b/stl/src/tzdb.cpp (L647-L649)andgithub.com/claimore22/ps5rs@5f252a658f/data/stubs/by_library/libc.txtChecklist
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)Overlap review: the full tool examined 1,364 open PRs. No duplicate function/export was found. Thirty-seven stale PR comparisons required manual review; PR #11848 appends unrelated freezero tests at the same ApplicationHeap.cpp insertion point, so a textual merge resolution may be needed. There is no demonstrated functional dependency. Full log and manual diff review are retained locally; do not describe every stale PR as merge-clean.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T03:23:58Z.
Review: CHANGES_REQUESTED
The code and focused test changes look sound in the scope I checked: the NID recomputes to
1a7K+jO+ST0, the public-header audit passes, both changed C++ files pass local C++20 syntax-only compilation, conventions/diff checks pass, and the current-main merge preview is clean. I found one required overlap follow-up before approval. Your overlap report identifies still-open #11848 as touching the sameApplicationHeap.cppinsertion point, and my merge preview confirms textual conflicts inApplicationHeap.cppanddocs/dev/debt/libc.md. CONTRIBUTING.md requires the authors to agree which overlapping PR goes first and to record that order withDepends on: #Nin the affected checklist. Please coordinate the order with #11848’s author and update the checklist accordingly. I am not asking to close or withdraw either PR. Your reported Windows 9/9 focused tests and patched-NID check are useful; I did not independently run that Windows suite. The available hosted checks at this head are conventions, intake and labels; the PR does not yet have hosted build checks.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T11:13:10Z.
Review: CHANGES_REQUESTED
Code, test and debt entry look right (alias to
calloc, overflow/zero/callback-failure rows, unverified native routing recorded). One point left, the one @MarcZX10 requested:core/libs/tests/ApplicationHeap.cppanddocs/dev/debt/libc.md, so the two conflict textually. CONTRIBUTING asks the authors to agree which goes first and to record it. Please agree the order with #11848's author and put the result inDepends onin the checklist (#11848if that one lands first). Rebase onto main afterwards.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T06:43:54Z.
Review: APPROVED
Reviewed — looks good
The wrapper and declaration follow the existing
callocpath, and the inspected tests cover zeroing, overflow, zero-sized requests, and allocation failure; the author reports the Windows test run, which I did not perform.What I ran
Reviewed head
f727bbacfb303b6932984abd2b7290323a8b3b7c. Read the prepared description, commits, manifest and diff, and all four changed files listed as reviewed. Used the provided repository reader to inspect the allocation helper and relevant tests. No commands or tests were run by me.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The reported build, CTest results, public-header audit, conventions check and NID export check were not independently run. No PS5 module, title or console behavior was tested. Files excluded by rule: none listed in
files.jsonbecause that file was not included in the prepared bundle; exclusion status not verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T22:22:42Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
ecd9477b745fbd1640c851360ffec78a1b9168cd, basemain.Api.hpp,FileAndHeap.cpp,ApplicationHeap.cppandlibc.md.FileAndHeap.cppat lines 1100–1135 (the calloc wrapper it forwards to).Results
files/not openedFindings
Blocking
None.
Non-blocking
None.
Not verified
application_heap_CTest run, including the 9/9 count. These are the author's report, not a run here.1a7K+jO+ST0as the export that a PS5 or the patchedlibc.prxresolves. The head search found the NID only indocs/dev/debt/libc.md:9. The export table is not in the repository at the head, so the mapping is not checked.tzdb.cppat lines 647–649, so whether those lines show the forwarding the entry describes is not verified.To get this to a good state
Nothing is required.
Optional: confirm that the Microsoft STL permalink in
docs/dev/debt/libc.md:9shows the calloc forwarding it describes. If it does not, point the entry at the right source.Imported from boykopovar/AnyPS5. Originally posted by malekaifa on 2026-11-23T23:46:06Z.
Review: CHANGES_REQUESTED
Current exact head
ecd9477b745fbd1640c851360ffec78a1b9168cdis not mergeable. The earlier overlap-order blocker is no longer the issue: #11848 (freezero) has merged, so its edits are now upstream and should simply be preserved.The
__std_calloc_crtimplementation itself still looks sound: it forwards to the existing checked guestcallocpath, the tests cover zeroing, multiplication overflow, zero dimensions and callback failure, and current-head Windows evidence reports the 11application_heap*tests passing. The debt entry correctly marks the PS5 allocator-domain/error semantics as unmeasured.Please rebase/restack this branch onto current
main, resolve the now-upstream #11848 changes inApplicationHeap.cppanddocs/dev/debt/libc.mdby preserving both sides, and rerun the focusedapplication_heap*tests plus conventions/diff checks. Then request exact-head review. The oldDepends oncoordination with #11848 is historical now; it should not remain as a live blocker after the rebase.I am requesting changes for integration state, not for the wrapper semantics.
AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:24:58Z.
Review: COMMENTED
Built the focused checks against the existing Linux runtime.
ApplicationHeappassed, including the allocation-wrapper checks.AI-assisted: yes.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.