Skip to content

ctest loads the unpatched libraries, so an import that nid_patcher renames only fails when a title loads the patched prx #1827

Closed

Description

@LeandroLP23

Every test puts libs/unpatched on its path (RUNTIME_OUTPUT_DIRECTORY in core/libs/CMakeLists.txt, PATH=path_list_prepend:$<TARGET_FILE_DIR:...> in the test definitions). Titles load build/core/libs/libs/*.prx, which nid_patcher has rewritten. Its rule (core/libs/nid/src/NidResolver.cpp:40-62) keeps a host export's name only if libc exports it too, it ends in _nid_no_patch, or it starts with SDL_. Every other export is renamed to its hash. On the import side only _nid_postfix and sce* names are rewritten.

So a library that calls a plain C++ helper from another library links, passes every test and CI, and then fails to load for every title. #1613 is an example: libScePosixForWebKit.prx imports _ZN12GuestSockets6IsOpenEi from libkernel. In the patched libkernel that export is renamed, and on Windows the module fails with GetLastError: 127, so OpenGL Showcase (PPSA99005) no longer starts (details in #1613).

On main 4b6ab6b all 122 patched libraries load on Windows, so nothing is broken today. Nothing checks it, though: tools/import_audit.py checks a title's imports, and nid_patcher_dynamic_strings/nid_patcher_symbol_versions cover one fixture on Linux only.

A test that loads each patched .prx with its imports bound would catch it. PR to follow.

Found with AI assistance (Claude Code).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions