feat(libc): add new std functions

This commit is contained in:
boykopovar 2026-09-05 19:13:39 +03:00
parent 4945be96ef
commit 9ac0798c09
3 changed files with 39 additions and 0 deletions

View File

@ -1,3 +1,5 @@
#include <cstddef>
#include <cxxabi.h>
#include <cstdint>
#include <cstdlib>
#include <cstring>
@ -13,6 +15,19 @@
extern "C" {
void* __dynamic_cast_nid_postfix(
const void* source,
const __cxxabiv1::__class_type_info* sourceType,
const __cxxabiv1::__class_type_info* destinationType,
std::ptrdiff_t sourceToDestinationOffset
) {
(void)source;
(void)sourceType;
(void)destinationType;
(void)sourceToDestinationOffset;
return nullptr;
}
void* __cxa_allocate_exception_nid_postfix(std::size_t thrownSize) {
return std::malloc(thrownSize + 128);
}
@ -188,6 +203,15 @@ bool _ZSt18uncaught_exceptionv_nid_postfix() { return false; }
const std::error_category* _ZSt17iostream_categoryv_nid_postfix() { return &std::iostream_category(); }
std::uintptr_t _ZTVSt13runtime_error_nid_postfix[5] {};
std::uintptr_t _ZTVSt12system_error_nid_postfix[5] {};
std::uintptr_t _ZTVSt9exception_nid_postfix[5] {};
std::uintptr_t _ZTVSt16invalid_argument_nid_postfix[5] {};
std::uintptr_t _ZTVSt12out_of_range_nid_postfix[5] {};
std::uintptr_t _ZTVSt12domain_error_nid_postfix[5] {};
std::uintptr_t _ZTVSt8bad_cast_nid_postfix[5] {};
std::uintptr_t _ZTVSt11logic_error_nid_postfix[5] {};
void* _ZTVNSt8ios_base7failureE_nid_postfix = nullptr;
void* _ZTISt8bad_cast_nid_postfix = nullptr;
void* _ZTISt12out_of_range_nid_postfix = nullptr;

View File

@ -26,6 +26,12 @@ const std::locale& ClassicLocaleInstance() {
extern "C" {
std::locale::id _ZNSt5ctypeIcE2idE_nid_postfix {};
std::locale::id _ZNSt5ctypeIwE2idE_nid_postfix {};
std::locale::id _ZNSt7collateIwE2idE_nid_postfix {};
std::locale::id _ZNSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE_nid_postfix {};
std::uintptr_t _ZTVSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE_nid_postfix[12] {};
std::streamoff _ZSt7_BADOFF_nid_postfix = -1;
std::fpos_t _ZSt4_Fpz_nid_postfix {};
long _ZNSt6locale2id7_Id_cntE_nid_postfix = 0;

View File

@ -2,6 +2,15 @@
extern "C" {
double cbrt_nid_postfix(double x) { (void)x; return 0.0; }
double asin_nid_postfix(double x) { (void)x; return 0.0; }
double acos_nid_postfix(double x) { (void)x; return 0.0; }
double exp_nid_postfix(double x) { (void)x; return 0.0; }
double atan_nid_postfix(double x) { (void)x; return 0.0; }
double tan_nid_postfix(double x) { (void)x; return 0.0; }
double log2_nid_postfix(double x) { (void)x; return 0.0; }
double log_nid_postfix(double x) { (void)x; return 0.0; }
float sinf_nid_postfix(float x) { return std::sin(x); }
float cosf_nid_postfix(float x) { return std::cos(x); }