windows: add brave new mingw compat hook for gcc 12.2.0+

This commit is contained in:
Michael Scire 2023-03-07 22:07:03 -07:00
parent 8da4d14e15
commit 68040e2922
2 changed files with 9 additions and 1 deletions

View file

@ -58,7 +58,7 @@ export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
-Wl,--wrap,exit -Wl,--wrap,exit
else ifeq ($(ATMOSPHERE_BOARD),generic_windows) else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
export CXXREQUIRED := export CXXREQUIRED :=
export CXXWRAPS := -Wl,--wrap,__p__acmdln export CXXWRAPS := -Wl,--wrap,__p__acmdln -Wl,--wrap,_set_invalid_parameter_handler
else else
export CXXREQUIRED := export CXXREQUIRED :=
export CXXWRAPS := export CXXWRAPS :=

View file

@ -16,6 +16,7 @@
#include <stratosphere.hpp> #include <stratosphere.hpp>
extern "C" char **__real___p__acmdln(void); extern "C" char **__real___p__acmdln(void);
extern "C" _invalid_parameter_handler __real__set_invalid_parameter_handler(_invalid_parameter_handler);
namespace ams { namespace ams {
@ -65,4 +66,11 @@ extern "C" {
return __real___p__acmdln(); return __real___p__acmdln();
} }
/* On some mingw gcc versions, acmdln isn't used, so we need to hook a different part of crt init. */
_invalid_parameter_handler __wrap__set_invalid_parameter_handler(_invalid_parameter_handler handler) {
::ams::os::Initialize();
return __real__set_invalid_parameter_handler(handler);
}
} }