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

Ignore differences based on the number appended to function static symbols

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

Function static symbols are appended with a number to prevent name collisions with other symbols with the same names.

asm-differ currently matches MWCC literals with the format of @num to any other symbol with the same format. The number appended to the name is internally generated by the compiler for both instances making the numbers irrelevant when matching code. Ignoring differences for function static symbols would make the symbol handling similar in both cases.

asm-differ currently flags the entire symbol as different when the number differs but the name is the same. Different compilers handle the symbol differently. GCC emits a . as the separator while MWCC emits a $.

MWCC: l_matDL$5761 image

GCC: cnt.1

I have not seen a great place to insert the code that compares 2 symbols to each other. It seems like the best place would be somewhere in https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L3140. Any thoughts on where the code should be added?

1superchip avatar Nov 16 '24 20:11 1superchip

I have not seen a great place to insert the code that compares 2 symbols to each other. It seems like the best place would be somewhere in https://github.com/simonlindholm/asm-differ/blob/main/diff.py#L3140. Any thoughts on where the code should be added?

Yes, I think that's exactly the place to add it. Maybe and field_matches_any_symbol(nf, config.arch) could be and (field_matches_any_symbol(nf, config.arch) or ...)?

simonlindholm avatar Nov 17 '24 10:11 simonlindholm