fix(relinker): share Windows --module-dir modules between executables #7450

Closed
SandstromPL wants to merge 2 commits from upstream-pr/7450 into main
SandstromPL commented 2026-10-18 07:18:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-18T07:18:39Z.


What

Rebased onto main 2ed704842, without #6112 or #6684. The previous head stacked on both because all three change the same .ginit block, and its test borrowed #6112's flag_module. #6112 was merged and then reverted in #7646: a title's own libc.prx already runs its preinit routine from DT_INIT, so running the preinit array as well ran it twice (#7636). This branch no longer carries any #6112 code, and its test has its own fixture. The two commits below are now the whole branch. The Windows results under Tested are from the previous head 9a82a1b45.

METAL GEAR SOLID: Peace Walker (PPSA18216, #5268) ships a launcher (src/eboot.elf) that starts the game (mgspw/mgspw.elf) with sceSystemServiceLoadExec. Both use the Unity modules in Media/Modules and Media/Plugins. mrfelek reached the beach tutorial on Linux and Windows. On Windows, though, the combined relink

relinker --windows --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins src/eboot.elf app.exe

fails with

Guest modules convert differently for mgspw/mgspw.elf, so it cannot share them with the input executable

For that run he relinked the two separately and gave the game the launcher's guest modules. The only module that differs is Media/Modules/Il2cppUserAssemblies.prx.

Why it differs:

  • --executable (#4786) converts each executable with the full pipeline and requires every guest module to come out byte-identical (main.cpp L234-L243), because one module tree is written for all of them (L311-L315). For a module that one executable needs and another does not, #4786 notes that "on Windows that is an error rather than a second module tree". #4793 had asked about one shared tree with initialization decided at run time; that was never built.
  • A --module-dir module is deferred unless the converting executable's DT_NEEDED (or, on Windows, another guest module) requires it (GuestModuleBuilder.cpp L258-L269).
  • On Windows that choice is written into the module. Only a deferred module gets the .ginit table and the __aps5_guest_initialize export (WindowsGuestModuleWriter.cpp L150-L157), which also moves the sections after it. The startup initializes the other modules through their handles and skips the deferred ones (WindowsGuestStartup.cpp L30-L37). A later sceKernelLoadStartModule runs a deferred module's entry and initializers once through the table (DynamicLoader.cpp L113-L162), and does nothing for a module without the export (L119-L120).
  • The launcher needs Il2cppUserAssemblies.prx at startup, and mgspw.elf loads it at run time, so the two conversions write different files. The rejection is pinned in test_executables.py L87-L89. On Linux the same choice only changes the executable's DT_NEEDED, so the modules match (L90-L94).

The workaround also has a side effect, found by reading the code (not run). With the launcher's copy, the game's startup skips the module, and its run-time load finds no table. So Il2cppUserAssemblies.prx's DT_INIT and init_array never run in the game process on Windows.

With this change, the module no longer depends on which executable converts it:

  • When --executable is given, every module of a --module-dir directory gets the table, whether this executable defers it or not (GuestRuntime::ExportInitialization). DeferInitialization is still decided per executable. It now only decides what that executable's startup does.
  • With ExportInitialization, the Windows writer puts .ginit in a writable section and records its RVA (GuestRuntime::InitializationTableRva).
  • Before it runs any DT_INIT or init_array entry, WindowsGuestStartup::Initialize stores 0 over the first two words (entry and count) of every table among the modules it initializes. The store is mov rax, [handle] followed by mov qword ptr [rax + table], 0. A later sceKernelLoadStartModule of such a module then finds {0, 0} and returns, which DynamicLoader already does after it has initialized a module itself (L128-L130). All tables are cleared before the first initializer runs. So if one module's initializer loads another startup module, DynamicLoader does not initialize that module early, before the startup initializes it again.
  • The entry stub never frees its guest module handles, so a cleared table stays cleared for the life of the process. Each process gets its own copy-on-write page, so the launcher's store does not reach the game.
  • In the executable that defers the module, nothing changes. Its startup skips the module, and DynamicLoader runs the entry with the pending start arguments, then the initializers, when the title loads it.

For Peace Walker, the launcher clears Il2cppUserAssemblies.prx's table and initializes it at startup, as before. The game skips it at startup and initializes it when it loads it, which the workaround never did.

A writable section keeps the startup's part to one store per module. The alternative is a read-only table that the startup unprotects with VirtualProtect, which the entry stub does not import today. That is the fallback if a write-copy table causes trouble on Windows.

What changes in Windows output with --executable, besides the fix:

  • A --module-dir module that every executable initializes at startup now also carries the table, and every startup clears it. Its .edata, .reloc and .dllmain sections move by the table's size.
  • A --module-dir module that every executable defers (for example an unused plugin in Media/Plugins) keeps its table, now in a writable section. DynamicLoader's VirtualProtect then changes a write-copy page instead of a read-only one.

Not changed:

  • Conversions without --executable: a --module-dir module gets the table only when it is deferred, in a read-only section.
  • Bundled sce_module modules never get the table.
  • Linux and macOS output. Only the Windows writer reads ExportInitialization.
  • DynamicLoader and the table's layout.
  • The check in main.cpp stays for any other difference between the conversions.

Docs: a paragraph in the "Windows deferred module initialization" section of ARCHITECTURE.md, and one sentence in USAGE.md's --executable row.

This PR does not depend on #6684, which changes the same .ginit block (guest.HasInit instead of guest.Init == 0). The writer marks the section writable and records its RVA after the table's words, not in the PeSection line, so the two branches don't change adjacent lines. git merge-tree merges them cleanly in either order, to the same tree, on main 2ed704842 and on main 3259e4c3e. The full relinker suite passes on the 3259e4c3e tree with both (210/210).

It has two commits:

  1. fix(relinker): share Windows runtime modules between executables that initialize them differently: the change, the relinker tests and the docs.
  2. test(libkernel): load a deferred module whose initialization table is writable. This commit is Windows-only. mrfelek ran its tests on Windows (see Tested). It can be dropped on its own; without it, the first commit's debt line about the untested writable table stays.

Tested

Ubuntu 24.04, GCC 13.3, CMake 3.28, Ninja 1.11, Python 3.12, Release relinker-only build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON), on main 2ed704842. Full ctest: 208/208. The same with -DANYPS5_ENABLE_ASAN=ON (ASAN_OPTIONS=detect_leaks=0): 208/208. The new checks extend existing tests, so the count is the same as on main.

relinker_executables:

  • The existing Windows case, where picker/picker.bin needs Media/Modules/needed.prx and eboot.bin defers it, used to assert the rejection. It now converts, and the shared module exports the table.
  • A new Windows case uses two --module-dir modules, needed.prx and second.prx, built from a new fixture with a DT_INIT and two init_array entries. The DT_INIT sets a flag, and each init_array entry traps unless the flag is set. The two modules put their DT_INIT and init_array at different addresses and have data segments of different sizes, so their tables land at different RVAs and every store and call can be matched to its module. One executable needs both modules, and the other defers both. The case runs in both orientations, with the picker needing them and with eboot.bin needing them. In each:
    • both modules have a writable .ginit and export the table, which holds the module's own DT_INIT RVA, the count 2 and its two slot RVAs;
    • the needing executable's .entry code has one handle-relative qword store per module and no other. Each store clears that module's table through its own handle slot, and that slot also carries the module's three lifecycle calls;
    • the last clear comes before the first lifecycle call;
    • the deferring executable has no such store and no lifecycle call for them;
    • sce_module/bundled.prx has no table;
    • both modules are byte-identical across the two orientations;
    • on a Windows host, both executables run and exit 42, as the other Windows cases do.

guest_module_dir: a single-executable deferred module's .ginit is still read-only. Its existing checks that a startup module has no table without --executable pass unchanged.

On main, relinker_executables fails at test_executables.py:161:

FAIL: Guest modules convert differently for picker/picker.bin, so it cannot share them with the input executable

With that case removed in a scratch copy, the new case fails at L178 with the same message. The new guest_module_dir check passes on main, because main already writes a read-only .ginit there.

I also ran 19 mutants of the startup, writer and builder code against relinker_executables and guest_module_dir, and each one fails at least one assertion:

  • the per-module check (L76): a clear for the first module only; a 32-bit store; every clear through the first handle slot; the clears in reverse slot order; the two shared modules' clears swapped between their slots; their lifecycle calls swapped between their slots; every clear with the first module's table RVA, or with the second module's; a clear 8 bytes past the table;
  • the store check (L80): a store at offset 0 for every startup module without a table;
  • the ordering check (L82): a clear after the initializers, or right before each module's own initializers;
  • L84: a clear in the deferring executable;
  • L70: a read-only .ginit in a shared module;
  • L181: the table on every module, including sce_module;
  • test_guest_module_dir.py:178: a writable .ginit, or the table on every --module-dir module, without --executable;
  • the rc check at L161: the table only on deferred modules, or only on modules needed at startup.

Four of them pass when the two modules are built identically, which is why the fixture gives them different layouts: both swaps between the shared modules' slots, and both single-table-RVA clears.

Not covered by a test:

  • a --module-dir module that every executable needs at startup;
  • one that every executable defers.

tools/check_conventions.py from main passes on both commits and on this title and description.

On Windows, on this head 9a2d69870:

  • mrfelek reran Peace Walker on Windows 11 (laptop RTX A2000, WinLibs GCC 15.2.0). This head doesn't merge cleanly onto his PPSA18216 test tree (main c9e6c45de plus the open Peace Walker PRs), so he cherry-picked its two commits. The only conflicts were in lines main added later, and the SharedGuestModules lines went in unchanged.
    • relinker --windows --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins exits 0 and writes app.exe and mgspw.mgspw.elf.exe with 12 guest modules, where main stops with Guest modules convert differently.
    • app.exe starts mgspw.mgspw.elf, and the tutorial and the next mission work. The log has no abort, no exception and no Thread destructor callback is already registered.
  • On this head itself, he ran ctest -R guest_deferred_module: the 4 existing tests and the 5 new guest_deferred_module_writable_* ones pass (9/9). They load the deferred-module fixture built a second time with a writable .ginit, and the cleared mode checks that a load after the startup's clear runs neither the entry nor the constructor.
  • The relinker CI's Windows job passed. It runs the nt branch of relinker_executables, so the startup's store into the write-copy .ginit page, followed by both modules' initializers, has run on a Windows host.

The previous head 9a82a1b45, which still carried #6112 and #6684, had the same results (Peace Walker, tests). What changed since then:

  • #6112's and #6684's commits are gone, so the startup no longer runs preinit entries, as on main.
  • The writer sets the write flag and records the table's RVA after the table's words instead of in the PeSection line. The output is the same.
  • The new case uses its own fixture instead of #6112's, with the per-module checks above.

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
  • Fixes: none
  • Unblocks: PPSA18216 #5268 (the combined Windows relink of the launcher and mgspw.elf)
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4907212803 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-18T07:18:39Z. --- ### What **Rebased onto `main` 2ed704842, without #6112 or #6684.** The previous head stacked on both because all three change the same `.ginit` block, and its test borrowed #6112's `flag_module`. #6112 was merged and then reverted in #7646: a title's own `libc.prx` already runs its preinit routine from `DT_INIT`, so running the preinit array as well ran it twice (#7636). This branch no longer carries any #6112 code, and its test has its own fixture. The two commits below are now the whole branch. The Windows results under Tested are from the previous head `9a82a1b45`. METAL GEAR SOLID: Peace Walker (PPSA18216, #5268) ships a launcher (`src/eboot.elf`) that starts the game (`mgspw/mgspw.elf`) with `sceSystemServiceLoadExec`. Both use the Unity modules in `Media/Modules` and `Media/Plugins`. mrfelek [reached the beach tutorial on Linux and Windows](https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-19002746). On Windows, though, the combined relink ``` relinker --windows --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins src/eboot.elf app.exe ``` fails with ``` Guest modules convert differently for mgspw/mgspw.elf, so it cannot share them with the input executable ``` For that run he relinked the two separately and gave the game the launcher's guest modules. The only module that differs is `Media/Modules/Il2cppUserAssemblies.prx`. Why it differs: - `--executable` (#4786) converts each executable with the full pipeline and requires every guest module to come out byte-identical ([main.cpp L234-L243](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/relinker/main.cpp#L234-L243)), because one module tree is written for all of them ([L311-L315](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/relinker/main.cpp#L311-L315)). For a module that one executable needs and another does not, #4786 notes that "on Windows that is an error rather than a second module tree". [#4793](https://github.com/boykopovar/AnyPS5/issues/4793#issuecomment-6140428068) had asked about one shared tree with initialization decided at run time; that was never built. - A `--module-dir` module is deferred unless the converting executable's `DT_NEEDED` (or, on Windows, another guest module) requires it ([GuestModuleBuilder.cpp L258-L269](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/relinker/relinker/src/guest/GuestModuleBuilder.cpp#L258-L269)). - On Windows that choice is written into the module. Only a deferred module gets the `.ginit` table and the `__aps5_guest_initialize` export ([WindowsGuestModuleWriter.cpp L150-L157](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/relinker/elfpatcher/src/windows/WindowsGuestModuleWriter.cpp#L150-L157)), which also moves the sections after it. The startup initializes the other modules through their handles and skips the deferred ones ([WindowsGuestStartup.cpp L30-L37](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/relinker/elfpatcher/src/windows/WindowsGuestStartup.cpp#L30-L37)). A later `sceKernelLoadStartModule` runs a deferred module's entry and initializers once through the table ([DynamicLoader.cpp L113-L162](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/libs/prx/libkernel/Module/src/DynamicLoader.cpp#L113-L162)), and does nothing for a module without the export ([L119-L120](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/libs/prx/libkernel/Module/src/DynamicLoader.cpp#L119-L120)). - The launcher needs `Il2cppUserAssemblies.prx` at startup, and `mgspw.elf` loads it at run time, so the two conversions write different files. The rejection is pinned in [test_executables.py L87-L89](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/relinker/relinker/tests/test_executables.py#L87-L89). On Linux the same choice only changes the executable's `DT_NEEDED`, so the modules match ([L90-L94](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/relinker/relinker/tests/test_executables.py#L90-L94)). The workaround also has a side effect, found by reading the code (not run). With the launcher's copy, the game's startup skips the module, and its run-time load finds no table. So `Il2cppUserAssemblies.prx`'s DT_INIT and init_array never run in the game process on Windows. With this change, the module no longer depends on which executable converts it: - When `--executable` is given, every module of a `--module-dir` directory gets the table, whether this executable defers it or not (`GuestRuntime::ExportInitialization`). `DeferInitialization` is still decided per executable. It now only decides what that executable's startup does. - With `ExportInitialization`, the Windows writer puts `.ginit` in a writable section and records its RVA (`GuestRuntime::InitializationTableRva`). - Before it runs any DT_INIT or init_array entry, `WindowsGuestStartup::Initialize` stores 0 over the first two words (entry and count) of every table among the modules it initializes. The store is `mov rax, [handle]` followed by `mov qword ptr [rax + table], 0`. A later `sceKernelLoadStartModule` of such a module then finds `{0, 0}` and returns, which `DynamicLoader` already does after it has initialized a module itself ([L128-L130](https://github.com/boykopovar/AnyPS5/blob/1c523bdb48f724c06d0f526ddfbcd4c3a22bbea0/core/libs/prx/libkernel/Module/src/DynamicLoader.cpp#L128-L130)). All tables are cleared before the first initializer runs. So if one module's initializer loads another startup module, `DynamicLoader` does not initialize that module early, before the startup initializes it again. - The entry stub never frees its guest module handles, so a cleared table stays cleared for the life of the process. Each process gets its own copy-on-write page, so the launcher's store does not reach the game. - In the executable that defers the module, nothing changes. Its startup skips the module, and `DynamicLoader` runs the entry with the pending start arguments, then the initializers, when the title loads it. For Peace Walker, the launcher clears `Il2cppUserAssemblies.prx`'s table and initializes it at startup, as before. The game skips it at startup and initializes it when it loads it, which the workaround never did. A writable section keeps the startup's part to one store per module. The alternative is a read-only table that the startup unprotects with `VirtualProtect`, which the entry stub does not import today. That is the fallback if a write-copy table causes trouble on Windows. What changes in Windows output with `--executable`, besides the fix: - A `--module-dir` module that every executable initializes at startup now also carries the table, and every startup clears it. Its `.edata`, `.reloc` and `.dllmain` sections move by the table's size. - A `--module-dir` module that every executable defers (for example an unused plugin in `Media/Plugins`) keeps its table, now in a writable section. `DynamicLoader`'s `VirtualProtect` then changes a write-copy page instead of a read-only one. Not changed: - Conversions without `--executable`: a `--module-dir` module gets the table only when it is deferred, in a read-only section. - Bundled `sce_module` modules never get the table. - Linux and macOS output. Only the Windows writer reads `ExportInitialization`. - `DynamicLoader` and the table's layout. - The check in `main.cpp` stays for any other difference between the conversions. Docs: a paragraph in the "Windows deferred module initialization" section of `ARCHITECTURE.md`, and one sentence in `USAGE.md`'s `--executable` row. This PR does not depend on #6684, which changes the same `.ginit` block (`guest.HasInit` instead of `guest.Init == 0`). The writer marks the section writable and records its RVA after the table's words, not in the `PeSection` line, so the two branches don't change adjacent lines. `git merge-tree` merges them cleanly in either order, to the same tree, on `main` 2ed704842 and on `main` 3259e4c3e. The full relinker suite passes on the 3259e4c3e tree with both (210/210). It has two commits: 1. `fix(relinker): share Windows runtime modules between executables that initialize them differently`: the change, the relinker tests and the docs. 2. `test(libkernel): load a deferred module whose initialization table is writable`. This commit is Windows-only. mrfelek ran its tests on Windows (see Tested). It can be dropped on its own; without it, the first commit's debt line about the untested writable table stays. ### Tested Ubuntu 24.04, GCC 13.3, CMake 3.28, Ninja 1.11, Python 3.12, Release relinker-only build (`-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON`), on `main` 2ed704842. Full `ctest`: 208/208. The same with `-DANYPS5_ENABLE_ASAN=ON` (`ASAN_OPTIONS=detect_leaks=0`): 208/208. The new checks extend existing tests, so the count is the same as on `main`. `relinker_executables`: - The existing Windows case, where `picker/picker.bin` needs `Media/Modules/needed.prx` and `eboot.bin` defers it, used to assert the rejection. It now converts, and the shared module exports the table. - A new Windows case uses two `--module-dir` modules, `needed.prx` and `second.prx`, built from a new fixture with a DT_INIT and two init_array entries. The DT_INIT sets a flag, and each init_array entry traps unless the flag is set. The two modules put their DT_INIT and init_array at different addresses and have data segments of different sizes, so their tables land at different RVAs and every store and call can be matched to its module. One executable needs both modules, and the other defers both. The case runs in both orientations, with the picker needing them and with `eboot.bin` needing them. In each: - both modules have a writable `.ginit` and export the table, which holds the module's own DT_INIT RVA, the count 2 and its two slot RVAs; - the needing executable's `.entry` code has one handle-relative qword store per module and no other. Each store clears that module's table through its own handle slot, and that slot also carries the module's three lifecycle calls; - the last clear comes before the first lifecycle call; - the deferring executable has no such store and no lifecycle call for them; - `sce_module/bundled.prx` has no table; - both modules are byte-identical across the two orientations; - on a Windows host, both executables run and exit 42, as the other Windows cases do. `guest_module_dir`: a single-executable deferred module's `.ginit` is still read-only. Its existing checks that a startup module has no table without `--executable` pass unchanged. On `main`, `relinker_executables` fails at `test_executables.py:161`: ``` FAIL: Guest modules convert differently for picker/picker.bin, so it cannot share them with the input executable ``` With that case removed in a scratch copy, the new case fails at L178 with the same message. The new `guest_module_dir` check passes on `main`, because `main` already writes a read-only `.ginit` there. I also ran 19 mutants of the startup, writer and builder code against `relinker_executables` and `guest_module_dir`, and each one fails at least one assertion: - the per-module check (L76): a clear for the first module only; a 32-bit store; every clear through the first handle slot; the clears in reverse slot order; the two shared modules' clears swapped between their slots; their lifecycle calls swapped between their slots; every clear with the first module's table RVA, or with the second module's; a clear 8 bytes past the table; - the store check (L80): a store at offset 0 for every startup module without a table; - the ordering check (L82): a clear after the initializers, or right before each module's own initializers; - L84: a clear in the deferring executable; - L70: a read-only `.ginit` in a shared module; - L181: the table on every module, including `sce_module`; - `test_guest_module_dir.py:178`: a writable `.ginit`, or the table on every `--module-dir` module, without `--executable`; - the rc check at L161: the table only on deferred modules, or only on modules needed at startup. Four of them pass when the two modules are built identically, which is why the fixture gives them different layouts: both swaps between the shared modules' slots, and both single-table-RVA clears. Not covered by a test: - a `--module-dir` module that every executable needs at startup; - one that every executable defers. `tools/check_conventions.py` from `main` passes on both commits and on this title and description. **On Windows**, on this head `9a2d69870`: - mrfelek [reran Peace Walker](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6265495650) on Windows 11 (laptop RTX A2000, WinLibs GCC 15.2.0). This head doesn't merge cleanly onto his PPSA18216 test tree (`main` c9e6c45de plus the open Peace Walker PRs), so he cherry-picked its two commits. The only conflicts were in lines `main` added later, and the `SharedGuestModules` lines went in unchanged. - `relinker --windows --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins` exits 0 and writes `app.exe` and `mgspw.mgspw.elf.exe` with 12 guest modules, where `main` stops with `Guest modules convert differently`. - `app.exe` starts `mgspw.mgspw.elf`, and the tutorial and the next mission work. The log has no abort, no exception and no `Thread destructor callback is already registered`. - On this head itself, he ran `ctest -R guest_deferred_module`: the 4 existing tests and the 5 new `guest_deferred_module_writable_*` ones pass (9/9). They load the deferred-module fixture built a second time with a writable `.ginit`, and the `cleared` mode checks that a load after the startup's clear runs neither the entry nor the constructor. - The relinker CI's [Windows job](https://github.com/boykopovar/AnyPS5/actions/runs/39194895338/job/117875459508) passed. It runs the `nt` branch of `relinker_executables`, so the startup's store into the write-copy `.ginit` page, followed by both modules' initializers, has run on a Windows host. The previous head `9a82a1b45`, which still carried #6112 and #6684, had the same results ([Peace Walker](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6250826088), [tests](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6254480479)). What changed since then: - #6112's and #6684's commits are gone, so the startup no longer runs preinit entries, as on `main`. - The writer sets the write flag and records the table's RVA after the table's words instead of in the `PeSection` line. The output is the same. - The new case uses its own fixture instead of #6112's, with the per-module checks above. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA18216 #5268 (the combined Windows relink of the launcher and mgspw.elf) - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-18 07:31:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T07:31:54Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 3786 docs/user/USAGE.md
PR 4563 core/libs/prx/libkernel/CMakeLists.txt
PR 4847 docs/user/USAGE.md
PR 5021 core/libs/prx/libkernel/CMakeLists.txt
docs/user/USAGE.md
PR 5925 docs/dev/ARCHITECTURE.md
docs/user/USAGE.md
PR 6044 core/libs/prx/libkernel/CMakeLists.txt
core/libs/tests/GuestDeferredModule.cpp
core/libs/tests/GuestDeferredModuleFixture.S
docs/dev/ARCHITECTURE.md
PR 6171 docs/user/USAGE.md
PR 6412 docs/dev/ARCHITECTURE.md
PR 6469 core/libs/prx/libkernel/CMakeLists.txt
PR 6586 core/libs/prx/libkernel/CMakeLists.txt
core/relinker/relinker/src/guest/GuestModuleBuilder.cpp
docs/user/USAGE.md
PR 6743 docs/dev/ARCHITECTURE.md
PR 6788 docs/user/USAGE.md
PR 6830 core/libs/prx/libkernel/CMakeLists.txt
PR 6893 core/libs/prx/libkernel/CMakeLists.txt
PR 6924 docs/user/USAGE.md
PR 6936 core/libs/prx/libkernel/CMakeLists.txt
PR 6946 docs/dev/ARCHITECTURE.md
docs/user/USAGE.md
PR 6947 docs/dev/ARCHITECTURE.md
docs/user/USAGE.md
PR 6977 core/libs/prx/libkernel/CMakeLists.txt
core/relinker/domain/include/domain/GuestRuntime.hpp
core/relinker/elfpatcher/src/windows/WindowsGuestModuleWriter.cpp
core/relinker/relinker/include/relinker/guest/GuestImage.hpp
core/relinker/relinker/src/guest/GuestModuleBuilder.cpp
PR 7090 core/libs/prx/libkernel/CMakeLists.txt
PR 7156 core/libs/prx/libkernel/CMakeLists.txt
PR 7192 core/libs/prx/libkernel/CMakeLists.txt
PR 7201 core/libs/prx/libkernel/CMakeLists.txt
PR 7299 core/libs/prx/libkernel/CMakeLists.txt
PR 7532 core/libs/prx/libkernel/CMakeLists.txt
PR 7642 docs/dev/ARCHITECTURE.md
docs/user/USAGE.md
PR 7644 docs/dev/ARCHITECTURE.md
PR 7684 docs/dev/ARCHITECTURE.md
PR 7800 docs/user/USAGE.md
PR 7849 docs/dev/ARCHITECTURE.md
PR 7853 core/libs/prx/libkernel/CMakeLists.txt
PR 7918 docs/user/USAGE.md
PR 7942 docs/user/USAGE.md
PR 8016 docs/user/USAGE.md
PR 8041 core/libs/prx/libkernel/CMakeLists.txt
PR 8076 core/relinker/relinker/src/guest/GuestModuleBuilder.cpp
PR 8212 docs/dev/ARCHITECTURE.md
PR 8213 docs/dev/ARCHITECTURE.md
PR 8251 core/relinker/main.cpp
PR 8365 docs/dev/ARCHITECTURE.md
PR 8463 core/libs/prx/libkernel/CMakeLists.txt
PR 8477 core/libs/prx/libkernel/CMakeLists.txt
PR 8487 core/libs/prx/libkernel/CMakeLists.txt
PR 8520 core/libs/prx/libkernel/CMakeLists.txt
PR 8527 docs/dev/ARCHITECTURE.md
PR 8542 docs/dev/ARCHITECTURE.md
PR 8565 core/relinker/main.cpp
PR 8566 docs/dev/ARCHITECTURE.md
PR 8658 core/libs/prx/libkernel/CMakeLists.txt
PR 8672 docs/dev/ARCHITECTURE.md
PR 8689 core/relinker/main.cpp
PR 8700 core/libs/prx/libkernel/CMakeLists.txt
PR 8717 core/libs/prx/libkernel/CMakeLists.txt
PR 8726 core/libs/prx/libkernel/CMakeLists.txt
PR 8890 core/libs/prx/libkernel/CMakeLists.txt
PR 8900 docs/user/USAGE.md
PR 8909 docs/user/USAGE.md
PR 8916 core/libs/prx/libkernel/CMakeLists.txt
PR 8973 core/relinker/main.cpp
core/relinker/relinker/include/relinker/pipeline/Conversion.hpp
core/relinker/relinker/src/pipeline/Conversion.cpp
docs/user/USAGE.md
PR 9001 core/libs/prx/libkernel/CMakeLists.txt
PR 9059 core/libs/prx/libkernel/CMakeLists.txt
PR 9079 docs/user/USAGE.md
PR 9101 core/libs/prx/libkernel/CMakeLists.txt
PR 9122 docs/user/USAGE.md
PR 9167 core/libs/prx/libkernel/CMakeLists.txt
PR 9187 core/libs/prx/libkernel/CMakeLists.txt
PR 9203 docs/dev/ARCHITECTURE.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6247168285 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6247168285). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-18T07:31:54Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 3786](https://www.github.com/boykopovar/AnyPS5/pull/3786) | `docs/user/USAGE.md` | | [PR 4563](https://www.github.com/boykopovar/AnyPS5/pull/4563) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 4847](https://www.github.com/boykopovar/AnyPS5/pull/4847) | `docs/user/USAGE.md` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`docs/user/USAGE.md` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `docs/dev/ARCHITECTURE.md`<br>`docs/user/USAGE.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`core/libs/tests/GuestDeferredModule.cpp`<br>`core/libs/tests/GuestDeferredModuleFixture.S`<br>`docs/dev/ARCHITECTURE.md` | | [PR 6171](https://www.github.com/boykopovar/AnyPS5/pull/6171) | `docs/user/USAGE.md` | | [PR 6412](https://www.github.com/boykopovar/AnyPS5/pull/6412) | `docs/dev/ARCHITECTURE.md` | | [PR 6469](https://www.github.com/boykopovar/AnyPS5/pull/6469) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6586](https://www.github.com/boykopovar/AnyPS5/pull/6586) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`core/relinker/relinker/src/guest/GuestModuleBuilder.cpp`<br>`docs/user/USAGE.md` | | [PR 6743](https://www.github.com/boykopovar/AnyPS5/pull/6743) | `docs/dev/ARCHITECTURE.md` | | [PR 6788](https://www.github.com/boykopovar/AnyPS5/pull/6788) | `docs/user/USAGE.md` | | [PR 6830](https://www.github.com/boykopovar/AnyPS5/pull/6830) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6893](https://www.github.com/boykopovar/AnyPS5/pull/6893) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6924](https://www.github.com/boykopovar/AnyPS5/pull/6924) | `docs/user/USAGE.md` | | [PR 6936](https://www.github.com/boykopovar/AnyPS5/pull/6936) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 6946](https://www.github.com/boykopovar/AnyPS5/pull/6946) | `docs/dev/ARCHITECTURE.md`<br>`docs/user/USAGE.md` | | [PR 6947](https://www.github.com/boykopovar/AnyPS5/pull/6947) | `docs/dev/ARCHITECTURE.md`<br>`docs/user/USAGE.md` | | [PR 6977](https://www.github.com/boykopovar/AnyPS5/pull/6977) | `core/libs/prx/libkernel/CMakeLists.txt`<br>`core/relinker/domain/include/domain/GuestRuntime.hpp`<br>`core/relinker/elfpatcher/src/windows/WindowsGuestModuleWriter.cpp`<br>`core/relinker/relinker/include/relinker/guest/GuestImage.hpp`<br>`core/relinker/relinker/src/guest/GuestModuleBuilder.cpp` | | [PR 7090](https://www.github.com/boykopovar/AnyPS5/pull/7090) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7156](https://www.github.com/boykopovar/AnyPS5/pull/7156) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7192](https://www.github.com/boykopovar/AnyPS5/pull/7192) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7299](https://www.github.com/boykopovar/AnyPS5/pull/7299) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7532](https://www.github.com/boykopovar/AnyPS5/pull/7532) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7642](https://www.github.com/boykopovar/AnyPS5/pull/7642) | `docs/dev/ARCHITECTURE.md`<br>`docs/user/USAGE.md` | | [PR 7644](https://www.github.com/boykopovar/AnyPS5/pull/7644) | `docs/dev/ARCHITECTURE.md` | | [PR 7684](https://www.github.com/boykopovar/AnyPS5/pull/7684) | `docs/dev/ARCHITECTURE.md` | | [PR 7800](https://www.github.com/boykopovar/AnyPS5/pull/7800) | `docs/user/USAGE.md` | | [PR 7849](https://www.github.com/boykopovar/AnyPS5/pull/7849) | `docs/dev/ARCHITECTURE.md` | | [PR 7853](https://www.github.com/boykopovar/AnyPS5/pull/7853) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 7918](https://www.github.com/boykopovar/AnyPS5/pull/7918) | `docs/user/USAGE.md` | | [PR 7942](https://www.github.com/boykopovar/AnyPS5/pull/7942) | `docs/user/USAGE.md` | | [PR 8016](https://www.github.com/boykopovar/AnyPS5/pull/8016) | `docs/user/USAGE.md` | | [PR 8041](https://www.github.com/boykopovar/AnyPS5/pull/8041) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8076](https://www.github.com/boykopovar/AnyPS5/pull/8076) | `core/relinker/relinker/src/guest/GuestModuleBuilder.cpp` | | [PR 8212](https://www.github.com/boykopovar/AnyPS5/pull/8212) | `docs/dev/ARCHITECTURE.md` | | [PR 8213](https://www.github.com/boykopovar/AnyPS5/pull/8213) | `docs/dev/ARCHITECTURE.md` | | [PR 8251](https://www.github.com/boykopovar/AnyPS5/pull/8251) | `core/relinker/main.cpp` | | [PR 8365](https://www.github.com/boykopovar/AnyPS5/pull/8365) | `docs/dev/ARCHITECTURE.md` | | [PR 8463](https://www.github.com/boykopovar/AnyPS5/pull/8463) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8477](https://www.github.com/boykopovar/AnyPS5/pull/8477) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8487](https://www.github.com/boykopovar/AnyPS5/pull/8487) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8520](https://www.github.com/boykopovar/AnyPS5/pull/8520) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8527](https://www.github.com/boykopovar/AnyPS5/pull/8527) | `docs/dev/ARCHITECTURE.md` | | [PR 8542](https://www.github.com/boykopovar/AnyPS5/pull/8542) | `docs/dev/ARCHITECTURE.md` | | [PR 8565](https://www.github.com/boykopovar/AnyPS5/pull/8565) | `core/relinker/main.cpp` | | [PR 8566](https://www.github.com/boykopovar/AnyPS5/pull/8566) | `docs/dev/ARCHITECTURE.md` | | [PR 8658](https://www.github.com/boykopovar/AnyPS5/pull/8658) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8672](https://www.github.com/boykopovar/AnyPS5/pull/8672) | `docs/dev/ARCHITECTURE.md` | | [PR 8689](https://www.github.com/boykopovar/AnyPS5/pull/8689) | `core/relinker/main.cpp` | | [PR 8700](https://www.github.com/boykopovar/AnyPS5/pull/8700) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8717](https://www.github.com/boykopovar/AnyPS5/pull/8717) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8726](https://www.github.com/boykopovar/AnyPS5/pull/8726) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8890](https://www.github.com/boykopovar/AnyPS5/pull/8890) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8900](https://www.github.com/boykopovar/AnyPS5/pull/8900) | `docs/user/USAGE.md` | | [PR 8909](https://www.github.com/boykopovar/AnyPS5/pull/8909) | `docs/user/USAGE.md` | | [PR 8916](https://www.github.com/boykopovar/AnyPS5/pull/8916) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 8973](https://www.github.com/boykopovar/AnyPS5/pull/8973) | `core/relinker/main.cpp`<br>`core/relinker/relinker/include/relinker/pipeline/Conversion.hpp`<br>`core/relinker/relinker/src/pipeline/Conversion.cpp`<br>`docs/user/USAGE.md` | | [PR 9001](https://www.github.com/boykopovar/AnyPS5/pull/9001) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 9059](https://www.github.com/boykopovar/AnyPS5/pull/9059) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 9079](https://www.github.com/boykopovar/AnyPS5/pull/9079) | `docs/user/USAGE.md` | | [PR 9101](https://www.github.com/boykopovar/AnyPS5/pull/9101) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 9122](https://www.github.com/boykopovar/AnyPS5/pull/9122) | `docs/user/USAGE.md` | | [PR 9167](https://www.github.com/boykopovar/AnyPS5/pull/9167) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 9187](https://www.github.com/boykopovar/AnyPS5/pull/9187) | `core/libs/prx/libkernel/CMakeLists.txt` | | [PR 9203](https://www.github.com/boykopovar/AnyPS5/pull/9203) | `docs/dev/ARCHITECTURE.md` |
mrfelek commented 2026-10-18 14:03:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-18T14:03:16Z.


@SandstromPL thanks for opening this so quickly. I tested it on Windows with Peace Walker (PPSA18216). The combined relink works now, and the game reaches the beach tutorial and plays on into the next mission.

Setup: laptop with Windows 11 Pro 26200, RTX A2000 Laptop GPU (driver 32.0.16.1060), i7-11850H, WinLibs GCC 15.2.0, Release.

Tree: our Peace Walker test branch test/ppsa18216-ingame (8e5e16820), with this PR's head 9a82a1b45 merged. The merge was clean. That branch is main c9e6c45de plus #6014, #6196, #6237, #6842, #7072 and #7200, plus one local commit (MSAA resolve, lines, NGS2 callback reset). That's the same tree as the run in #5268.

Relink:

relinker --windows --to-intel --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins --sce-module-path <dump> <dump>/eboot.elf app.exe

It exits 0 and writes app.exe, mgspw.mgspw.elf.exe and one module tree (Media/Modules, Media/Plugins, sce_module, with Il2cppUserAssemblies.prx.guest.prx among them). Without this PR the same command stopped with Guest modules convert differently for mgspw/mgspw.elf, so it cannot share them with the input executable.

Two separate relinks, launcher's modules (before) Combined relink (this PR)
Combined relink refused exit 0
Launcher hands over to mgspw.elf (ExitAndStartNewProject) yes yes
Title and New Game yes yes
Beach tutorial yes yes, and on into the next mission
Errors or GPU refusals in the log 0 0
  • I only tested Windows. I didn't rerun Linux with this branch.
  • I didn't measure FPS in this run.

AI-assisted; the runs are from my machine(s).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6250826088 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6250826088). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-18T14:03:16Z. --- @SandstromPL thanks for opening this so quickly. I tested it on Windows with Peace Walker (PPSA18216). The combined relink works now, and the game reaches the beach tutorial and plays on into the next mission. **Setup:** laptop with Windows 11 Pro 26200, RTX A2000 Laptop GPU (driver 32.0.16.1060), i7-11850H, WinLibs GCC 15.2.0, Release. **Tree:** our Peace Walker test branch [`test/ppsa18216-ingame`](https://github.com/mrfelek/AnyPS5/tree/test/ppsa18216-ingame) (8e5e16820), with this PR's head 9a82a1b45 merged. The merge was clean. That branch is `main` c9e6c45de plus #6014, #6196, #6237, #6842, #7072 and #7200, plus one local commit (MSAA resolve, lines, NGS2 callback reset). That's the same tree as the run in [#5268](https://github.com/boykopovar/AnyPS5/discussions/5268#discussioncomment-19002746). **Relink:** ``` relinker --windows --to-intel --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins --sce-module-path <dump> <dump>/eboot.elf app.exe ``` It exits 0 and writes `app.exe`, `mgspw.mgspw.elf.exe` and one module tree (`Media/Modules`, `Media/Plugins`, `sce_module`, with `Il2cppUserAssemblies.prx.guest.prx` among them). Without this PR the same command stopped with `Guest modules convert differently for mgspw/mgspw.elf, so it cannot share them with the input executable`. | | Two separate relinks, launcher's modules (before) | Combined relink (this PR) | |---|---|---| | Combined relink | refused | exit 0 | | Launcher hands over to `mgspw.elf` (`ExitAndStartNewProject`) | yes | yes | | Title and New Game | yes | yes | | Beach tutorial | yes | yes, and on into the next mission | | Errors or GPU refusals in the log | 0 | 0 | - I only tested Windows. I didn't rerun Linux with this branch. - I didn't measure FPS in this run. AI-assisted; the runs are from my machine(s).
SandstromPL commented 2026-10-18 17:26:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-18T17:26:01Z.


@mrfelek thank you, that's exactly the check this needed. I've added your run to the description, next to the relinker CI's Windows job, which passed on the same head.

One small thing, only if you have a Windows build with tests on: ctest -R guest_deferred_module runs the new guest_deferred_module_writable_* loader tests (plus the 4 existing ones). I couldn't compile them here.

I'll rebase this onto main once #6112 and #6684 are in. ayam04 has already fixed the .ginitc register order in #6112, and the rebase picks that up.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6252891590 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6252891590). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-18T17:26:01Z. --- @mrfelek thank you, that's exactly the check this needed. I've added your run to the description, next to the relinker CI's Windows job, which passed on the same head. One small thing, only if you have a Windows build with tests on: `ctest -R guest_deferred_module` runs the new `guest_deferred_module_writable_*` loader tests (plus the 4 existing ones). I couldn't compile them here. I'll rebase this onto `main` once #6112 and #6684 are in. ayam04 has already fixed the `.ginitc` register order in #6112, and the rebase picks that up. AI-assisted: yes (Claude Code)
mrfelek commented 2026-10-18 20:00:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-18T20:00:47Z.


@SandstromPL ran it on the same laptop (Windows 11 Pro 26200, RTX A2000 Laptop, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON) on this PR's head 9a82a1b45:

ctest -R guest_deferred_module
1/9 guest_deferred_module_reload ............... Passed
2/9 guest_deferred_module_pinned ............... Passed
3/9 guest_deferred_module_parallel ............. Passed
4/9 guest_deferred_module_reentrant ............ Passed
5/9 guest_deferred_module_writable_reload ...... Passed
6/9 guest_deferred_module_writable_pinned ...... Passed
7/9 guest_deferred_module_writable_parallel .... Passed
8/9 guest_deferred_module_writable_reentrant ... Passed
9/9 guest_deferred_module_writable_cleared ..... Passed
100% tests passed, 0 tests failed out of 9

AI-assisted; the runs are from my machine(s).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254480479 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6254480479). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-18T20:00:47Z. --- @SandstromPL ran it on the same laptop (Windows 11 Pro 26200, RTX A2000 Laptop, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`) on this PR's head 9a82a1b45: ``` ctest -R guest_deferred_module 1/9 guest_deferred_module_reload ............... Passed 2/9 guest_deferred_module_pinned ............... Passed 3/9 guest_deferred_module_parallel ............. Passed 4/9 guest_deferred_module_reentrant ............ Passed 5/9 guest_deferred_module_writable_reload ...... Passed 6/9 guest_deferred_module_writable_pinned ...... Passed 7/9 guest_deferred_module_writable_parallel .... Passed 8/9 guest_deferred_module_writable_reentrant ... Passed 9/9 guest_deferred_module_writable_cleared ..... Passed 100% tests passed, 0 tests failed out of 9 ``` AI-assisted; the runs are from my machine(s).
SandstromPL commented 2026-10-19 03:29:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-19T03:29:46Z.


@mrfelek thank you for the guest_deferred_module run, 9/9 is what the libkernel commit needed. I've added it to the description.

#6112 was reverted in #7646, so I rebased this onto main 2ed704842 without it or #6684. The branch is now only this PR's two commits, at 9a2d69870. Since your runs:

  • #6112's code is gone, so the startup no longer runs preinit entries, as on main.
  • The new relinker_executables case has its own fixture instead of #6112's.
  • The startup clear is unchanged, and the writer sets the same flags, just two lines later.
  • The libkernel commit is the same as the one you ran.

Your Peace Walker run and the 9/9 were on the old head 9a82a1b45, which still had #6112 in it. When convenient, could you rerun the combined relink (--executable mgspw/mgspw.elf with both --module-dirs) and a short play on the new head?

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6259023862 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6259023862). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-19T03:29:46Z. --- @mrfelek thank you for the `guest_deferred_module` run, 9/9 is what the libkernel commit needed. I've added it to the description. #6112 was reverted in #7646, so I rebased this onto `main` 2ed704842 without it or #6684. The branch is now only this PR's two commits, at 9a2d69870. Since your runs: - #6112's code is gone, so the startup no longer runs preinit entries, as on `main`. - The new `relinker_executables` case has its own fixture instead of #6112's. - The startup clear is unchanged, and the writer sets the same flags, just two lines later. - The libkernel commit is the same as the one you ran. Your Peace Walker run and the 9/9 were on the old head 9a82a1b45, which still had #6112 in it. When convenient, could you rerun the combined relink (`--executable mgspw/mgspw.elf` with both `--module-dir`s) and a short play on the new head? AI-assisted: yes (Claude Code)
mrfelek commented 2026-10-19 10:50:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrfelek on 2026-10-19T10:50:50Z.


@SandstromPL reran on the new head, same laptop (Windows 11 Pro 26200, RTX A2000 Laptop, WinLibs GCC 15.2.0, Release).

Peace Walker: the playable test branch (main c9e6c45de + the open Peace Walker PRs, 8e5e16820) plus this PR's two commits. 9a2d69870 doesn't merge cleanly onto that older base, so I cherry-picked 2088dc38c and 9a2d69870. The only conflicts were options.Patches/TargetName in main.cpp and Conversion.hpp, which main added later, and two docs; this PR's SharedGuestModules lines went in unchanged.

  • relinker --windows --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins src/eboot.elf app.exe: exit 0, 12 guest modules, app.exe and mgspw.mgspw.elf.exe written.
  • app.exe starts mgspw.mgspw.elf. The scripted start reaches the tutorial stage after about 28 s, as on the old head.
  • Then played by hand: finished the tutorial and reached the next mission, with no problems seen.
  • No abort, exception or Thread destructor callback is already registered in the log.

Tests: this PR's head 9a2d69870 itself (not the cherry-picked tree), BUILD_TESTING=ON:

ctest -R guest_deferred_module
1/9 guest_deferred_module_reload ...............   Passed
2/9 guest_deferred_module_pinned ...............   Passed
3/9 guest_deferred_module_parallel .............   Passed
4/9 guest_deferred_module_reentrant ............   Passed
5/9 guest_deferred_module_writable_reload ......   Passed
6/9 guest_deferred_module_writable_pinned ......   Passed
7/9 guest_deferred_module_writable_parallel ....   Passed
8/9 guest_deferred_module_writable_reentrant ...   Passed
9/9 guest_deferred_module_writable_cleared .....   Passed
100% tests passed, 0 tests failed out of 9

AI-assisted; the runs are from my machine(s).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6265495650 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6265495650). Originally posted by [mrfelek](https://github.com/mrfelek) on 2026-10-19T10:50:50Z. --- @SandstromPL reran on the new head, same laptop (Windows 11 Pro 26200, RTX A2000 Laptop, WinLibs GCC 15.2.0, Release). **Peace Walker:** the playable test branch (`main` c9e6c45de + the open Peace Walker PRs, 8e5e16820) plus this PR's two commits. `9a2d69870` doesn't merge cleanly onto that older base, so I cherry-picked 2088dc38c and 9a2d69870. The only conflicts were `options.Patches`/`TargetName` in `main.cpp` and `Conversion.hpp`, which `main` added later, and two docs; this PR's `SharedGuestModules` lines went in unchanged. - `relinker --windows --registry --executable mgspw/mgspw.elf --module-dir Media/Modules --module-dir Media/Plugins src/eboot.elf app.exe`: exit 0, 12 guest modules, `app.exe` and `mgspw.mgspw.elf.exe` written. - `app.exe` starts `mgspw.mgspw.elf`. The scripted start reaches the tutorial stage after about 28 s, as on the old head. - Then played by hand: finished the tutorial and reached the next mission, with no problems seen. - No abort, exception or `Thread destructor callback is already registered` in the log. **Tests:** this PR's head 9a2d69870 itself (not the cherry-picked tree), `BUILD_TESTING=ON`: ``` ctest -R guest_deferred_module 1/9 guest_deferred_module_reload ............... Passed 2/9 guest_deferred_module_pinned ............... Passed 3/9 guest_deferred_module_parallel ............. Passed 4/9 guest_deferred_module_reentrant ............ Passed 5/9 guest_deferred_module_writable_reload ...... Passed 6/9 guest_deferred_module_writable_pinned ...... Passed 7/9 guest_deferred_module_writable_parallel .... Passed 8/9 guest_deferred_module_writable_reentrant ... Passed 9/9 guest_deferred_module_writable_cleared ..... Passed 100% tests passed, 0 tests failed out of 9 ``` AI-assisted; the runs are from my machine(s).
SandstromPL commented 2026-10-19 19:21:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-19T19:21:08Z.


@mrfelek thank you for rerunning it on this head, and for the ctest run on the head itself. I've updated the description's Windows section with both, so it no longer rests on the old head.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6275344947 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6275344947). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-19T19:21:08Z. --- @mrfelek thank you for rerunning it on this head, and for the `ctest` run on the head itself. I've updated the description's Windows section with both, so it no longer rests on the old head. AI-assisted: yes (Claude Code)
SandstromPL commented 2026-10-21 16:11:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by SandstromPL on 2026-10-21T16:11:39Z.


Closing in favour of #8162, which is now merged. With its uniform deferral on Windows, a --module-dir module converts the same way for every executable, so the --executable mismatch this PR handled can no longer happen. mrfelek confirmed that Peace Walker works on Windows with #8162 alone (https://github.com/boykopovar/AnyPS5/pull/8162#issuecomment-6288011511). Thanks to mrfelek for all the Windows runs here.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6320667107 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7450#issuecomment-6320667107). Originally posted by [SandstromPL](https://github.com/SandstromPL) on 2026-10-21T16:11:39Z. --- Closing in favour of #8162, which is now merged. With its uniform deferral on Windows, a `--module-dir` module converts the same way for every executable, so the `--executable` mismatch this PR handled can no longer happen. mrfelek confirmed that Peace Walker works on Windows with #8162 alone (https://github.com/boykopovar/AnyPS5/pull/8162#issuecomment-6288011511). Thanks to mrfelek for all the Windows runs here. AI-assisted: yes (Claude Code)

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!7450
No description provided.