Skip to content

feat(relinker): hint at the MinGW runtime DLLs when a module fails to load with error 126 - #4869

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
omurc4:feat/load-failure-hint
Oct 14, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
omurc4:feat/load-failure-hint

Conversation

@omurc4

@omurc4 omurc4 commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

What

When a relinked Windows executable fails to load a library with error 126, the startup stub now prints one more line after the system message: the module or one of its dependent DLLs was not found, and a self-built libs/ also needs libgcc_s_seh-1.dll, libstdc++-6.dll and libwinpthread-1.dll from the toolchain's mingw64/bin next to it.

Error 126 (The specified module could not be found.) is also what Windows reports when the library file exists but one of its dependencies is missing, which is what the reporter of #4482 hit with libSceNpManager.prx. The existing output named only the .prx. No other error code, load path or exit code changes.

The new lines sit after writeLastError() in WindowsEntryStubBuilder.cpp; #3579 edits the same function above them (the optional-provider probe), so whichever lands second needs a small rebase.

Refs #4482.

Tested

Windows 11, WinLibs GCC 15.2.0 r7, relinker-only build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON) on main 758aca7: 138/138 tests pass, including windows_import_modules, which now asserts GetLastError: 126 and the hint for a missing module. tools/check_conventions.py --base origin/main passes. Not run with a real title.

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

… load with error 126

A relinked executable that cannot load a library reports
"GetLastError: 126 - The specified module could not be found.", which also
covers a library whose dependent DLLs are missing. On Windows a self-built
libs/ directory needs libgcc_s_seh-1.dll, libstdc++-6.dll and
libwinpthread-1.dll next to it. For error 126 the stub now adds a line naming
them.

Refs boykopovar#4482
@xXPBSXx

xXPBSXx commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Windows test: head 19150397e merged onto current main 5d50886ee, together with 9 other open pull requests in one build (the merges were conflict-free); a failure would have been bisected per PR. Windows 10, MinGW GCC (WinLibs), Ninja Release, -j2: full build 0 errors; ctest for the tests this change adds or touches: windows_import_modules passed; python tools/check_conventions.py --base upstream/main passed for the combined tree. I did not run the new tests against main without the change.

AI-assisted (Claude Code).

@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the stub change (error 126 compare reloads lastError, branch patched past the hint), relinker ctest 125/125, the new assertion in windows_import_modules and the Windows relinker CI job; merging.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants