aboutsummaryrefslogtreecommitdiff
path: root/scripts/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/file2alias.c11
-rw-r--r--scripts/mod/modpost.c76
-rw-r--r--scripts/mod/sumversion.c1
3 files changed, 54 insertions, 34 deletions
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index ed1244dd58d..f646381dc01 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -353,11 +353,16 @@ static int do_pcmcia_entry(const char *filename,
static int do_of_entry (const char *filename, struct of_device_id *of, char *alias)
{
+ int len;
char *tmp;
- sprintf (alias, "of:N%sT%sC%s",
+ len = sprintf (alias, "of:N%sT%s",
of->name[0] ? of->name : "*",
- of->type[0] ? of->type : "*",
- of->compatible[0] ? of->compatible : "*");
+ of->type[0] ? of->type : "*");
+
+ if (of->compatible[0])
+ sprintf (&alias[len], "%sC%s",
+ of->type[0] ? "*" : "",
+ of->compatible);
/* Replace all whitespace with underscores */
for (tmp = alias; tmp && *tmp; tmp++)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 4ab36de45aa..3645e980da7 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -582,6 +582,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.
@@ -619,14 +625,6 @@ static int strrcmp(const char *s, const char *sub)
* This pattern is identified by
* refsymname = __init_begin, _sinittext, _einittext
*
- * Pattern 6:
- * During the early init phase we have references from .init.text to
- * .text we have an intended section mismatch - do not warn about it.
- * See kernel_init() in init/main.c
- * tosec = .init.text
- * fromsec = .text
- * atsym = kernel_init
- *
* Pattern 7:
* Logos used in drivers/video/logo reside in __initdata but the
* funtion that references them are EXPORT_SYMBOL() so cannot be
@@ -642,6 +640,11 @@ static int strrcmp(const char *s, const char *sub)
* tosec = .init.text
* fromsec = .paravirtprobe
*
+ * Pattern 10:
+ * ia64 has machvec table for each platform and
+ * powerpc has a machine desc table for each platform.
+ * It is mixture of function pointers of .init.text and .text.
+ * fromsec = .machvec | .machine.desc
**/
static int secref_whitelist(const char *modname, const char *tosec,
const char *fromsec, const char *atsym,
@@ -668,6 +671,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;
@@ -709,12 +717,6 @@ static int secref_whitelist(const char *modname, const char *tosec,
if (strcmp(refsymname, *s) == 0)
return 1;
- /* Check for pattern 6 */
- if ((strcmp(tosec, ".init.text") == 0) &&
- (strcmp(fromsec, ".text") == 0) &&
- (strcmp(refsymname, "kernel_init") == 0))
- return 1;
-
/* Check for pattern 7 */
if ((strcmp(tosec, ".init.data") == 0) &&
(strncmp(fromsec, ".text", strlen(".text")) == 0) &&
@@ -726,6 +728,11 @@ static int secref_whitelist(const char *modname, const char *tosec,
(strcmp(fromsec, ".paravirtprobe") == 0))
return 1;
+ /* Check for pattern 10 */
+ if ((strcmp(fromsec, ".machvec") == 0) ||
+ (strcmp(fromsec, ".machine.desc") == 0))
+ return 1;
+
return 0;
}
@@ -857,30 +864,34 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
elf->strtab + before->st_name, refsymname))
return;
+ /* fromsec whitelist - without a valid 'before'
+ * powerpc has a GOT table in .got2 section */
+ if (strcmp(fromsec, ".got2") == 0)
+ return;
+
if (before && after) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "between '%s' (at offset 0x%llx) and '%s'\n",
- modname, secname, refsymname, fromsec,
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+ "(between '%s' and '%s')\n",
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname,
elf->strtab + before->st_name,
- (long long)r.r_offset,
elf->strtab + after->st_name);
} else if (before) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "after '%s' (at offset 0x%llx)\n",
- modname, secname, refsymname, fromsec,
- elf->strtab + before->st_name,
- (long long)r.r_offset);
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
+ "(after '%s')\n",
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname,
+ elf->strtab + before->st_name);
} else if (after) {
- warn("%s - Section mismatch: reference to %s:%s from %s "
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s "
"before '%s' (at offset -0x%llx)\n",
- modname, secname, refsymname, fromsec,
- elf->strtab + after->st_name,
- (long long)r.r_offset);
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname,
+ elf->strtab + after->st_name);
} else {
- warn("%s - Section mismatch: reference to %s:%s from %s "
- "(offset 0x%llx)\n",
- modname, secname, fromsec, refsymname,
- (long long)r.r_offset);
+ warn("%s(%s+0x%llx): Section mismatch: reference to %s:%s\n",
+ modname, fromsec, (unsigned long long)r.r_offset,
+ secname, refsymname);
}
}
@@ -1041,6 +1052,7 @@ static int init_section_ref_ok(const char *name)
".plt", /* seen on ARCH=um build on x86_64. Harmless */
"__ftr_fixup", /* powerpc cpu feature fixup */
"__fw_ftr_fixup", /* powerpc firmware feature fixup */
+ ".cranges", /* used by sh64 */
NULL
};
/* Start of section names */
@@ -1121,6 +1133,7 @@ static int exit_section_ref_ok(const char *name)
".fixup",
".smp_locks",
".plt", /* seen on ARCH=um build on x86_64. Harmless */
+ ".cranges", /* used by sh64 */
NULL
};
/* Start of section names */
@@ -1316,6 +1329,7 @@ static void add_header(struct buffer *b, struct module *mod)
buf_printf(b, "#ifdef CONFIG_MODULE_UNLOAD\n"
" .exit = cleanup_module,\n"
"#endif\n");
+ buf_printf(b, " .arch = MODULE_ARCH_INIT,\n");
buf_printf(b, "};\n");
}
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c
index 6873d5af80d..d9cc6901d68 100644
--- a/scripts/mod/sumversion.c
+++ b/scripts/mod/sumversion.c
@@ -7,6 +7,7 @@
#include <ctype.h>
#include <errno.h>
#include <string.h>
+#include <limits.h>
#include "modpost.h"
/*