mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
LibC: Move C++ABI functions to cxxabi.cpp, typecheck cxa_atexit
This commit is contained in:
parent
9d2d97a059
commit
ff590db7e5
4 changed files with 21 additions and 22 deletions
|
@ -28,13 +28,12 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <sys/internals.h>
|
||||||
|
|
||||||
//#define GLOBAL_DTORS_DEBUG
|
//#define GLOBAL_DTORS_DEBUG
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
typedef void (*AtExitFunction)(void*);
|
|
||||||
|
|
||||||
struct __exit_entry {
|
struct __exit_entry {
|
||||||
AtExitFunction method;
|
AtExitFunction method;
|
||||||
void* parameter;
|
void* parameter;
|
||||||
|
@ -83,4 +82,16 @@ void __cxa_finalize(void* dso_handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[noreturn]] void __cxa_pure_virtual()
|
||||||
|
{
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
|
|
||||||
|
extern u32 __stack_chk_guard;
|
||||||
|
u32 __stack_chk_guard = (u32)0xc6c7c8c9;
|
||||||
|
|
||||||
|
[[noreturn]] void __stack_chk_fail()
|
||||||
|
{
|
||||||
|
ASSERT_NOT_REACHED();
|
||||||
|
}
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
|
@ -40,20 +40,4 @@ void __libc_init()
|
||||||
__malloc_init();
|
__malloc_init();
|
||||||
__stdio_init();
|
__stdio_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]] void __cxa_pure_virtual() __attribute__((weak));
|
|
||||||
|
|
||||||
[[noreturn]] void __cxa_pure_virtual()
|
|
||||||
{
|
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
}
|
|
||||||
|
|
||||||
extern u32 __stack_chk_guard;
|
|
||||||
u32 __stack_chk_guard = (u32)0xc6c7c8c9;
|
|
||||||
|
|
||||||
[[noreturn]] void __stack_chk_fail();
|
|
||||||
[[noreturn]] void __stack_chk_fail()
|
|
||||||
{
|
|
||||||
ASSERT_NOT_REACHED();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/internals.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
@ -197,10 +198,6 @@ __attribute__((warn_unused_result)) int __generate_unique_filename(char* pattern
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
// Itanium C++ ABI methods defined in crt0.cpp
|
|
||||||
extern int __cxa_atexit(void (*function)(void*), void* paramter, void* dso_handle);
|
|
||||||
extern void __cxa_finalize(void* dso_handle);
|
|
||||||
|
|
||||||
void exit(int status)
|
void exit(int status)
|
||||||
{
|
{
|
||||||
__cxa_finalize(nullptr);
|
__cxa_finalize(nullptr);
|
||||||
|
|
|
@ -30,10 +30,17 @@
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef void (*AtExitFunction)(void*);
|
||||||
|
|
||||||
extern void __libc_init();
|
extern void __libc_init();
|
||||||
extern void __malloc_init();
|
extern void __malloc_init();
|
||||||
extern void __stdio_init();
|
extern void __stdio_init();
|
||||||
extern void _init();
|
extern void _init();
|
||||||
extern bool __environ_is_malloced;
|
extern bool __environ_is_malloced;
|
||||||
|
|
||||||
|
int __cxa_atexit(AtExitFunction exit_function, void* parameter, void* dso_handle);
|
||||||
|
void __cxa_finalize(void* dso_handle);
|
||||||
|
[[noreturn]] void __cxa_pure_virtual() __attribute__((weak));
|
||||||
|
[[noreturn]] void __stack_chk_fail();
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue