lkml.org 
[lkml]   [2009]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 2/6] module: add module ELF section with module_init() pointer
Date
The linker script will append this section to the end of the list
of initcalls so that init/main.c:do_initcalls() can find it.
---
include/asm-generic/vmlinux.lds.h | 3 ++-
include/linux/init.h | 11 ++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index c61fab1..d3c0787 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -428,7 +428,8 @@
*(.initcall6.init) \
*(.initcall6s.init) \
*(.initcall7.init) \
- *(.initcall7s.init)
+ *(.initcall7s.init) \
+ *(.mod_initcall.init)

#define PERCPU(align) \
. = ALIGN(align); \
diff --git a/include/linux/init.h b/include/linux/init.h
index 68cb026..62b854f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -284,11 +284,20 @@ void __init parse_early_param(void);

#define security_initcall(fn) module_init(fn)

+#ifdef CONFIG_MODULE_STATIC
+#define module_initcall(fn) \
+ static initcall_t __initcall_##fn \
+ __used __section(.mod_initcall.init) = fn
+#else
+#define module_initcall(fn)
+#endif
+
/* Each module must use one module_init(). */
#define module_init(initfn) \
static inline initcall_t __inittest(void) \
{ return initfn; } \
- int init_module(void) __attribute__((alias(#initfn)));
+ int init_module(void) __attribute__((alias(#initfn))); \
+ module_initcall(initfn);

/* This is only required if you want to be unloadable. */
#define module_exit(exitfn) \
--
1.5.6.3


\
 
 \ /
  Last update: 2009-02-15 19:23    [W:0.554 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site