Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x86 relocation offset incorrectly applied #159

Open
1superchip opened this issue May 24, 2024 · 0 comments
Open

x86 relocation offset incorrectly applied #159

1superchip opened this issue May 24, 2024 · 0 comments

Comments

@1superchip
Copy link
Contributor

1superchip commented May 24, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant