Skip to content

Add opt-in later literal-pool placement within a reach budget - #410

Merged
MatyMeatBoy merged 2 commits into
claude/rom-decompilation-research-obsal6from
codex/sdk-late-pool-20261104
Nov 4, 2026
Merged

MatyMeatBoy merged 2 commits into
claude/rom-decompilation-research-obsal6from
codex/sdk-late-pool-20261104

Conversation

@MatyMeatBoy

Copy link
Copy Markdown
Owner

The Thumb backend currently places a literal pool at the first available barrier. Add independent, default-off -fthumb-late-pool to 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.

MatyMeatBoy and others added 2 commits November 4, 2026 20:08
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
MatyMeatBoy merged commit 49bc114 into claude/rom-decompilation-research-obsal6 Nov 4, 2026
4 checks passed
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.

1 participant