Skip to content

feat(libc): implement __std_calloc_crt allocation wrapper - #180

Open
Thimo188 wants to merge 4 commits into
mainfrom
upstream-pr/12184
Open

Thimo188 wants to merge 4 commits into
mainfrom
upstream-pr/12184

Conversation

@Thimo188

@Thimo188 Thimo188 commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Imported from boykopovar/AnyPS5#12184, originally opened by laloerraz.

Source commit: ecd9477b745fbd1640c851360ffec78a1b9168cd. The import branch preserves this fetched upstream PR snapshot. The description and validation below are copied from upstream; no new code changes or test runs were made for this import. Original reviews, discussions, and attachments remain at the linked upstream PR.


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: https://github.com/microsoft/STL/blob/b6f01e438b68ee497f9c08313e49d12bb2f0d8e0/stl/src/tzdb.cpp#L647-L649 and https://github.com/claimore22/ps5rs/blob/5f252a658ff470bcb2b6cd15205fd8ca64ae4477/data/stubs/by_library/libc.txt

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

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 boykopovar#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.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown

Progress report (5cf487d → ecd9477)

📈 System libraries: 47.94% (+0.0013%, +1 implemented function)

✅ 1 implemented
Library Name
libc __std_calloc_crt_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libc 1908/1917 (99.53%) 1909/1918 (99.53%) +0.0002%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants