Skip to content

Some small fixes for codegen-new#7080

Merged
Cacodemon345 merged 3 commits into
86Box:masterfrom
ChrisDeadman:codegen-fixes
Apr 21, 2026
Merged

Some small fixes for codegen-new#7080
Cacodemon345 merged 3 commits into
86Box:masterfrom
ChrisDeadman:codegen-fixes

Conversation

@ChrisDeadman

@ChrisDeadman ChrisDeadman commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the following issues I have encountered while using the codegen-new:

I ran into the linker optimization issues (function inlined, stale pointer) when compiling with lto=auto on GCC.
GCC 15.2.0 also aligns differently, causing stack misalignment bug in JIT load, crashing the game "Incoming" on startup.

Checklist

  • Closes N/A
  • I have tested my changes locally and validated that the functionality works as intended
  • I have discussed this with core contributors already
  • This pull request doesn't require changes to the ROM set
  • This pull request doesn't require changes to the asset set

The load slow-path shim is entered via CALL from the JIT block body
(RSP % 16 == 0 at that point, so RSP % 16 == 8 inside the shim).
After saving RAX and RDX with two PUSHes RSP % 16 is still 8, which
violates the SysV AMD64 ABI 16-byte alignment requirement before a CALL.
The store routine already carried the compensating SUB RSP,8 / ADD RSP,8
pair; apply the same fix to the load routine.
@Cacodemon345 Cacodemon345 merged commit 4b1bc3b into 86Box:master Apr 21, 2026
@ChrisDeadman ChrisDeadman deleted the codegen-fixes branch April 21, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants