Function __libc_start_main is defined in libc.so with below function signature
void __libc_start_main( int (*main) (int, char * *, char * *),
int argc, char * * ubp_av,
void (*init) (void),
void (*fini) (void),
void (*rtld_fini) (void),
void (* stack_end));
In normal usage, this function is called by function _start which is defined in C RunTime object crt1.o.
Questions:
- Is it possible to call
__libc_start_mainin C code?
Difficulties:
- I could not find a way to determine the value of last argument
stack_endin C code. The implementation ofcrt1.ois in assembly, which is able to determinestack_end.
PS: I am just curious if we are able to call __libc_start_main in C code.