Re: [Mingw-w64-public] [PATCH] crt: Optimize __ms_vsnprintf() for LTO

2022-02-08 Thread LIU Hao
在 2/8/22 17:43, Pali Rohár 写道: Well, I have tried to compile just a simple executable application with "snprintf" call which do not check return value of snprintf function and with LTO built of CRT was _vscprintf call fully eliminated without any undefined reference issues and application worked

Re: [Mingw-w64-public] [PATCH] headers: Enable WIDL_EXPLICIT_AGGREGATE_RETURNS on arm/aarch64 too

2022-02-08 Thread Martin Storsjö
On Tue, 8 Feb 2022, LIU Hao wrote: 在 2/8/22 18:45, Martin Storsjö 写道: While clang does match MSVC with regards to aggregate returns, when run in MSVC mode, it matches GCC when run in mingw mode - and the same behaviour extends to arm/aarch64 too. Thus, this workaround needs to be enabled on al

Re: [Mingw-w64-public] [PATCH] headers: Enable WIDL_EXPLICIT_AGGREGATE_RETURNS on arm/aarch64 too

2022-02-08 Thread LIU Hao
在 2/8/22 18:45, Martin Storsjö 写道: While clang does match MSVC with regards to aggregate returns, when run in MSVC mode, it matches GCC when run in mingw mode - and the same behaviour extends to arm/aarch64 too. Thus, this workaround needs to be enabled on all architectures, not only on x86. Si

Re: [Mingw-w64-public] [PATCH] headers: Use __MINGW_ATTRIB_PURE instead of __attribute__((pure))

2022-02-08 Thread LIU Hao
在 2/8/22 21:12, Martin Storsjö 写道: Using __attribute__((pure)) can conflict with a user-defined macro "pure" - the correct form for system headers would use "__pure__" instead. We have an existing macro that expands to this (with some compiler variance handling too). Signed-off-by: Martin Storsj

[Mingw-w64-public] [PATCH] headers: Use __MINGW_ATTRIB_PURE instead of __attribute__((pure))

2022-02-08 Thread Martin Storsjö
Using __attribute__((pure)) can conflict with a user-defined macro "pure" - the correct form for system headers would use "__pure__" instead. We have an existing macro that expands to this (with some compiler variance handling too). Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/stdio.h

[Mingw-w64-public] [PATCH] headers: Enable WIDL_EXPLICIT_AGGREGATE_RETURNS on arm/aarch64 too

2022-02-08 Thread Martin Storsjö
While clang does match MSVC with regards to aggregate returns, when run in MSVC mode, it matches GCC when run in mingw mode - and the same behaviour extends to arm/aarch64 too. Thus, this workaround needs to be enabled on all architectures, not only on x86. Signed-off-by: Martin Storsjö --- min

Re: [Mingw-w64-public] [PATCH] crt: Optimize __ms_vsnprintf() for LTO

2022-02-08 Thread Pali Rohár
On Tuesday 08 February 2022 11:22:12 Martin Storsjö wrote: > On Tue, 8 Feb 2022, LIU Hao wrote: > > > 在 2/8/22 16:33, Martin Storsjö 写道: > > > On Sun, 6 Feb 2022, Pali Rohár wrote: > > > > > > > Mark _vscprintf() and _scprintf() functions with attribute pure as their > > > > return value depends

Re: [Mingw-w64-public] [PATCH v2] crt: Fix v*scanf functions

2022-02-08 Thread Martin Storsjö
On Sun, 6 Feb 2022, Pali Rohár wrote: Currently v*scanf functions are broken and crash when are called with more than 30 arguments in va_list. This is because va_list v*scanf functions are redirected to variadic *scanf functions and this redirect implemented in scanf.S file has fixed limit for 3

Re: [Mingw-w64-public] [PATCH] crt: Optimize __ms_vsnprintf() for LTO

2022-02-08 Thread Martin Storsjö
On Tue, 8 Feb 2022, LIU Hao wrote: 在 2/8/22 16:33, Martin Storsjö 写道: On Sun, 6 Feb 2022, Pali Rohár wrote: Mark _vscprintf() and _scprintf() functions with attribute pure as their return value depends only on passed arguments. In function __ms_vsnprintf() check only for n==0 and move _vscpr

Re: [Mingw-w64-public] [PATCH] crt: Optimize __ms_vsnprintf() for LTO

2022-02-08 Thread LIU Hao
在 2/8/22 16:33, Martin Storsjö 写道: On Sun, 6 Feb 2022, Pali Rohár wrote: Mark _vscprintf() and _scprintf() functions with attribute pure as their return value depends only on passed arguments. In function __ms_vsnprintf() check only for n==0 and move _vscprintf() call at the end of function. T

Re: [Mingw-w64-public] [PATCH v2] crt: Fix libcrtdll.a import library

2022-02-08 Thread Martin Storsjö
On Sun, 6 Feb 2022, Pali Rohár wrote: Import library libcrtdll.a (for crtdll.dll runtime library) compiled during mingw-w64 build process is currently broken and cannot be used for linking executable applications. Trying to do it results in following linker errors: /usr/bin/i686-w64-mingw32-l

Re: [Mingw-w64-public] [PATCH] crt: Simplify building *crt*.o startup files

2022-02-08 Thread Martin Storsjö
On Sun, 6 Feb 2022, Pali Rohár wrote: MinGW-w64 has same startup files for crtdll.dll and msvcrt.dll and defining -D__CRTDLL__ or -D__MSVCRT__ has no effect on built *crt*.o files, they are same. So build startup files only once and create other as copy from the first one. Also remove -D__CRTDLL

Re: [Mingw-w64-public] [PATCH] crt: Optimize __ms_vsnprintf() for LTO

2022-02-08 Thread Martin Storsjö
On Sun, 6 Feb 2022, Pali Rohár wrote: Mark _vscprintf() and _scprintf() functions with attribute pure as their return value depends only on passed arguments. In function __ms_vsnprintf() check only for n==0 and move _vscprintf() call at the end of function. This allows LTO to optimize out _vscp