From 0e0d314e6a01bb14d303e35e6f7ba24b17020044 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 17 May 2007 20:14:48 +0200 Subject: 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 Signed-off-by: Sam Ravnborg Cc: Andrew Morton --- scripts/mod/modpost.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'scripts/mod') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 2909391a8035..7c87267b6ff0 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -583,6 +583,12 @@ static int strrcmp(const char *s, const char *sub) /** * Whitelist to allow certain references to pass with no warning. + * + * Pattern 0: + * Do not warn if funtion/data are marked with __init_refok/__initdata_refok. + * The pattern is identified by: + * fromsec = .text.init.refok | .data.init.refok + * * Pattern 1: * If a module parameter is declared __initdata and permissions=0 * then this is legal despite the warning generated. @@ -686,6 +692,11 @@ static int secref_whitelist(const char *modname, const char *tosec, NULL }; + /* Check for pattern 0 */ + if ((strcmp(fromsec, ".text.init.refok") == 0) || + (strcmp(fromsec, ".data.init.refok") == 0)) + return 1; + /* Check for pattern 1 */ if (strcmp(tosec, ".init.data") != 0) f1 = 0; -- cgit v1.2.1