blob: 3f51fdb988ef444ac40c4ce1b39e245472ce460f (
plain) (
tree)
|
|
#include <tce/syscall.h>
#include <stdio.h>
extern int main(int argc, char **argv);
extern size_t start_ctors, end_ctors, start_dtors, end_dtors;
void __tce_libc_start(char **args) {
// setup stdio
term.fd = 0;
__tce_libc_fsetup(&term);
// call C++ static constructors
size_t *call;
for (call = &start_ctors; call < &end_ctors; call++) {
((void(*)(void))*call)();
}
// call main
char **lastarg = args;
while (*lastarg) lastarg++;
int ret = main((lastarg - args), args);
// call C++ static destructors
for (call = &start_dtors; call < &end_dtors; call++) {
((void(*)(void))*call)();
}
process_exit(ret);
}
|