On Tue Oct 28 07:03:26 2025 +0000, Yuxuan Shui wrote:
even mingw-w64 supports both `.CRT` section and GCC-style constructor lists. Do you need GCC-style constructors for something? mingw-gcc generates GCC-style constructors for ASan, do you mean there is a way maybe a compile flag to make mingw-gcc use .CRT instead? Sorry for the delay. My main concern is that those decisions are made at Wine build time, yet we don't know how the resulting static libraries will be used. For all we know, a Wine built with GCC might be used with `winegcc` for Clang/MSVC-style builds and things would mostly work. There are subtle differences that won't, and as we extend the CRT it will become harder to maintain conditionals like these, so it'd be nice to avoid `#ifdef`s here where possible.
In this particular case, the `#ifdef` also doesn’t match how the mingw CRT behaves. The mingw CRT supports `.CRT` sections, so from the CRT point of view both GCC-style and MSVC-style constructors work. This becomes even more important for TLS constructors, which I believe only work with `.CRT` sections. Always supporting `.CRT` should be straightforward, but doing the same for `__CTOR_LIST__` is trickier because it’s undefined in MSVC mode. We could maybe provide a fallback using weak symbols, I'm not sure without trying. My question was mostly in hope that we can ignore `__CTOR_LIST__` for the first iteration and just get the `.CRT` support right. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9265#note_124025