mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 02:26:11 +00:00
LibC: Clean up crt0
We already set these variables and call `_init` in the dynamic linker. As we don't care about static binaries, remove these assignments and the call to `_init` from `_entry`. The function referenced by DT_INIT is also not necessarily called `_init`, so directly calling `_init` is not really correct. `s_global_initializers_ran` and `__stack_chk_guard` are unused, so remove them.
This commit is contained in:
parent
0bff1f61b6
commit
e7c8ff3839
|
@ -14,13 +14,10 @@
|
||||||
#ifndef _DYNAMIC_LOADER
|
#ifndef _DYNAMIC_LOADER
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
extern uintptr_t __stack_chk_guard;
|
|
||||||
extern bool s_global_initializers_ran;
|
|
||||||
|
|
||||||
int main(int, char**, char**);
|
int main(int, char**, char**);
|
||||||
|
|
||||||
// Tell the compiler that this may be called from somewhere else.
|
// Tell the compiler that this may be called from somewhere else.
|
||||||
int _entry(int argc, char** argv, char** env) __attribute__((used));
|
int _entry(int argc, char** argv) __attribute__((used));
|
||||||
void _start(int, char**, char**) __attribute__((used));
|
void _start(int, char**, char**) __attribute__((used));
|
||||||
|
|
||||||
NAKED void _start(int, char**, char**)
|
NAKED void _start(int, char**, char**)
|
||||||
|
@ -37,16 +34,10 @@ NAKED void _start(int, char**, char**)
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int _entry(int argc, char** argv, char** env)
|
int _entry(int argc, char** argv)
|
||||||
{
|
{
|
||||||
environ = env;
|
|
||||||
__environ_is_malloced = false;
|
|
||||||
__begin_atexit_locking();
|
__begin_atexit_locking();
|
||||||
|
|
||||||
s_global_initializers_ran = true;
|
|
||||||
|
|
||||||
_init();
|
|
||||||
|
|
||||||
int status = main(argc, argv, environ);
|
int status = main(argc, argv, environ);
|
||||||
|
|
||||||
exit(status);
|
exit(status);
|
||||||
|
|
|
@ -20,7 +20,6 @@ __thread int errno_storage;
|
||||||
char** environ;
|
char** environ;
|
||||||
bool __environ_is_malloced;
|
bool __environ_is_malloced;
|
||||||
bool __stdio_is_initialized;
|
bool __stdio_is_initialized;
|
||||||
bool s_global_initializers_ran;
|
|
||||||
void* __auxiliary_vector;
|
void* __auxiliary_vector;
|
||||||
|
|
||||||
static void __auxiliary_vector_init();
|
static void __auxiliary_vector_init();
|
||||||
|
|
Loading…
Reference in a new issue