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>
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
I have been using claude in a dreamcast decompilation. It found the following:
objdiff-core's SuperH backend reads every opcode, and the literal pool values it shows after
mov.wandmov.l, withfrom_be_bytes. That suits the Saturn, but Dreamcast (SH-4) code is little-endian, so on a little-endian object every instruction comes out wrong:rts(0b 00in memory) shows as.word 0x0B00.ArchSuperHnow keeps the object's endianness, as the ARM and MIPS backends do, and reads opcodes and pool values with it. The existing SuperH tests construct the arch as big-endian. A new test checks that the same function and literal pool, written in either byte order, scan to the same instructions (branch destination included) and display the same.Checked:
cargo test --release --all-features -p objdiff-core,cargo +nightly fmt --all --checkandcargo +nightly clippy --all-targets --all-features -p objdiff-core -- -D warningspass.Not in this pull request: the decoder covers the SH-2's instructions, so the SH-4's floating-point, cache and control-register instructions still show as
.word, as doesmova(0xC7xx).🤖 Generated with Claude Code