Skip to content

[Feature Request] MSVC: The ability to auto-detect anonymous namespace symbols #318

@rjkiv

Description

@rjkiv

In MWCC, symbols under an anonymous namespace will usually have @unnamed@File_cpp@. The file layout itself doesn't seem to matter, as long as you have the symbol under an anonymous namespace, objdiff will detect it no problem.

In MSVC, however, symbols under an anonymous namespace will have a hash in it, for example: ??1Unlockable@?A0xf8e4b4b5@@QAA@XZ. This hash (from what I can tell) is calculated via function declaration order, macro usage order, etc. In other words, simply replacing this given symbol with what my decomp provides is not feasible, as any little code change can alter the hash and thus make the symbol non-matching again.

What I am proposing is a way for MSVC symbols under an anonymous namespace to ignore the hash part of the symbol - as long as every other part of it is equal, objdiff should be able to detect the symbol. The specific phrase, if you will, to denote an anonymous namespace is ?A0xXXXXXXXX@@.

i.e. if the target symbol is ??1Unlockable@?A0xf8e4b4b5@@QAA@XZ, and my code produces ??1Unlockable@?A0x9d17dd81@@QAA@XZ, objdiff should be able to ignore the anonymous namespace hash, and recognize otherwise that these symbols are identical.

I should also note the hash can appear more than once in a symbol, i.e. ?allocate@?$StlNodeAlloc@UUnlockable@?A0xf8e4b4b5@@@stlpmtx_std@@QBAPAUUnlockable@?A0xf8e4b4b5@@IPBX@Z.

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