Commit Graph
81 Commits
Author SHA1 Message Date
Dean 6df35a4f58 Merge pull request #10997 from SandstromPL/fix/relinker-backup-copies-in-conversion
fix(relinker): skip backup copies of guest modules in the online converter too
2026-10-27 10:58:32 +13:00
Dean e34b992e8a Merge pull request #11010 from harisibrar1/fix/relinker-rpath-value
fix(relinker): reject a repeated --rpath
2026-10-27 10:35:33 +13:00
Dean 37caf45550 Merge pull request #10912 from ahmadmuj/fix/anyps5-frame-red-zone-requires-windows
fix(relinker): reject --frame-red-zone without --windows
2026-10-27 10:33:25 +13:00
Adrià cbf76e7a6e Merge pull request #9408 from rursache/feat/macos-trace-imports
feat(relinker): trace function imports on macOS
2026-10-26 11:27:51 +01:00
Dean f2c8e1dda4 Merge pull request #9657 from jotitadev/fix/autorun-skip-noop-chmod
fix(relinker): leave an already executable autorun output's mode alone
2026-10-26 11:07:10 +13:00
Radu Ursache 66ca5c0442 feat(relinker): trace function imports on macOS
Walk each macOS function import before the guest entry and pass it through TraceImport_nid_no_patch, as Linux and Windows already do. An x86-64 libc build records the call and prints it on SIGABRT.
2026-10-25 18:37:23 +01:00
harisibrar1andClaude Opus 5.5 685a291838 fix(relinker): reject a repeated --rpath
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 10:05:14 -04:00
SandstromPLandClaude Opus 5.5 479fcec4ee fix(relinker): skip backup copies of guest modules in the online converter too
The command-line relinker skips an ELF module whose file name extends
another module's in the same directory when both have the same SONAME, a
dumper's backup such as libX.prx.esbak (#7380). That check lives in the
CLI's ReadModules, so the online converter, which hands every ELF in
sce_module/ straight to Conversion, still stops on such a layout with
"Ambiguous guest dependency name: libX.prx".

The check moves into the relinker core as RemoveBackupCopies, which
Conversion::Convert now runs before patching or converting modules and
reports through the progress messages, so the browser prints the same
"Skipping backup copy" lines. ReadModules uses the same function, so the
command line and --verify-patches behave as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-25 18:42:27 +05:30
Ahmad Mujahid 1c3bb466a8 fix(relinker): reject --frame-red-zone without --windows 2026-10-25 13:30:50 +04:00
Dean 268674d31c Merge pull request #10682 from ahmadmuj/fix/relinker-verify-frame-red-zone
fix(relinker): reject --frame-red-zone with --verify-patches
2026-10-25 21:50:21 +13:00
Dean 5aa203ba74 Merge pull request #9663 from AdnanKhan-ak47/feat/relinker-report-unconverted-needed
feat(relinker): report needed modules shipped outside the module directories
2026-10-25 21:50:08 +13:00
Adnan Khan 37c516ad2e fix(relinker): keep the needed-module report best-effort on traversal and status errors 2026-10-25 12:24:22 +05:30
Ahmad Mujahid 73a681b488 fix(relinker): reject --frame-red-zone with --verify-patches 2026-10-24 21:33:31 +04:00
Adrià d01070d6c3 Merge pull request #5640 from EagleBearerYS/feat/relinker-frame-frameless-leaves
feat(relinker): frame red-zone leaves without a frame pointer by moving their rsp operands
2026-10-24 18:14:53 +02:00
Yunus Shaikh ff16118b63 Merge branch 'main' into feat/relinker-frame-frameless-leaves-next 2026-10-23 03:13:53 +00:00
harisibrar1andClaude Opus 5.5 e1342e7de2 test(relinker): find the Windows test executables with GetModuleFileNameW
autorun_exit_tests built its own path from argv[0] and
windows_dependency_diagnostics_tests from GetModuleFileNameA. Both are in
the ANSI code page on Windows, but MinGW's std::filesystem::path reads a
narrow string as UTF-8, so in a build directory with characters such as
"ü" both tests stopped with "Cannot convert character sequence: Illegal
byte sequence" before testing anything (windows_diagnostic_fixture_isolation
runs the second one).

Take the path from GetModuleFileNameW on Windows. The relinker and the
generated diagnostic runner already use UTF-8 and wide APIs, so nothing
else changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-22 08:48:34 -04:00
Adnan Khan f3dcf6d8be fix(relinker): skip unreadable candidates and fold case for --windows in the needed-module report 2026-10-22 14:02:37 +05:30
Adnan Khan 00d6b33126 feat(relinker): report needed modules shipped outside the module directories 2026-10-22 12:48:19 +05:30
Jota 600efd95be fix(relinker): leave an already executable autorun output's mode alone
Autorun added the execute bits with an unconditional chmod, even when the
output already had them. On macOS a chmod changes the file's ctime, and
Rosetta then throws away its translation of an x86_64 executable and
translates it again on the next exec, about 0.11 s per run on an M2 Max.

autorun_exit_status paid that on every POSIX run: it chmods the child and
also renames it once per quoting case, and a rename changes the ctime too.
On the x86_64 macOS relinker job it takes 5 s at the median and timed out
once at its 20 s limit, against 0.2 s on arm64. Autorun now only calls
chmod when an execute bit is missing, and the test runs symlinks to
itself instead of copying and renaming the executable. It also checks
that the executable's ctime does not change and that Autorun still makes
a non-executable output executable.
2026-10-22 03:29:42 -03:00
mpratsakiandClaude Opus 5.5 763702c5ce fix(relinker): use the Windows file identity in module and executable checks
Guest module discovery skipped the input executable and the
--executable check rejected an executable converted twice through
std::filesystem::equivalent, which MinGW reports as false for hard links
whose names give different permissions, such as .bin and .exe. Move the
GetFileInformationByHandle comparison to Io::SameFile and use it for
these checks and for SameOutputFile.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 02:19:01 +03:00
Ishmam Ahmed 78634fb0a9 feat(relinker): support --trace-imports for Linux output
The Linux entry stub now passes each traced import through libc.prx's
TraceImport_nid_no_patch before it calls the guest entry, and stores the
returned thunk in the import's slot. The same imports are traced as on
Windows: functions bound through a PLT slot or a GOT slot, without an
addend, and not weak. TraceImport_nid_no_patch is bound eagerly through
an added GLOB_DAT relocation, so a libc.prx without it fails at load.
Each slot's page is made writable with mprotect first, so slots inside a
PT_GNU_RELRO range can be replaced.

--trace-imports now requires libc.prx among the libraries on Linux too,
and is refused with --macos.
2026-10-19 22:56:03 +01:00
Adrià dd4c2a413b Merge pull request #7418 from tkcm01/fix/relinker-backup-copy-export-aliases
fix(relinker): allow Windows export aliases when probing backup copies
2026-10-19 21:51:59 +02:00
David 3ea53b5412 test(relinker): check the macOS fixed base layout and option parsing
macos_fixed_base relinks the fixed-base fixture with and without
--macos-fixed-base 0x400000 and checks that every segment and section
moves by the same amount, __PAGEZERO ends 64 KiB below the base, the
lowest load page is at the base, the entry offset is unchanged, and the
metadata load bias and the relocated slot hold base-relative addresses.
It also checks the lowest base and the refused options and images.

cli_args covers the parsing, range, repetition and --macos requirement.
2026-10-19 10:32:50 +02:00
David 35fe448155 feat(relinker): place macOS executables at a fixed base with --macos-fixed-base
Ruffle (PPSA68091), VLC (PPSA85300) and XPSemu (PPSA97358) read
app0/imports.txt, whose import slot addresses assume the executable's
lowest ELF load page at 0x400000, and dereference them at once. macOS
output always placed that page at 0x140010000, so all three fault on
their first slot read. Linux and Windows have --linux-fixed-base and
--windows-fixed-base for this; macOS had no equivalent.

--macos-fixed-base <address> builds the load image so that the lowest
ELF load page is at the address, as --windows-fixed-base does. The
Mach-O header takes the 64 KiB below it and __PAGEZERO ends there. The
executable is MH_EXECUTE without MH_PIE, so dyld does not slide it. The
address must be 64 KiB aligned, from 0x20000 through 0x7fffffff0000,
and an image ending past the macOS user address space is refused.
2026-10-19 10:32:30 +02:00
Eli Yarson 346b0a92ca feat(relinker): add conversion-time game patches
A per-game relinker-patches.toml (or --patches) replaces verified bytes in
the input executable and bundled modules before conversion. Entries are
checked against the expected bytes and against every in-place writer,
the ELF header range and relocation targets. An <output-stem>.patches.toml
manifest records the applied entries, and --verify-patches checks an input
or a converted output. With no patch file the output is unchanged.
2026-10-18 14:57:13 -03:00
tkcm01 8bcf040abb fix(relinker): allow Windows export aliases when probing backup copies 2026-10-18 01:22:50 -04:00
Dean Galvin 489c64ecb5 Merge main into fix/explicit-homebrew-module-directories 2026-10-18 17:43:12 +13:00
thuanquangandClaude Opus 5.5 a7499e072f fix(relinker): skip a dumper's backup copy of a module beside the module
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-18 10:41:02 +07:00
Dean 696c5f3516 Merge pull request #6156 from MarcZX100/codex/relinker-guest-dir-identity
fix(relinker): compare guest module directories by identity
2026-10-17 18:00:53 +13:00
Adrià e967594f62 Merge pull request #5868 from Lorkydey/fix/autorun-system-failure
fix(relinker): propagate POSIX autorun failures
2026-10-15 23:01:29 +02:00
Adrià f728e37955 Merge pull request #5702 from AlexOfTheForest/test/runtime-layout
test(cli): cover RuntimeLayout file tree output
2026-10-15 14:15:39 +02:00
ArjenS-LA 1800d3892b fix(relinker): allow explicit module directories without standard folders 2026-10-14 22:51:15 -07:00
Jota 006e176812 fix(relinker): compare guest module directories by identity
(cherry picked from commit 6e3b80d65bd47344b896af9cbc763033fe6d5be0)
2026-10-14 23:42:30 +00:00
lorkydey 48aaec50f8 fix(relinker): propagate POSIX autorun failures 2026-10-14 16:17:24 +02:00
Yunus Shaikh cef664f770 Merge branch 'main' into feat/relinker-frame-frameless-leaves 2026-10-14 05:00:25 -07:00
Renan Pires 75cfcec67c feat(relinker): load Linux executables at a fixed base with --linux-fixed-base 2026-10-14 12:35:36 +02:00
Alexej Szpevák c740935455 test(cli): cover RuntimeLayout file tree output
Add a unit test for the layout the relinker prints after a conversion:
the fixed header and library entries, extra executables in order, and
module paths merged into one sorted tree with directories marked and
duplicates collapsed.
2026-10-14 09:23:22 +02:00
Dean aa1927872f Merge pull request #5197 from AlexOfTheForest/test/relinker-cli-module-and-target-options
test(cli): cover module-dir, sce-module-path and target option errors
2026-10-14 15:46:50 +13:00
Josip Parlov fab7d203fb feat(relinker): --frame-red-zone gives red-zone leaf functions a frame on Windows
Windows writes an exception frame directly below RSP, so a fault resumed on
a guest thread overwrites values a System V leaf function keeps in its red
zone. With --frame-red-zone, a leaf function with a
push rbp; mov rbp, rsp; push ... prologue that reads or writes below its
pushes gets two kinds of trampoline: the prologue lowers RSP by 128 bytes
after its pushes, and each pop ...; pop rbp; ret exit raises it back first.

Sites a branch enters, sites shorter than a jump and sites over a --to-intel
stub are skipped; the conversion reports the framed and skipped counts.
2026-10-13 18:46:08 +02:00
codingreapermapsandClaude Opus 5.5 430e5c833e feat(relinker): add --trace-imports for Windows executables
With --trace-imports the entry stub resolves TraceImport_nid_no_patch
in libc.prx and passes each function import through it before writing
the slot: every PLT slot, and a GOT slot only when the original symbol
is a function, so data imports such as __stdoutp keep their address.
Without the option the output is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 16:55:31 +02:00
Alexej Szpevák fc8165e8b9 test(cli): cover module-dir, sce-module-path and target option errors
Add parser tests for --module-dir, --sce-module-path, --macos and
--to-rosetta, including their repeat and conflict errors, which had no
coverage.
2026-10-13 16:17:23 +02:00
Avijit SinghandCopilot 48ea54ed3e fix(relinker): include output stream header
Co-authored-by: Copilot <[email protected]>
2026-10-13 18:05:37 +05:30
Avijit SinghandCopilot 82f24e44a2 fix(relinker): warn on skipped SELF modules
Co-authored-by: Copilot <[email protected]>
2026-10-13 18:04:49 +05:30
Kovalev Vladislav 319fa5779a feat(relinker): support fixed Windows guest image bases 2026-10-13 12:55:54 +02:00
boykopovar 04899cb0f7 fix(relinker): align console progress columns 2026-10-13 13:02:03 +03:00
boykopovar d35b1afa51 fix(relinker): use consistent two-space nesting in runtime layout 2026-10-13 12:59:22 +03:00
boykopovar c9a94dd021 fix(relinker): remove layout padding and blank lines after headings 2026-10-13 12:59:04 +03:00
boykopovar 868d7a138d fix(relinker): separate console sections without spacing every message 2026-10-13 12:58:35 +03:00
boykopovar 56c2a53188 fix(relinker): redraw console progress and format runtime layout as a tree 2026-10-13 12:58:34 +03:00
boykopovar 3e658db4b6 refactor(relinker): remove the obsolete file-based icon builder 2026-10-13 12:57:55 +03:00