Repository navigation
Conversation
The SuperH backend read every opcode, and the literal pool values shown after mov.w and mov.l, as big-endian. That suits the Saturn, but Dreamcast (SH-4) objects are little-endian, so every instruction was decoded wrongly. Take the byte order from the object, as the ARM and MIPS backends do, and test both orders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The diff compares instructions by their arguments, and the SuperH decoder pushed the register of add #imm,Rn and both registers of mov.l Rm,@(disp,Rn) and mov.l @(disp,Rm),Rn as plain text. Two functions that differed only in one of those registers showed as a 100% match. Make them arguments, like every other register, and show tas.b @rn with its @. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Requested by spriteice · project thread
Builds on #438, so that its test can use the byte order field; only the last commit is new here.
objdiff compares instructions by their arguments, and the SuperH decoder pushes some registers as
InstructionPart::basic:Rnofadd #imm,Rn, and both registers ofmov.l Rm,@(disp,Rn)andmov.l @(disp,Rm),Rn. So two functions that differ only in one of those registers show as a 100% match:add #0x1, r4againstadd #0x1, r5, for example, on Saturn code as well as Dreamcast code. This makes themopaquearguments like every other register. It also showstas.b @Rnwith its@(it showed astas.b r0).Checked
test_sh2_registers_are_arguments, checks the text and the arguments of each instruction; the existingtas.bexpectation now has its@.objdiff-cli diffof two objects that differ only inadd #0x1, r4/r5: a 100% match before, an argument mismatch now.cargo test -p objdiff-core,cargo +nightly fmt --checkandcargo clippy --all-targetspass.🤖 Generated with Claude Code