On Sat, 15 Jan 2022, Pali Rohár wrote:

In attachment are updated patches which adds these redirects and usage
of F_NON_I386() macro. With these redirects it is possible to compile
target mingw applications also with those gcc linker flags
-Wl,--disable-auto-import -Wl,--disable-runtime-pseudo-reloc. Previously
gcc really throw linker error about undefined symbols _vscrpintf.

Thanks! These patches look acceptable to me. If Jacek doesn't mind, I'll go ahead and push them in a couple days.

Anyway, is not this redirect required to add also for _wassert()
function which is in mingw-w64-crt/misc/wassert.c file? Because it use
same construction like _vscprintf in my patch. And similarly other
source files which calls __mingw_get_msvcrt_handle() function?

No, it doesn't seem to be necessary there.

Both _wassert and _vscprintf are declared with _CRTIMP. This is a macro that expands to dllimport normally, unless _CRTBLD is defined - which is defined when building mingw-w64-crt. So for code within mingw-w64-crt, it sees all these functions without dllimport - which is necessary when we are reimplementing those functions here. But that also means that for code in mingw-w64-crt which calls another _CRTIMP function, it also sees that function without the dllimport attribute.

Currently there doesn't seem to be any code in mingw-w64-crt calling _wassert, but if there was, we would need the same kind of extra redirect there too.

// Martin

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

Reply via email to