1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibC: Move even more methods and globals out of crt0.o

This commit is contained in:
Andrew Kaster 2020-01-09 00:36:32 -07:00 committed by Andreas Kling
parent 9681d41bf0
commit 4cb7c8ea85
3 changed files with 40 additions and 27 deletions

View file

@ -54,7 +54,8 @@ LIBC_OBJS = \
wchar.o \ wchar.o \
serenity.o \ serenity.o \
syslog.o \ syslog.o \
cxxabi.o cxxabi.o \
libcinit.o
ELF_OBJS = \ ELF_OBJS = \
../LibELF/ELFDynamicObject.o \ ../LibELF/ELFDynamicObject.o \

View file

@ -7,18 +7,10 @@ extern "C" {
int main(int, char**, char**); int main(int, char**, char**);
__thread int errno; extern void __libc_init();
char** environ; extern void _init();
bool __environ_is_malloced; extern char** environ;
extern bool __environ_is_malloced;
void __libc_init()
{
void __malloc_init();
__malloc_init();
void __stdio_init();
__stdio_init();
}
int _start(int argc, char** argv, char** env) int _start(int argc, char** argv, char** env)
{ {
@ -27,7 +19,6 @@ int _start(int argc, char** argv, char** env)
__libc_init(); __libc_init();
extern void _init();
_init(); _init();
extern void (*__init_array_start[])(int, char**, char**) __attribute__((visibility("hidden"))); extern void (*__init_array_start[])(int, char**, char**) __attribute__((visibility("hidden")));
@ -43,17 +34,4 @@ int _start(int argc, char** argv, char** env)
return 20150614; return 20150614;
} }
[[noreturn]] void __cxa_pure_virtual()
{
ASSERT_NOT_REACHED();
}
extern u32 __stack_chk_guard;
u32 __stack_chk_guard = (u32)0xc0000c13;
[[noreturn]] void __stack_chk_fail()
{
ASSERT_NOT_REACHED();
}
} }

View file

@ -0,0 +1,34 @@
#include <AK/Types.h>
#include <assert.h>
extern "C" {
__thread int errno;
char** environ;
bool __environ_is_malloced;
void __libc_init()
{
void __malloc_init();
__malloc_init();
void __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)0xc0000c13;
[[noreturn]] void __stack_chk_fail()
{
ASSERT_NOT_REACHED();
}
}