Jacek Caban (@jacek) commented about dlls/winecrtend/init.c:
+#define _CRTALLOC(x) __declspec(allocate(x)) +#elif defined(__GNUC__) +#define _CRTALLOC(x) __attribute__ ((section (x), used)) +#endif + +#if defined(_MSC_VER) +/* Instructions for the linker to merge .CRT$??? in objects files into .CRT in the + * final binary during linking, sorted by the section names alphabetically. The names + * don't have significance to the linker but conventions do apply. */ +#pragma section(".CRT$XIA", read, write) +#pragma section(".CRT$XIZ", read, write) +#pragma section(".CRT$XCA", read, write) +#pragma section(".CRT$XCZ", read, write) +#pragma section(".CRT$XTA", read, write) +#pragma section(".CRT$XTZ", read, write) +#pragma comment(linker, "/merge:.CRT=.rdata") Unfortunately, binutils linker doesn't seem to understand such directives. We could probably just pass it with `-Wl,...` in winegcc only for MSVC target.
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9265#note_124627