diff --git a/core/libs/prx/libc/include/exceptions/Runtime.hpp b/core/libs/prx/libc/include/exceptions/Runtime.hpp index bb50789ba..783b14255 100644 --- a/core/libs/prx/libc/include/exceptions/Runtime.hpp +++ b/core/libs/prx/libc/include/exceptions/Runtime.hpp @@ -50,12 +50,12 @@ void Release(void*); } extern "C" { -void* __cxa_allocate_exception_nid_postfix(std::size_t); -void __cxa_free_exception_nid_postfix(void*); -[[noreturn]] void __cxa_throw_nid_postfix(void*, std::type_info*, void (*)(void*)); -[[noreturn]] void __cxa_rethrow_nid_postfix(); -void* __cxa_begin_catch_nid_postfix(void*); -void __cxa_end_catch_nid_postfix(); +void* APS5_VABI __cxa_allocate_exception_nid_postfix(std::size_t); +void APS5_VABI __cxa_free_exception_nid_postfix(void*); +[[noreturn]] void APS5_VABI __cxa_throw_nid_postfix(void*, std::type_info*, void (*)(void*)); +[[noreturn]] void APS5_VABI __cxa_rethrow_nid_postfix(); +void* APS5_VABI __cxa_begin_catch_nid_postfix(void*); +void APS5_VABI __cxa_end_catch_nid_postfix(); } #endif diff --git a/core/libs/prx/libc/include/exceptions/Unwind.hpp b/core/libs/prx/libc/include/exceptions/Unwind.hpp index cfc25ee27..2559dfd45 100644 --- a/core/libs/prx/libc/include/exceptions/Unwind.hpp +++ b/core/libs/prx/libc/include/exceptions/Unwind.hpp @@ -93,11 +93,11 @@ inline unsigned EncodingSize(Byte encoding) { } extern "C" { -_Unwind_Reason_Code __gxx_personality_v0_nid_postfix(int, _Unwind_Action, std::uint64_t, _Unwind_Exception*, _Unwind_Context*); -_Unwind_Reason_Code _Unwind_RaiseException_nid_postfix(_Unwind_Exception*); -[[noreturn]] void _Unwind_Resume_nid_postfix(_Unwind_Exception*); -_Unwind_Reason_Code _Unwind_Resume_or_Rethrow_nid_postfix(_Unwind_Exception*); -void _Unwind_DeleteException_nid_postfix(_Unwind_Exception*); + _Unwind_Reason_Code APS5_VABI __gxx_personality_v0_nid_postfix(int, _Unwind_Action, std::uint64_t, _Unwind_Exception*, _Unwind_Context*); + _Unwind_Reason_Code APS5_VABI _Unwind_RaiseException_nid_postfix(_Unwind_Exception*); + [[noreturn]] void APS5_VABI _Unwind_Resume_nid_postfix(_Unwind_Exception*); + _Unwind_Reason_Code APS5_VABI _Unwind_Resume_or_Rethrow_nid_postfix(_Unwind_Exception*); + void APS5_VABI _Unwind_DeleteException_nid_postfix(_Unwind_Exception*); } #endif diff --git a/core/libs/prx/libc/include/general/VabiMacros.hpp b/core/libs/prx/libc/include/general/VabiMacros.hpp index fb1318e5d..1eed45e45 100644 --- a/core/libs/prx/libc/include/general/VabiMacros.hpp +++ b/core/libs/prx/libc/include/general/VabiMacros.hpp @@ -1,6 +1,10 @@ #ifndef CORE_LIBS_PRX_LIBC_INCLUDE_GENERAL_GENERALMACROS_HPP #define CORE_LIBS_PRX_LIBC_INCLUDE_GENERAL_GENERALMACROS_HPP +#ifdef _WIN32 +#define APS5_VABI __attribute__((sysv_abi)) +#else #define APS5_VABI +#endif #endif diff --git a/core/libs/prx/libc/src/FileAndHeap.cpp b/core/libs/prx/libc/src/FileAndHeap.cpp index 0803e8b54..3042d9429 100644 --- a/core/libs/prx/libc/src/FileAndHeap.cpp +++ b/core/libs/prx/libc/src/FileAndHeap.cpp @@ -8,7 +8,7 @@ extern "C" { -[[noreturn]] void _ZSt11_Xbad_allocv_nid_postfix(); +[[noreturn]] void APS5_VABI _ZSt11_Xbad_allocv_nid_postfix(); FileStream* APS5_VABI fopen_nid_postfix(const char* filename, const char* mode) { if (!filename || !mode) throw std::runtime_error("fopen: null argument"); diff --git a/core/libs/prx/libc/src/General.cpp b/core/libs/prx/libc/src/General.cpp index ede127991..e70f3d513 100644 --- a/core/libs/prx/libc/src/General.cpp +++ b/core/libs/prx/libc/src/General.cpp @@ -1,6 +1,6 @@ #include #include -extern "C" void APS5_VABI NotImplemented_nid_no_patch(const char* funcName) { +extern "C" void NotImplemented_nid_no_patch(const char* funcName) { throw std::runtime_error(std::string(funcName) + " not implemented"); } diff --git a/core/libs/prx/libc/src/exception/StandardExceptions.cpp b/core/libs/prx/libc/src/exception/StandardExceptions.cpp index 276f850b6..3e0fcf7f0 100644 --- a/core/libs/prx/libc/src/exception/StandardExceptions.cpp +++ b/core/libs/prx/libc/src/exception/StandardExceptions.cpp @@ -271,7 +271,7 @@ const char* APS5_VABI _ZNKSt8ios_base7failure4whatEv_nid_postfix(const LibcExcep [[noreturn]] void APS5_VABI _ZSt14_Xlength_errorPKc_nid_postfix(const char* message) { LibcException::ThrowMessage(_ZTVSt12length_error_nid_postfix, message); } [[noreturn]] void APS5_VABI _ZSt18_Xinvalid_argumentPKc_nid_postfix(const char* message) { LibcException::ThrowMessage(_ZTVSt16invalid_argument_nid_postfix, message); } [[noreturn]] void APS5_VABI _ZSt19_Xbad_function_callv_nid_postfix() { LibcException::ThrowPlain(_ZTVSt17bad_function_call_nid_postfix); } -[[noreturn]] void _ZSt13_Xregex_errorNSt15regex_constants10error_typeE_nid_postfix(std::regex_constants::error_type code) { +[[noreturn]] void APS5_VABI _ZSt13_Xregex_errorNSt15regex_constants10error_typeE_nid_postfix(std::regex_constants::error_type code) { struct RegexObject { LibcException::ExceptionObject base; std::regex_constants::error_type code; }; auto* object = static_cast(__cxa_allocate_exception_nid_postfix(sizeof(RegexObject))); LibcException::Construct(&object->base, _ZTVSt11regex_error_nid_postfix, "regular expression error"); diff --git a/core/libs/prx/libkernel/Pthread/Pthread.cpp b/core/libs/prx/libkernel/Pthread/Pthread.cpp index 2f6ddf552..d4bf4ba74 100644 --- a/core/libs/prx/libkernel/Pthread/Pthread.cpp +++ b/core/libs/prx/libkernel/Pthread/Pthread.cpp @@ -39,6 +39,8 @@ struct ThreadArgs { }; static void RunThread(std::unique_ptr args) { + fprintf(stderr, "RunThread started\n"); + fprintf(stdout, "RunThread started stdout\n"); void* retval = args->entry(args->arg); PthreadPrivate* self = args->self; args.reset();