aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build2
-rw-r--r--scripts/Makefile.modpost21
-rw-r--r--scripts/kconfig/conf.c31
-rw-r--r--scripts/kconfig/expr.h4
-rw-r--r--scripts/kconfig/gconf.c10
-rw-r--r--scripts/kconfig/kxgettext.c4
-rw-r--r--scripts/kconfig/lkc_proto.h2
-rw-r--r--scripts/kconfig/mconf.c4
-rw-r--r--scripts/kconfig/menu.c12
-rw-r--r--scripts/kconfig/qconf.cc2
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped12
-rw-r--r--scripts/kconfig/zconf.y12
-rw-r--r--scripts/mod/file2alias.c12
-rw-r--r--scripts/mod/modpost.c160
-rwxr-xr-xscripts/ver_linux4
15 files changed, 168 insertions, 124 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 3f7b451f3955..7fd6055bedfd 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -315,7 +315,7 @@ quiet_cmd_link_multi-y = LD $@
315cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps) 315cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
316 316
317quiet_cmd_link_multi-m = LD [M] $@ 317quiet_cmd_link_multi-m = LD [M] $@
318cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps) 318cmd_link_multi-m = $(cmd_link_multi-y)
319 319
320# We would rather have a list of rules like 320# We would rather have a list of rules like
321# foo.o: $(foo-objs) 321# foo.o: $(foo-objs)
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index c6fcc597b3be..d988f5d21e3d 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -56,23 +56,24 @@ _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules))
56 56
57# Step 2), invoke modpost 57# Step 2), invoke modpost
58# Includes step 3,4 58# Includes step 3,4
59modpost = scripts/mod/modpost \
60 $(if $(CONFIG_MODVERSIONS),-m) \
61 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
62 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
63 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
64 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
65 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
66
59quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 67quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
60 cmd_modpost = scripts/mod/modpost \ 68 cmd_modpost = $(modpost) -s
61 $(if $(CONFIG_MODVERSIONS),-m) \
62 $(if $(CONFIG_MODULE_SRCVERSION_ALL),-a,) \
63 $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
64 $(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
65 $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
66 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
67 69
68PHONY += __modpost 70PHONY += __modpost
69__modpost: $(modules:.ko=.o) FORCE 71__modpost: $(modules:.ko=.o) FORCE
70 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) 72 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^)
71 73
72quiet_cmd_kernel-mod = MODPOST $@ 74quiet_cmd_kernel-mod = MODPOST $@
73 cmd_kernel-mod = $(cmd_modpost) $@ 75 cmd_kernel-mod = $(modpost) $@
74 76
75PHONY += vmlinux
76vmlinux.o: FORCE 77vmlinux.o: FORCE
77 $(call cmd,kernel-mod) 78 $(call cmd,kernel-mod)
78 79
@@ -97,7 +98,7 @@ targets += $(modules:.ko=.mod.o)
97 98
98# Step 6), final link of the modules 99# Step 6), final link of the modules
99quiet_cmd_ld_ko_o = LD [M] $@ 100quiet_cmd_ld_ko_o = LD [M] $@
100 cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \ 101 cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \
101 $(filter-out FORCE,$^) 102 $(filter-out FORCE,$^)
102 103
103$(modules): %.ko :%.o %.mod.o FORCE 104$(modules): %.ko :%.o %.mod.o FORCE
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 1199baf866ca..8be6a4269e63 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -37,6 +37,14 @@ static struct menu *rootEntry;
37 37
38static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"); 38static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
39 39
40static const char *get_help(struct menu *menu)
41{
42 if (menu_has_help(menu))
43 return menu_get_help(menu);
44 else
45 return nohelp_text;
46}
47
40static void strip(char *str) 48static void strip(char *str)
41{ 49{
42 char *p = str; 50 char *p = str;
@@ -171,7 +179,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
171int conf_string(struct menu *menu) 179int conf_string(struct menu *menu)
172{ 180{
173 struct symbol *sym = menu->sym; 181 struct symbol *sym = menu->sym;
174 const char *def, *help; 182 const char *def;
175 183
176 while (1) { 184 while (1) {
177 printf("%*s%s ", indent - 1, "", menu->prompt->text); 185 printf("%*s%s ", indent - 1, "", menu->prompt->text);
@@ -186,10 +194,7 @@ int conf_string(struct menu *menu)
186 case '?': 194 case '?':
187 /* print help */ 195 /* print help */
188 if (line[1] == '\n') { 196 if (line[1] == '\n') {
189 help = nohelp_text; 197 printf("\n%s\n", get_help(menu));
190 if (menu->sym->help)
191 help = menu->sym->help;
192 printf("\n%s\n", menu->sym->help);
193 def = NULL; 198 def = NULL;
194 break; 199 break;
195 } 200 }
@@ -207,7 +212,6 @@ static int conf_sym(struct menu *menu)
207 struct symbol *sym = menu->sym; 212 struct symbol *sym = menu->sym;
208 int type; 213 int type;
209 tristate oldval, newval; 214 tristate oldval, newval;
210 const char *help;
211 215
212 while (1) { 216 while (1) {
213 printf("%*s%s ", indent - 1, "", menu->prompt->text); 217 printf("%*s%s ", indent - 1, "", menu->prompt->text);
@@ -233,7 +237,7 @@ static int conf_sym(struct menu *menu)
233 printf("/m"); 237 printf("/m");
234 if (oldval != yes && sym_tristate_within_range(sym, yes)) 238 if (oldval != yes && sym_tristate_within_range(sym, yes))
235 printf("/y"); 239 printf("/y");
236 if (sym->help) 240 if (menu_has_help(menu))
237 printf("/?"); 241 printf("/?");
238 printf("] "); 242 printf("] ");
239 conf_askvalue(sym, sym_get_string_value(sym)); 243 conf_askvalue(sym, sym_get_string_value(sym));
@@ -269,10 +273,7 @@ static int conf_sym(struct menu *menu)
269 if (sym_set_tristate_value(sym, newval)) 273 if (sym_set_tristate_value(sym, newval))
270 return 0; 274 return 0;
271help: 275help:
272 help = nohelp_text; 276 printf("\n%s\n", get_help(menu));
273 if (sym->help)
274 help = sym->help;
275 printf("\n%s\n", help);
276 } 277 }
277} 278}
278 279
@@ -342,7 +343,7 @@ static int conf_choice(struct menu *menu)
342 goto conf_childs; 343 goto conf_childs;
343 } 344 }
344 printf("[1-%d", cnt); 345 printf("[1-%d", cnt);
345 if (sym->help) 346 if (menu_has_help(menu))
346 printf("?"); 347 printf("?");
347 printf("]: "); 348 printf("]: ");
348 switch (input_mode) { 349 switch (input_mode) {
@@ -359,8 +360,7 @@ static int conf_choice(struct menu *menu)
359 fgets(line, 128, stdin); 360 fgets(line, 128, stdin);
360 strip(line); 361 strip(line);
361 if (line[0] == '?') { 362 if (line[0] == '?') {
362 printf("\n%s\n", menu->sym->help ? 363 printf("\n%s\n", get_help(menu));
363 menu->sym->help : nohelp_text);
364 continue; 364 continue;
365 } 365 }
366 if (!line[0]) 366 if (!line[0])
@@ -391,8 +391,7 @@ static int conf_choice(struct menu *menu)
391 if (!child) 391 if (!child)
392 continue; 392 continue;
393 if (line[strlen(line) - 1] == '?') { 393 if (line[strlen(line) - 1] == '?') {
394 printf("\n%s\n", child->sym->help ? 394 printf("\n%s\n", get_help(child));
395 child->sym->help : nohelp_text);
396 continue; 395 continue;
397 } 396 }
398 sym_set_choice_value(sym, child->sym); 397 sym_set_choice_value(sym, child->sym);
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 6084525f604b..a195986eec6f 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -71,14 +71,12 @@ enum {
71struct symbol { 71struct symbol {
72 struct symbol *next; 72 struct symbol *next;
73 char *name; 73 char *name;
74 char *help;
75 enum symbol_type type; 74 enum symbol_type type;
76 struct symbol_value curr; 75 struct symbol_value curr;
77 struct symbol_value def[4]; 76 struct symbol_value def[4];
78 tristate visible; 77 tristate visible;
79 int flags; 78 int flags;
80 struct property *prop; 79 struct property *prop;
81 struct expr *dep, *dep2;
82 struct expr_value rev_dep; 80 struct expr_value rev_dep;
83}; 81};
84 82
@@ -139,7 +137,7 @@ struct menu {
139 struct property *prompt; 137 struct property *prompt;
140 struct expr *dep; 138 struct expr *dep;
141 unsigned int flags; 139 unsigned int flags;
142 //char *help; 140 char *help;
143 struct file *file; 141 struct file *file;
144 int lineno; 142 int lineno;
145 void *data; 143 void *data;
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 61d8166166ef..262908cfc2ac 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -38,9 +38,6 @@ static gboolean show_all = FALSE;
38static gboolean show_debug = FALSE; 38static gboolean show_debug = FALSE;
39static gboolean resizeable = FALSE; 39static gboolean resizeable = FALSE;
40 40
41static char nohelp_text[] =
42 N_("Sorry, no help available for this option yet.\n");
43
44GtkWidget *main_wnd = NULL; 41GtkWidget *main_wnd = NULL;
45GtkWidget *tree1_w = NULL; // left frame 42GtkWidget *tree1_w = NULL; // left frame
46GtkWidget *tree2_w = NULL; // right frame 43GtkWidget *tree2_w = NULL; // right frame
@@ -462,12 +459,9 @@ static void text_insert_help(struct menu *menu)
462 GtkTextIter start, end; 459 GtkTextIter start, end;
463 const char *prompt = menu_get_prompt(menu); 460 const char *prompt = menu_get_prompt(menu);
464 gchar *name; 461 gchar *name;
465 const char *help = _(nohelp_text); 462 const char *help;
466 463
467 if (!menu->sym) 464 help = _(menu_get_help(menu));
468 help = "";
469 else if (menu->sym->help)
470 help = _(menu->sym->help);
471 465
472 if (menu->sym && menu->sym->name) 466 if (menu->sym && menu->sym->name)
473 name = g_strdup_printf(_(menu->sym->name)); 467 name = g_strdup_printf(_(menu->sym->name));
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c
index 11f7dab94715..6eb72a7f2562 100644
--- a/scripts/kconfig/kxgettext.c
+++ b/scripts/kconfig/kxgettext.c
@@ -170,8 +170,8 @@ void menu_build_message_list(struct menu *menu)
170 menu->file == NULL ? "Root Menu" : menu->file->name, 170 menu->file == NULL ? "Root Menu" : menu->file->name,
171 menu->lineno); 171 menu->lineno);
172 172
173 if (menu->sym != NULL && menu->sym->help != NULL) 173 if (menu->sym != NULL && menu_has_help(menu))
174 message__add(menu->sym->help, menu->sym->name, 174 message__add(menu_get_help(menu), menu->sym->name,
175 menu->file == NULL ? "Root Menu" : menu->file->name, 175 menu->file == NULL ? "Root Menu" : menu->file->name,
176 menu->lineno); 176 menu->lineno);
177 177
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 15030770d1ad..4d09f6ddefe3 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -15,6 +15,8 @@ P(menu_is_visible,bool,(struct menu *menu));
15P(menu_get_prompt,const char *,(struct menu *menu)); 15P(menu_get_prompt,const char *,(struct menu *menu));
16P(menu_get_root_menu,struct menu *,(struct menu *menu)); 16P(menu_get_root_menu,struct menu *,(struct menu *menu));
17P(menu_get_parent_menu,struct menu *,(struct menu *menu)); 17P(menu_get_parent_menu,struct menu *,(struct menu *menu));
18P(menu_has_help,bool,(struct menu *menu));
19P(menu_get_help,const char *,(struct menu *menu));
18 20
19/* symbol.c */ 21/* symbol.c */
20P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); 22P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index d2c2a429887b..bc5854ed6055 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -725,11 +725,11 @@ static void show_help(struct menu *menu)
725 struct gstr help = str_new(); 725 struct gstr help = str_new();
726 struct symbol *sym = menu->sym; 726 struct symbol *sym = menu->sym;
727 727
728 if (sym->help) 728 if (menu_has_help(menu))
729 { 729 {
730 if (sym->name) { 730 if (sym->name) {
731 str_printf(&help, "CONFIG_%s:\n\n", sym->name); 731 str_printf(&help, "CONFIG_%s:\n\n", sym->name);
732 str_append(&help, _(sym->help)); 732 str_append(&help, _(menu_get_help(menu)));
733 str_append(&help, "\n"); 733 str_append(&help, "\n");
734 } 734 }
735 } else { 735 } else {
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index f14aeac67d4f..f9d0d91a3fe4 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -417,3 +417,15 @@ struct menu *menu_get_parent_menu(struct menu *menu)
417 return menu; 417 return menu;
418} 418}
419 419
420bool menu_has_help(struct menu *menu)
421{
422 return menu->help != NULL;
423}
424
425const char *menu_get_help(struct menu *menu)
426{
427 if (menu->help)
428 return menu->help;
429 else
430 return "";
431}
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index f2a23a9c3938..e4eeb59a8c24 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1041,7 +1041,7 @@ void ConfigInfoView::menuInfo(void)
1041 if (showDebug()) 1041 if (showDebug())
1042 debug = debug_info(sym); 1042 debug = debug_info(sym);
1043 1043
1044 help = print_filter(_(sym->help)); 1044 help = print_filter(_(menu_get_help(menu)));
1045 } else if (menu->prompt) { 1045 } else if (menu->prompt) {
1046 head += "<big><b>"; 1046 head += "<big><b>";
1047 head += print_filter(_(menu->prompt->text)); 1047 head += print_filter(_(menu->prompt->text));
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 9a06b6771eee..ec21db77f78b 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -1722,7 +1722,7 @@ yyreduce:
1722 case 83: 1722 case 83:
1723 1723
1724 { 1724 {
1725 current_entry->sym->help = (yyvsp[0].string); 1725 current_entry->help = (yyvsp[0].string);
1726;} 1726;}
1727 break; 1727 break;
1728 1728
@@ -2280,11 +2280,11 @@ void print_symbol(FILE *out, struct menu *menu)
2280 break; 2280 break;
2281 } 2281 }
2282 } 2282 }
2283 if (sym->help) { 2283 if (menu->help) {
2284 int len = strlen(sym->help); 2284 int len = strlen(menu->help);
2285 while (sym->help[--len] == '\n') 2285 while (menu->help[--len] == '\n')
2286 sym->help[len] = 0; 2286 menu->help[len] = 0;
2287 fprintf(out, " help\n%s\n", sym->help); 2287 fprintf(out, " help\n%s\n", menu->help);
2288 } 2288 }
2289 fputc('\n', out); 2289 fputc('\n', out);
2290} 2290}
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 92eb02bdf9c5..79db4cf22a51 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -402,7 +402,7 @@ help_start: T_HELP T_EOL
402 402
403help: help_start T_HELPTEXT 403help: help_start T_HELPTEXT
404{ 404{
405 current_entry->sym->help = $2; 405 current_entry->help = $2;
406}; 406};
407 407
408/* depends option */ 408/* depends option */
@@ -649,11 +649,11 @@ void print_symbol(FILE *out, struct menu *menu)
649 break; 649 break;
650 } 650 }
651 } 651 }
652 if (sym->help) { 652 if (menu->help) {
653 int len = strlen(sym->help); 653 int len = strlen(menu->help);
654 while (sym->help[--len] == '\n') 654 while (menu->help[--len] == '\n')
655 sym->help[len] = 0; 655 menu->help[len] = 0;
656 fprintf(out, " help\n%s\n", sym->help); 656 fprintf(out, " help\n%s\n", menu->help);
657 } 657 }
658 fputc('\n', out); 658 fputc('\n', out);
659} 659}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index f646381dc015..8a09021d8c59 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -290,6 +290,14 @@ static int do_serio_entry(const char *filename,
290 return 1; 290 return 1;
291} 291}
292 292
293/* looks like: "acpi:ACPI0003 or acpi:PNP0C0B" or "acpi:LNXVIDEO" */
294static int do_acpi_entry(const char *filename,
295 struct acpi_device_id *id, char *alias)
296{
297 sprintf(alias, "acpi*:%s:", id->id);
298 return 1;
299}
300
293/* looks like: "pnp:dD" */ 301/* looks like: "pnp:dD" */
294static int do_pnp_entry(const char *filename, 302static int do_pnp_entry(const char *filename,
295 struct pnp_device_id *id, char *alias) 303 struct pnp_device_id *id, char *alias)
@@ -551,6 +559,10 @@ void handle_moddevtable(struct module *mod, struct elf_info *info,
551 do_table(symval, sym->st_size, 559 do_table(symval, sym->st_size,
552 sizeof(struct serio_device_id), "serio", 560 sizeof(struct serio_device_id), "serio",
553 do_serio_entry, mod); 561 do_serio_entry, mod);
562 else if (sym_is(symname, "__mod_acpi_device_table"))
563 do_table(symval, sym->st_size,
564 sizeof(struct acpi_device_id), "acpi",
565 do_acpi_entry, mod);
554 else if (sym_is(symname, "__mod_pnp_device_table")) 566 else if (sym_is(symname, "__mod_pnp_device_table"))
555 do_table(symval, sym->st_size, 567 do_table(symval, sym->st_size,
556 sizeof(struct pnp_device_id), "pnp", 568 sizeof(struct pnp_device_id), "pnp",
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 5ab7914d30ef..6c145d6e89de 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -23,6 +23,8 @@ int have_vmlinux = 0;
23static int all_versions = 0; 23static int all_versions = 0;
24/* If we are modposting external module set to 1 */ 24/* If we are modposting external module set to 1 */
25static int external_module = 0; 25static int external_module = 0;
26/* Warn about section mismatch in vmlinux if set to 1 */
27static int vmlinux_section_warnings = 1;
26/* Only warn about unresolved symbols */ 28/* Only warn about unresolved symbols */
27static int warn_unresolved = 0; 29static int warn_unresolved = 0;
28/* How a symbol is exported */ 30/* How a symbol is exported */
@@ -584,13 +586,61 @@ static int strrcmp(const char *s, const char *sub)
584 return memcmp(s + slen - sublen, sub, sublen); 586 return memcmp(s + slen - sublen, sub, sublen);
585} 587}
586 588
589/*
590 * Functions used only during module init is marked __init and is stored in
591 * a .init.text section. Likewise data is marked __initdata and stored in
592 * a .init.data section.
593 * If this section is one of these sections return 1
594 * See include/linux/init.h for the details
595 */
596static int init_section(const char *name)
597{
598 if (strcmp(name, ".init") == 0)
599 return 1;
600 if (strncmp(name, ".init.", strlen(".init.")) == 0)
601 return 1;
602 return 0;
603}
604
605/*
606 * Functions used only during module exit is marked __exit and is stored in
607 * a .exit.text section. Likewise data is marked __exitdata and stored in
608 * a .exit.data section.
609 * If this section is one of these sections return 1
610 * See include/linux/init.h for the details
611 **/
612static int exit_section(const char *name)
613{
614 if (strcmp(name, ".exit.text") == 0)
615 return 1;
616 if (strcmp(name, ".exit.data") == 0)
617 return 1;
618 return 0;
619
620}
621
622/*
623 * Data sections are named like this:
624 * .data | .data.rel | .data.rel.*
625 * Return 1 if the specified section is a data section
626 */
627static int data_section(const char *name)
628{
629 if ((strcmp(name, ".data") == 0) ||
630 (strcmp(name, ".data.rel") == 0) ||
631 (strncmp(name, ".data.rel.", strlen(".data.rel.")) == 0))
632 return 1;
633 else
634 return 0;
635}
636
587/** 637/**
588 * Whitelist to allow certain references to pass with no warning. 638 * Whitelist to allow certain references to pass with no warning.
589 * 639 *
590 * Pattern 0: 640 * Pattern 0:
591 * Do not warn if funtion/data are marked with __init_refok/__initdata_refok. 641 * Do not warn if funtion/data are marked with __init_refok/__initdata_refok.
592 * The pattern is identified by: 642 * The pattern is identified by:
593 * fromsec = .text.init.refok | .data.init.refok 643 * fromsec = .text.init.refok* | .data.init.refok*
594 * 644 *
595 * Pattern 1: 645 * Pattern 1:
596 * If a module parameter is declared __initdata and permissions=0 646 * If a module parameter is declared __initdata and permissions=0
@@ -608,8 +658,8 @@ static int strrcmp(const char *s, const char *sub)
608 * These functions may often be marked __init and we do not want to 658 * These functions may often be marked __init and we do not want to
609 * warn here. 659 * warn here.
610 * the pattern is identified by: 660 * the pattern is identified by:
611 * tosec = .init.text | .exit.text | .init.data 661 * tosec = init or exit section
612 * fromsec = .data | .data.rel | .data.rel.* 662 * fromsec = data section
613 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer 663 * atsym = *driver, *_template, *_sht, *_ops, *_probe, *probe_one, *_console, *_timer
614 * 664 *
615 * Pattern 3: 665 * Pattern 3:
@@ -625,12 +675,18 @@ static int strrcmp(const char *s, const char *sub)
625 * This pattern is identified by 675 * This pattern is identified by
626 * refsymname = __init_begin, _sinittext, _einittext 676 * refsymname = __init_begin, _sinittext, _einittext
627 * 677 *
678 * Pattern 5:
679 * Xtensa uses literal sections for constants that are accessed PC-relative.
680 * Literal sections may safely reference their text sections.
681 * (Note that the name for the literal section omits any trailing '.text')
682 * tosec = <section>[.text]
683 * fromsec = <section>.literal
628 **/ 684 **/
629static int secref_whitelist(const char *modname, const char *tosec, 685static int secref_whitelist(const char *modname, const char *tosec,
630 const char *fromsec, const char *atsym, 686 const char *fromsec, const char *atsym,
631 const char *refsymname) 687 const char *refsymname)
632{ 688{
633 int f1 = 1, f2 = 1; 689 int len;
634 const char **s; 690 const char **s;
635 const char *pat2sym[] = { 691 const char *pat2sym[] = {
636 "driver", 692 "driver",
@@ -652,36 +708,21 @@ static int secref_whitelist(const char *modname, const char *tosec,
652 }; 708 };
653 709
654 /* Check for pattern 0 */ 710 /* Check for pattern 0 */
655 if ((strcmp(fromsec, ".text.init.refok") == 0) || 711 if ((strncmp(fromsec, ".text.init.refok", strlen(".text.init.refok")) == 0) ||
656 (strcmp(fromsec, ".data.init.refok") == 0)) 712 (strncmp(fromsec, ".data.init.refok", strlen(".data.init.refok")) == 0))
657 return 1; 713 return 1;
658 714
659 /* Check for pattern 1 */ 715 /* Check for pattern 1 */
660 if (strcmp(tosec, ".init.data") != 0) 716 if ((strcmp(tosec, ".init.data") == 0) &&
661 f1 = 0; 717 (strncmp(fromsec, ".data", strlen(".data")) == 0) &&
662 if (strncmp(fromsec, ".data", strlen(".data")) != 0) 718 (strncmp(atsym, "__param", strlen("__param")) == 0))
663 f1 = 0; 719 return 1;
664 if (strncmp(atsym, "__param", strlen("__param")) != 0)
665 f1 = 0;
666
667 if (f1)
668 return f1;
669 720
670 /* Check for pattern 2 */ 721 /* Check for pattern 2 */
671 if ((strcmp(tosec, ".init.text") != 0) && 722 if ((init_section(tosec) || exit_section(tosec)) && data_section(fromsec))
672 (strcmp(tosec, ".exit.text") != 0) && 723 for (s = pat2sym; *s; s++)
673 (strcmp(tosec, ".init.data") != 0)) 724 if (strrcmp(atsym, *s) == 0)
674 f2 = 0; 725 return 1;
675 if ((strcmp(fromsec, ".data") != 0) &&
676 (strcmp(fromsec, ".data.rel") != 0) &&
677 (strncmp(fromsec, ".data.rel.", strlen(".data.rel.")) != 0))
678 f2 = 0;
679
680 for (s = pat2sym; *s; s++)
681 if (strrcmp(atsym, *s) == 0)
682 f1 = 1;
683 if (f1 && f2)
684 return 1;
685 726
686 /* Check for pattern 3 */ 727 /* Check for pattern 3 */
687 if ((strcmp(fromsec, ".text.head") == 0) && 728 if ((strcmp(fromsec, ".text.head") == 0) &&
@@ -694,6 +735,15 @@ static int secref_whitelist(const char *modname, const char *tosec,
694 if (strcmp(refsymname, *s) == 0) 735 if (strcmp(refsymname, *s) == 0)
695 return 1; 736 return 1;
696 737
738 /* Check for pattern 5 */
739 if (strrcmp(tosec, ".text") == 0)
740 len = strlen(tosec) - strlen(".text");
741 else
742 len = strlen(tosec);
743 if ((strncmp(tosec, fromsec, len) == 0) && (strlen(fromsec) > len) &&
744 (strcmp(fromsec + len, ".literal") == 0))
745 return 1;
746
697 return 0; 747 return 0;
698} 748}
699 749
@@ -822,9 +872,9 @@ static void warn_sec_mismatch(const char *modname, const char *fromsec,
822 refsymname = elf->strtab + refsym->st_name; 872 refsymname = elf->strtab + refsym->st_name;
823 873
824 /* check whitelist - we may ignore it */ 874 /* check whitelist - we may ignore it */
825 if (before && 875 if (secref_whitelist(modname, secname, fromsec,
826 secref_whitelist(modname, secname, fromsec, 876 before ? elf->strtab + before->st_name : "",
827 elf->strtab + before->st_name, refsymname)) 877 refsymname))
828 return; 878 return;
829 879
830 if (before && after) { 880 if (before && after) {
@@ -1071,12 +1121,15 @@ static int initexit_section_ref_ok(const char *name)
1071 ".machvec", /* ia64 + powerpc uses these */ 1121 ".machvec", /* ia64 + powerpc uses these */
1072 ".machine.desc", 1122 ".machine.desc",
1073 ".opd", /* See comment [OPD] */ 1123 ".opd", /* See comment [OPD] */
1124 "__dbe_table",
1074 ".parainstructions", 1125 ".parainstructions",
1075 ".pdr", 1126 ".pdr",
1076 ".plt", /* seen on ARCH=um build on x86_64. Harmless */ 1127 ".plt", /* seen on ARCH=um build on x86_64. Harmless */
1077 ".smp_locks", 1128 ".smp_locks",
1078 ".stab", 1129 ".stab",
1079 ".m68k_fixup", 1130 ".m68k_fixup",
1131 ".xt.prop", /* xtensa informational section */
1132 ".xt.lit", /* xtensa informational section */
1080 NULL 1133 NULL
1081 }; 1134 };
1082 /* Start of section names */ 1135 /* Start of section names */
@@ -1106,21 +1159,6 @@ static int initexit_section_ref_ok(const char *name)
1106 return 0; 1159 return 0;
1107} 1160}
1108 1161
1109/**
1110 * Functions used only during module init is marked __init and is stored in
1111 * a .init.text section. Likewise data is marked __initdata and stored in
1112 * a .init.data section.
1113 * If this section is one of these sections return 1
1114 * See include/linux/init.h for the details
1115 **/
1116static int init_section(const char *name)
1117{
1118 if (strcmp(name, ".init") == 0)
1119 return 1;
1120 if (strncmp(name, ".init.", strlen(".init.")) == 0)
1121 return 1;
1122 return 0;
1123}
1124 1162
1125/* 1163/*
1126 * Identify sections from which references to a .init section is OK. 1164 * Identify sections from which references to a .init section is OK.
@@ -1178,23 +1216,6 @@ static int init_section_ref_ok(const char *name)
1178} 1216}
1179 1217
1180/* 1218/*
1181 * Functions used only during module exit is marked __exit and is stored in
1182 * a .exit.text section. Likewise data is marked __exitdata and stored in
1183 * a .exit.data section.
1184 * If this section is one of these sections return 1
1185 * See include/linux/init.h for the details
1186 **/
1187static int exit_section(const char *name)
1188{
1189 if (strcmp(name, ".exit.text") == 0)
1190 return 1;
1191 if (strcmp(name, ".exit.data") == 0)
1192 return 1;
1193 return 0;
1194
1195}
1196
1197/*
1198 * Identify sections from which references to a .exit section is OK. 1219 * Identify sections from which references to a .exit section is OK.
1199 */ 1220 */
1200static int exit_section_ref_ok(const char *name) 1221static int exit_section_ref_ok(const char *name)
@@ -1257,8 +1278,10 @@ static void read_symbols(char *modname)
1257 handle_modversions(mod, &info, sym, symname); 1278 handle_modversions(mod, &info, sym, symname);
1258 handle_moddevtable(mod, &info, sym, symname); 1279 handle_moddevtable(mod, &info, sym, symname);
1259 } 1280 }
1260 check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok); 1281 if (is_vmlinux(modname) && vmlinux_section_warnings) {
1261 check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok); 1282 check_sec_ref(mod, modname, &info, init_section, init_section_ref_ok);
1283 check_sec_ref(mod, modname, &info, exit_section, exit_section_ref_ok);
1284 }
1262 1285
1263 version = get_modinfo(info.modinfo, info.modinfo_len, "version"); 1286 version = get_modinfo(info.modinfo, info.modinfo_len, "version");
1264 if (version) 1287 if (version)
@@ -1626,7 +1649,7 @@ int main(int argc, char **argv)
1626 int opt; 1649 int opt;
1627 int err; 1650 int err;
1628 1651
1629 while ((opt = getopt(argc, argv, "i:I:mo:aw")) != -1) { 1652 while ((opt = getopt(argc, argv, "i:I:mso:aw")) != -1) {
1630 switch(opt) { 1653 switch(opt) {
1631 case 'i': 1654 case 'i':
1632 kernel_read = optarg; 1655 kernel_read = optarg;
@@ -1644,6 +1667,9 @@ int main(int argc, char **argv)
1644 case 'a': 1667 case 'a':
1645 all_versions = 1; 1668 all_versions = 1;
1646 break; 1669 break;
1670 case 's':
1671 vmlinux_section_warnings = 0;
1672 break;
1647 case 'w': 1673 case 'w':
1648 warn_unresolved = 1; 1674 warn_unresolved = 1;
1649 break; 1675 break;
diff --git a/scripts/ver_linux b/scripts/ver_linux
index 72876dfadc8a..8f8df93141a9 100755
--- a/scripts/ver_linux
+++ b/scripts/ver_linux
@@ -66,8 +66,8 @@ showmount --version 2>&1 | grep nfs-utils | awk \
66'NR==1{print "nfs-utils ", $NF}' 66'NR==1{print "nfs-utils ", $NF}'
67 67
68ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \ 68ls -l `ldd /bin/sh | awk '/libc/{print $3}'` | sed \
69-e 's/\.so$//' | awk -F'[.-]' '{print "Linux C Library " \ 69-e 's/\.so$//' | sed -e 's/>//' | \
70$(NF-2)"."$(NF-1)"."$NF}' 70awk -F'[.-]' '{print "Linux C Library "$(NF-1)"."$NF}'
71 71
72ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \ 72ldd -v > /dev/null 2>&1 && ldd -v || ldd --version |head -n 1 | awk \
73'NR==1{print "Dynamic linker (ldd) ", $NF}' 73'NR==1{print "Dynamic linker (ldd) ", $NF}'