Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / um / include / init.h
index f1d82e0..d4de7c0 100644 (file)
 typedef int (*initcall_t)(void);
 typedef void (*exitcall_t)(void);
 
-#define __init          __attribute__ ((__section__ (".text.init")))
-#define __exit          __attribute__ ((unused, __section__(".text.exit")))
-#define __initdata      __attribute__ ((__section__ (".data.init")))
+/* These are for everybody (although not all archs will actually
+   discard it in modules) */
+#define __init         __attribute__ ((__section__ (".init.text")))
+#define __initdata     __attribute__ ((__section__ (".init.data")))
+#define __exitdata     __attribute__ ((__section__(".exit.data")))
+#define __exit_call    __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
+
+#ifdef MODULE
+#define __exit         __attribute__ ((__section__(".exit.text")))
+#else
+#define __exit         __attribute_used__ __attribute__ ((__section__(".exit.text")))
+#endif
 
 #endif
 
@@ -94,11 +103,28 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
  * Mark functions and data as being only used at initialization
  * or exit time.
  */
-#define __uml_init_setup       __attribute__ ((unused,__section__ (".uml.setup.init")))
-#define __uml_setup_help       __attribute__ ((unused,__section__ (".uml.help.init")))
-#define __uml_init_call                __attribute__ ((unused,__section__ (".uml.initcall.init")))
-#define __uml_postsetup_call   __attribute__ ((unused,__section__ (".uml.postsetup.init")))
-#define __uml_exit_call                __attribute__ ((unused,__section__ (".uml.exitcall.exit")))
+#define __uml_init_setup       __attribute_used__ __attribute__ ((__section__ (".uml.setup.init")))
+#define __uml_setup_help       __attribute_used__ __attribute__ ((__section__ (".uml.help.init")))
+#define __uml_init_call                __attribute_used__ __attribute__ ((__section__ (".uml.initcall.init")))
+#define __uml_postsetup_call   __attribute_used__ __attribute__ ((__section__ (".uml.postsetup.init")))
+#define __uml_exit_call                __attribute_used__ __attribute__ ((__section__ (".uml.exitcall.exit")))
+
+#ifndef __KERNEL__
+
+#define __define_initcall(level,fn) \
+       static initcall_t __initcall_##fn __attribute_used__ \
+       __attribute__((__section__(".initcall" level ".init"))) = fn
+
+/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll
+ * make them run first.
+ */
+#define __initcall(fn) __define_initcall("1", fn)
+
+#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
+
+#define __init_call    __attribute_used__ __attribute__ ((__section__ (".initcall.init")))
+
+#endif
 
 #endif /* _LINUX_UML_INIT_H */