On Thu, 20 Mar 2025, Jacek Caban wrote:

On 20.03.2025 18:54, Martin Storsjö wrote:
+int __cdecl (*__MINGW_IMP_SYMBOL(snwprintf))(wchar_t *__restrict__, size_t, const wchar_t *__restrict__, ...) = snwprintf;


Do we need those |__imp_| symbols in these files? We don’t declare them as |dllimport| in headers, and since they were previously inlined, I’d be surprised if anything depends on them.

That's true, we probably don't need them.

I tried to look into why we have them here, and I found 91459ac35276522b0e4405c76795d91822bb395a - from 2017. This is a workaround to avoid autoexporting these symbols.

But we can probably get rid of this workaround now, to avoid perpetuating this hack.

Since binutils 2.30 (Jan 2018), it does exclude "libmvscrt", "libmsvcrt-os" and "libucrtbase" from autoexporting. Since binutils 2.38 (Feb 2022) it also excludes "libucrt".

We should probably add "libucrtapp" as well.

But I noticed that we haven't remembered to add these in LLD, where we currently only have "libmsvcrt" and "libucrtbase". So this works fine when linking via the toolchain's default CRT, but if specifying a custom CRT to link (-lmsvcrt-os or -lucrt), it may end up autoexporting symbols from there.

That said, using non-default CRTs is rare, and I think we can get rid of this workaround, and add the other default CRT names in LLD and binutils.

// Martin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to