Re: [Mingw-w64-public] [PATCH 1/3] crt: Add non-inline variant of UCRT _scprintf, _snprintf and _snscanf functions

2022-09-21 Thread Martin Storsjö
On Tue, 20 Sep 2022, Pali Rohár wrote: There are many, many different variants of inline behaviour - C89 inline, C99 inline, static inline, extern inline, gnu_inline, etc. There's a couple different styles used here; all the inline functions that we're talking about here have static inline linka

Re: [Mingw-w64-public] [PATCH v2] crt: Add support for Control Flow Guard

2022-09-21 Thread Martin Storsjö
On Tue, 20 Sep 2022, Alvin Wong via Mingw-w64-public wrote: This adds support to enable building mingw-w64-crt and user code with Control Flow Guard using Clang, with the option `--enable-cfguard`. In addition to adding the Clang 16 compiler option `-mguard=cf` to CFLAGS, it also add two new obj

[Mingw-w64-public] [PATCH v2 3/4] crt: Provide the stack protector functions/variables in libmingwex too

2022-09-21 Thread Martin Storsjö
While the compiler drivers do add -lssp automatically when linking with -fstack-protector-strong, this also allows relying entirely on libmingwex. This implementation should be functionally equivalent to GCC's libssp for a mingw build configuration. This allows toolchains that don't otherwise use

[Mingw-w64-public] [PATCH v2 2/4] crt: Implement a subset of libssp functions in libmingwex

2022-09-21 Thread Martin Storsjö
This is the subset of functions that ends up called when our headers are used with _FORTIFY_SOURCE defined. This avoids needing to manually pass -lssp in such build configurations. Signed-off-by: Martin Storsjö --- v2: Made the message buffer static const. Switched the __chk_fail function to IsP

[Mingw-w64-public] [PATCH v2 1/4] headers: Implement the __fastfail intrinsic

2022-09-21 Thread Martin Storsjö
Signed-off-by: Martin Storsjö --- mingw-w64-headers/crt/_mingw.h.in | 25 + 1 file changed, 25 insertions(+) diff --git a/mingw-w64-headers/crt/_mingw.h.in b/mingw-w64-headers/crt/_mingw.h.in index 0ef7ae6ea..087fce88d 100644 --- a/mingw-w64-headers/crt/_mingw.h.in +++ b

[Mingw-w64-public] [PATCH v2 4/4] RFC: crt: Implement the rest of the libssp functions

2022-09-21 Thread Martin Storsjö
Our fortification macros don't wrap these stdio functions (since there's already lots of variability, whether calling directly to the CRT's stdio functions, or if calling the __USE_MINGW_ANSI_STDIO replacements), but this at least provides token implementations if someone implements fortification o

Re: [Mingw-w64-public] [PATCH] headers: Fix PROCESS_MITIGATION_DYNAMIC_CODE_POLICY in winnt.h

2022-09-21 Thread Jacek Caban
On 9/19/22 13:38, Yannis Juglaret wrote: This fixes the struct used to enable the Arbitrary Code Guard mitigation or query its status on Windows. The size of the struct was wrong, which could lead calls to Get/SetProcessMitigationPolicy to fail with the last error set to ERROR_INVALID_PARAMETER.

[Mingw-w64-public] [PATCH 2/2] Makefile.am: add missing msvcr${V} dependency on msvcr${V}_extra

2022-09-21 Thread Sergei Trofimovich
Without the change build fails with missing dependency on _extra library similar to the following: cd lib32/ && x86_64-w64-mingw32-ar -M < /build/mingw-w64/mingw-w64-crt/lib32/msvcr71.mri x86_64-w64-mingw32-ar: libmsvcr71_extra.a: No such file or directory make[3]: *** [Makefile:78262

[Mingw-w64-public] [PATCH 1/2] mingw-w64-crt: fix parallel build failures in dlltool calls

2022-09-21 Thread Sergei Trofimovich
Before the change massively parallel builds failed when Makefile attempted to build both lib64/libd3dx9_38.a and lib32/libd3dx9_38.a: x86_64-w64-mingw32-dlltool --as-flags=--64 -m i386:x86-64 ... \ --output-lib lib64/libd3dx9_38.a \ --temp-prefix $(basename lib64/libd3dx9_38.a .a)