Hi,

> .CRT section is combined into .rdata which doesn't have shared attribute but
> read only. If we declare it with shared, it will causes LNK4254 warning.

The patch in itself probably is right, but can you explain your usecase a bit more?

LNK4254 is a link.exe error; linking mingw object files or static libraries with link.exe is generally not supported. (That said, avoiding unnecessary divergence is of course good, but there are many fundamental issues you'll run into at various points if you do that.)

Yes, you're right, LNK4254 is a link.exe error. I just noticed that when I find something equivalent to __attribute__((constructor)) in MSVC. When I refer to the mingw-w64's implementation of sect_attrib.h and take these codes directly in my Visual Studio, link.exe complained merging .CRT into .rdata with a different
attributes. It's even a bit strange why the MSVC-specific extension appears
here, I don't think it has a use case, it's just to avoid confusion as in this
case.

I also noticed
https://github.com/reactos/reactos/commit/439126ffd669bde03c032216f9bf617c0a40ea8b.
They made similar changes in 13 years ago.

Best Regards,

Yang Kun

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to