Commit Graph
245 Commits
Author SHA1 Message Date
Aryan Sharma ec832e0bcb fix(libc): limit sceLibcBacktraceSelf to Linux and test its record layout 2026-10-17 14:56:56 +05:30
Aryan Sharma ce57c2d799 feat(libc): implement sceLibcBacktraceSelf on Linux
PPSA28997 (IL2CPP) calls sceLibcBacktraceGetBufferSize and
sceLibcBacktraceSelf. On Linux the host call stack is captured with
backtrace and each frame is resolved to its module and offset with
dladdr, then written as a linked list of frame records. The record
layout is inferred and listed in TechnicalDebt. Windows throws.
2026-10-17 14:56:56 +05:30
Dean 437f157d31 Merge pull request #6319 from hypermoist/docs/debt-duplicate-entries
docs(debt): drop the call tracing entry that --trace-imports superseded
2026-10-17 17:28:35 +13:00
lorkydey 4e7e8ac1a9 feat(libc): implement floating-point rounding and exception flags 2026-10-17 03:46:56 +02:00
Adrià d96e0e554c Merge pull request #5772 from DavidSamir/fix/libc-empty-guest-environment
fix(libc): start the guest environment empty instead of copying the host's
2026-10-16 21:23:35 +02:00
Alexej Szpevák b71434d9b7 feat(libc): read app0.zar beside app0 and refuse archive-only paths elsewhere
A ZArchive named app0.zar beside app0/ is a read-only layer under it. libc opens it at the first path resolution, looks paths missing from app0/ up case-insensitively, reads files across compressed blocks and keeps the archived descriptor table with shared positions.

Resolving an archive-only path through a call that does not read the archive throws instead of failing with ENOENT, as do opendir of a directory present in both places, fdopen of an archived descriptor and chdir into the archive. A path through .. in an archive-only directory resolves.
2026-10-16 20:03:26 +02:00
David 69aa703c6b docs(debt): say how mktime solves a time before 1900 on macOS 2026-10-16 13:28:56 +04:00
Karim Ibrahim ceec3da0a0 fix(libc): share the constraint handler across libc source files
SonyCrt.hpp kept the constraint handler slot in an unnamed namespace,
so every source file that included it had its own slot. A handler
installed with set_constraint_handler_s in WideConversion.cpp was not
the one qsort_s in FileAndHeap.cpp called, and its violations aborted.
The slot and its mutex now have one instance per module, and the
handler type uses the guest calling convention, as the handlers a title
installs and the default handler it gets back are guest functions.
2026-10-16 02:46:25 -04:00
Karim Ibrahim edf4efe360 feat(libc): implement qsort_s
The Quake homebrew's libOSMesa.so.8 imports qsort_s, the only strong
import left unresolved once its symbol names resolve through NIDs.

qsort_s sorts as qsort does, with the context passed as the
comparator's third argument, and returns EINVAL after calling the
constraint handler for the runtime constraint violations of FreeBSD
13's qsort_s. The sort helpers take any comparator so both functions
share the FreeBSD 11 algorithm.
2026-10-16 01:31:40 -04:00
David 0e6ad36fe4 docs(debt): say how mktime converts a time before 1900 on macOS 2026-10-16 08:45:29 +04:00
hypermistandClaude Opus 5.5 20edd079e4 fix(libc): store the sign of gamma in an exported signgam from lgamma
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 16:11:02 +13:00
Adrià 7663bc63bb Merge pull request #5092 from MrMha/fix/scripting-heap-694
feat(libc): provide the runtime scripting allocator hooks
2026-10-15 22:58:23 +02:00
Anthony 2b567cda34 fix(libc): count wide collate string elements 2026-10-15 15:30:40 -03:00
Yossi Yadgar a7ef31e103 docs(debt): note how closed standard descriptors are reopened 2026-10-15 18:19:21 +03:00
Adrià d67b79a7e4 Merge pull request #5709 from fogydes/fix/libc-formatting-allocation-and-bounds
fix(libc): check allocation result in vasprintf and guard null pointer in strndup
2026-10-15 17:04:33 +02:00
Adrià f5a55a11d0 Merge pull request #5662 from Roojool/contrib/g15-libc-pending
feat(libc): implement collate<wchar_t>::_Getcat
2026-10-15 17:03:49 +02:00
Adrià 08290338aa Merge pull request #5599 from JJenkx/feat/libc-isfinitel
feat(libc): implement x87 long-double finite classification
2026-10-15 17:03:18 +02:00
Adrià 0dab493f5b Merge pull request #5816 from Nawasfadili/feat/libc-wide-and-unlocked-stream-io
feat(libc): implement wide and unlocked stream I/O
2026-10-15 15:58:44 +02:00
MrMha aea1dd601a feat(libc): provide the runtime scripting allocator hooks
Use the registered application allocator and the source-backed alignment/size signature. Add callback ownership and failure checks; record unmeasured console behavior.
2026-10-15 17:21:14 +04:00
Adrià FranchandClaude bc3f81c198 test(libc): pin vasprintf allocation failure; move debt line off the section end
Co-Authored-By: Claude <[email protected]>
2026-10-15 14:44:16 +02:00
fogydes ceb963c6dd fix(libc): check allocation result in vasprintf and guard null pointer in strndup 2026-10-15 14:43:04 +02:00
hypermistandClaude Opus 5.5 4f608a8c49 feat(libc): add exact long double and BSD math exports
copysignl, fdiml, fmodl, remainderl, remquol, logbl, ilogbl, rintl, roundl,
lroundl, lrintl, llrintl, sqrtl, modfl, nanl, scalblnl, fmal, rint(f),
lrint(f), llrint(f), drem(f), scalbln(f), scalb(f), finite(f),
__fpclassifyl, __isinfl, __isnanl, __isnormall, _LDtest, _Dclass, _FDclass,
_LDclass and _LDsign, matching the libc.prx bundled with PPSA08427 bit for
bit, including NaN propagation, errno and FreeBSD fmal special cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
2026-10-16 01:38:41 +13:00
hypermistandClaude Opus 5.5 6103a3e0b9 feat(libc): implement the __std vectorized algorithm helpers
__std_find_trivial(_unsized), __std_count_trivial, __std_min/max/minmax_element,
__std_reverse_trivially_swappable, __std_reverse_copy_trivially_copyable and
__std_swap_ranges_trivially_swappable_noalias for 1-, 2-, 4- and 8-byte
elements, matching the libc.prx bundled with PPSA08427 including the rescan of
the first aligned block in the unsized find.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
2026-10-16 01:15:23 +13:00
hypermistandClaude Opus 5.5 6d2708ab95 feat(libc): implement the 16-byte __sync builtins and __atomic_is_lock_free
__sync_fetch_and_{add,sub,and,or,xor}_16 and __sync_lock_test_and_set_16 are
cmpxchg16b loops returning the previous value, and __atomic_is_lock_free
answers by size and alignment, as in the libc.prx bundled with PPSA08427. Its
generic __atomic_load/store/exchange/compare_exchange are a ud2, so they throw.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
2026-10-16 00:59:12 +13:00
hypermistandClaude Opus 5.5 f8b611b7da feat(libc): implement the compiler-rt floating-point builtins
Soft-float arithmetic and comparisons, float/double/x87 conversions to and from
32-, 64- and 128-bit integers, __extendsfdf2, __truncdfsf2, complex
multiplication and division and __powixf2, matching the libc.prx bundled with
PPSA08427: soft-float results ignore MXCSR and raise no flags, division flushes
subnormal quotients, NaN payloads are moved unshifted and float-to-integer
conversions do not saturate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
2026-10-16 00:55:33 +13:00
hypermistandClaude Opus 5.5 667e8ad80c fix(libc): count zero bits of zero like the console's __clz and __ctz builtins
The libc.prx bundled with PPSA08427 returns 32 from __clzdi2 and __ctzdi2 and
64 from __clzti2 and __ctzti2 for a zero argument; found by comparing every
builtin against it on random inputs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
2026-10-16 00:51:46 +13:00
hypermistandClaude Opus 5.5 0d62d4ee1a feat(libc): implement the compiler-rt integer builtins
Shifts, bit counts, comparisons, negation, multiplication, division and
remainder, __udivmodti4, the overflow-reporting __mulo* and the overflow
checking __addv*/__subv*/__mulv*/__negv*/__absv* families. Where the libc.prx
bundled with PPSA08427 differs from compiler-rt it is followed: __addv* and
__subv* wrap, and the 32-bit unsigned division returns 0 for a zero divisor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
2026-10-16 00:30:58 +13:00
hypermistandClaude Opus 5.5 7d7515b632 docs(debt): drop the call tracing entry that --trace-imports superseded
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 00:14:25 +13:00
Rujul Talekar 3dffc8ca9e fix(libc): give collate<wchar_t> its own 16-bit vtable 2026-10-15 11:07:58 +05:30
BIGFERRY999 c33036b162 feat(libc): implement safe wide string and concatenation functions 2026-10-15 00:20:27 +01:00
Akul Tyagi ec2acea5bd feat(libc): implement __modti3
Implement __modti3, the signed 128-bit integer modulo runtime helper complementing __divti3, __udivti3 and __umodti3. Add unit test coverage in guest_crt_tests and document zero-divisor exception behavior in technical debt.
2026-10-15 04:25:52 +05:30
yripper 913adca3aa docs(libc): record the macOS guest arena holes as debt
Move the explanatory comments into docs/dev/debt/libc.md, as the conventions require.
2026-10-14 19:47:07 -03:00
Rujul Talekar 661b1671ff feat(libc): implement collate<wchar_t>::_Getcat 2026-10-14 22:27:59 +05:30
Nawasfadili 6509ec274a feat(libc): implement wide and unlocked stream I/O 2026-10-14 14:24:37 +00:00
Adrià Franch 32a11a57d1 docs(libc): move the fegetenv debt line off the end of its section 2026-10-14 14:02:31 +02:00
Karim IbrahimandClaude Opus 5.5 34cf0e223f test(libc): cover fegetenv with a null environment and pending x87 flags
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 14:02:31 +02:00
Karim IbrahimandClaude Opus 5.5 74b93adb6c feat(libc): implement fegetenv
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 14:02:31 +02:00
Dean c3bad39372 Merge pull request #5434 from milescoviello/fix/relinked-module-name-case
fix(libc): find a relinked module whose name differs in case
2026-10-14 22:41:23 +13:00
David 69715e8393 docs(debt): record that the guest environment starts empty 2026-10-14 13:15:53 +04:00
Dean 3152609030 Merge pull request #5454 from mohammad-alosta/feat/libc-swprintf-s
feat(libc): implement swprintf_s
2026-10-14 20:12:15 +13:00
Dean 6546a33944 Merge pull request #4728 from Ondra97/codex/fix-fdopen-access-mode
fix(libc): reject incompatible fdopen access modes on Windows
2026-10-14 19:06:55 +13:00
Dean 1c95691fb5 Merge pull request #5290 from veosett/codex/allocator-failure-results
fix(libc): return allocation failures to guest callers
2026-10-14 17:26:13 +13:00
Dean 6ed374413e Merge pull request #4681 from milescoviello/fix/alias-trailing-slash
fix(libc): keep a trailing slash on paths under a mount alias
2026-10-14 17:25:15 +13:00
JJenkx 2f9d04fb77 chore: resolve current upstream integration conflicts 2026-10-13 23:13:49 -04:00
Dean 3e4fe4ce31 Merge pull request #5596 from tibzejoker/port/pr-637-main
fix(libc): track writes to singly mapped direct memory without faults on Windows
2026-10-14 15:53:44 +13:00
Dean 91e5f60880 Merge pull request #4822 from MarcZX100/fix/fopen-native-open-errors-4814
fix(libc): return native fopen errors
2026-10-14 15:36:11 +13:00
milescovielloandClaude Opus 5.5 f0c3a5c85e fix(libc): find a relinked module whose name differs in case
Borderlands 4 (PPSA01494) loads its UI library with
sceKernelLoadStartModule("/app0/prx/libRenoirCore.PS5.prx"), but ships
the module as prx/librenoircore.ps5.prx. On Linux the call fails:

    Could not load /app0/prx/libRenoirCore.PS5.prx result 0, handle result -2147352574

(0x80020002, ENOENT). Guest paths are resolved case-insensitively, but
that only finds a component that exists. With the documented layout,
app0/prx holds only the converted librenoircore.ps5.prx.guest.prx,
so the requested name resolves to itself and RelinkedModulePath then
looks for "libRenoirCore.PS5.prx.guest.prx" with its exact spelling.
Windows and macOS hosts ignore the case, so only Linux is affected.

RelinkedModulePath now falls back to the same ASCII case-insensitive
match as ResolveHostPath when the exact <name>.guest.prx is missing,
and throws for an ambiguous match as that does. dlopen,
sceKernelLoadStartModule, stat, open and sceKernelCheckReachability all
go through it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 01:31:24 +00:00
milescovielloandClaude Opus 5.5 ccfadfbeef fix(libc): keep a trailing slash on paths under a mount alias
Guest path resolution trimmed the trailing slash of a path under a
mount alias (/savedata0, /download0, /app0 and the others), so the host
saw "file" for "file/": unlink, remove, sceKernelUnlink and rename
removed or moved the file, open opened it, and chmod and access
succeeded on it. The same path outside an alias already failed with
ENOTDIR, because the host got the slash.

FreeBSD 11.4 rejects it in lookup() (sys/kern/vfs_lookup.c):

	/*
	 * If we're processing a path with a trailing slash,
	 * check that the end result is a directory.
	 */
	if ((cnp->cn_flags & TRAILINGSLASH) && dp->v_type != VDIR) {
		error = ENOTDIR;
		goto bad2;
	}

On Linux and macOS a path under an alias now keeps its trailing slash
on the host path, as paths outside an alias do, so the host fails with
ENOTDIR for a file and directories with a trailing slash still work.
Windows keeps the previous behaviour; TechnicalDebt records it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 01:31:01 +00:00
Dean dd7174423a Merge pull request #5009 from p3n1cillin/claude/libc-tzname
feat(libc): export tzname
2026-10-14 14:27:27 +13:00
thibautandClaude Opus 5.5 b7d7e71bf6 docs(libc): move the Windows direct memory debt entry to libc.md
The entry links WindowsMappings.hpp, so the debt-file convention puts it in
docs/dev/debt/libc.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01V1W4jdNSKTV7xwuS6xQPJV
2026-10-14 02:39:10 +02:00