I'm writing a linker for Windows binaries, and currently working on implementing COMDAT. I think I understand most of the specification, except that of the three records for a COMDAT section (the section header, section symbols and auxiliary symbol), the specification doesn't seem to mention the common name being stored in any of them.
In other words, when I run dumpbin on such an object, it gives output like:
SECTION HEADER #8
.text$mn name
0 physical address
0 virtual address
5 size of raw data
2358 file pointer to raw data (00002358 to 0000235C)
235D file pointer to relocation table
0 file pointer to line numbers
1 number of relocations
0 number of line numbers
60301020 flags
Code
COMDAT; sym= cosl
Where does that last item sym= cosl
come from? Or if it's just a regular symbol that points to the section, what happens if there are several different such symbols pointing to it?