i386 DLL builds have same issue as EXE builds, entry point (DllMain or
DllEntryPoint) can use SSE and therefore stack should be aligned to
16-bytes. Use attribute force_align_arg_pointer for __DllMainCRTStartup,
like it is already for __tmainCRTStartup. Also mark it as static.
This code was copied
On Wednesday 27 November 2024 15:11:52 Pali Rohár wrote:
> On Wednesday 27 November 2024 16:02:35 Lasse Collin wrote:
> > On 2024-11-27 Pali Rohár wrote:
> > > I think that we should not ignore memory allocation failures.
> >
> > I agree. I'm not able to comment the implementation ideas though.
>
Use _initterm_e() for executing functions in __xi_a[] ... __xi_z[] array.
This function properly stops execution on error and returns error value.
Same logic is doing Visual C++ startup code.
This fixes error handling of function callbacks defined in that array.
---
mingw-w64-crt/crt/crtdll.c | 3
Check for return value of functions called in startup code and exit
process on failure.
Pali Rohár (6):
crt: Fix __getmainargs() and __wgetmainargs() ABI for msvcrt40.dll and
msvcrt.dll
crt: Check for return value from __(w)getmainargs() calls
crt: Process return value from _(w)setargv()
Function _(w)setargv() provided by the application itself (not by the CRT
DLL runtime library) can fail, which is indicated by the return value.
Check for this failure and call _amsg_exit(_RT_SPACEARG) on error. Same
behavior has Visual C++ startup code.
---
mingw-w64-crt/crt/crtexe.c | 7 +--
They are of _PIFV types, not of _PVFV.
---
mingw-w64-crt/crt/cinitexe.c | 7 +++
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/mingw-w64-crt/crt/cinitexe.c b/mingw-w64-crt/crt/cinitexe.c
index ee441ed77f90..9e6931c4fc4b 100644
--- a/mingw-w64-crt/crt/cinitexe.c
+++ b/mingw-w64-
Function _initterm_e() is available since msvcr80.dll. Add emulation of
this function into all pre-msvcr80 import libraries for compatibility.
---
mingw-w64-crt/Makefile.am | 3 +++
mingw-w64-crt/lib-common/msvcrt.def.in | 2 +-
mingw-w64-crt/misc/_initterm_e.c | 25 ++
Functions __getmainargs() and __wgetmainargs() in system msvcrt.dll library
since Windows XP and in Visual C++ libraries since msvcr70.dll return
negative value on error and expect that caller handle it and terminate
process. Visual C++ 2002+ startup code calls _amsg_exit(_RT_SPACEARG) on
failure.
Visual C++ CRT DLL libraries older than VC70 / msvcr70.dll have different
ABI of __getmainargs() and __wgetmainargs() functions. Their return value
is void, instead of int. This includes VC++ libs crtdll.dll, msvcrt10.dll,
msvcrt20.dll, msvcrt40.dll, msvcr40d.dll, msvcrt.dll and msvcrtd.dll.
Same
Variable startinfo is used only by __(w)getmainargs() call passed by the
pointer in pre_cpp_init() function. The __(w)getmainargs() function does
not use or store the pointer value, so the variable does not have to be
static. Declare this variable just on the pre_cpp_init() function stack.
---
min
This ensures that mingwex wprintf implementation will not be used and
statically linked when not needed. And also make it more predictable as %ls
format is always using wide string.
---
mingw-w64-crt/crt/crtexe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mingw-w64-crt
Explicitly initialize variable to zeros, which has same effect as
initialzing it via memset.
---
mingw-w64-crt/crt/crt_handler.c | 8 ++--
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/mingw-w64-crt/crt/crt_handler.c b/mingw-w64-crt/crt/crt_handler.c
index c49a2b3b573d..0a08880
For EXE builds __mingw_init_ehandler() function is called after the
_pei386_runtime_relocator() from the __tmainCRTStartup() (and not from the
WinMainCRTStartup() function).
Do same for DLL builds and call __mingw_init_ehandler() from
__DllMainCRTStartup() instead of DllMainCRTStartup().
---
ming
On Wednesday 27 November 2024 16:02:35 Lasse Collin wrote:
> On 2024-11-27 Pali Rohár wrote:
> > I think that we should not ignore memory allocation failures.
>
> I agree. I'm not able to comment the implementation ideas though.
>
> --
> Lasse Collin
Just to note that this issue is mostly rare.
On 2024-11-27 Pali Rohár wrote:
> I think that we should not ignore memory allocation failures.
I agree. I'm not able to comment the implementation ideas though.
--
Lasse Collin
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
msvc compiler for msvcrt and ucrt debug builds declare debug CRT function
when _DEBUG macro is defined. All those functions and macros are defined in
crtdbg.h include file. Do same in mingw-w64 headers.
This allows applications to be compiled with gcc's -mcrtdll=msvcrtd and
-D_DEBUG switches and t
In Visual Studio when including crtdbg.h file with both _DEBUG and
_CRTDBG_MAP_ALLOC macros set, all standard memory allocation functions are
redefined and forwarded to their *_dbg siblings. This allows to track
memory allocation in program compiled and linked with debug version of CRT
DLL library.
C11 supports two-arg _Static_assert keyword
C++11 supports two-arg static_assert keyword
C++17 supports one-arg static_assert keyword
C23 supports one-arg static_assert keyword
So when possible expand _STATIC_ASSERT macro to the suitable C/C++ keyword.
---
mingw-w64-headers/crt/crtdbg.h | 8 +
Hi Martin Storsjö,
Am 22.11.24 um 13:13 schrieb Martin Storsjö:
>
> This patch was approved and merged now (after some discussion and some tweaks
to
> the implementation), see
>
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=3c557e1ae9c320efcfd4a7a91b752413a7bfd280.
>
> // Martin
On Saturday 09 November 2024 16:27:09 Pali Rohár wrote:
> Hello, now, when looking at this issue, I have figured out that in
> mingw-w64 is declaration of __getmainargs() and __wgetmainargs()
> functions incompatible with msvcrt.dll library.
>
> In header file mingw-w64-crt/include/internal.h is:
All 3 vcruntime140 def files (vcruntime140.def.in, vcruntime140d.def.in and
vcruntime140_app.def.in) contains exactly same symbols. Deduplicate symbols
into new common file vcruntime140-common.def.in and include it in all 3 def
files.
---
...e140.def.in => vcruntime140-common.def.in} | 5 -
mingw
Both _NLG_Dispatch2 and _NLG_Return symbols in i386 version have stdcall
convention, like in all other CRT libraries. So add missing @4 / @12.
Also sort symbols by name and make library name uppercase as it is stored
in the vcruntime140_app.dll and as gendef detects it.
---
mingw-w64-crt/lib-comm
Hello, do you have any opinion how to move forward with this issue?
Do we really needed special value for __MSVCRT_VERSION__ (e.g. 0x6FF pr
0x7FF)? Or can we just reuse 0x600 value together with _WIN32_WINNT check?
On Saturday 19 October 2024 13:04:44 Pali Rohár wrote:
> On Saturday 19 October 20
23 matches
Mail list logo