2
extern void __wasm_call_ctors(void);
3
extern int __original_main(void);
4
extern void __wasm_call_dtors(void);
6
__attribute__((export_name("_start")))
8
// The linker synthesizes this to call constructors.
11
// Call `__original_main` which will either be the application's zero-argument
12
// `__original_main` function or a libc routine which calls `__main_void`.
13
// TODO: Call `main` directly once we no longer have to support old compilers.
14
int r = __original_main();
16
// Call atexit functions, destructors, stdio cleanup, etc.
19
// If main exited successfully, just return, otherwise call
20
// `__wasi_proc_exit`.
1
// We compile a plain crt1.o for toolchain compatibility, but it's
2
// identical to crt1-command.o.
3
#include "crt1-command.c"