kbuild: silence section mismatch warnings for exported functions

From: Sam Ravnborg
Date: Sat Mar 03 2007 - 13:34:23 EST


There are legitime cases of exported functions which
is marked __init. Some examples are in drivers/pci/
where the pci subsystem export symbols to be used by other
__init functions.
So ignore references from ksymtab* to .init.text

Signed-off-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
---
scripts/mod/modpost.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 9042039..9e80dc5 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -625,6 +625,13 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.data
* fromsec = .text*
* refsymname = logo_
+ *
+ * Pattern 8:
+ * Symbols exported may be marked __init because we need to
+ * export functions that are only used by init function.
+ * The pattern is:
+ * tosec = .init.text
+ * fromsec = __ksymtab*
**/
static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
@@ -702,6 +709,10 @@ static int secref_whitelist(const char *modname, const char *tosec,
(strncmp(fromsec, ".text", strlen(".text")) == 0) &&
(strncmp(refsymname, "logo_", strlen("logo_")) == 0))
return 1;
+ /* Check for pattern 8 */
+ if ((strcmp(tosec, ".init.text") == 0) &&
+ (strncmp(fromsec, "__ksymtab", strlen("__ksymtab")) == 0))
+ return 1;
return 0;
}

--
1.4.4.2

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/