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

MWCC literals are still matched together even when the addend is different #177

Open
1superchip opened this issue Nov 18, 2024 · 1 comment

Comments

@1superchip
Copy link
Collaborator

1superchip commented Nov 18, 2024

In some cases, literals can have addends (struct copies that generate literals). With the current implementation of https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L3000, we only check if the symbol contains "@" without comparing the 2 symbols on both sides of the diff. Ideally, the addend should match between the target and current objects.

field_matches_any_symbol doesn't have the functionality to compare the left and right symbols of the diff. I am currently working on #175 and am thinking that the solution I have for that issue may evolve to replace field_matches_any_symbol.

image
decomp.me scratch: https://decomp.me/scratch/9T6B6

@1superchip
Copy link
Collaborator Author

I was writing: "For the MIPS case, https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L3073 I think we could pull the regex result into a variable (while also changing the regex to capture the possible addend) and then check the addend.
%(?:hi|lo|gp_rel)\((@\d+(?:\+0x[A-Fa-f0-9]+)?)\) -> %(?:hi|lo|gp_rel)\((?:@\d+(\+0x[A-Fa-f0-9]+)?)\)"

But field_matches_any_symbol doesn't compare the left and right sides of the diff. Any ideas on how https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L3217 could change to support field_matches_any_symbol and better symbol comparison?

For MWCC literals, we don't care about the number @12345 but we should care about the addend @9+0x10 != @3+0xC but @9+0x10 = @3+0x10. If both sides have the format @... and addends exist but do not match, the symbol does not match.

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