kernel: constructor support
[safe/jmp/linux-2.6] / init / main.c
index 0e7aede..1a65fdd 100644 (file)
@@ -720,6 +720,17 @@ asmlinkage void __init start_kernel(void)
        rest_init();
 }
 
+/* Call all constructor functions linked into the kernel. */
+static void __init do_ctors(void)
+{
+#ifdef CONFIG_CONSTRUCTORS
+       ctor_fn_t *call = (ctor_fn_t *) __ctors_start;
+
+       for (; call < (ctor_fn_t *) __ctors_end; call++)
+               (*call)();
+#endif
+}
+
 int initcall_debug;
 core_param(initcall_debug, initcall_debug, bool, 0644);
 
@@ -800,6 +811,7 @@ static void __init do_basic_setup(void)
        usermodehelper_init();
        driver_init();
        init_irq_proc();
+       do_ctors();
        do_initcalls();
 }