Skip to content

x86 relocation offset incorrectly applied #159

@1superchip

Description

@1superchip

The relocation for cmpl $0x3, 0x18c is being applied to $0x3 rather than 0x18c.

curState is at offset 0x18c of g_Supervisor and is being compared to 3 in the source code while asm-differ is treating $0x3 as an offset rather than an immediate.

decomp.me scratch link:
https://decomp.me/scratch/Og700

Source code:
image

asm-differ output:
image

objdump output:
image

Related code in asm-differ:
https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L1915

Changing the regex from (^|(?<=\*)|(?<=\$))0x[0-9a-f]+ to (^|(?<=\*)|(?<!\$))0x[0-9a-f]+ captures the correct value in cmpl $0x3, 0x18c.
It may cause issues in other instructions though.

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