working on it
This commit is contained in:
parent
56a6e78765
commit
35a88970c2
1094 changed files with 51093 additions and 51 deletions
30
05/musl-final/src/env/__libc_start_main.c
vendored
Normal file
30
05/musl-final/src/env/__libc_start_main.c
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "libc.h"
|
||||
|
||||
#if 0
|
||||
/* Any use of __environ/environ will override this symbol. */
|
||||
char **__dummy_environ = (void *)-1;
|
||||
weak_alias(__dummy_environ, ___environ);
|
||||
#else
|
||||
extern char **___environ;
|
||||
#endif
|
||||
|
||||
int __libc_start_main(
|
||||
int (*main)(int, char **, char **), int argc, char **argv,
|
||||
int (*init)(int, char **, char **), void (*fini)(void),
|
||||
void (*ldso_fini)(void))
|
||||
{
|
||||
/* Save the environment if it may be used by libc/application */
|
||||
char **envp = argv+argc+1;
|
||||
if (___environ != (void *)-1) ___environ = envp;
|
||||
|
||||
/* Avoid writing 0 and triggering unnecessary COW */
|
||||
if (ldso_fini) libc.ldso_fini = ldso_fini;
|
||||
if (fini) libc.fini = fini;
|
||||
|
||||
/* Execute constructors (static) linked into the application */
|
||||
if (init) init(argc, argv, envp);
|
||||
|
||||
/* Pass control to to application */
|
||||
exit(main(argc, argv, envp));
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue