The default attribute on the section is read/write. This would cause
the section to have different attributes when compiled. The linker
would then preserve the section rather than merge it into the right
location. This was noticed when linking with `link.exe`.
The Windows constructor was not populated properly, with the protocol
list being dropped. Ensure that all the fields are initialised
properly. Thanks to clang's `-Wmissing-field-initializers` warning to
help catch this.
On windows, we create synthetic markers with grouping identifiers to
ensure that the markers are sorted properly and merged. We would
previously mark the section as read/write rather than read-only causing
warnings when linking. Correct the attributes. This ensures the proper
linking of the modules.
Restructure the COFF metadata handling to use the linker section
grouping to emit section start/stop markers in the appropriate location.
This allows us to lookup the sections statically without having to the
walk the entire image structure.
Introduce a constructor for PE/COFF binaries. This will ensure that the
registration occurs for all modules appropriately. This should resolve
rdar://problem/19045112. The registration should occur prior to
`DllMain` being invoked from `DllMainCRTStartup`.