Repository navigation
fix(relinker): preserve inputs behind Windows executable hard links - #6328
Merged
adriadam10 merged 1 commit intoOct 18, 2026
Merged
Conversation
Co-authored-by: Codex <noreply@openai.com>
This was referenced Oct 15, 2026
|
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.
|
This was referenced Oct 15, 2026
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Windows with the supported MinGW-w64 compiler, an
output.exehard link toinput.elfpasses the relinker's input-overwrite checks. Conversion returns success and replaces the input ELF with the generated PE executable. The same comparison is used for additional executable inputs and bundled modules.Use the existing
SameOutputFilehelper for all three input/output comparisons. It already handles the extension-dependent permission mismatch that makes MinGW'sstd::filesystem::equivalentmiss these hard links. Collisions are rejected before any output is written.Extend the existing input-preservation test with main/secondary outputs aliased to the main executable, a secondary executable, and a bundled module, for Linux and Windows conversion targets. Windows also exercises read-only aliases. Check original bytes, existing outputs, permissions, link counts and temporary-probe cleanup. A positive control confirms that distinct multiply linked files with identical bytes still convert successfully.
The existing helper conservatively rejects ambiguous read-only identities or unwritable probe directories. Record this limitation in relinker technical debt.
Related: #6127 proposes removing the Windows permission-mismatch workaround from
SameOutputFile. This fix relies on that workaround; its removal would restore the input-overwrite failure covered by the new regression.Tested
Windows 11 Home Single Language 10.0.22631, WinLibs MinGW-w64 GCC 15.2.0
x86_64-ucrt-posix-sehr7, Release, relinker-only build, Python 3.13.12.mainat5050a23f38ed03e2601804e90e0565b84ca4f1b5: all 167 registered tests passed. The new regression then failed on that original executable; an independent synthetic reproduction returned success and observed the input bytes being overwritten.mainat6ea62f9b407b766c5adca63b37f63c70170f7612, rebuilt, and passed all 168 registered tests in 50.54 seconds. The input-preservation test completed in 4.06 seconds.fdea36b83667541516affdc8c04fdc39b3496337before publication. The relinker, its tests and its build inputs are unchanged from the tested tree; the intervening upstream changes concern AGC graphics.tools/check_conventions.pypassed against the exact staged tree and PR description. Whitespace and patch applicability checks passed.Synthetic fixtures only. No retail game, GPU execution, or Linux/macOS host execution. No performance claim.
Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository