fix(relinker): preserve input binaries when writing registries #3495
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3495"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Lorkydey on 2026-10-11T11:40:31Z.
What
Prevent
--registryfrom overwriting the input executable or an input guest module when a generated registry path names the same file, including through hard links or symbolic links.For example, converting an ELF named
output.registry.jsontooutput.exewith--windows --skip-sce-module --registrycurrently succeeds but replaces the input ELF with a 6-byte JSON report. The relinker now rejects the collision before writing any registry or converted binary. All registry destinations are checked first, so a collision in a later module registry also leaves existing reports and outputs untouched.Guest artifacts retain their source paths for the checks. The existing input-preservation test covers both executable and module registries, both input types, direct names and linked aliases, and Windows/Linux output formats. No Markdown files or dependencies are changed.
Tested
Windows x64, WinLibs MinGW-w64 GCC 15.2.0 (ucrt r7), CMake/Ninja, Release, BUILD_TESTING=ON, based on main
0f863c10:cmake --build build --parallel 8: passed.ctest --test-dir build/core/relinker --output-on-failure --parallel 4 --no-tests=error: 95/95 passed.--skip-sce-module: collisions preserve the source and return exit 2; existing unrelated registries can still be replaced successfully, for both output formats.python tools/check_conventions.py --base origin/mainandgit diff --check origin/main...HEAD: passed.Linux outputs were generated and inspected on Windows; no native Linux or macOS runtime testing was performed locally.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:56:50Z.
Checked: all registry paths are validated against the input executable and input modules (direct, hardlink, symlink) before anything is written; the regression test fails without the change and passes with it; relinker ctest scope green on Linux. Merging once CI is green.