Skip to content

Wrong offset on THUMB ldrb/ldrh instructions #142

Closed
@camthehaxman

Description

@camthehaxman

When disassembling a ldrb or ldrh instruction in THUMB mode (ARM is not affected), the offset operand is incorrect. It appears to always be 2 times what it should be for a ldrh instruction and 4 times what it should be for a ldrb instruction. I've attached a zip file containing an object file that is affected by this bug. The correct disassembly should be

ldrb r0, [r0, #2]
ldrh r0, [r0, #2]
bx lr

however, objdiff disassembles this as

ldrb r0, [r0, #8]
ldrh r0, [r0, #4]
bx lr

test.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions