]>
git.proxmox.com Git - wasi-libc.git/blob - basics/crt/crt1.c
a0f5a7349be7d72bdfd0690db6e01e1a646f6bc0
1 extern void __wasm_call_ctors(void);
2 extern int __original_main(void);
3 extern void __prepare_for_exit(void);
4 void _Exit(int) __attribute__((noreturn
));
7 // The linker synthesizes this to call constructors.
10 // Call `__original_main` which will either be the application's
11 // zero-argument `main` function (renamed by the compiler) or a libc
12 // routine which populates `argv` and `argc` and calls the application's
13 // two-argument `main`.
14 int r
= __original_main();
16 // Call atexit functions, destructors, stdio cleanup, etc.
19 // If main exited successfully, just return, otherwise call _Exit.