ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \
REGISTER_INIT(ns, id)
-void __static_init() { }
+void __static_init_early() { }
+void __static_init() { CALL_ACCUMULATED_FUNCTION(__static_init_early); }
#define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
-#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func)
+#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init_early, func)
-#define STATIC_INIT(func) \
+#define _STATIC_INIT(where, func) \
void _static_##func(); \
- ACCUMULATE_FUNCTION(__static_init, _static_##func) \
+ ACCUMULATE_FUNCTION(where, _static_##func) \
void _static_##func()
+#define STATIC_INIT(func) _STATIC_INIT(__static_init_early, func##_early)
+#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init, func)
+
#endif