Commit Graph
1602 Commits
Author SHA1 Message Date
Dean d8875f5dbd Merge pull request #14662 from slopgobblercobbler/test/relinker-shaddralign-non-power-two-bounds
test(relinker): cover non power of two sh_addralign bounds
2026-11-05 16:59:58 +13:00
Dean f3604031cf Merge pull request #15526 from oneandonlydean/fix/relinker-guest-none-relocations-split
test(relinker): run guest_none_relocations as two halves
2026-11-05 08:21:01 +13:00
Dean 6145630210 Merge pull request #15055 from Milos-Opletal/fix/relinker-reject-duplicate-gnu-stack
fix(relinker): preserve the last PT_GNU_STACK segment
2026-11-05 08:20:31 +13:00
Dean 3288b21f88 Merge pull request #15370 from oneandonlydean/fix/windows-deferred-dependency-start
fix(relinker): restore the Windows deferral of #12621 and start deferred dependencies first
2026-11-05 08:18:30 +13:00
Dean 18a6629e2d Merge pull request #10662 from shurhundo/fix/linux-relro-enforcement
fix(relinker): emit PT_GNU_RELRO for Linux output instead of leaving RELRO writable
2026-11-05 06:35:23 +13:00
Dean ba61f414e8 Merge pull request #8251 from imshah-id/fix/relinker-patch-inputs
fix(relinker): preserve patch inputs across all outputs
2026-11-05 06:34:01 +13:00
Dean 0c31a0e326 Merge pull request #11432 from muhmuhkuh/codex/windows-executable-exports
fix(relinker): export Windows executable symbols
2026-11-04 18:33:35 +13:00
Dean 7a5989388c Merge pull request #10917 from slugzero/feat/relinker-linux-gnu-hash
feat(relinker): emit DT_GNU_HASH and exclude undefined symbols from DT_HASH
2026-11-04 17:48:56 +13:00
Dean e231f17d8f Merge pull request #15255 from HenriksApsitis/test/reported-relinker-regression
test(relinker): guard against duplicate module preinit startup
2026-11-04 08:12:11 +13:00
Dean Galvin 29178b2917 fix(relinker): start the deferred modules others depend on at the first load of any deferred module
A deferred module that only another deferred module names (PSNCommon, needed by
PSNCore) started after the plugins that use it (SPFXUnityPlugin) and crashed
Soul Hackers 2 on Windows. The first title load of any deferred module now starts
every deferred module some module depends on, in dependency order, with that
load's start arguments, and logs the sweep. Boot is unchanged.
2026-11-04 03:29:14 +13:00
Dean Galvin 62aec71ad8 fix(relinker): start what a deferred module the executable needs depends on, and log each deferred start
On Windows a module the executable needs or imports from stays deferred, but its
dependencies were deferred too and started only when the title loads it, so a title
that calls it first ran them uninitialised (Soul Hackers 2, #15370 rerun). They start
at startup again, as on main. The loader prints one line per deferred start.
2026-11-04 02:36:53 +13:00
Dean Galvin acdbf77838 test(relinker): run guest_none_relocations as two halves
On the x86_64 macOS relinker job (emulated on an arm runner) the test took 11 to 20 s against its
20 s limit. Over the main runs of 4a7770bf54 to 66387a10ee, 20.04, 20.07, 20.03 and 20.07 s timed
out and 19.99, 19.99 and 19.33 s passed, while the native arm64 job takes 1.3 to 5 s. The test is a
loop of relinker subprocess runs over sce False and True. It now takes "plain", "sce" or "all" (the
default, so the importing tests are unaffected), and CMake registers guest_none_relocations (plain)
and guest_none_relocations_sce, each with the same 20 s limit and half the work.
2026-11-03 22:20:22 +13:00
Dean Galvin f17fd26885 Merge commit '4f41f4c375f5abb487dbd184fbc150f31994d762' into HEAD
# Conflicts:
#	docs/dev/debt/relinker.md
2026-11-03 21:17:37 +13:00
Dean 04ca53e25d Merge pull request #13962 from LeandroLP23/fix/relinker-windows-df-symbolic
fix(relinker): convert DF_SYMBOLIC guest modules for Windows
2026-11-03 21:09:26 +13:00
Dean c4c6934558 Merge pull request #12282 from JJenkx/windows/relinker-collect-vector-result
perf(relinker): return the collected instructions as a sorted vector
2026-11-03 21:09:10 +13:00
Dean 7af9b1c691 Merge pull request #14139 from JJenkx/fix/relinker-absent-unused-dependency
fix(relinker): optionally leave out a module dependency nothing provides or imports from on Linux
2026-11-03 21:08:25 +13:00
Dean 8835460b5e Merge pull request #7532 from hugodearaujo/fix/linux-guest-main-stack
fix(linux): enter the guest entry on a main stack at the console's address
2026-11-03 21:07:51 +13:00
Dean 58c21ea16c Merge pull request #15356 from DonRyuzaki/fix/relinker-relative-gap-values
fix(relinker): allow relative values in image gaps
2026-11-03 18:14:41 +13:00
Dean 937c92d41f Merge pull request #15063 from peacocksir/fix/guest-static-tls-flag
fix(relinker): accept DF_STATIC_TLS on guest modules
2026-11-03 18:13:36 +13:00
Dean fffa45ebe5 Merge pull request #14855 from ken00H/fix/relinker-windows-entry-stub-parent-log
fix(relinker): wait for the LoadExec parent after opening the Windows log
2026-11-03 18:10:38 +13:00
Dean 1c59a15291 Merge pull request #13862 from roboterspinne/fix/relinker-reject-unknown-load-flags
fix(relinker): reject main-executable PT_LOAD flags outside PF_R, PF_W and PF_X
2026-11-03 18:09:30 +13:00
Dean 3fc8f5863b Merge pull request #12513 from LuPetro/fix/windows-icon-virtual-overlap
fix(relinker): check virtual size before adding Windows icon
2026-11-03 18:09:14 +13:00
Dean Galvin 2cdb4d40d4 fix(relinker): start a deferred module's deferred dependencies before it on Windows
Since #12621 a Windows runtime module that another runtime module needs is deferred instead of started at boot, but loading a deferred module only started that module. A Unity plugin such as SPFXUnityPlugin that calls into a deferred module it needs (Il2CppUserAssemblies in Media/Modules) ran against code whose initializers had never run, and PPSA03743 crashed about 2.6 s in.

A deferred module's initialization table now lists the deferred modules it depends on (names, after the initializer array, behind a magic number so older output reads as having none). DynamicLoader starts those first, transitively and once each through the existing per-module state, with the start arguments of the load that began it, then starts the module itself. The module start result stays the module's own. Boot still starts no deferred module.

Linux is unchanged: its deferred modules still start only when loaded.
2026-11-03 16:03:33 +13:00
Dean Galvin d63b675177 fix(relinker): reapply the Windows deferral of runtime modules another deferred module needs (#12621)
Reapplies the code, tests and USAGE.md change of 420b6a064e (#12621 by Ragbie), which commit 987ebe9855 (#15360) reverted because Soul Hackers 2 (PPSA03743) crashed on Windows: SPFXUnityPlugin calls into Il2CppUserAssemblies, which #12621 defers, and loading a deferred module did not start the deferred modules it needs. The next commit makes the loader start them, so the deferral and the start come back together.
2026-11-03 16:03:33 +13:00
Dean f6232fcfda Merge pull request #15360 from oneandonlydean/revert-12621-v2
revert(relinker): defer the runtime modules another deferred module needs on Windows (#12621)
2026-11-03 16:02:16 +13:00
Ryuzaki 86f330a102 fix(relinker): allow relative values in image gaps 2026-11-03 02:50:33 +00:00
slopgobblercobbler 1a6dcfef66 test(relinker): cover non power of two sh_addralign bounds 2026-11-03 03:46:27 +01:00
Dean 6c3d3b29c0 Merge pull request #14688 from slopgobblercobbler/test/relinker-symtab-entsize-bounds
test(relinker): cover sh_entsize mismatch for SHT_SYMTAB section
2026-11-03 11:41:50 +13:00
Dean 96b856f9e6 Merge pull request #14614 from slopgobblercobbler/test/relinker-ptload-filesz-overflow-bounds
test(relinker): cover PT_LOAD segment p_filesz exceeding p_memsz
2026-11-03 11:40:18 +13:00
Dean c71fef4835 Merge pull request #14604 from slopgobblercobbler/test/relinker-relr-entry-oob-bounds
test(relinker): cover out of bounds entry in RELR table
2026-11-03 11:40:13 +13:00
Dean 610adb58f1 Merge pull request #14470 from slopgobblercobbler/test/relinker-cie-augmentation-coverage
test(relinker): cover CIE augmentation string bounds and unterminated records in unwind tests
2026-11-03 11:37:32 +13:00
Dean dca6785e9b Merge pull request #14460 from slopgobblercobbler/test/relinker-dynamic-table-bounds-coverage
test(relinker): cover DT_RELA and DT_STRTAB out of bounds in dynamic table tests
2026-11-03 11:36:56 +13:00
Dean 4c54ba9bfa Merge pull request #14442 from Serph91P/fix/14423-linux-trace-permissions
fix(relinker): preserve Linux import tracing execute permissions
2026-11-03 11:36:27 +13:00
Dean 10ba64ebcb Merge pull request #14422 from Dinsuljevic336/fix/relinker-unused-filter-shn-abs
fix(relinker): skip SHN_ABS function symbols in unused NID filters
2026-11-03 11:36:09 +13:00
Henriks Apsitis 3577e0368a test(relinker): guard against duplicate module preinit startup
Model a module whose initializer dispatches its own preinit callback and assert the exact once-only callback, preserved arguments and return value. Retain zero-address and no-preinit controls and cover deferred Linux initialization.

Regression coverage for #7636, introduced by #6112 and reverted by #7646. The new test fails with the actual historical bad relinker at 376c040 and passes on main 9090972.

AI-assisted: yes. Independently reviewed staged patch 6e437226c361065dad96478101fc899f65cde86caf51a39415369c01c1725168.
2026-11-02 22:05:16 +00:00
roboterspinne 4d6f5458c0 test(relinker): pin the PT_LOAD flags diagnostic line with its offset 2026-11-02 22:23:40 +01:00
Dean Galvin 987ebe9855 revert(relinker): defer the runtime modules another deferred module needs on Windows (#12621)
This reverts the code, tests and USAGE.md change of commit 420b6a064e
(#12621). The docs/dev/debt/relinker.md line is left for the follow-up
that brings the deferral back with dependency start, to keep a running
batch that edits the same file valid.

Soul Hackers 2 (PPSA03743) stops about 2.6 s into boot on Windows with an
access violation on UnityGfxDeviceWorker inside SPFXUnityPlugin.prx since
this change. klosixgaming-arch bisected main's merge commits to 420b6a064e
and confirmed that undoing its dependency filter makes the title boot again
(https://github.com/boykopovar/AnyPS5/pull/12621#issuecomment-6587462742).

SPFXUnityPlugin (Media/Plugins) calls into Il2CppUserAssemblies
(Media/Modules). With #12621 that dependency is deferred, and loading a
deferred module does not start the deferred modules it needs, so it is
never started. The revert restores the previous Windows behaviour, where a
module another module needs starts at startup.
2026-11-03 09:51:50 +13:00
Dean 13e95604e4 Merge pull request #14410 from roboterspinne/fix/relinker-linux-fixed-base-paddr
fix(relinker): stop rejecting Linux fixed-base output over the unused p_paddr field
2026-11-03 08:50:04 +13:00
Dean b2627ce36d Merge pull request #13291 from PolkadotDom/fix/eip-import-call-sites
fix(relinker): resolve EIP-relative import call sites
2026-11-03 08:45:32 +13:00
Dean 8065bdfa25 Merge pull request #13143 from kyon-eth/fix/monosgen-module-alias
fix(relinker): resolve versioned Mono module dependency
2026-11-03 06:27:05 +13:00
Dean b9d18dc1f9 Merge pull request #12951 from Kikoarl/fix/relinker-rip-displacement-overflow-guard
fix(relinker): guard 64-bit rip-relative displacement overflow and underflow
2026-11-03 06:25:52 +13:00
Dean 62949c1978 Merge pull request #12822 from slopgobblercobbler/fix/relinker-rela-entry-bounds
fix(relinker): validate dynamic DT_RELAENT and PLTREL table entries
2026-11-03 05:13:52 +13:00
dom 21a7616cda chore(relinker): refresh EIP import analysis after prerequisite merge 2026-11-02 10:53:33 -05:00
SlugZero e46c9ef7f6 feat(relinker): emit DT_GNU_HASH and exclude undefined symbols from DT_HASH
Emit a standard DT_GNU_HASH table (0x6ffffef5) alongside the SysV DT_HASH table in LinuxElfPatcher::Patch(), and only insert defined symbols (st_shndx != SHN_UNDEF) into both hash tables.

When the executable exports defined symbols, sort the contiguous defined tail of .dynsym by GNU hash bucket before constructing both DT_HASH and DT_GNU_HASH so both tables record the final post-sort symbol indices.

AI-assisted: yes (Antigravity)
2026-11-02 16:28:57 +01:00
Milos-Opletal 6f8fb8b184 fix(relinker): preserve the last PT_GNU_STACK segment 2026-11-02 16:19:35 +01:00
Dean 25797f0fab Merge pull request #12500 from StoneDC/feat/b20-autorun-noninteractive
feat(relinker): optionally skip the autorun exit prompt
2026-11-03 02:38:19 +13:00
Dean 52e4cad5aa Merge pull request #12495 from StoneDC/fix/b20-console-progress-control-characters
fix(relinker): escape ASCII controls in progress filenames
2026-11-03 02:38:14 +13:00
Dean d6e9570d8b Merge pull request #12341 from roboterspinne/fix/relinker-tls-relocation-undefined-non-tls
fix(relinker): reject executable TLS relocations against an undefined symbol that is not STT_TLS
2026-11-03 02:37:21 +13:00
Dean f903f87b99 Merge pull request #12270 from JJenkx/windows/relinker-reserve-reachable
perf(relinker): reserve the reachable instruction set before the graph walk
2026-11-03 02:36:29 +13:00
Dean 2a43ad9dbe Merge pull request #12243 from rooklz/test/gap-walk-branch-targets
test(relinker): cover branch targets found by the jump-table gap walk
2026-11-03 02:35:58 +13:00