Repository navigation
Add opt-in later literal-pool placement within a reach budget - #410
Merged
MatyMeatBoy merged 2 commits intoNov 4, 2026
Merged
MatyMeatBoy merged 2 commits into
MatyMeatBoy merged 2 commits into
Conversation
Prefer a later existing barrier only when estimated code and conservative literal reservations remain within Thumb reach. Reuse legacy emission and fallback, keep production flags unchanged, and exercise actual linked constant loads and ABI state. Co-Authored-By: Codex <noreply@openai.com>
GNU ld may keep an empty .data section outside the mapped code range. It has no bytes to load; ignore zero-sized sections while retaining address and content checks for every nonempty allocated section. Co-Authored-By: Codex <noreply@openai.com>
MatyMeatBoy
merged commit Nov 4, 2026
49bc114
into
claude/rom-decompilation-research-obsal6
4 checks passed
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.
The Thumb backend currently places a literal pool at the first available barrier. Add independent, default-off
-fthumb-late-poolto the isolated SDK compiler, allowing a later existing barrier when conservative reach checks admit it. Production module flags remain unchanged.The bounded scan accounts for instruction lengths and every prospective literal, deliberately overcounting duplicates and reserving promoted halfwords and doublewords correctly. Code plus pool reservations must fit a 1000-byte budget, with margin for alignment and PC bias. Unsupported sizes stop the scan; without an admitted barrier the original placement runs unchanged. Existing relocation/pool emission is reused, with no forced layout or function/address exceptions.
Validation: fresh pinned compiler installation and zero-fuzz/hash-verified patch; 140,000 literal-layout executions across reference/off/on/combined/no-TST profiles, plus the existing 948,816 CC and loop cases. Fixtures cover 120 distinct constants, multiple barriers, a function with 520 volatile updates beyond the reach budget, 32/64-bit results and actual linked read-only-data references. All incoming NZCV states, boundaries/random pairs, memory, return PC/SP/r4-r11 and a non-returning negative control are checked. Off text is reference-identical and the positive pool moves after its return. Normal ROM compare, NONMATCHING build, tree check and strict SDK oracles pass; production engine objects remain byte-identical.
With all opt-in flags, an unchanged private full-module ply_note candidate now matches original bytes and relocations (536 bytes). This tooling PR keeps its original ASM fallback and does not activate the new option or award matching credit. Production activation and normal-ROM C conversion require separate verification.