The relinker binary carried no build identity: a release build and a
checkout of main were indistinguishable, so a report could not name the
build it came from. --version prints the revision git describe reports,
falling back to "unknown" when the tree has no git metadata, and needs
no input or output paths. The usage line and USAGE.md list the option.
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]>
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.
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.
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.
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.
The relinker's repeatable --executable converts another executable of the
title beside the output, sharing its libs, app0 and guest modules.
sceSystemServiceLoadExec maps /app0 paths to those executables, passes the
argument list on the new command line and finds the main executable through
APS5_EBOOT. RetroArch (PPSA99169) starts its frontend picker this way.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cli::ParseArgs had no test coverage: its only sibling test
(AutorunExitTests) exercises the autorun launcher, not the parser.
Add cli_args_tests covering every option and its side effects, the
--rpath and --exclude-sce-module value consumption (including that the
following token is taken verbatim rather than re-parsed as a flag), the
unused-filter value and single-specification validation, the
--exclude-sce-module/--skip-sce-module conflict in both orders, the
order-independent --windows-diagnostics/--windows-gui requirement on
--windows, unknown-option and extra-positional rejection, and the usage
message when an input or output path is missing.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>