aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mod
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-09 18:53:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-09 18:53:39 -0500
commit50c36504fc6090847f1fbdc7cf4852ae16d6e500 (patch)
treeaa43bb2839cbb733c2aa59fefc45b5c757458582 /scripts/mod
parentce5c2d2c256a4c8b523036537cd6be2d6af8f69d (diff)
parentd1189c63ea5e3272dc390a83e1235f142b739eb4 (diff)
Merge tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull module updates from Rusty Russell: "Nothing exciting, minor tweaks and cleanups" * tag 'modules-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: scripts: [modpost] add new sections to white list modpost: Add flag -E for making section mismatches fatal params: don't ignore the rest of cmdline if parse_one() fails modpost: abort if a module symbol is too long
Diffstat (limited to 'scripts/mod')
-rw-r--r--scripts/mod/modpost.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 12d3db3bd46b..e080746e1a6b 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -38,6 +38,7 @@ static int warn_unresolved = 0;
38/* How a symbol is exported */ 38/* How a symbol is exported */
39static int sec_mismatch_count = 0; 39static int sec_mismatch_count = 0;
40static int sec_mismatch_verbose = 1; 40static int sec_mismatch_verbose = 1;
41static int sec_mismatch_fatal = 0;
41/* ignore missing files */ 42/* ignore missing files */
42static int ignore_missing_files; 43static int ignore_missing_files;
43 44
@@ -833,6 +834,8 @@ static const char *const section_white_list[] =
833 ".xt.lit", /* xtensa */ 834 ".xt.lit", /* xtensa */
834 ".arcextmap*", /* arc */ 835 ".arcextmap*", /* arc */
835 ".gnu.linkonce.arcext*", /* arc : modules */ 836 ".gnu.linkonce.arcext*", /* arc : modules */
837 ".cmem*", /* EZchip */
838 ".fmt_slot*", /* EZchip */
836 ".gnu.lto*", 839 ".gnu.lto*",
837 NULL 840 NULL
838}; 841};
@@ -2133,6 +2136,11 @@ static void add_staging_flag(struct buffer *b, const char *name)
2133 buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n"); 2136 buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
2134} 2137}
2135 2138
2139/* In kernel, this size is defined in linux/module.h;
2140 * here we use Elf_Addr instead of long for covering cross-compile
2141 */
2142#define MODULE_NAME_LEN (64 - sizeof(Elf_Addr))
2143
2136/** 2144/**
2137 * Record CRCs for unresolved symbols 2145 * Record CRCs for unresolved symbols
2138 **/ 2146 **/
@@ -2177,6 +2185,12 @@ static int add_versions(struct buffer *b, struct module *mod)
2177 s->name, mod->name); 2185 s->name, mod->name);
2178 continue; 2186 continue;
2179 } 2187 }
2188 if (strlen(s->name) >= MODULE_NAME_LEN) {
2189 merror("too long symbol \"%s\" [%s.ko]\n",
2190 s->name, mod->name);
2191 err = 1;
2192 break;
2193 }
2180 buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n", 2194 buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",
2181 s->crc, s->name); 2195 s->crc, s->name);
2182 } 2196 }
@@ -2374,7 +2388,7 @@ int main(int argc, char **argv)
2374 struct ext_sym_list *extsym_iter; 2388 struct ext_sym_list *extsym_iter;
2375 struct ext_sym_list *extsym_start = NULL; 2389 struct ext_sym_list *extsym_start = NULL;
2376 2390
2377 while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) { 2391 while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:E")) != -1) {
2378 switch (opt) { 2392 switch (opt) {
2379 case 'i': 2393 case 'i':
2380 kernel_read = optarg; 2394 kernel_read = optarg;
@@ -2415,6 +2429,9 @@ int main(int argc, char **argv)
2415 case 'w': 2429 case 'w':
2416 warn_unresolved = 1; 2430 warn_unresolved = 1;
2417 break; 2431 break;
2432 case 'E':
2433 sec_mismatch_fatal = 1;
2434 break;
2418 default: 2435 default:
2419 exit(1); 2436 exit(1);
2420 } 2437 }
@@ -2464,14 +2481,20 @@ int main(int argc, char **argv)
2464 sprintf(fname, "%s.mod.c", mod->name); 2481 sprintf(fname, "%s.mod.c", mod->name);
2465 write_if_changed(&buf, fname); 2482 write_if_changed(&buf, fname);
2466 } 2483 }
2467
2468 if (dump_write) 2484 if (dump_write)
2469 write_dump(dump_write); 2485 write_dump(dump_write);
2470 if (sec_mismatch_count && !sec_mismatch_verbose) 2486 if (sec_mismatch_count) {
2471 warn("modpost: Found %d section mismatch(es).\n" 2487 if (!sec_mismatch_verbose) {
2472 "To see full details build your kernel with:\n" 2488 warn("modpost: Found %d section mismatch(es).\n"
2473 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", 2489 "To see full details build your kernel with:\n"
2474 sec_mismatch_count); 2490 "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n",
2491 sec_mismatch_count);
2492 }
2493 if (sec_mismatch_fatal) {
2494 fatal("modpost: Section mismatches detected.\n"
2495 "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n");
2496 }
2497 }
2475 2498
2476 return err; 2499 return err;
2477} 2500}