aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.build3
-rw-r--r--scripts/Makefile.lib24
-rw-r--r--scripts/Makefile.modpost8
-rw-r--r--scripts/basic/fixdep.c93
-rwxr-xr-xscripts/checkpatch.pl34
-rwxr-xr-xscripts/decodecode8
-rw-r--r--scripts/genksyms/genksyms.c18
-rwxr-xr-xscripts/get_maintainer.pl2
-rw-r--r--scripts/kconfig/menu.c31
-rw-r--r--scripts/kconfig/streamline_config.pl26
-rw-r--r--scripts/link-vmlinux.sh5
-rw-r--r--scripts/mod/devicetable-offsets.c3
-rw-r--r--scripts/mod/file2alias.c12
-rw-r--r--scripts/mod/modpost.c94
14 files changed, 239 insertions, 122 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 0e801c3cdaf8..d5d859c80729 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -211,7 +211,8 @@ $(obj)/%.i: $(src)/%.c FORCE
211 211
212cmd_gensymtypes = \ 212cmd_gensymtypes = \
213 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \ 213 $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
214 $(GENKSYMS) $(if $(1), -T $(2)) -a $(ARCH) \ 214 $(GENKSYMS) $(if $(1), -T $(2)) \
215 $(patsubst y,-s _,$(CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX)) \
215 $(if $(KBUILD_PRESERVE),-p) \ 216 $(if $(KBUILD_PRESERVE),-p) \
216 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null)) 217 -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
217 218
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 07125e697d7a..51bb3de680b6 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -119,13 +119,6 @@ _c_flags += $(if $(patsubst n%,, \
119 $(CFLAGS_GCOV)) 119 $(CFLAGS_GCOV))
120endif 120endif
121 121
122ifdef CONFIG_SYMBOL_PREFIX
123_sym_flags = -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
124_cpp_flags += $(_sym_flags)
125_a_flags += $(_sym_flags)
126endif
127
128
129# If building the kernel in a separate objtree expand all occurrences 122# If building the kernel in a separate objtree expand all occurrences
130# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). 123# of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/').
131 124
@@ -156,9 +149,9 @@ cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) \
156 149
157ld_flags = $(LDFLAGS) $(ldflags-y) 150ld_flags = $(LDFLAGS) $(ldflags-y)
158 151
159dtc_cpp_flags = -Wp,-MD,$(depfile) -nostdinc \ 152dtc_cpp_flags = -Wp,-MD,$(depfile).pre -nostdinc \
160 -I$(srctree)/arch/$(SRCARCH)/boot/dts \ 153 -I$(srctree)/arch/$(SRCARCH)/boot/dts \
161 -I$(srctree)/arch/$(SRCARCH)/include/dts \ 154 -I$(srctree)/arch/$(SRCARCH)/boot/dts/include \
162 -undef -D__DTS__ 155 -undef -D__DTS__
163 156
164# Finds the multi-part object the current object will be linked into 157# Finds the multi-part object the current object will be linked into
@@ -269,20 +262,17 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
269 $(call cmd,dt_S_dtb) 262 $(call cmd,dt_S_dtb)
270 263
271quiet_cmd_dtc = DTC $@ 264quiet_cmd_dtc = DTC $@
272cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $< 265cmd_dtc = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
266 $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 \
267 -i $(srctree)/arch/$(SRCARCH)/boot/dts $(DTC_FLAGS) \
268 -d $(depfile).dtc $(dtc-tmp) ; \
269 cat $(depfile).pre $(depfile).dtc > $(depfile)
273 270
274$(obj)/%.dtb: $(src)/%.dts FORCE 271$(obj)/%.dtb: $(src)/%.dts FORCE
275 $(call if_changed_dep,dtc) 272 $(call if_changed_dep,dtc)
276 273
277dtc-tmp = $(subst $(comma),_,$(dot-target).dts) 274dtc-tmp = $(subst $(comma),_,$(dot-target).dts)
278 275
279quiet_cmd_dtc_cpp = DTC+CPP $@
280cmd_dtc_cpp = $(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $< ; \
281 $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) $(dtc-tmp)
282
283$(obj)/%.dtb: $(src)/%.dtsp FORCE
284 $(call if_changed_dep,dtc_cpp)
285
286# Bzip2 276# Bzip2
287# --------------------------------------------------------------------------- 277# ---------------------------------------------------------------------------
288 278
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index cf82c832458f..8dcdca27d836 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -60,7 +60,8 @@ kernelsymfile := $(objtree)/Module.symvers
60modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers 60modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers
61 61
62# Step 1), find all modules listed in $(MODVERDIR)/ 62# Step 1), find all modules listed in $(MODVERDIR)/
63__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) 63MODLISTCMD := find $(MODVERDIR) -name '*.mod' | xargs -r grep -h '\.ko$$' | sort -u
64__modules := $(shell $(MODLISTCMD))
64modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) 65modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o)))
65 66
66# Stop after building .o files if NOFINAL is set. Makes compile tests quicker 67# Stop after building .o files if NOFINAL is set. Makes compile tests quicker
@@ -78,12 +79,13 @@ modpost = scripts/mod/modpost \
78 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ 79 $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \
79 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) 80 $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w)
80 81
82# We can go over command line length here, so be careful.
81quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules 83quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules
82 cmd_modpost = $(modpost) -s 84 cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) -s -T -
83 85
84PHONY += __modpost 86PHONY += __modpost
85__modpost: $(modules:.ko=.o) FORCE 87__modpost: $(modules:.ko=.o) FORCE
86 $(call cmd,modpost) $(wildcard vmlinux) $(filter-out FORCE,$^) 88 $(call cmd,modpost) $(wildcard vmlinux)
87 89
88quiet_cmd_kernel-mod = MODPOST $@ 90quiet_cmd_kernel-mod = MODPOST $@
89 cmd_kernel-mod = $(modpost) $@ 91 cmd_kernel-mod = $(modpost) $@
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 7f6425e24ce3..078fe1d64e7d 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -320,49 +320,78 @@ static void parse_dep_file(void *map, size_t len)
320 char *end = m + len; 320 char *end = m + len;
321 char *p; 321 char *p;
322 char s[PATH_MAX]; 322 char s[PATH_MAX];
323 int first; 323 int is_target;
324 324 int saw_any_target = 0;
325 p = strchr(m, ':'); 325 int is_first_dep = 0;
326 if (!p) {
327 fprintf(stderr, "fixdep: parse error\n");
328 exit(1);
329 }
330 memcpy(s, m, p-m); s[p-m] = 0;
331 m = p+1;
332 326
333 clear_config(); 327 clear_config();
334 328
335 first = 1;
336 while (m < end) { 329 while (m < end) {
330 /* Skip any "white space" */
337 while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) 331 while (m < end && (*m == ' ' || *m == '\\' || *m == '\n'))
338 m++; 332 m++;
333 /* Find next "white space" */
339 p = m; 334 p = m;
340 while (p < end && *p != ' ') p++; 335 while (p < end && *p != ' ' && *p != '\\' && *p != '\n')
341 if (p == end) {
342 do p--; while (!isalnum(*p));
343 p++; 336 p++;
337 /* Is the token we found a target name? */
338 is_target = (*(p-1) == ':');
339 /* Don't write any target names into the dependency file */
340 if (is_target) {
341 /* The /next/ file is the first dependency */
342 is_first_dep = 1;
343 } else {
344 /* Save this token/filename */
345 memcpy(s, m, p-m);
346 s[p - m] = 0;
347
348 /* Ignore certain dependencies */
349 if (strrcmp(s, "include/generated/autoconf.h") &&
350 strrcmp(s, "arch/um/include/uml-config.h") &&
351 strrcmp(s, "include/linux/kconfig.h") &&
352 strrcmp(s, ".ver")) {
353 /*
354 * Do not list the source file as dependency,
355 * so that kbuild is not confused if a .c file
356 * is rewritten into .S or vice versa. Storing
357 * it in source_* is needed for modpost to
358 * compute srcversions.
359 */
360 if (is_first_dep) {
361 /*
362 * If processing the concatenation of
363 * multiple dependency files, only
364 * process the first target name, which
365 * will be the original source name,
366 * and ignore any other target names,
367 * which will be intermediate temporary
368 * files.
369 */
370 if (!saw_any_target) {
371 saw_any_target = 1;
372 printf("source_%s := %s\n\n",
373 target, s);
374 printf("deps_%s := \\\n",
375 target);
376 }
377 is_first_dep = 0;
378 } else
379 printf(" %s \\\n", s);
380 do_config_file(s);
381 }
344 } 382 }
345 memcpy(s, m, p-m); s[p-m] = 0; 383 /*
346 if (strrcmp(s, "include/generated/autoconf.h") && 384 * Start searching for next token immediately after the first
347 strrcmp(s, "arch/um/include/uml-config.h") && 385 * "whitespace" character that follows this token.
348 strrcmp(s, "include/linux/kconfig.h") && 386 */
349 strrcmp(s, ".ver")) {
350 /*
351 * Do not list the source file as dependency, so that
352 * kbuild is not confused if a .c file is rewritten
353 * into .S or vice versa. Storing it in source_* is
354 * needed for modpost to compute srcversions.
355 */
356 if (first) {
357 printf("source_%s := %s\n\n", target, s);
358 printf("deps_%s := \\\n", target);
359 } else
360 printf(" %s \\\n", s);
361 do_config_file(s);
362 }
363 first = 0;
364 m = p + 1; 387 m = p + 1;
365 } 388 }
389
390 if (!saw_any_target) {
391 fprintf(stderr, "fixdep: parse error; no targets found\n");
392 exit(1);
393 }
394
366 printf("\n%s: $(deps_%s)\n\n", target, target); 395 printf("\n%s: $(deps_%s)\n\n", target, target);
367 printf("$(deps_%s):\n", target); 396 printf("$(deps_%s):\n", target);
368} 397}
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b28cc384a5bc..b954de58304f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -281,6 +281,7 @@ our $signature_tags = qr{(?xi:
281 Tested-by:| 281 Tested-by:|
282 Reviewed-by:| 282 Reviewed-by:|
283 Reported-by:| 283 Reported-by:|
284 Suggested-by:|
284 To:| 285 To:|
285 Cc: 286 Cc:
286)}; 287)};
@@ -628,6 +629,13 @@ sub sanitise_line {
628 return $res; 629 return $res;
629} 630}
630 631
632sub get_quoted_string {
633 my ($line, $rawline) = @_;
634
635 return "" if ($line !~ m/(\"[X]+\")/g);
636 return substr($rawline, $-[0], $+[0] - $-[0]);
637}
638
631sub ctx_statement_block { 639sub ctx_statement_block {
632 my ($linenr, $remain, $off) = @_; 640 my ($linenr, $remain, $off) = @_;
633 my $line = $linenr - 1; 641 my $line = $linenr - 1;
@@ -1576,7 +1584,8 @@ sub process {
1576# Check for incorrect file permissions 1584# Check for incorrect file permissions
1577 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) { 1585 if ($line =~ /^new (file )?mode.*[7531]\d{0,2}$/) {
1578 my $permhere = $here . "FILE: $realfile\n"; 1586 my $permhere = $here . "FILE: $realfile\n";
1579 if ($realfile =~ /(Makefile|Kconfig|\.c|\.h|\.S|\.tmpl)$/) { 1587 if ($realfile !~ m@scripts/@ &&
1588 $realfile !~ /\.(py|pl|awk|sh)$/) {
1580 ERROR("EXECUTE_PERMISSIONS", 1589 ERROR("EXECUTE_PERMISSIONS",
1581 "do not set execute permissions for source files\n" . $permhere); 1590 "do not set execute permissions for source files\n" . $permhere);
1582 } 1591 }
@@ -2514,8 +2523,8 @@ sub process {
2514 2523
2515# check for whitespace before a non-naked semicolon 2524# check for whitespace before a non-naked semicolon
2516 if ($line =~ /^\+.*\S\s+;/) { 2525 if ($line =~ /^\+.*\S\s+;/) {
2517 CHK("SPACING", 2526 WARN("SPACING",
2518 "space prohibited before semicolon\n" . $herecurr); 2527 "space prohibited before semicolon\n" . $herecurr);
2519 } 2528 }
2520 2529
2521# Check operator spacing. 2530# Check operator spacing.
@@ -3016,6 +3025,7 @@ sub process {
3016 $dstat !~ /^'X'$/ && # character constants 3025 $dstat !~ /^'X'$/ && # character constants
3017 $dstat !~ /$exceptions/ && 3026 $dstat !~ /$exceptions/ &&
3018 $dstat !~ /^\.$Ident\s*=/ && # .foo = 3027 $dstat !~ /^\.$Ident\s*=/ && # .foo =
3028 $dstat !~ /^(?:\#\s*$Ident|\#\s*$Constant)\s*$/ && # stringification #foo
3019 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...) 3029 $dstat !~ /^do\s*$Constant\s*while\s*$Constant;?$/ && # do {...} while (...); // do {...} while (...)
3020 $dstat !~ /^for\s*$Constant$/ && # for (...) 3030 $dstat !~ /^for\s*$Constant$/ && # for (...)
3021 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar() 3031 $dstat !~ /^for\s*$Constant\s+(?:$Ident|-?$Constant)$/ && # for (...) bar()
@@ -3220,7 +3230,7 @@ sub process {
3220 } 3230 }
3221 3231
3222# check for unnecessary blank lines around braces 3232# check for unnecessary blank lines around braces
3223 if (($line =~ /^..*}\s*$/ && $prevline =~ /^.\s*$/)) { 3233 if (($line =~ /^.\s*}\s*$/ && $prevline =~ /^.\s*$/)) {
3224 CHK("BRACES", 3234 CHK("BRACES",
3225 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev); 3235 "Blank lines aren't necessary before a close brace '}'\n" . $hereprev);
3226 } 3236 }
@@ -3372,6 +3382,15 @@ sub process {
3372 "struct spinlock should be spinlock_t\n" . $herecurr); 3382 "struct spinlock should be spinlock_t\n" . $herecurr);
3373 } 3383 }
3374 3384
3385# check for seq_printf uses that could be seq_puts
3386 if ($line =~ /\bseq_printf\s*\(/) {
3387 my $fmt = get_quoted_string($line, $rawline);
3388 if ($fmt !~ /[^\\]\%/) {
3389 WARN("PREFER_SEQ_PUTS",
3390 "Prefer seq_puts to seq_printf\n" . $herecurr);
3391 }
3392 }
3393
3375# Check for misused memsets 3394# Check for misused memsets
3376 if ($^V && $^V ge 5.10.0 && 3395 if ($^V && $^V ge 5.10.0 &&
3377 defined $stat && 3396 defined $stat &&
@@ -3476,6 +3495,13 @@ sub process {
3476 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); 3495 "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr);
3477 } 3496 }
3478 3497
3498# check for krealloc arg reuse
3499 if ($^V && $^V ge 5.10.0 &&
3500 $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
3501 WARN("KREALLOC_ARG_REUSE",
3502 "Reusing the krealloc arg is almost always a bug\n" . $herecurr);
3503 }
3504
3479# check for alloc argument mismatch 3505# check for alloc argument mismatch
3480 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) { 3506 if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) {
3481 WARN("ALLOC_ARRAY_ARGS", 3507 WARN("ALLOC_ARRAY_ARGS",
diff --git a/scripts/decodecode b/scripts/decodecode
index 4f8248d5a11f..d8824f37acce 100755
--- a/scripts/decodecode
+++ b/scripts/decodecode
@@ -89,10 +89,16 @@ echo $code >> $T.s
89disas $T 89disas $T
90cat $T.dis >> $T.aa 90cat $T.dis >> $T.aa
91 91
92# (lines of whole $T.oo) - (lines of $T.aa, i.e. "Code starting") + 3,
93# i.e. the title + the "===..=" line (sed is counting from 1, 0 address is
94# special)
95faultlinenum=$(( $(wc -l $T.oo | cut -d" " -f1) - \
96 $(wc -l $T.aa | cut -d" " -f1) + 3))
97
92faultline=`cat $T.dis | head -1 | cut -d":" -f2-` 98faultline=`cat $T.dis | head -1 | cut -d":" -f2-`
93faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'` 99faultline=`echo "$faultline" | sed -e 's/\[/\\\[/g; s/\]/\\\]/g'`
94 100
95cat $T.oo | sed -e "s/\($faultline\)/\*\1 <-- trapping instruction/g" 101cat $T.oo | sed -e "${faultlinenum}s/^\(.*:\)\(.*\)/\1\*\2\t\t<-- trapping instruction/"
96echo 102echo
97cat $T.aa 103cat $T.aa
98cleanup 104cleanup
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index d25e4a118d37..88632df4381b 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -45,7 +45,6 @@ int in_source_file;
45 45
46static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types, 46static int flag_debug, flag_dump_defs, flag_reference, flag_dump_types,
47 flag_preserve, flag_warnings; 47 flag_preserve, flag_warnings;
48static const char *arch = "";
49static const char *mod_prefix = ""; 48static const char *mod_prefix = "";
50 49
51static int errors; 50static int errors;
@@ -731,7 +730,7 @@ static void genksyms_usage(void)
731{ 730{
732 fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n" 731 fputs("Usage:\n" "genksyms [-adDTwqhV] > /path/to/.tmp_obj.ver\n" "\n"
733#ifdef __GNU_LIBRARY__ 732#ifdef __GNU_LIBRARY__
734 " -a, --arch Select architecture\n" 733 " -s, --symbol-prefix Select symbol prefix\n"
735 " -d, --debug Increment the debug level (repeatable)\n" 734 " -d, --debug Increment the debug level (repeatable)\n"
736 " -D, --dump Dump expanded symbol defs (for debugging only)\n" 735 " -D, --dump Dump expanded symbol defs (for debugging only)\n"
737 " -r, --reference file Read reference symbols from a file\n" 736 " -r, --reference file Read reference symbols from a file\n"
@@ -742,7 +741,7 @@ static void genksyms_usage(void)
742 " -h, --help Print this message\n" 741 " -h, --help Print this message\n"
743 " -V, --version Print the release version\n" 742 " -V, --version Print the release version\n"
744#else /* __GNU_LIBRARY__ */ 743#else /* __GNU_LIBRARY__ */
745 " -a Select architecture\n" 744 " -s Select symbol prefix\n"
746 " -d Increment the debug level (repeatable)\n" 745 " -d Increment the debug level (repeatable)\n"
747 " -D Dump expanded symbol defs (for debugging only)\n" 746 " -D Dump expanded symbol defs (for debugging only)\n"
748 " -r file Read reference symbols from a file\n" 747 " -r file Read reference symbols from a file\n"
@@ -763,7 +762,7 @@ int main(int argc, char **argv)
763 762
764#ifdef __GNU_LIBRARY__ 763#ifdef __GNU_LIBRARY__
765 struct option long_opts[] = { 764 struct option long_opts[] = {
766 {"arch", 1, 0, 'a'}, 765 {"symbol-prefix", 1, 0, 's'},
767 {"debug", 0, 0, 'd'}, 766 {"debug", 0, 0, 'd'},
768 {"warnings", 0, 0, 'w'}, 767 {"warnings", 0, 0, 'w'},
769 {"quiet", 0, 0, 'q'}, 768 {"quiet", 0, 0, 'q'},
@@ -776,14 +775,14 @@ int main(int argc, char **argv)
776 {0, 0, 0, 0} 775 {0, 0, 0, 0}
777 }; 776 };
778 777
779 while ((o = getopt_long(argc, argv, "a:dwqVDr:T:ph", 778 while ((o = getopt_long(argc, argv, "s:dwqVDr:T:ph",
780 &long_opts[0], NULL)) != EOF) 779 &long_opts[0], NULL)) != EOF)
781#else /* __GNU_LIBRARY__ */ 780#else /* __GNU_LIBRARY__ */
782 while ((o = getopt(argc, argv, "a:dwqVDr:T:ph")) != EOF) 781 while ((o = getopt(argc, argv, "s:dwqVDr:T:ph")) != EOF)
783#endif /* __GNU_LIBRARY__ */ 782#endif /* __GNU_LIBRARY__ */
784 switch (o) { 783 switch (o) {
785 case 'a': 784 case 's':
786 arch = optarg; 785 mod_prefix = optarg;
787 break; 786 break;
788 case 'd': 787 case 'd':
789 flag_debug++; 788 flag_debug++;
@@ -826,9 +825,6 @@ int main(int argc, char **argv)
826 genksyms_usage(); 825 genksyms_usage();
827 return 1; 826 return 1;
828 } 827 }
829 if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0) ||
830 (strcmp(arch, "metag") == 0))
831 mod_prefix = "_";
832 { 828 {
833 extern int yydebug; 829 extern int yydebug;
834 extern int yy_flex_debug; 830 extern int yy_flex_debug;
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ce4cc837b748..5e4fb144a04f 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -611,7 +611,7 @@ sub get_maintainers {
611 $hash{$tvi} = $value_pd; 611 $hash{$tvi} = $value_pd;
612 } 612 }
613 } 613 }
614 } elsif ($type eq 'K') { 614 } elsif ($type eq 'N') {
615 if ($file =~ m/$value/x) { 615 if ($file =~ m/$value/x) {
616 $hash{$tvi} = 0; 616 $hash{$tvi} = 0;
617 } 617 }
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index f3bffa309333..b5c7d90df9df 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -515,13 +515,6 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
515 struct jump_key *jump; 515 struct jump_key *jump;
516 516
517 str_printf(r, _("Prompt: %s\n"), _(prop->text)); 517 str_printf(r, _("Prompt: %s\n"), _(prop->text));
518 str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
519 prop->menu->lineno);
520 if (!expr_is_yes(prop->visible.expr)) {
521 str_append(r, _(" Depends on: "));
522 expr_gstr_print(prop->visible.expr, r);
523 str_append(r, "\n");
524 }
525 menu = prop->menu->parent; 518 menu = prop->menu->parent;
526 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { 519 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
527 bool accessible = menu_is_visible(menu); 520 bool accessible = menu_is_visible(menu);
@@ -572,6 +565,18 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
572} 565}
573 566
574/* 567/*
568 * get peoperty of type P_SYMBOL
569 */
570static struct property *get_symbol_prop(struct symbol *sym)
571{
572 struct property *prop = NULL;
573
574 for_all_properties(sym, prop, P_SYMBOL)
575 break;
576 return prop;
577}
578
579/*
575 * head is optional and may be NULL 580 * head is optional and may be NULL
576 */ 581 */
577void get_symbol_str(struct gstr *r, struct symbol *sym, 582void get_symbol_str(struct gstr *r, struct symbol *sym,
@@ -595,6 +600,18 @@ void get_symbol_str(struct gstr *r, struct symbol *sym,
595 } 600 }
596 for_all_prompts(sym, prop) 601 for_all_prompts(sym, prop)
597 get_prompt_str(r, prop, head); 602 get_prompt_str(r, prop, head);
603
604 prop = get_symbol_prop(sym);
605 if (prop) {
606 str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
607 prop->menu->lineno);
608 if (!expr_is_yes(prop->visible.expr)) {
609 str_append(r, _(" Depends on: "));
610 expr_gstr_print(prop->visible.expr, r);
611 str_append(r, "\n");
612 }
613 }
614
598 hit = false; 615 hit = false;
599 for_all_properties(sym, prop, P_SELECT) { 616 for_all_properties(sym, prop, P_SELECT) {
600 if (!hit) { 617 if (!hit) {
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index 33689396953a..4606cdfb859d 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -156,7 +156,6 @@ sub read_kconfig {
156 156
157 my $state = "NONE"; 157 my $state = "NONE";
158 my $config; 158 my $config;
159 my @kconfigs;
160 159
161 my $cont = 0; 160 my $cont = 0;
162 my $line; 161 my $line;
@@ -190,7 +189,13 @@ sub read_kconfig {
190 189
191 # collect any Kconfig sources 190 # collect any Kconfig sources
192 if (/^source\s*"(.*)"/) { 191 if (/^source\s*"(.*)"/) {
193 $kconfigs[$#kconfigs+1] = $1; 192 my $kconfig = $1;
193 # prevent reading twice.
194 if (!defined($read_kconfigs{$kconfig})) {
195 $read_kconfigs{$kconfig} = 1;
196 read_kconfig($kconfig);
197 }
198 next;
194 } 199 }
195 200
196 # configs found 201 # configs found
@@ -250,14 +255,6 @@ sub read_kconfig {
250 } 255 }
251 } 256 }
252 close($kinfile); 257 close($kinfile);
253
254 # read in any configs that were found.
255 foreach my $kconfig (@kconfigs) {
256 if (!defined($read_kconfigs{$kconfig})) {
257 $read_kconfigs{$kconfig} = 1;
258 read_kconfig($kconfig);
259 }
260 }
261} 258}
262 259
263if ($kconfig) { 260if ($kconfig) {
@@ -396,6 +393,15 @@ foreach my $module (keys(%modules)) {
396 foreach my $conf (@arr) { 393 foreach my $conf (@arr) {
397 $configs{$conf} = $module; 394 $configs{$conf} = $module;
398 dprint "$conf added by direct ($module)\n"; 395 dprint "$conf added by direct ($module)\n";
396 if ($debugprint) {
397 my $c=$conf;
398 $c =~ s/^CONFIG_//;
399 if (defined($depends{$c})) {
400 dprint " deps = $depends{$c}\n";
401 } else {
402 dprint " no deps\n";
403 }
404 }
399 } 405 }
400 } else { 406 } else {
401 # Most likely, someone has a custom (binary?) module loaded. 407 # Most likely, someone has a custom (binary?) module loaded.
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 3d569d6022c2..014994936b1c 100644
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -74,9 +74,8 @@ kallsyms()
74 info KSYM ${2} 74 info KSYM ${2}
75 local kallsymopt; 75 local kallsymopt;
76 76
77 if [ -n "${CONFIG_SYMBOL_PREFIX}" ]; then 77 if [ -n "${CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX}" ]; then
78 kallsymopt="${kallsymopt} \ 78 kallsymopt="${kallsymopt} --symbol-prefix=_"
79 --symbol-prefix=${CONFIG_SYMBOL_PREFIX}"
80 fi 79 fi
81 80
82 if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then 81 if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c
index b45260bfeaa0..e66d4d258e1a 100644
--- a/scripts/mod/devicetable-offsets.c
+++ b/scripts/mod/devicetable-offsets.c
@@ -174,5 +174,8 @@ int main(void)
174 DEVID_FIELD(x86_cpu_id, model); 174 DEVID_FIELD(x86_cpu_id, model);
175 DEVID_FIELD(x86_cpu_id, vendor); 175 DEVID_FIELD(x86_cpu_id, vendor);
176 176
177 DEVID(mei_cl_device_id);
178 DEVID_FIELD(mei_cl_device_id, name);
179
177 return 0; 180 return 0;
178} 181}
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c
index 771ac17f635d..45f9a3377dcd 100644
--- a/scripts/mod/file2alias.c
+++ b/scripts/mod/file2alias.c
@@ -1133,6 +1133,18 @@ static int do_x86cpu_entry(const char *filename, void *symval,
1133} 1133}
1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry); 1134ADD_TO_DEVTABLE("x86cpu", x86_cpu_id, do_x86cpu_entry);
1135 1135
1136/* Looks like: mei:S */
1137static int do_mei_entry(const char *filename, void *symval,
1138 char *alias)
1139{
1140 DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
1141
1142 sprintf(alias, MEI_CL_MODULE_PREFIX "%s", *name);
1143
1144 return 1;
1145}
1146ADD_TO_DEVTABLE("mei", mei_cl_device_id, do_mei_entry);
1147
1136/* Does namelen bytes of name exactly match the symbol? */ 1148/* Does namelen bytes of name exactly match the symbol? */
1137static bool sym_is(const char *name, unsigned namelen, const char *symbol) 1149static bool sym_is(const char *name, unsigned namelen, const char *symbol)
1138{ 1150{
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 78b30c1548e9..a4be8e112bb6 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -15,17 +15,12 @@
15#include <stdio.h> 15#include <stdio.h>
16#include <ctype.h> 16#include <ctype.h>
17#include <string.h> 17#include <string.h>
18#include <limits.h>
19#include <stdbool.h>
18#include "modpost.h" 20#include "modpost.h"
19#include "../../include/generated/autoconf.h" 21#include "../../include/generated/autoconf.h"
20#include "../../include/linux/license.h" 22#include "../../include/linux/license.h"
21 23#include "../../include/linux/export.h"
22/* Some toolchains use a `_' prefix for all user symbols. */
23#ifdef CONFIG_SYMBOL_PREFIX
24#define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
25#else
26#define MODULE_SYMBOL_PREFIX ""
27#endif
28
29 24
30/* Are we using CONFIG_MODVERSIONS? */ 25/* Are we using CONFIG_MODVERSIONS? */
31int modversions = 0; 26int modversions = 0;
@@ -85,6 +80,14 @@ PRINTF void merror(const char *fmt, ...)
85 va_end(arglist); 80 va_end(arglist);
86} 81}
87 82
83static inline bool strends(const char *str, const char *postfix)
84{
85 if (strlen(str) < strlen(postfix))
86 return false;
87
88 return strcmp(str + strlen(str) - strlen(postfix), postfix) == 0;
89}
90
88static int is_vmlinux(const char *modname) 91static int is_vmlinux(const char *modname)
89{ 92{
90 const char *myname; 93 const char *myname;
@@ -120,22 +123,20 @@ static struct module *find_module(char *modname)
120 return mod; 123 return mod;
121} 124}
122 125
123static struct module *new_module(char *modname) 126static struct module *new_module(const char *modname)
124{ 127{
125 struct module *mod; 128 struct module *mod;
126 char *p, *s; 129 char *p;
127 130
128 mod = NOFAIL(malloc(sizeof(*mod))); 131 mod = NOFAIL(malloc(sizeof(*mod)));
129 memset(mod, 0, sizeof(*mod)); 132 memset(mod, 0, sizeof(*mod));
130 p = NOFAIL(strdup(modname)); 133 p = NOFAIL(strdup(modname));
131 134
132 /* strip trailing .o */ 135 /* strip trailing .o */
133 s = strrchr(p, '.'); 136 if (strends(p, ".o")) {
134 if (s != NULL) 137 p[strlen(p) - 2] = '\0';
135 if (strcmp(s, ".o") == 0) { 138 mod->is_dot_o = 1;
136 *s = '\0'; 139 }
137 mod->is_dot_o = 1;
138 }
139 140
140 /* add to list */ 141 /* add to list */
141 mod->name = p; 142 mod->name = p;
@@ -562,7 +563,7 @@ static void parse_elf_finish(struct elf_info *info)
562static int ignore_undef_symbol(struct elf_info *info, const char *symname) 563static int ignore_undef_symbol(struct elf_info *info, const char *symname)
563{ 564{
564 /* ignore __this_module, it will be resolved shortly */ 565 /* ignore __this_module, it will be resolved shortly */
565 if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) 566 if (strcmp(symname, VMLINUX_SYMBOL_STR(__this_module)) == 0)
566 return 1; 567 return 1;
567 /* ignore global offset table */ 568 /* ignore global offset table */
568 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0) 569 if (strcmp(symname, "_GLOBAL_OFFSET_TABLE_") == 0)
@@ -583,8 +584,8 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname)
583 return 0; 584 return 0;
584} 585}
585 586
586#define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" 587#define CRC_PFX VMLINUX_SYMBOL_STR(__crc_)
587#define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" 588#define KSYMTAB_PFX VMLINUX_SYMBOL_STR(__ksymtab_)
588 589
589static void handle_modversions(struct module *mod, struct elf_info *info, 590static void handle_modversions(struct module *mod, struct elf_info *info,
590 Elf_Sym *sym, const char *symname) 591 Elf_Sym *sym, const char *symname)
@@ -637,14 +638,15 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
637 } 638 }
638#endif 639#endif
639 640
640 if (memcmp(symname, MODULE_SYMBOL_PREFIX, 641#ifdef CONFIG_HAVE_UNDERSCORE_SYMBOL_PREFIX
641 strlen(MODULE_SYMBOL_PREFIX)) == 0) { 642 if (symname[0] != '_')
642 mod->unres = 643 break;
643 alloc_symbol(symname + 644 else
644 strlen(MODULE_SYMBOL_PREFIX), 645 symname++;
645 ELF_ST_BIND(sym->st_info) == STB_WEAK, 646#endif
646 mod->unres); 647 mod->unres = alloc_symbol(symname,
647 } 648 ELF_ST_BIND(sym->st_info) == STB_WEAK,
649 mod->unres);
648 break; 650 break;
649 default: 651 default:
650 /* All exported symbols */ 652 /* All exported symbols */
@@ -652,9 +654,9 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
652 sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, 654 sym_add_exported(symname + strlen(KSYMTAB_PFX), mod,
653 export); 655 export);
654 } 656 }
655 if (strcmp(symname, MODULE_SYMBOL_PREFIX "init_module") == 0) 657 if (strcmp(symname, VMLINUX_SYMBOL_STR(init_module)) == 0)
656 mod->has_init = 1; 658 mod->has_init = 1;
657 if (strcmp(symname, MODULE_SYMBOL_PREFIX "cleanup_module") == 0) 659 if (strcmp(symname, VMLINUX_SYMBOL_STR(cleanup_module)) == 0)
658 mod->has_cleanup = 1; 660 mod->has_cleanup = 1;
659 break; 661 break;
660 } 662 }
@@ -1762,6 +1764,27 @@ static void read_symbols(char *modname)
1762 mod->unres = alloc_symbol("module_layout", 0, mod->unres); 1764 mod->unres = alloc_symbol("module_layout", 0, mod->unres);
1763} 1765}
1764 1766
1767static void read_symbols_from_files(const char *filename)
1768{
1769 FILE *in = stdin;
1770 char fname[PATH_MAX];
1771
1772 if (strcmp(filename, "-") != 0) {
1773 in = fopen(filename, "r");
1774 if (!in)
1775 fatal("Can't open filenames file %s: %m", filename);
1776 }
1777
1778 while (fgets(fname, PATH_MAX, in) != NULL) {
1779 if (strends(fname, "\n"))
1780 fname[strlen(fname)-1] = '\0';
1781 read_symbols(fname);
1782 }
1783
1784 if (in != stdin)
1785 fclose(in);
1786}
1787
1765#define SZ 500 1788#define SZ 500
1766 1789
1767/* We first write the generated file into memory using the 1790/* We first write the generated file into memory using the
@@ -1934,7 +1957,8 @@ static int add_versions(struct buffer *b, struct module *mod)
1934 s->name, mod->name); 1957 s->name, mod->name);
1935 continue; 1958 continue;
1936 } 1959 }
1937 buf_printf(b, "\t{ %#8x, \"%s\" },\n", s->crc, s->name); 1960 buf_printf(b, "\t{ %#8x, __VMLINUX_SYMBOL_STR(%s) },\n",
1961 s->crc, s->name);
1938 } 1962 }
1939 1963
1940 buf_printf(b, "};\n"); 1964 buf_printf(b, "};\n");
@@ -2122,13 +2146,13 @@ int main(int argc, char **argv)
2122 struct module *mod; 2146 struct module *mod;
2123 struct buffer buf = { }; 2147 struct buffer buf = { };
2124 char *kernel_read = NULL, *module_read = NULL; 2148 char *kernel_read = NULL, *module_read = NULL;
2125 char *dump_write = NULL; 2149 char *dump_write = NULL, *files_source = NULL;
2126 int opt; 2150 int opt;
2127 int err; 2151 int err;
2128 struct ext_sym_list *extsym_iter; 2152 struct ext_sym_list *extsym_iter;
2129 struct ext_sym_list *extsym_start = NULL; 2153 struct ext_sym_list *extsym_start = NULL;
2130 2154
2131 while ((opt = getopt(argc, argv, "i:I:e:msSo:awM:K:")) != -1) { 2155 while ((opt = getopt(argc, argv, "i:I:e:msST:o:awM:K:")) != -1) {
2132 switch (opt) { 2156 switch (opt) {
2133 case 'i': 2157 case 'i':
2134 kernel_read = optarg; 2158 kernel_read = optarg;
@@ -2160,6 +2184,9 @@ int main(int argc, char **argv)
2160 case 'S': 2184 case 'S':
2161 sec_mismatch_verbose = 0; 2185 sec_mismatch_verbose = 0;
2162 break; 2186 break;
2187 case 'T':
2188 files_source = optarg;
2189 break;
2163 case 'w': 2190 case 'w':
2164 warn_unresolved = 1; 2191 warn_unresolved = 1;
2165 break; 2192 break;
@@ -2182,6 +2209,9 @@ int main(int argc, char **argv)
2182 while (optind < argc) 2209 while (optind < argc)
2183 read_symbols(argv[optind++]); 2210 read_symbols(argv[optind++]);
2184 2211
2212 if (files_source)
2213 read_symbols_from_files(files_source);
2214
2185 for (mod = modules; mod; mod = mod->next) { 2215 for (mod = modules; mod; mod = mod->next) {
2186 if (mod->skip) 2216 if (mod->skip)
2187 continue; 2217 continue;