summaryrefslogtreecommitdiff
path: root/src/user/lib/libc/start.c
blob: f15f90d4a0ed248c2f51a8813ada4d43c527d0cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <tce/syscall.h>

extern int main(char **args);

extern size_t start_ctors, end_ctors, start_dtors, end_dtors;

void start(char **args) {
	size_t *call;

	for (call = &start_ctors; call < &end_ctors; call++) {
		((void(*)(void))*call)();
	}
	
	int ret = main(args);

	for (call = &start_dtors; call < &end_dtors; call++) {
		((void(*)(void))*call)();
	}

	process_exit(ret);
}