asm-differ icon indicating copy to clipboard operation
asm-differ copied to clipboard

x86 relocation offset incorrectly applied

Open 1superchip opened this issue 1 year ago • 0 comments

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.

1superchip avatar May 24 '24 16:05 1superchip