Remove arch specific ifdefs and instead add dummy symbols to the arm specific import libs.
Also add a dummy symbol for __winitenv, fixing building apps that use a wmain() function for arm/aarch64 when targeting msvcrt.dll. Signed-off-by: Martin Storsjö <[email protected]> --- mingw-w64-crt/Makefile.am | 2 ++ mingw-w64-crt/crt/crtexe.c | 4 +--- mingw-w64-crt/include/internal.h | 2 +- mingw-w64-crt/misc/initenv.c | 12 ++++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 mingw-w64-crt/misc/initenv.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index c44de20eb..5e7c0c746 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -287,6 +287,7 @@ src_msvcrtarm32=\ misc/__p__fmode.c \ misc/__p__wcmdln.c \ misc/_getpid.c \ + misc/initenv.c \ stdio/_setmaxstdio.c \ stdio/gets.c @@ -382,6 +383,7 @@ src_msvcrtarm64=\ misc/__p__fmode.c \ misc/__p__wcmdln.c \ misc/_getpid.c \ + misc/initenv.c \ stdio/_setmaxstdio.c \ stdio/gets.c diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c index e78800525..54bb20430 100644 --- a/mingw-w64-crt/crt/crtexe.c +++ b/mingw-w64-crt/crt/crtexe.c @@ -34,7 +34,7 @@ extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); #define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv)) #endif -#if !defined(__initenv) && !defined(__arm__) && !defined(__aarch64__) +#if !defined(__initenv) extern char *** __MINGW_IMP_SYMBOL(__initenv); #define __initenv (* __MINGW_IMP_SYMBOL(__initenv)) #endif @@ -327,9 +327,7 @@ __tmainCRTStartup (void) gcc inserts this call automatically for a function called main, but not for wmain. */ mainret = wmain (argc, argv, envp); #else -#if !defined(__arm__) && !defined(__aarch64__) __initenv = envp; -#endif mainret = main (argc, argv, envp); #endif if (!managedapp) diff --git a/mingw-w64-crt/include/internal.h b/mingw-w64-crt/include/internal.h index 205d30daa..8a7aeb1f9 100644 --- a/mingw-w64-crt/include/internal.h +++ b/mingw-w64-crt/include/internal.h @@ -101,7 +101,7 @@ extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); #define __winitenv (* __MINGW_IMP_SYMBOL(__winitenv)) #endif -#if !defined(__initenv) && !defined(__arm__) +#if !defined(__initenv) extern char *** __MINGW_IMP_SYMBOL(__initenv); #define __initenv (* __MINGW_IMP_SYMBOL(__initenv)) #endif diff --git a/mingw-w64-crt/misc/initenv.c b/mingw-w64-crt/misc/initenv.c new file mode 100644 index 000000000..0cfad4f63 --- /dev/null +++ b/mingw-w64-crt/misc/initenv.c @@ -0,0 +1,12 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <wchar.h> + +static char ** local__initenv; +static wchar_t ** local__winitenv; +char *** __MINGW_IMP_SYMBOL(__initenv) = &local__initenv; +wchar_t *** __MINGW_IMP_SYMBOL(__winitenv) = &local__winitenv; -- 2.17.1 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
