fix(loader): resolve sceKernelDlsym on the main module #2786
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2786"
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 tototomate123 on 2026-10-10T15:00:31Z.
What
Split from #1616, following its review. Resolve handle 0 through the main executable for
sceKernelDlsym, retaining the existing error behavior. The regression calls an executable-only export; Windows exports it through a generated.def, with a plainextern "C"definition instead of__declspec.Tested
Linux x86-64, GCC 16.2.1, Release.
guest_dynamic_loaderpasses, including main-module calls and missing-symbol errors. MinGW C++20 syntax check passes; Windows runtime/CI has not been run locally. Conventions and whitespace checks pass on current main (5edae353).Depends on
None for build. HFW integration also needs #2785 (relinker), #2787 (filesystem), #2788 (http), #2789 (apr), #2790 (shader). #1269 (media), #1339 (VRR), #1586 (unwind) and #1436 (imports) are now on main. Local image-table experiments are excluded; open #757 → #758 overlaps them, and #920 is closed without merging. Earlier combined integration reached menu/loading UI; these isolated branches have not been game-tested and gameplay is unverified.
Checklist
main; no duplicate implementation found beyond superseded #1616Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T15:00:40Z.
Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:06:35Z.
Review: CHANGES_REQUESTED
Thanks for splitting this out. Checked on Linux (GCC, Release, PR merged onto current main): the build and the area's ctest (94 tests) pass, including
guest_dynamic_loader.Module.cppreverted,guest_dynamic_loaderstill passes:dlsym_nid_postfix(nullptr, ...)already falls back toDefaultScopeSymbol(DynamicLoader.cpp:164), sosceKernelDlsym(0, ...)finds the executable's export there. The fix only changes behaviour on Windows, where there is no such fallback and the only global module is the onedlopen(nullptr)registers.guest_dynamic_loaderoutput onmain(failing at the newsceKernelDlsym(0, "GuestDefaultScopeOnly", ...)check) and with this PR (passing), and that the generated.deflinks.The change itself looks right (handle 0 only, same ESRCH on a missing symbol, module handle closed after the lookup). Once the Windows before/after is in, this is ready from my side.
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T07:27:53Z.
Additional platform validation of standalone PR head
43110f8ed73e386396efdd34aaccb6c34e002393(2026-10-11):Windows: failed tests — Windows 11, WinLibs GCC 15.2.0 UCRT/POSIX/SEH r7; CMake 4.3.1 / Ninja; Release,
BUILD_TESTING=ON.1 checks, 1 failures, 0 CTest skips. Built the selected targets and dependencies; this is focused validation, not a full build or full-suite run.
Checks:
guest_dynamic_loader.Command after building:
ctest --test-dir <build> --verbose --no-tests=error --timeout 30 -R "^guest_dynamic_loader$".Diagnostic-only rebuild (same assertions, added failure printing): sceKernelDlsym(0, "GuestDefaultScopeOnly", &mainSymbol) == 0 && mainSymbol != nullptr. The PE export table does not contain GuestDefaultScopeOnly. Pristine parent
5edae35361passes guest_dynamic_loader.Failed cases:
guest_dynamic_loader.No title/gameplay validation. These results cover the standalone head, not a merge with current main.
Imported from boykopovar/AnyPS5. Originally posted by tototomate123 on 2026-10-11T09:52:26Z.
@adriadam10 Fixed the Windows export configuration and rebased onto current main. I’m on Linux, so I cant test native Windows directly, but the MinGW-built test under Wine fails without the loader change and passes with it; Linux also passes, so looks fixed.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T10:10:01Z.
Review: APPROVED
Thanks for the update. Checked on Linux (GCC, Release, PR merged onto current main): build and the area's ctest (106 tests) pass,
guest_dynamic_loaderincluded. As expected, the regression passes on Linux without the loader change (the default-scope fallback already resolves it); it only discriminates on Windows, where the.defexport now makesGuestDefaultScopeOnlyvisible. The main-module path (GetModuleHandleW(nullptr)→ registered handle →GetProcAddress) and the error return look right. Merging once the Windows build job is green.