Skip to content

fix(relinker): move a following in-place replacement into a 256-bit store's stub - #10237

Closed
Nciibi wants to merge 1 commit into
boykopovar:mainfrom
Nciibi:fix/relinker-inplace-follower-wide-store
Closed

Nciibi wants to merge 1 commit into
boykopovar:mainfrom
Nciibi:fix/relinker-inplace-follower-wide-store

Conversation

@Nciibi

@Nciibi Nciibi commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

What

A Rosetta 256-bit store occupies 4 bytes, so Amd64OnlyConverter replaces it with a stub and jumps there. WindowPlacer can move a neighbouring instruction into that stub to free the 5 bytes the jump needs. When the store starts a segment and the next instruction is an AMD-only site that can only be emitted in place (RDSEED, CLWB, MOVNTSS/MOVNTSD, MONITORX/MWAITX, ...), there was no preceding instruction to move and the follower could not leave its place, so conversion failed with No room for a jump to the stub of 256-bit store within its neighbours or a nearby island.

This adds a last-resort window placement that asks EmitOutOfLine to fall back to the in-place lowering for that follower, so the store's stub carries the replacement and the following bytes are freed. Preferred preceding and following moves are tried first, so the existing preference test is unchanged.

Tested

Windows 11, MinGW-w64 GCC 16.2.0, -DANYPS5_RELINKER_ONLY=ON, branch based on main at 4997726a5. cmake --build build-relinker and ctest --test-dir build-relinker --output-on-failure: 32/32 pass.

New cases in converterWideStoreWindows cover a 256-bit store followed by RDSEED, by CLWB and by a RIP-relative MOVNTSS, and assert the stub body, length, report count and relocation target. The standalone conversion fixture that previously failed now reports ok trampolines=1 reports=1 site off=512 len=7 body=19.

tools/check_conventions.py and tools/pr_overlap.py were not run because this environment has no Python; the overlap below was checked manually through the GitHub API.

Checklist

…tore's stub

A 4-byte 256-bit store at the start of a segment followed by an AMD-only
site that can only be emitted in place (RDSEED, CLWB, MOVNTSS, ...) had no
preceding instruction to move, so WindowPlacer gave up with "No room for a
jump to the stub of 256-bit store within its neighbours or a nearby island".

Try a last-resort window placement that allows EmitOutOfLine to use the
in-place lowering for the follower. Preferred preceding and following moves
are unchanged.
@github-actions github-actions Bot added the open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20 label Oct 23, 2026
@github-actions

Copy link
Copy Markdown

Thank you for your contribution! Authors with no pull requests merged into main can have 1 open pull request at a time, authors with at least 1 merged can have 20, and from 20 merged there is no limit. This PR has been automatically closed and labeled "open PR limit" because that limit was reached. This is not a judgment of the quality of your changes: reopen it once one of your open pull requests is merged or closed.

@github-actions github-actions Bot closed this Oct 23, 2026
@Nciibi
Nciibi deleted the fix/relinker-inplace-follower-wide-store branch October 24, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open PR limit Closed over the open PR limit: 1 without merged PRs, 20 with at least 1, none from 20

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant