]> git.buserror.net Git - polintos/scott/priv.git/blob - kernel/lib/ctors.cc
Initial struct marshalling.
[polintos/scott/priv.git] / kernel / lib / ctors.cc
1 // lib/ctors.cc -- Run C++ global constructors
2 //
3 // Destructors are not run at shutdown, as we won't be relying on global
4 // destructors to do any cleanup.  Constuctors are needed even if we don't
5 // explicitly use them, however, as GCC sometimes uses them implicitly
6 // to initialize global data.
7
8 #include <kern/libc.h>
9 #include <kern/mem.h>
10 #include <lowlevel/barriers.h>
11
12 void run_ctors()
13 {
14         typedef void (*ctor)();
15         extern ctor ctors;
16         
17         for (ctor *ptr = &ctors; *ptr; ptr++)
18                 (*ptr)();
19 }
20
21 // Global constructors call this to register global destructors
22 // with some versions and/or configurations of GCC.  I'm not sure
23 // why just using a static dtor table isn't good enough.
24
25 extern "C" int __cxa_atexit(void (*func)(void *), void *arg, void *d)
26 {
27         return 0;
28 }
29
30 // More crap we don't care about (we don't use global destructors),
31 // but GCC requires.
32
33 int __dso_handle;