We use an external (commercial) software package to modify the generated executable as a post-process.
That software requires a map file with the same format as generated by link.exe /MAP.
This implementation is based on observation from the output of link.exe's map files.
We didn't need support for the /MAPINFO option.
Enhancements from the lldmap counterpart:
- Removed duplicates of symbols (that is duplicate Symbol* values)
- Added output for thunk symbols for dllimport stubs
I've also modified the default file name for /lldmap to use the .lldmap extension (instead of .map). This is to avoid conflict if both /map and /lldmap are used.
Except a few features, everything in lld/COFF is Microsoft-compatible, so adding a MS suffix feels a bit odd to me. You probably should rename existing MapFile.cpp to LLDMapFile.cpp and then place your file as MapFile.cpp.