feat(libs): sysv abi macros for windows exports

This commit is contained in:
boykopovar 2026-09-10 13:30:05 +03:00
parent 74de895ac0
commit 36c29c9a66
7 changed files with 20 additions and 14 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -1,6 +1,6 @@
#include <stdexcept>
#include <string>
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");
}

View File

@ -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<RegexObject*>(__cxa_allocate_exception_nid_postfix(sizeof(RegexObject)));
LibcException::Construct(&object->base, _ZTVSt11regex_error_nid_postfix, "regular expression error");

View File

@ -39,6 +39,8 @@ struct ThreadArgs {
};
static void RunThread(std::unique_ptr<ThreadArgs> args) {
fprintf(stderr, "RunThread started\n");
fprintf(stdout, "RunThread started stdout\n");
void* retval = args->entry(args->arg);
PthreadPrivate* self = args->self;
args.reset();