ladybird/Libraries/LibC/crt0.cpp

38 lines
813 B
C++
Raw Normal View History

#include <AK/Types.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
2018-10-22 14:06:22 +02:00
extern "C" {
int main(int, char**, char**);
2018-10-22 14:06:22 +02:00
extern void __libc_init();
extern void _init();
extern char** environ;
extern bool __environ_is_malloced;
int _start(int argc, char** argv, char** env)
2018-10-22 14:06:22 +02:00
{
environ = env;
__environ_is_malloced = false;
__libc_init();
_init();
extern void (*__init_array_start[])(int, char**, char**) __attribute__((visibility("hidden")));
extern void (*__init_array_end[])(int, char**, char**) __attribute__((visibility("hidden")));
const size_t size = __init_array_end - __init_array_start;
for (size_t i = 0; i < size; i++)
(*__init_array_start[i])(argc, argv, env);
int status = main(argc, argv, environ);
exit(status);
2018-10-22 14:06:22 +02:00
return 20150614;
}
}