kbuild: introduce __init_refok/__initdata_refok to supress section mismatch warnings

Throughout the kernel there are a few legitimite references
to init or exit sections. Most of these are covered by the
patterns included in modpost but a few nees special attention.
To avoid hardcoding a lot of function names in modpost introduce
a marker so relevant function/data can be marked.
When modpost see a reference to a init/exit function from
a function/data marked no warning will be issued.

Idea from: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Sam Ravnborg
2007-05-17 20:14:48 +02:00
parent ca967258b6
commit 0e0d314e6a
3 changed files with 28 additions and 2 deletions

View File

@@ -11,7 +11,8 @@
/* .data section */
#define DATA_DATA \
*(.data)
*(.data) \
*(.data.init.refok)
#define RODATA \
. = ALIGN(4096); \
@@ -147,7 +148,8 @@
* during second ld run in second ld pass when generating System.map */
#define TEXT_TEXT \
ALIGN_FUNCTION(); \
*(.text)
*(.text) \
*(.text.init.refok)
/* sched.text is aling to function alignment to secure we have same
* address even at second ld pass when generating System.map */