summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rw-r--r--init/Kconfig5
-rw-r--r--init/main.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig
index c4b3c6d51a7..1ce05a4cb5f 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -16,6 +16,11 @@ config DEFCONFIG_LIST
default "$ARCH_DEFCONFIG"
default "arch/$ARCH/defconfig"
+config CONSTRUCTORS
+ bool
+ depends on !UML
+ default y
+
menu "General setup"
config EXPERIMENTAL
diff --git a/init/main.c b/init/main.c
index 0e7aedeaa05..1a65fdd0631 100644
--- a/init/main.c
+++ b/init/main.c
@@ -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();
}