diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.lib | 5 | ||||
-rwxr-xr-x | scripts/get_maintainer.pl | 499 | ||||
-rw-r--r-- | scripts/mod/Makefile | 2 | ||||
-rw-r--r-- | scripts/mod/mk_elfconfig.c | 9 | ||||
-rw-r--r-- | scripts/mod/modpost.c | 177 | ||||
-rw-r--r-- | scripts/mod/modpost.h | 3 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 3 |
7 files changed, 391 insertions, 307 deletions
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ffdafb26f539..224d85e72ef1 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -127,6 +127,11 @@ _c_flags += $(if $(patsubst n%,, \ | |||
127 | $(CFLAGS_GCOV)) | 127 | $(CFLAGS_GCOV)) |
128 | endif | 128 | endif |
129 | 129 | ||
130 | ifdef CONFIG_SYMBOL_PREFIX | ||
131 | _cpp_flags += -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)) | ||
132 | endif | ||
133 | |||
134 | |||
130 | # If building the kernel in a separate objtree expand all occurrences | 135 | # If building the kernel in a separate objtree expand all occurrences |
131 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). | 136 | # of -Idir to -I$(srctree)/dir except for absolute paths (starting with '/'). |
132 | 137 | ||
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl index 81a67a458e78..445e8845f0a4 100755 --- a/scripts/get_maintainer.pl +++ b/scripts/get_maintainer.pl | |||
@@ -13,7 +13,7 @@ | |||
13 | use strict; | 13 | use strict; |
14 | 14 | ||
15 | my $P = $0; | 15 | my $P = $0; |
16 | my $V = '0.21'; | 16 | my $V = '0.23'; |
17 | 17 | ||
18 | use Getopt::Long qw(:config no_auto_abbrev); | 18 | use Getopt::Long qw(:config no_auto_abbrev); |
19 | 19 | ||
@@ -23,16 +23,19 @@ my $email_usename = 1; | |||
23 | my $email_maintainer = 1; | 23 | my $email_maintainer = 1; |
24 | my $email_list = 1; | 24 | my $email_list = 1; |
25 | my $email_subscriber_list = 0; | 25 | my $email_subscriber_list = 0; |
26 | my $email_git = 1; | ||
27 | my $email_git_penguin_chiefs = 0; | 26 | my $email_git_penguin_chiefs = 0; |
27 | my $email_git = 1; | ||
28 | my $email_git_blame = 0; | ||
28 | my $email_git_min_signatures = 1; | 29 | my $email_git_min_signatures = 1; |
29 | my $email_git_max_maintainers = 5; | 30 | my $email_git_max_maintainers = 5; |
30 | my $email_git_min_percent = 5; | 31 | my $email_git_min_percent = 5; |
31 | my $email_git_since = "1-year-ago"; | 32 | my $email_git_since = "1-year-ago"; |
32 | my $email_git_blame = 0; | 33 | my $email_hg_since = "-365"; |
33 | my $email_remove_duplicates = 1; | 34 | my $email_remove_duplicates = 1; |
34 | my $output_multiline = 1; | 35 | my $output_multiline = 1; |
35 | my $output_separator = ", "; | 36 | my $output_separator = ", "; |
37 | my $output_roles = 0; | ||
38 | my $output_rolestats = 0; | ||
36 | my $scm = 0; | 39 | my $scm = 0; |
37 | my $web = 0; | 40 | my $web = 0; |
38 | my $subsystem = 0; | 41 | my $subsystem = 0; |
@@ -64,21 +67,52 @@ my $penguin_chiefs = "\(" . join("|",@penguin_chief_names) . "\)"; | |||
64 | my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; | 67 | my $rfc822_lwsp = "(?:(?:\\r\\n)?[ \\t])"; |
65 | my $rfc822_char = '[\\000-\\377]'; | 68 | my $rfc822_char = '[\\000-\\377]'; |
66 | 69 | ||
70 | # VCS command support: class-like functions and strings | ||
71 | |||
72 | my %VCS_cmds; | ||
73 | |||
74 | my %VCS_cmds_git = ( | ||
75 | "execute_cmd" => \&git_execute_cmd, | ||
76 | "available" => '(which("git") ne "") && (-d ".git")', | ||
77 | "find_signers_cmd" => "git log --since=\$email_git_since -- \$file", | ||
78 | "find_commit_signers_cmd" => "git log -1 \$commit", | ||
79 | "blame_range_cmd" => "git blame -l -L \$diff_start,+\$diff_length \$file", | ||
80 | "blame_file_cmd" => "git blame -l \$file", | ||
81 | "commit_pattern" => "^commit [0-9a-f]{40,40}", | ||
82 | "blame_commit_pattern" => "^([0-9a-f]+) " | ||
83 | ); | ||
84 | |||
85 | my %VCS_cmds_hg = ( | ||
86 | "execute_cmd" => \&hg_execute_cmd, | ||
87 | "available" => '(which("hg") ne "") && (-d ".hg")', | ||
88 | "find_signers_cmd" => | ||
89 | "hg log --date=\$email_hg_since" . | ||
90 | " --template='commit {node}\\n{desc}\\n' -- \$file", | ||
91 | "find_commit_signers_cmd" => "hg log --template='{desc}\\n' -r \$commit", | ||
92 | "blame_range_cmd" => "", # not supported | ||
93 | "blame_file_cmd" => "hg blame -c \$file", | ||
94 | "commit_pattern" => "^commit [0-9a-f]{40,40}", | ||
95 | "blame_commit_pattern" => "^([0-9a-f]+):" | ||
96 | ); | ||
97 | |||
67 | if (!GetOptions( | 98 | if (!GetOptions( |
68 | 'email!' => \$email, | 99 | 'email!' => \$email, |
69 | 'git!' => \$email_git, | 100 | 'git!' => \$email_git, |
101 | 'git-blame!' => \$email_git_blame, | ||
70 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, | 102 | 'git-chief-penguins!' => \$email_git_penguin_chiefs, |
71 | 'git-min-signatures=i' => \$email_git_min_signatures, | 103 | 'git-min-signatures=i' => \$email_git_min_signatures, |
72 | 'git-max-maintainers=i' => \$email_git_max_maintainers, | 104 | 'git-max-maintainers=i' => \$email_git_max_maintainers, |
73 | 'git-min-percent=i' => \$email_git_min_percent, | 105 | 'git-min-percent=i' => \$email_git_min_percent, |
74 | 'git-since=s' => \$email_git_since, | 106 | 'git-since=s' => \$email_git_since, |
75 | 'git-blame!' => \$email_git_blame, | 107 | 'hg-since=s' => \$email_hg_since, |
76 | 'remove-duplicates!' => \$email_remove_duplicates, | 108 | 'remove-duplicates!' => \$email_remove_duplicates, |
77 | 'm!' => \$email_maintainer, | 109 | 'm!' => \$email_maintainer, |
78 | 'n!' => \$email_usename, | 110 | 'n!' => \$email_usename, |
79 | 'l!' => \$email_list, | 111 | 'l!' => \$email_list, |
80 | 's!' => \$email_subscriber_list, | 112 | 's!' => \$email_subscriber_list, |
81 | 'multiline!' => \$output_multiline, | 113 | 'multiline!' => \$output_multiline, |
114 | 'roles!' => \$output_roles, | ||
115 | 'rolestats!' => \$output_rolestats, | ||
82 | 'separator=s' => \$output_separator, | 116 | 'separator=s' => \$output_separator, |
83 | 'subsystem!' => \$subsystem, | 117 | 'subsystem!' => \$subsystem, |
84 | 'status!' => \$status, | 118 | 'status!' => \$status, |
@@ -90,8 +124,7 @@ if (!GetOptions( | |||
90 | 'v|version' => \$version, | 124 | 'v|version' => \$version, |
91 | 'h|help' => \$help, | 125 | 'h|help' => \$help, |
92 | )) { | 126 | )) { |
93 | usage(); | 127 | die "$P: invalid argument - use --help if necessary\n"; |
94 | die "$P: invalid argument\n"; | ||
95 | } | 128 | } |
96 | 129 | ||
97 | if ($help != 0) { | 130 | if ($help != 0) { |
@@ -113,6 +146,10 @@ if ($output_separator ne ", ") { | |||
113 | $output_multiline = 0; | 146 | $output_multiline = 0; |
114 | } | 147 | } |
115 | 148 | ||
149 | if ($output_rolestats) { | ||
150 | $output_roles = 1; | ||
151 | } | ||
152 | |||
116 | my $selections = $email + $scm + $status + $subsystem + $web; | 153 | my $selections = $email + $scm + $status + $subsystem + $web; |
117 | if ($selections == 0) { | 154 | if ($selections == 0) { |
118 | usage(); | 155 | usage(); |
@@ -175,7 +212,7 @@ if ($email_remove_duplicates) { | |||
175 | next if ($line =~ m/^\s*$/); | 212 | next if ($line =~ m/^\s*$/); |
176 | 213 | ||
177 | my ($name, $address) = parse_email($line); | 214 | my ($name, $address) = parse_email($line); |
178 | $line = format_email($name, $address); | 215 | $line = format_email($name, $address, $email_usename); |
179 | 216 | ||
180 | next if ($line =~ m/^\s*$/); | 217 | next if ($line =~ m/^\s*$/); |
181 | 218 | ||
@@ -207,12 +244,10 @@ foreach my $file (@ARGV) { | |||
207 | push(@files, $file); | 244 | push(@files, $file); |
208 | if (-f $file && $keywords) { | 245 | if (-f $file && $keywords) { |
209 | open(FILE, "<$file") or die "$P: Can't open ${file}\n"; | 246 | open(FILE, "<$file") or die "$P: Can't open ${file}\n"; |
210 | while (<FILE>) { | 247 | my $text = do { local($/) ; <FILE> }; |
211 | my $patch_line = $_; | 248 | foreach my $line (keys %keyword_hash) { |
212 | foreach my $line (keys %keyword_hash) { | 249 | if ($text =~ m/$keyword_hash{$line}/x) { |
213 | if ($patch_line =~ m/^.*$keyword_hash{$line}/x) { | 250 | push(@keyword_tvi, $line); |
214 | push(@keyword_tvi, $line); | ||
215 | } | ||
216 | } | 251 | } |
217 | } | 252 | } |
218 | close(FILE); | 253 | close(FILE); |
@@ -304,11 +339,11 @@ foreach my $file (@files) { | |||
304 | } | 339 | } |
305 | 340 | ||
306 | if ($email && $email_git) { | 341 | if ($email && $email_git) { |
307 | recent_git_signoffs($file); | 342 | vcs_file_signoffs($file); |
308 | } | 343 | } |
309 | 344 | ||
310 | if ($email && $email_git_blame) { | 345 | if ($email && $email_git_blame) { |
311 | git_assign_blame($file); | 346 | vcs_file_blame($file); |
312 | } | 347 | } |
313 | } | 348 | } |
314 | 349 | ||
@@ -324,11 +359,11 @@ if ($email) { | |||
324 | if ($chief =~ m/^(.*):(.*)/) { | 359 | if ($chief =~ m/^(.*):(.*)/) { |
325 | my $email_address; | 360 | my $email_address; |
326 | 361 | ||
327 | $email_address = format_email($1, $2); | 362 | $email_address = format_email($1, $2, $email_usename); |
328 | if ($email_git_penguin_chiefs) { | 363 | if ($email_git_penguin_chiefs) { |
329 | push(@email_to, $email_address); | 364 | push(@email_to, [$email_address, 'chief penguin']); |
330 | } else { | 365 | } else { |
331 | @email_to = grep(!/${email_address}/, @email_to); | 366 | @email_to = grep($_->[0] !~ /${email_address}/, @email_to); |
332 | } | 367 | } |
333 | } | 368 | } |
334 | } | 369 | } |
@@ -342,7 +377,7 @@ if ($email || $email_list) { | |||
342 | if ($email_list) { | 377 | if ($email_list) { |
343 | @to = (@to, @list_to); | 378 | @to = (@to, @list_to); |
344 | } | 379 | } |
345 | output(uniq(@to)); | 380 | output(merge_email(@to)); |
346 | } | 381 | } |
347 | 382 | ||
348 | if ($scm) { | 383 | if ($scm) { |
@@ -398,13 +433,16 @@ MAINTAINER field selection options: | |||
398 | --git-min-signatures => number of signatures required (default: 1) | 433 | --git-min-signatures => number of signatures required (default: 1) |
399 | --git-max-maintainers => maximum maintainers to add (default: 5) | 434 | --git-max-maintainers => maximum maintainers to add (default: 5) |
400 | --git-min-percent => minimum percentage of commits required (default: 5) | 435 | --git-min-percent => minimum percentage of commits required (default: 5) |
401 | --git-since => git history to use (default: 1-year-ago) | ||
402 | --git-blame => use git blame to find modified commits for patch or file | 436 | --git-blame => use git blame to find modified commits for patch or file |
437 | --git-since => git history to use (default: 1-year-ago) | ||
438 | --hg-since => hg history to use (default: -365) | ||
403 | --m => include maintainer(s) if any | 439 | --m => include maintainer(s) if any |
404 | --n => include name 'Full Name <addr\@domain.tld>' | 440 | --n => include name 'Full Name <addr\@domain.tld>' |
405 | --l => include list(s) if any | 441 | --l => include list(s) if any |
406 | --s => include subscriber only list(s) if any | 442 | --s => include subscriber only list(s) if any |
407 | --remove-duplicates => minimize duplicate email names/addresses | 443 | --remove-duplicates => minimize duplicate email names/addresses |
444 | --roles => show roles (status:subsystem, git-signer, list, etc...) | ||
445 | --rolestats => show roles and statistics (commits/total_commits, %) | ||
408 | --scm => print SCM tree(s) if any | 446 | --scm => print SCM tree(s) if any |
409 | --status => print status if any | 447 | --status => print status if any |
410 | --subsystem => print subsystem name if any | 448 | --subsystem => print subsystem name if any |
@@ -430,11 +468,24 @@ Notes: | |||
430 | directory are examined as git recurses directories. | 468 | directory are examined as git recurses directories. |
431 | Any specified X: (exclude) pattern matches are _not_ ignored. | 469 | Any specified X: (exclude) pattern matches are _not_ ignored. |
432 | Used with "--nogit", directory is used as a pattern match, | 470 | Used with "--nogit", directory is used as a pattern match, |
433 | no individual file within the directory or subdirectory | 471 | no individual file within the directory or subdirectory |
434 | is matched. | 472 | is matched. |
435 | Used with "--git-blame", does not iterate all files in directory | 473 | Used with "--git-blame", does not iterate all files in directory |
436 | Using "--git-blame" is slow and may add old committers and authors | 474 | Using "--git-blame" is slow and may add old committers and authors |
437 | that are no longer active maintainers to the output. | 475 | that are no longer active maintainers to the output. |
476 | Using "--roles" or "--rolestats" with git send-email --cc-cmd or any | ||
477 | other automated tools that expect only ["name"] <email address> | ||
478 | may not work because of additional output after <email address>. | ||
479 | Using "--rolestats" and "--git-blame" shows the #/total=% commits, | ||
480 | not the percentage of the entire file authored. # of commits is | ||
481 | not a good measure of amount of code authored. 1 major commit may | ||
482 | contain a thousand lines, 5 trivial commits may modify a single line. | ||
483 | If git is not installed, but mercurial (hg) is installed and an .hg | ||
484 | repository exists, the following options apply to mercurial: | ||
485 | --git, | ||
486 | --git-min-signatures, --git-max-maintainers, --git-min-percent, and | ||
487 | --git-blame | ||
488 | Use --hg-since not --git-since to control date selection | ||
438 | EOT | 489 | EOT |
439 | } | 490 | } |
440 | 491 | ||
@@ -493,7 +544,7 @@ sub parse_email { | |||
493 | } | 544 | } |
494 | 545 | ||
495 | sub format_email { | 546 | sub format_email { |
496 | my ($name, $address) = @_; | 547 | my ($name, $address, $usename) = @_; |
497 | 548 | ||
498 | my $formatted_email; | 549 | my $formatted_email; |
499 | 550 | ||
@@ -506,11 +557,11 @@ sub format_email { | |||
506 | $name = "\"$name\""; | 557 | $name = "\"$name\""; |
507 | } | 558 | } |
508 | 559 | ||
509 | if ($email_usename) { | 560 | if ($usename) { |
510 | if ("$name" eq "") { | 561 | if ("$name" eq "") { |
511 | $formatted_email = "$address"; | 562 | $formatted_email = "$address"; |
512 | } else { | 563 | } else { |
513 | $formatted_email = "$name <${address}>"; | 564 | $formatted_email = "$name <$address>"; |
514 | } | 565 | } |
515 | } else { | 566 | } else { |
516 | $formatted_email = $address; | 567 | $formatted_email = $address; |
@@ -547,6 +598,71 @@ sub find_ending_index { | |||
547 | return $index; | 598 | return $index; |
548 | } | 599 | } |
549 | 600 | ||
601 | sub get_maintainer_role { | ||
602 | my ($index) = @_; | ||
603 | |||
604 | my $i; | ||
605 | my $start = find_starting_index($index); | ||
606 | my $end = find_ending_index($index); | ||
607 | |||
608 | my $role; | ||
609 | my $subsystem = $typevalue[$start]; | ||
610 | if (length($subsystem) > 20) { | ||
611 | $subsystem = substr($subsystem, 0, 17); | ||
612 | $subsystem =~ s/\s*$//; | ||
613 | $subsystem = $subsystem . "..."; | ||
614 | } | ||
615 | |||
616 | for ($i = $start + 1; $i < $end; $i++) { | ||
617 | my $tv = $typevalue[$i]; | ||
618 | if ($tv =~ m/^(\C):\s*(.*)/) { | ||
619 | my $ptype = $1; | ||
620 | my $pvalue = $2; | ||
621 | if ($ptype eq "S") { | ||
622 | $role = $pvalue; | ||
623 | } | ||
624 | } | ||
625 | } | ||
626 | |||
627 | $role = lc($role); | ||
628 | if ($role eq "supported") { | ||
629 | $role = "supporter"; | ||
630 | } elsif ($role eq "maintained") { | ||
631 | $role = "maintainer"; | ||
632 | } elsif ($role eq "odd fixes") { | ||
633 | $role = "odd fixer"; | ||
634 | } elsif ($role eq "orphan") { | ||
635 | $role = "orphan minder"; | ||
636 | } elsif ($role eq "obsolete") { | ||
637 | $role = "obsolete minder"; | ||
638 | } elsif ($role eq "buried alive in reporters") { | ||
639 | $role = "chief penguin"; | ||
640 | } | ||
641 | |||
642 | return $role . ":" . $subsystem; | ||
643 | } | ||
644 | |||
645 | sub get_list_role { | ||
646 | my ($index) = @_; | ||
647 | |||
648 | my $i; | ||
649 | my $start = find_starting_index($index); | ||
650 | my $end = find_ending_index($index); | ||
651 | |||
652 | my $subsystem = $typevalue[$start]; | ||
653 | if (length($subsystem) > 20) { | ||
654 | $subsystem = substr($subsystem, 0, 17); | ||
655 | $subsystem =~ s/\s*$//; | ||
656 | $subsystem = $subsystem . "..."; | ||
657 | } | ||
658 | |||
659 | if ($subsystem eq "THE REST") { | ||
660 | $subsystem = ""; | ||
661 | } | ||
662 | |||
663 | return $subsystem; | ||
664 | } | ||
665 | |||
550 | sub add_categories { | 666 | sub add_categories { |
551 | my ($index) = @_; | 667 | my ($index) = @_; |
552 | 668 | ||
@@ -564,17 +680,22 @@ sub add_categories { | |||
564 | if ($ptype eq "L") { | 680 | if ($ptype eq "L") { |
565 | my $list_address = $pvalue; | 681 | my $list_address = $pvalue; |
566 | my $list_additional = ""; | 682 | my $list_additional = ""; |
683 | my $list_role = get_list_role($i); | ||
684 | |||
685 | if ($list_role ne "") { | ||
686 | $list_role = ":" . $list_role; | ||
687 | } | ||
567 | if ($list_address =~ m/([^\s]+)\s+(.*)$/) { | 688 | if ($list_address =~ m/([^\s]+)\s+(.*)$/) { |
568 | $list_address = $1; | 689 | $list_address = $1; |
569 | $list_additional = $2; | 690 | $list_additional = $2; |
570 | } | 691 | } |
571 | if ($list_additional =~ m/subscribers-only/) { | 692 | if ($list_additional =~ m/subscribers-only/) { |
572 | if ($email_subscriber_list) { | 693 | if ($email_subscriber_list) { |
573 | push(@list_to, $list_address); | 694 | push(@list_to, [$list_address, "subscriber list${list_role}"]); |
574 | } | 695 | } |
575 | } else { | 696 | } else { |
576 | if ($email_list) { | 697 | if ($email_list) { |
577 | push(@list_to, $list_address); | 698 | push(@list_to, [$list_address, "open list${list_role}"]); |
578 | } | 699 | } |
579 | } | 700 | } |
580 | } elsif ($ptype eq "M") { | 701 | } elsif ($ptype eq "M") { |
@@ -585,13 +706,14 @@ sub add_categories { | |||
585 | if ($tv =~ m/^(\C):\s*(.*)/) { | 706 | if ($tv =~ m/^(\C):\s*(.*)/) { |
586 | if ($1 eq "P") { | 707 | if ($1 eq "P") { |
587 | $name = $2; | 708 | $name = $2; |
588 | $pvalue = format_email($name, $address); | 709 | $pvalue = format_email($name, $address, $email_usename); |
589 | } | 710 | } |
590 | } | 711 | } |
591 | } | 712 | } |
592 | } | 713 | } |
593 | if ($email_maintainer) { | 714 | if ($email_maintainer) { |
594 | push_email_addresses($pvalue); | 715 | my $role = get_maintainer_role($i); |
716 | push_email_addresses($pvalue, $role); | ||
595 | } | 717 | } |
596 | } elsif ($ptype eq "T") { | 718 | } elsif ($ptype eq "T") { |
597 | push(@scm, $pvalue); | 719 | push(@scm, $pvalue); |
@@ -618,7 +740,7 @@ sub email_inuse { | |||
618 | } | 740 | } |
619 | 741 | ||
620 | sub push_email_address { | 742 | sub push_email_address { |
621 | my ($line) = @_; | 743 | my ($line, $role) = @_; |
622 | 744 | ||
623 | my ($name, $address) = parse_email($line); | 745 | my ($name, $address) = parse_email($line); |
624 | 746 | ||
@@ -627,9 +749,9 @@ sub push_email_address { | |||
627 | } | 749 | } |
628 | 750 | ||
629 | if (!$email_remove_duplicates) { | 751 | if (!$email_remove_duplicates) { |
630 | push(@email_to, format_email($name, $address)); | 752 | push(@email_to, [format_email($name, $address, $email_usename), $role]); |
631 | } elsif (!email_inuse($name, $address)) { | 753 | } elsif (!email_inuse($name, $address)) { |
632 | push(@email_to, format_email($name, $address)); | 754 | push(@email_to, [format_email($name, $address, $email_usename), $role]); |
633 | $email_hash_name{$name}++; | 755 | $email_hash_name{$name}++; |
634 | $email_hash_address{$address}++; | 756 | $email_hash_address{$address}++; |
635 | } | 757 | } |
@@ -638,24 +760,52 @@ sub push_email_address { | |||
638 | } | 760 | } |
639 | 761 | ||
640 | sub push_email_addresses { | 762 | sub push_email_addresses { |
641 | my ($address) = @_; | 763 | my ($address, $role) = @_; |
642 | 764 | ||
643 | my @address_list = (); | 765 | my @address_list = (); |
644 | 766 | ||
645 | if (rfc822_valid($address)) { | 767 | if (rfc822_valid($address)) { |
646 | push_email_address($address); | 768 | push_email_address($address, $role); |
647 | } elsif (@address_list = rfc822_validlist($address)) { | 769 | } elsif (@address_list = rfc822_validlist($address)) { |
648 | my $array_count = shift(@address_list); | 770 | my $array_count = shift(@address_list); |
649 | while (my $entry = shift(@address_list)) { | 771 | while (my $entry = shift(@address_list)) { |
650 | push_email_address($entry); | 772 | push_email_address($entry, $role); |
651 | } | 773 | } |
652 | } else { | 774 | } else { |
653 | if (!push_email_address($address)) { | 775 | if (!push_email_address($address, $role)) { |
654 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); | 776 | warn("Invalid MAINTAINERS address: '" . $address . "'\n"); |
655 | } | 777 | } |
656 | } | 778 | } |
657 | } | 779 | } |
658 | 780 | ||
781 | sub add_role { | ||
782 | my ($line, $role) = @_; | ||
783 | |||
784 | my ($name, $address) = parse_email($line); | ||
785 | my $email = format_email($name, $address, $email_usename); | ||
786 | |||
787 | foreach my $entry (@email_to) { | ||
788 | if ($email_remove_duplicates) { | ||
789 | my ($entry_name, $entry_address) = parse_email($entry->[0]); | ||
790 | if ($name eq $entry_name || $address eq $entry_address) { | ||
791 | if ($entry->[1] eq "") { | ||
792 | $entry->[1] = "$role"; | ||
793 | } else { | ||
794 | $entry->[1] = "$entry->[1],$role"; | ||
795 | } | ||
796 | } | ||
797 | } else { | ||
798 | if ($email eq $entry->[0]) { | ||
799 | if ($entry->[1] eq "") { | ||
800 | $entry->[1] = "$role"; | ||
801 | } else { | ||
802 | $entry->[1] = "$entry->[1],$role"; | ||
803 | } | ||
804 | } | ||
805 | } | ||
806 | } | ||
807 | } | ||
808 | |||
659 | sub which { | 809 | sub which { |
660 | my ($bin) = @_; | 810 | my ($bin) = @_; |
661 | 811 | ||
@@ -669,7 +819,7 @@ sub which { | |||
669 | } | 819 | } |
670 | 820 | ||
671 | sub mailmap { | 821 | sub mailmap { |
672 | my @lines = @_; | 822 | my (@lines) = @_; |
673 | my %hash; | 823 | my %hash; |
674 | 824 | ||
675 | foreach my $line (@lines) { | 825 | foreach my $line (@lines) { |
@@ -678,14 +828,14 @@ sub mailmap { | |||
678 | $hash{$name} = $address; | 828 | $hash{$name} = $address; |
679 | } elsif ($address ne $hash{$name}) { | 829 | } elsif ($address ne $hash{$name}) { |
680 | $address = $hash{$name}; | 830 | $address = $hash{$name}; |
681 | $line = format_email($name, $address); | 831 | $line = format_email($name, $address, $email_usename); |
682 | } | 832 | } |
683 | if (exists($mailmap{$name})) { | 833 | if (exists($mailmap{$name})) { |
684 | my $obj = $mailmap{$name}; | 834 | my $obj = $mailmap{$name}; |
685 | foreach my $map_address (@$obj) { | 835 | foreach my $map_address (@$obj) { |
686 | if (($map_address eq $address) && | 836 | if (($map_address eq $address) && |
687 | ($map_address ne $hash{$name})) { | 837 | ($map_address ne $hash{$name})) { |
688 | $line = format_email($name, $hash{$name}); | 838 | $line = format_email($name, $hash{$name}, $email_usename); |
689 | } | 839 | } |
690 | } | 840 | } |
691 | } | 841 | } |
@@ -694,34 +844,38 @@ sub mailmap { | |||
694 | return @lines; | 844 | return @lines; |
695 | } | 845 | } |
696 | 846 | ||
697 | sub recent_git_signoffs { | 847 | sub git_execute_cmd { |
698 | my ($file) = @_; | 848 | my ($cmd) = @_; |
699 | |||
700 | my $sign_offs = ""; | ||
701 | my $cmd = ""; | ||
702 | my $output = ""; | ||
703 | my $count = 0; | ||
704 | my @lines = (); | 849 | my @lines = (); |
705 | my %hash; | ||
706 | my $total_sign_offs; | ||
707 | 850 | ||
708 | if (which("git") eq "") { | 851 | my $output = `$cmd`; |
709 | warn("$P: git not found. Add --nogit to options?\n"); | 852 | $output =~ s/^\s*//gm; |
710 | return; | 853 | @lines = split("\n", $output); |
711 | } | ||
712 | if (!(-d ".git")) { | ||
713 | warn("$P: .git directory not found. Use a git repository for better results.\n"); | ||
714 | warn("$P: perhaps 'git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git'\n"); | ||
715 | return; | ||
716 | } | ||
717 | 854 | ||
718 | $cmd = "git log --since=${email_git_since} -- ${file}"; | 855 | return @lines; |
856 | } | ||
719 | 857 | ||
720 | $output = `${cmd}`; | 858 | sub hg_execute_cmd { |
721 | $output =~ s/^\s*//gm; | 859 | my ($cmd) = @_; |
860 | my @lines = (); | ||
722 | 861 | ||
862 | my $output = `$cmd`; | ||
723 | @lines = split("\n", $output); | 863 | @lines = split("\n", $output); |
724 | 864 | ||
865 | return @lines; | ||
866 | } | ||
867 | |||
868 | sub vcs_find_signers { | ||
869 | my ($cmd) = @_; | ||
870 | my @lines = (); | ||
871 | my $commits; | ||
872 | |||
873 | @lines = &{$VCS_cmds{"execute_cmd"}}($cmd); | ||
874 | |||
875 | my $pattern = $VCS_cmds{"commit_pattern"}; | ||
876 | |||
877 | $commits = grep(/$pattern/, @lines); # of commits | ||
878 | |||
725 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); | 879 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); |
726 | if (!$email_git_penguin_chiefs) { | 880 | if (!$email_git_penguin_chiefs) { |
727 | @lines = grep(!/${penguin_chiefs}/i, @lines); | 881 | @lines = grep(!/${penguin_chiefs}/i, @lines); |
@@ -729,111 +883,183 @@ sub recent_git_signoffs { | |||
729 | # cut -f2- -d":" | 883 | # cut -f2- -d":" |
730 | s/.*:\s*(.+)\s*/$1/ for (@lines); | 884 | s/.*:\s*(.+)\s*/$1/ for (@lines); |
731 | 885 | ||
732 | $total_sign_offs = @lines; | 886 | ## Reformat email addresses (with names) to avoid badly written signatures |
733 | 887 | ||
734 | if ($email_remove_duplicates) { | 888 | foreach my $line (@lines) { |
735 | @lines = mailmap(@lines); | 889 | my ($name, $address) = parse_email($line); |
890 | $line = format_email($name, $address, 1); | ||
736 | } | 891 | } |
737 | 892 | ||
738 | @lines = sort(@lines); | 893 | return ($commits, @lines); |
739 | |||
740 | # uniq -c | ||
741 | $hash{$_}++ for @lines; | ||
742 | |||
743 | # sort -rn | ||
744 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | ||
745 | my $sign_offs = $hash{$line}; | ||
746 | $count++; | ||
747 | last if ($sign_offs < $email_git_min_signatures || | ||
748 | $count > $email_git_max_maintainers || | ||
749 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | ||
750 | push_email_address($line); | ||
751 | } | ||
752 | } | 894 | } |
753 | 895 | ||
754 | sub save_commits { | 896 | sub vcs_save_commits { |
755 | my ($cmd, @commits) = @_; | 897 | my ($cmd) = @_; |
756 | my $output; | ||
757 | my @lines = (); | 898 | my @lines = (); |
899 | my @commits = (); | ||
758 | 900 | ||
759 | $output = `${cmd}`; | 901 | @lines = &{$VCS_cmds{"execute_cmd"}}($cmd); |
760 | 902 | ||
761 | @lines = split("\n", $output); | ||
762 | foreach my $line (@lines) { | 903 | foreach my $line (@lines) { |
763 | if ($line =~ m/^(\w+) /) { | 904 | if ($line =~ m/$VCS_cmds{"blame_commit_pattern"}/) { |
764 | push (@commits, $1); | 905 | push(@commits, $1); |
765 | } | 906 | } |
766 | } | 907 | } |
908 | |||
767 | return @commits; | 909 | return @commits; |
768 | } | 910 | } |
769 | 911 | ||
770 | sub git_assign_blame { | 912 | sub vcs_blame { |
771 | my ($file) = @_; | 913 | my ($file) = @_; |
772 | |||
773 | my @lines = (); | ||
774 | my @commits = (); | ||
775 | my $cmd; | 914 | my $cmd; |
776 | my $output; | 915 | my @commits = (); |
777 | my %hash; | 916 | |
778 | my $total_sign_offs; | 917 | return @commits if (!(-f $file)); |
779 | my $count; | 918 | |
919 | if (@range && $VCS_cmds{"blame_range_cmd"} eq "") { | ||
920 | my @all_commits = (); | ||
921 | |||
922 | $cmd = $VCS_cmds{"blame_file_cmd"}; | ||
923 | $cmd =~ s/(\$\w+)/$1/eeg; #interpolate $cmd | ||
924 | @all_commits = vcs_save_commits($cmd); | ||
780 | 925 | ||
781 | if (@range) { | ||
782 | foreach my $file_range_diff (@range) { | 926 | foreach my $file_range_diff (@range) { |
783 | next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); | 927 | next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); |
784 | my $diff_file = $1; | 928 | my $diff_file = $1; |
785 | my $diff_start = $2; | 929 | my $diff_start = $2; |
786 | my $diff_length = $3; | 930 | my $diff_length = $3; |
787 | next if (!("$file" eq "$diff_file")); | 931 | next if ("$file" ne "$diff_file"); |
788 | $cmd = "git blame -l -L $diff_start,+$diff_length $file"; | 932 | for (my $i = $diff_start; $i < $diff_start + $diff_length; $i++) { |
789 | @commits = save_commits($cmd, @commits); | 933 | push(@commits, $all_commits[$i]); |
934 | } | ||
790 | } | 935 | } |
791 | } else { | 936 | } elsif (@range) { |
792 | if (-f $file) { | 937 | foreach my $file_range_diff (@range) { |
793 | $cmd = "git blame -l $file"; | 938 | next if (!($file_range_diff =~ m/(.+):(.+):(.+)/)); |
794 | @commits = save_commits($cmd, @commits); | 939 | my $diff_file = $1; |
940 | my $diff_start = $2; | ||
941 | my $diff_length = $3; | ||
942 | next if ("$file" ne "$diff_file"); | ||
943 | $cmd = $VCS_cmds{"blame_range_cmd"}; | ||
944 | $cmd =~ s/(\$\w+)/$1/eeg; #interpolate $cmd | ||
945 | push(@commits, vcs_save_commits($cmd)); | ||
795 | } | 946 | } |
947 | } else { | ||
948 | $cmd = $VCS_cmds{"blame_file_cmd"}; | ||
949 | $cmd =~ s/(\$\w+)/$1/eeg; #interpolate $cmd | ||
950 | @commits = vcs_save_commits($cmd); | ||
796 | } | 951 | } |
797 | 952 | ||
798 | $total_sign_offs = 0; | 953 | return @commits; |
799 | @commits = uniq(@commits); | 954 | } |
800 | foreach my $commit (@commits) { | ||
801 | $cmd = "git log -1 ${commit}"; | ||
802 | 955 | ||
803 | $output = `${cmd}`; | 956 | my $printed_novcs = 0; |
804 | $output =~ s/^\s*//gm; | 957 | sub vcs_exists { |
805 | @lines = split("\n", $output); | 958 | %VCS_cmds = %VCS_cmds_git; |
959 | return 1 if eval $VCS_cmds{"available"}; | ||
960 | %VCS_cmds = %VCS_cmds_hg; | ||
961 | return 1 if eval $VCS_cmds{"available"}; | ||
962 | %VCS_cmds = (); | ||
963 | if (!$printed_novcs) { | ||
964 | warn("$P: No supported VCS found. Add --nogit to options?\n"); | ||
965 | warn("Using a git repository produces better results.\n"); | ||
966 | warn("Try Linus Torvalds' latest git repository using:\n"); | ||
967 | warn("git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git\n"); | ||
968 | $printed_novcs = 1; | ||
969 | } | ||
970 | return 0; | ||
971 | } | ||
806 | 972 | ||
807 | @lines = grep(/^[-_ a-z]+by:.*\@.*$/i, @lines); | 973 | sub vcs_assign { |
808 | if (!$email_git_penguin_chiefs) { | 974 | my ($role, $divisor, @lines) = @_; |
809 | @lines = grep(!/${penguin_chiefs}/i, @lines); | ||
810 | } | ||
811 | 975 | ||
812 | # cut -f2- -d":" | 976 | my %hash; |
813 | s/.*:\s*(.+)\s*/$1/ for (@lines); | 977 | my $count = 0; |
814 | 978 | ||
815 | $total_sign_offs += @lines; | 979 | return if (@lines <= 0); |
816 | 980 | ||
817 | if ($email_remove_duplicates) { | 981 | if ($divisor <= 0) { |
818 | @lines = mailmap(@lines); | 982 | warn("Bad divisor in " . (caller(0))[3] . ": $divisor\n"); |
819 | } | 983 | $divisor = 1; |
984 | } | ||
820 | 985 | ||
821 | $hash{$_}++ for @lines; | 986 | if ($email_remove_duplicates) { |
987 | @lines = mailmap(@lines); | ||
822 | } | 988 | } |
823 | 989 | ||
824 | $count = 0; | 990 | @lines = sort(@lines); |
991 | |||
992 | # uniq -c | ||
993 | $hash{$_}++ for @lines; | ||
994 | |||
995 | # sort -rn | ||
825 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { | 996 | foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) { |
826 | my $sign_offs = $hash{$line}; | 997 | my $sign_offs = $hash{$line}; |
998 | my $percent = $sign_offs * 100 / $divisor; | ||
999 | |||
1000 | $percent = 100 if ($percent > 100); | ||
827 | $count++; | 1001 | $count++; |
828 | last if ($sign_offs < $email_git_min_signatures || | 1002 | last if ($sign_offs < $email_git_min_signatures || |
829 | $count > $email_git_max_maintainers || | 1003 | $count > $email_git_max_maintainers || |
830 | $sign_offs * 100 / $total_sign_offs < $email_git_min_percent); | 1004 | $percent < $email_git_min_percent); |
831 | push_email_address($line); | 1005 | push_email_address($line, ''); |
1006 | if ($output_rolestats) { | ||
1007 | my $fmt_percent = sprintf("%.0f", $percent); | ||
1008 | add_role($line, "$role:$sign_offs/$divisor=$fmt_percent%"); | ||
1009 | } else { | ||
1010 | add_role($line, $role); | ||
1011 | } | ||
1012 | } | ||
1013 | } | ||
1014 | |||
1015 | sub vcs_file_signoffs { | ||
1016 | my ($file) = @_; | ||
1017 | |||
1018 | my @signers = (); | ||
1019 | my $commits; | ||
1020 | |||
1021 | return if (!vcs_exists()); | ||
1022 | |||
1023 | my $cmd = $VCS_cmds{"find_signers_cmd"}; | ||
1024 | $cmd =~ s/(\$\w+)/$1/eeg; # interpolate $cmd | ||
1025 | |||
1026 | ($commits, @signers) = vcs_find_signers($cmd); | ||
1027 | vcs_assign("commit_signer", $commits, @signers); | ||
1028 | } | ||
1029 | |||
1030 | sub vcs_file_blame { | ||
1031 | my ($file) = @_; | ||
1032 | |||
1033 | my @signers = (); | ||
1034 | my @commits = (); | ||
1035 | my $total_commits; | ||
1036 | |||
1037 | return if (!vcs_exists()); | ||
1038 | |||
1039 | @commits = vcs_blame($file); | ||
1040 | @commits = uniq(@commits); | ||
1041 | $total_commits = @commits; | ||
1042 | |||
1043 | foreach my $commit (@commits) { | ||
1044 | my $commit_count; | ||
1045 | my @commit_signers = (); | ||
1046 | |||
1047 | my $cmd = $VCS_cmds{"find_commit_signers_cmd"}; | ||
1048 | $cmd =~ s/(\$\w+)/$1/eeg; #interpolate $cmd | ||
1049 | |||
1050 | ($commit_count, @commit_signers) = vcs_find_signers($cmd); | ||
1051 | push(@signers, @commit_signers); | ||
1052 | } | ||
1053 | |||
1054 | if ($from_filename) { | ||
1055 | vcs_assign("commits", $total_commits, @signers); | ||
1056 | } else { | ||
1057 | vcs_assign("modified commits", $total_commits, @signers); | ||
832 | } | 1058 | } |
833 | } | 1059 | } |
834 | 1060 | ||
835 | sub uniq { | 1061 | sub uniq { |
836 | my @parms = @_; | 1062 | my (@parms) = @_; |
837 | 1063 | ||
838 | my %saw; | 1064 | my %saw; |
839 | @parms = grep(!$saw{$_}++, @parms); | 1065 | @parms = grep(!$saw{$_}++, @parms); |
@@ -841,7 +1067,7 @@ sub uniq { | |||
841 | } | 1067 | } |
842 | 1068 | ||
843 | sub sort_and_uniq { | 1069 | sub sort_and_uniq { |
844 | my @parms = @_; | 1070 | my (@parms) = @_; |
845 | 1071 | ||
846 | my %saw; | 1072 | my %saw; |
847 | @parms = sort @parms; | 1073 | @parms = sort @parms; |
@@ -849,8 +1075,27 @@ sub sort_and_uniq { | |||
849 | return @parms; | 1075 | return @parms; |
850 | } | 1076 | } |
851 | 1077 | ||
1078 | sub merge_email { | ||
1079 | my @lines; | ||
1080 | my %saw; | ||
1081 | |||
1082 | for (@_) { | ||
1083 | my ($address, $role) = @$_; | ||
1084 | if (!$saw{$address}) { | ||
1085 | if ($output_roles) { | ||
1086 | push(@lines, "$address ($role)"); | ||
1087 | } else { | ||
1088 | push(@lines, $address); | ||
1089 | } | ||
1090 | $saw{$address} = 1; | ||
1091 | } | ||
1092 | } | ||
1093 | |||
1094 | return @lines; | ||
1095 | } | ||
1096 | |||
852 | sub output { | 1097 | sub output { |
853 | my @parms = @_; | 1098 | my (@parms) = @_; |
854 | 1099 | ||
855 | if ($output_multiline) { | 1100 | if ($output_multiline) { |
856 | foreach my $line (@parms) { | 1101 | foreach my $line (@parms) { |
@@ -947,11 +1192,9 @@ sub rfc822_validlist ($) { | |||
947 | if ($s =~ m/^(?:$rfc822re)?(?:,(?:$rfc822re)?)*$/so && | 1192 | if ($s =~ m/^(?:$rfc822re)?(?:,(?:$rfc822re)?)*$/so && |
948 | $s =~ m/^$rfc822_char*$/) { | 1193 | $s =~ m/^$rfc822_char*$/) { |
949 | while ($s =~ m/(?:^|,$rfc822_lwsp*)($rfc822re)/gos) { | 1194 | while ($s =~ m/(?:^|,$rfc822_lwsp*)($rfc822re)/gos) { |
950 | push @r, $1; | 1195 | push(@r, $1); |
951 | } | 1196 | } |
952 | return wantarray ? (scalar(@r), @r) : 1; | 1197 | return wantarray ? (scalar(@r), @r) : 1; |
953 | } | 1198 | } |
954 | else { | 1199 | return wantarray ? () : 0; |
955 | return wantarray ? () : 0; | ||
956 | } | ||
957 | } | 1200 | } |
diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index 11d69c35e5b4..ff954f8168c1 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile | |||
@@ -8,7 +8,7 @@ modpost-objs := modpost.o file2alias.o sumversion.o | |||
8 | $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h | 8 | $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h |
9 | 9 | ||
10 | quiet_cmd_elfconfig = MKELF $@ | 10 | quiet_cmd_elfconfig = MKELF $@ |
11 | cmd_elfconfig = $(obj)/mk_elfconfig $(ARCH) < $< > $@ | 11 | cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ |
12 | 12 | ||
13 | $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE | 13 | $(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE |
14 | $(call if_changed,elfconfig) | 14 | $(call if_changed,elfconfig) |
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c index 6a96d47bd1e6..639bca7ba559 100644 --- a/scripts/mod/mk_elfconfig.c +++ b/scripts/mod/mk_elfconfig.c | |||
@@ -9,9 +9,6 @@ main(int argc, char **argv) | |||
9 | unsigned char ei[EI_NIDENT]; | 9 | unsigned char ei[EI_NIDENT]; |
10 | union { short s; char c[2]; } endian_test; | 10 | union { short s; char c[2]; } endian_test; |
11 | 11 | ||
12 | if (argc != 2) { | ||
13 | fprintf(stderr, "Error: no arch\n"); | ||
14 | } | ||
15 | if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) { | 12 | if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) { |
16 | fprintf(stderr, "Error: input truncated\n"); | 13 | fprintf(stderr, "Error: input truncated\n"); |
17 | return 1; | 14 | return 1; |
@@ -55,12 +52,6 @@ main(int argc, char **argv) | |||
55 | else | 52 | else |
56 | exit(1); | 53 | exit(1); |
57 | 54 | ||
58 | if ((strcmp(argv[1], "h8300") == 0) | ||
59 | || (strcmp(argv[1], "blackfin") == 0)) | ||
60 | printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); | ||
61 | else | ||
62 | printf("#define MODULE_SYMBOL_PREFIX \"\"\n"); | ||
63 | |||
64 | return 0; | 55 | return 0; |
65 | } | 56 | } |
66 | 57 | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 801a16a17545..6c4ffc767b91 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -15,8 +15,17 @@ | |||
15 | #include <stdio.h> | 15 | #include <stdio.h> |
16 | #include <ctype.h> | 16 | #include <ctype.h> |
17 | #include "modpost.h" | 17 | #include "modpost.h" |
18 | #include "../../include/linux/autoconf.h" | ||
18 | #include "../../include/linux/license.h" | 19 | #include "../../include/linux/license.h" |
19 | 20 | ||
21 | /* Some toolchains use a `_' prefix for all user symbols. */ | ||
22 | #ifdef CONFIG_SYMBOL_PREFIX | ||
23 | #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX | ||
24 | #else | ||
25 | #define MODULE_SYMBOL_PREFIX "" | ||
26 | #endif | ||
27 | |||
28 | |||
20 | /* Are we using CONFIG_MODVERSIONS? */ | 29 | /* Are we using CONFIG_MODVERSIONS? */ |
21 | int modversions = 0; | 30 | int modversions = 0; |
22 | /* Warn about undefined symbols? (do so if we have vmlinux) */ | 31 | /* Warn about undefined symbols? (do so if we have vmlinux) */ |
@@ -451,8 +460,6 @@ static int parse_elf(struct elf_info *info, const char *filename) | |||
451 | info->export_unused_gpl_sec = i; | 460 | info->export_unused_gpl_sec = i; |
452 | else if (strcmp(secname, "__ksymtab_gpl_future") == 0) | 461 | else if (strcmp(secname, "__ksymtab_gpl_future") == 0) |
453 | info->export_gpl_future_sec = i; | 462 | info->export_gpl_future_sec = i; |
454 | else if (strcmp(secname, "__markers_strings") == 0) | ||
455 | info->markers_strings_sec = i; | ||
456 | 463 | ||
457 | if (sechdrs[i].sh_type != SHT_SYMTAB) | 464 | if (sechdrs[i].sh_type != SHT_SYMTAB) |
458 | continue; | 465 | continue; |
@@ -515,7 +522,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
515 | break; | 522 | break; |
516 | case SHN_ABS: | 523 | case SHN_ABS: |
517 | /* CRC'd symbol */ | 524 | /* CRC'd symbol */ |
518 | if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { | 525 | if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { |
519 | crc = (unsigned int) sym->st_value; | 526 | crc = (unsigned int) sym->st_value; |
520 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc, | 527 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc, |
521 | export); | 528 | export); |
@@ -559,7 +566,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
559 | break; | 566 | break; |
560 | default: | 567 | default: |
561 | /* All exported symbols */ | 568 | /* All exported symbols */ |
562 | if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { | 569 | if (strncmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { |
563 | sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, | 570 | sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, |
564 | export); | 571 | export); |
565 | } | 572 | } |
@@ -1509,62 +1516,6 @@ static void check_sec_ref(struct module *mod, const char *modname, | |||
1509 | } | 1516 | } |
1510 | } | 1517 | } |
1511 | 1518 | ||
1512 | static void get_markers(struct elf_info *info, struct module *mod) | ||
1513 | { | ||
1514 | const Elf_Shdr *sh = &info->sechdrs[info->markers_strings_sec]; | ||
1515 | const char *strings = (const char *) info->hdr + sh->sh_offset; | ||
1516 | const Elf_Sym *sym, *first_sym, *last_sym; | ||
1517 | size_t n; | ||
1518 | |||
1519 | if (!info->markers_strings_sec) | ||
1520 | return; | ||
1521 | |||
1522 | /* | ||
1523 | * First count the strings. We look for all the symbols defined | ||
1524 | * in the __markers_strings section named __mstrtab_*. For | ||
1525 | * these local names, the compiler puts a random .NNN suffix on, | ||
1526 | * so the names don't correspond exactly. | ||
1527 | */ | ||
1528 | first_sym = last_sym = NULL; | ||
1529 | n = 0; | ||
1530 | for (sym = info->symtab_start; sym < info->symtab_stop; sym++) | ||
1531 | if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT && | ||
1532 | sym->st_shndx == info->markers_strings_sec && | ||
1533 | !strncmp(info->strtab + sym->st_name, | ||
1534 | "__mstrtab_", sizeof "__mstrtab_" - 1)) { | ||
1535 | if (first_sym == NULL) | ||
1536 | first_sym = sym; | ||
1537 | last_sym = sym; | ||
1538 | ++n; | ||
1539 | } | ||
1540 | |||
1541 | if (n == 0) | ||
1542 | return; | ||
1543 | |||
1544 | /* | ||
1545 | * Now collect each name and format into a line for the output. | ||
1546 | * Lines look like: | ||
1547 | * marker_name vmlinux marker %s format %d | ||
1548 | * The format string after the second \t can use whitespace. | ||
1549 | */ | ||
1550 | mod->markers = NOFAIL(malloc(sizeof mod->markers[0] * n)); | ||
1551 | mod->nmarkers = n; | ||
1552 | |||
1553 | n = 0; | ||
1554 | for (sym = first_sym; sym <= last_sym; sym++) | ||
1555 | if (ELF_ST_TYPE(sym->st_info) == STT_OBJECT && | ||
1556 | sym->st_shndx == info->markers_strings_sec && | ||
1557 | !strncmp(info->strtab + sym->st_name, | ||
1558 | "__mstrtab_", sizeof "__mstrtab_" - 1)) { | ||
1559 | const char *name = strings + sym->st_value; | ||
1560 | const char *fmt = strchr(name, '\0') + 1; | ||
1561 | char *line = NULL; | ||
1562 | asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt); | ||
1563 | NOFAIL(line); | ||
1564 | mod->markers[n++] = line; | ||
1565 | } | ||
1566 | } | ||
1567 | |||
1568 | static void read_symbols(char *modname) | 1519 | static void read_symbols(char *modname) |
1569 | { | 1520 | { |
1570 | const char *symname; | 1521 | const char *symname; |
@@ -1620,8 +1571,6 @@ static void read_symbols(char *modname) | |||
1620 | get_src_version(modname, mod->srcversion, | 1571 | get_src_version(modname, mod->srcversion, |
1621 | sizeof(mod->srcversion)-1); | 1572 | sizeof(mod->srcversion)-1); |
1622 | 1573 | ||
1623 | get_markers(&info, mod); | ||
1624 | |||
1625 | parse_elf_finish(&info); | 1574 | parse_elf_finish(&info); |
1626 | 1575 | ||
1627 | /* Our trick to get versioning for module struct etc. - it's | 1576 | /* Our trick to get versioning for module struct etc. - it's |
@@ -1976,96 +1925,6 @@ static void write_dump(const char *fname) | |||
1976 | write_if_changed(&buf, fname); | 1925 | write_if_changed(&buf, fname); |
1977 | } | 1926 | } |
1978 | 1927 | ||
1979 | static void add_marker(struct module *mod, const char *name, const char *fmt) | ||
1980 | { | ||
1981 | char *line = NULL; | ||
1982 | asprintf(&line, "%s\t%s\t%s\n", name, mod->name, fmt); | ||
1983 | NOFAIL(line); | ||
1984 | |||
1985 | mod->markers = NOFAIL(realloc(mod->markers, ((mod->nmarkers + 1) * | ||
1986 | sizeof mod->markers[0]))); | ||
1987 | mod->markers[mod->nmarkers++] = line; | ||
1988 | } | ||
1989 | |||
1990 | static void read_markers(const char *fname) | ||
1991 | { | ||
1992 | unsigned long size, pos = 0; | ||
1993 | void *file = grab_file(fname, &size); | ||
1994 | char *line; | ||
1995 | |||
1996 | if (!file) /* No old markers, silently ignore */ | ||
1997 | return; | ||
1998 | |||
1999 | while ((line = get_next_line(&pos, file, size))) { | ||
2000 | char *marker, *modname, *fmt; | ||
2001 | struct module *mod; | ||
2002 | |||
2003 | marker = line; | ||
2004 | modname = strchr(marker, '\t'); | ||
2005 | if (!modname) | ||
2006 | goto fail; | ||
2007 | *modname++ = '\0'; | ||
2008 | fmt = strchr(modname, '\t'); | ||
2009 | if (!fmt) | ||
2010 | goto fail; | ||
2011 | *fmt++ = '\0'; | ||
2012 | if (*marker == '\0' || *modname == '\0') | ||
2013 | goto fail; | ||
2014 | |||
2015 | mod = find_module(modname); | ||
2016 | if (!mod) { | ||
2017 | mod = new_module(modname); | ||
2018 | mod->skip = 1; | ||
2019 | } | ||
2020 | if (is_vmlinux(modname)) { | ||
2021 | have_vmlinux = 1; | ||
2022 | mod->skip = 0; | ||
2023 | } | ||
2024 | |||
2025 | if (!mod->skip) | ||
2026 | add_marker(mod, marker, fmt); | ||
2027 | } | ||
2028 | release_file(file, size); | ||
2029 | return; | ||
2030 | fail: | ||
2031 | fatal("parse error in markers list file\n"); | ||
2032 | } | ||
2033 | |||
2034 | static int compare_strings(const void *a, const void *b) | ||
2035 | { | ||
2036 | return strcmp(*(const char **) a, *(const char **) b); | ||
2037 | } | ||
2038 | |||
2039 | static void write_markers(const char *fname) | ||
2040 | { | ||
2041 | struct buffer buf = { }; | ||
2042 | struct module *mod; | ||
2043 | size_t i; | ||
2044 | |||
2045 | for (mod = modules; mod; mod = mod->next) | ||
2046 | if ((!external_module || !mod->skip) && mod->markers != NULL) { | ||
2047 | /* | ||
2048 | * Sort the strings so we can skip duplicates when | ||
2049 | * we write them out. | ||
2050 | */ | ||
2051 | qsort(mod->markers, mod->nmarkers, | ||
2052 | sizeof mod->markers[0], &compare_strings); | ||
2053 | for (i = 0; i < mod->nmarkers; ++i) { | ||
2054 | char *line = mod->markers[i]; | ||
2055 | buf_write(&buf, line, strlen(line)); | ||
2056 | while (i + 1 < mod->nmarkers && | ||
2057 | !strcmp(mod->markers[i], | ||
2058 | mod->markers[i + 1])) | ||
2059 | free(mod->markers[i++]); | ||
2060 | free(mod->markers[i]); | ||
2061 | } | ||
2062 | free(mod->markers); | ||
2063 | mod->markers = NULL; | ||
2064 | } | ||
2065 | |||
2066 | write_if_changed(&buf, fname); | ||
2067 | } | ||
2068 | |||
2069 | struct ext_sym_list { | 1928 | struct ext_sym_list { |
2070 | struct ext_sym_list *next; | 1929 | struct ext_sym_list *next; |
2071 | const char *file; | 1930 | const char *file; |
@@ -2077,8 +1936,6 @@ int main(int argc, char **argv) | |||
2077 | struct buffer buf = { }; | 1936 | struct buffer buf = { }; |
2078 | char *kernel_read = NULL, *module_read = NULL; | 1937 | char *kernel_read = NULL, *module_read = NULL; |
2079 | char *dump_write = NULL; | 1938 | char *dump_write = NULL; |
2080 | char *markers_read = NULL; | ||
2081 | char *markers_write = NULL; | ||
2082 | int opt; | 1939 | int opt; |
2083 | int err; | 1940 | int err; |
2084 | struct ext_sym_list *extsym_iter; | 1941 | struct ext_sym_list *extsym_iter; |
@@ -2122,12 +1979,6 @@ int main(int argc, char **argv) | |||
2122 | case 'w': | 1979 | case 'w': |
2123 | warn_unresolved = 1; | 1980 | warn_unresolved = 1; |
2124 | break; | 1981 | break; |
2125 | case 'M': | ||
2126 | markers_write = optarg; | ||
2127 | break; | ||
2128 | case 'K': | ||
2129 | markers_read = optarg; | ||
2130 | break; | ||
2131 | default: | 1982 | default: |
2132 | exit(1); | 1983 | exit(1); |
2133 | } | 1984 | } |
@@ -2182,11 +2033,5 @@ int main(int argc, char **argv) | |||
2182 | "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", | 2033 | "'make CONFIG_DEBUG_SECTION_MISMATCH=y'\n", |
2183 | sec_mismatch_count); | 2034 | sec_mismatch_count); |
2184 | 2035 | ||
2185 | if (markers_read) | ||
2186 | read_markers(markers_read); | ||
2187 | |||
2188 | if (markers_write) | ||
2189 | write_markers(markers_write); | ||
2190 | |||
2191 | return err; | 2036 | return err; |
2192 | } | 2037 | } |
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 09f58e33d227..be987a44f250 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
@@ -112,8 +112,6 @@ struct module { | |||
112 | int has_init; | 112 | int has_init; |
113 | int has_cleanup; | 113 | int has_cleanup; |
114 | struct buffer dev_table_buf; | 114 | struct buffer dev_table_buf; |
115 | char **markers; | ||
116 | size_t nmarkers; | ||
117 | char srcversion[25]; | 115 | char srcversion[25]; |
118 | }; | 116 | }; |
119 | 117 | ||
@@ -128,7 +126,6 @@ struct elf_info { | |||
128 | Elf_Section export_gpl_sec; | 126 | Elf_Section export_gpl_sec; |
129 | Elf_Section export_unused_gpl_sec; | 127 | Elf_Section export_unused_gpl_sec; |
130 | Elf_Section export_gpl_future_sec; | 128 | Elf_Section export_gpl_future_sec; |
131 | Elf_Section markers_strings_sec; | ||
132 | const char *strtab; | 129 | const char *strtab; |
133 | char *modinfo; | 130 | char *modinfo; |
134 | unsigned int modinfo_len; | 131 | unsigned int modinfo_len; |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index f0d14452632b..9cf0a6fad6ba 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -295,6 +295,9 @@ if ($arch eq "x86_64") { | |||
295 | $ld .= " -m elf64_sparc"; | 295 | $ld .= " -m elf64_sparc"; |
296 | $cc .= " -m64"; | 296 | $cc .= " -m64"; |
297 | $objcopy .= " -O elf64-sparc"; | 297 | $objcopy .= " -O elf64-sparc"; |
298 | } elsif ($arch eq "microblaze") { | ||
299 | # Microblaze calls '_mcount' instead of plain 'mcount'. | ||
300 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s_mcount\$"; | ||
298 | } else { | 301 | } else { |
299 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; | 302 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; |
300 | } | 303 | } |