func_02057410: the digit loop divides unsigned, and the reloc says so - #1383
Merged
Conversation
`bl` at 0x02057b64 relocated to `_ll_sdiv` (0x01ffaa34) where the ROM calls `__aeabi_uldiv` (0x01ffa9dc). The bytes agreed anyway -- a relocated word is a wildcard to the byte comparison -- so the function sat in the matched set as a fakematch. `pr_linkcheck` is what sees it. The sign is already consumed above the loop: the 0x80000000 test emits the minus prefix and negates `v`, so every division below it is on a magnitude. Casting the two operands to u64 selects the unsigned helper the ROM uses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015AXm5k53WFPjCYcDHRDX3x
✅ PR validation — PassedCommitted merge introduces no reconstruction or attribution regression. Full merge validation
Per-file link-check detailAll 1 changed file(s) compile to the ROM byte-for-byte with correct relocation targets.
The private worker commits a test merge, builds the stock ROM profile, compares every executable module, measures matched and source-built code, checks contributor lineage, and verifies affected relocations. The mod profile is opt-in and is not part of this merge gate. |
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.
A fakematch, found by
pr_linkcheckand not by any byte gate.What is wrong
func_02057410is a printf-style formatter. At0x02057b64its digit loop calls a 64-bit divide helper, and we call the wrong one:0xebfe8b9c0x01ffa9dc__aeabi_uldiv— unsigned0xebfe8bb20x01ffaa34_ll_sdiv— signedThe bytes agreed regardless, because a relocated word is a wildcard to the byte comparison. So this has been sitting in the matched set with a call that resolves to the wrong function.
Why unsigned is right
The sign is consumed above the loop — the
0x80000000test emits the minus prefix and negatesv:Every division below that point is on a magnitude, so the original divides unsigned.
vstayss64in our source, which selects the signed helper. Casting both operands tou64at the two use sites selects the one the ROM uses.Verified
pr_linkcheck --files src/func_02057410.c_ll_sdiv -> 0x01ffaa34rombuild.py -j16, full ROMport_refcheckByte-neutral: the change selects a different relocation target, and the relocated word was never part of the comparison.
How it surfaced
It blocks #1382, which touches none of this.
pr_linkcheckexpands a changed header through the reverse include graph, so that PR link-checks consumers it never names — including this file, whose blob is identical to main's. The verdict reproduces on a cleanorigin/mainworktree, so it is main's defect, not that PR's.🤖 Generated with Claude Code
https://claude.ai/code/session_015AXm5k53WFPjCYcDHRDX3x