Skip to content

feat(libc): export tzname - #5009

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
p3n1cillin:claude/libc-tzname
Oct 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
p3n1cillin:claude/libc-tzname

Conversation

@p3n1cillin

Copy link
Copy Markdown

What

ES-DE, the second frontend in RetroArch (PPSA99169, /app0/es-de/es-de.bin), imports tzname from libSceLibcInternal, which nothing exports. Its relinked executable stops at load:

FAIL: unresolved ELF import BAYjQubSZT8 from libSceLibcInternal.prx

(BAYjQubSZT8 is tzname in the aerolib NID list; tools/import_audit.py reports it as the only absent import of es-de.bin.)

The only code in es-de.bin that reads it (0xF13ADB–0xF13C0C) is ICU's uprv_tzname: two localtime_r probes, the tm_isdst > 0 checks, then tzname[0] and tzname[1] passed to remapShortTimeZone, and tzname[n] returned when that finds nothing. ICU falls back to it when detecting the default time zone.

tzname is now a char*[2] data export of libc, next to tzset, which ES-DE also imports from libSceLibcInternal and which already resolves there. It points at the host's zone names (_tzname on Windows, tzname on Linux). It is filled when the library loads, after the existing Linux TZ setup, and refreshed by tzset, because glibc can move its strings when the zone changes. tm_zone and %Z already come from the same host names. The Windows full names without TZ, the empty or repeated daylight name of a zone without daylight-saving time, and the unknown console values are recorded in docs/dev/debt/libc.md.

Tested

  • guest_time_conversion (all 83 libc tests pass on Windows): after tzset with TZ=UTC-5, tzname[0] is UTC and tzname[1] is set; with TZ=EST5EDT, they are EST and EDT. Without the export the test does not link. glibc gives the same names for both strings (checked in Ubuntu/WSL with a C program); the full Linux build was not run locally.
  • RetroArch PPSA99169 v1.0.0-beta.1 on Windows 11 (MinGW GCC 15.2.0), with es-de.bin converted and started through feat: convert a title's other executables and start them with sceSystemServiceLoadExec #4786: before, the load fails as above. After, ES-DE starts and its own log records start: arguments for ES-DE 1. It creates its Vulkan device and swapchain and then stops in the AGC translator (last provoking vertex with explicit per-vertex triangle-strip interpolation is unsupported).
  • python tools/check_conventions.py --base origin/main passes.

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 (reaching ES-DE in RetroArch needs feat: convert a title's other executables and start them with sceSystemServiceLoadExec #4786)
  • Unblocks: ES-DE in RetroArch (PPSA99169)
  • AI-assisted: yes

🤖 Generated with Claude Code

@p3n1cillin

Copy link
Copy Markdown
Author

Follow-up Linux validation of this change on current main 4bb2c7f3947440d513b1dbd12143ec55b250495a: cleanly cherry-picked PR head 8d6b8df72c9c059d63a805791b9363a85651cc4c into an isolated local branch, alongside the independent Windows pipe-selection change from #5013. Exact integration head: 2e3b9eb35c775e1d429f6c42144a701a632859ae.

Ubuntu 26.04.1 / WSL2, GCC 15.2.0, Ninja Release, bundled dependencies, BUILD_TESTING=ON. Built the real libc and libkernel libraries and all their Linux-registered test targets. All 187 scoped tests passed (66 libc, 121 libkernel), no skips or failures, 3.73 s. guest_time_conversion passed in 0.11 s, checking zone changes and both EST/EDT names through the actual new data export.

Removing this change from Time.cpp while keeping the new test caused the test link to fail with undefined references to tzname_nid_postfix. Restored the exact source bytes, rebuilt the real library and test, and confirmed guest_time_conversion passed again. Conventions and whitespace checks passed on the integration branch.

This was a scoped library build and native Linux test run, not a full Linux application build or a Linux ES-DE run. No further game run was performed. AI-assisted validation with Codex; Claude's original implementation remains unchanged.

@xXPBSXx

xXPBSXx commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Windows test of this PR.

Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, BUILD_TESTING=ON, -j2, libusb-cmake from a local checkout. Built from main ad653c9bc with this PR and #5004 merged together; the merge had no conflict.

Result: guest_time_conversion (1 of 1) passes.

Not checked: whether the test fails without the change in the library code; the PR was not tested alone, only in the combined merge; no title run; Linux not tested.

AI-assisted (Claude Code).

ES-DE in RetroArch (PPSA99169) imports tzname from libSceLibcInternal and
fails to load without it; ICU's uprv_tzname reads it after localtime. It
points at the host's zone names and tzset refreshes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@p3n1cillin

Copy link
Copy Markdown
Author

Rebased onto main 5d50886ee, where Time.cpp changed with the FreeBSD 11 strftime rewrite (d0df62b). The change is the same: the HostZoneNames helper now sits after formatGuestTime. All 87 libc tests pass on Windows, including guest_time_conversion; conventions pass.

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#4681 docs/dev/debt/libc.md L58
#5434 docs/dev/debt/libc.md L58

@oneandonlydean
oneandonlydean merged commit dd71744 into boykopovar:main Oct 14, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants