HomePhabricator

[COFF] Merge the .ctors, .dtors and .CRT sections into .rdata for MinGW

Description

[COFF] Merge the .ctors, .dtors and .CRT sections into .rdata for MinGW

There's no point in keeping them as separate sections.

This differs from GNU ld, which places .ctors and .dtors content in
.text (implemented by a built-in linker script). But since the content
only is pointers, there's no need to have it executable.

GNU ld also leaves .CRT separate as its own standalone section.

MSVC merges .CRT into .rdata similarly, with a directive embedded in
an object file in msvcrt.lib or libcmt.lib.

Differential Revision: https://reviews.llvm.org/D51414