Showing the changes to scripts (22 of 9752 files). Show all
Unified · Split
| @@ -79,9 +79,11 @@ modpost = scripts/mod/modpost \ · 78 unmodified lines | |||
| 79 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ | 79 | $(if $(CONFIG_DEBUG_SECTION_MISMATCH),,-S) \ |
| 80 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) | 80 | $(if $(KBUILD_EXTMOD)$(KBUILD_MODPOST_WARN),-w) |
| 81 | 81 | ||
| 82 | MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS))) | ||
| 83 | |||
| 82 | # We can go over command line length here, so be careful. | 84 | # We can go over command line length here, so be careful. |
| 83 | quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules | 85 | quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules |
| 84 | cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) -s -T - | 86 | cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) $(MODPOST_OPT) -s -T - |
| 85 | 87 | ||
| 86 | PHONY += __modpost | 88 | PHONY += __modpost |
| 87 | __modpost: $(modules:.ko=.o) FORCE | 89 | __modpost: $(modules:.ko=.o) FORCE |
| @@ -1353,6 +1353,8 @@ static void render_out_of_line_list(FILE *out) · 1352 unmodified lines | |||
| 1353 | render_opcode(out, "ASN1_OP_END_SET_OF%s,\n", act); | 1353 | render_opcode(out, "ASN1_OP_END_SET_OF%s,\n", act); |
| 1354 | render_opcode(out, "_jump_target(%u),\n", entry); | 1354 | render_opcode(out, "_jump_target(%u),\n", entry); |
| 1355 | break; | 1355 | break; |
| 1356 | default: | ||
| 1357 | break; | ||
| 1356 | } | 1358 | } |
| 1357 | if (e->action) | 1359 | if (e->action) |
| 1358 | render_opcode(out, "_action(ACT_%s),\n", | 1360 | render_opcode(out, "_action(ACT_%s),\n", |
| @@ -19,9 +19,10 @@ def getsizes(file): · 18 unmodified lines | |||
| 19 | size, type, name = l[:-1].split() | 19 | size, type, name = l[:-1].split() |
| 20 | if type in "tTdDbBrR": | 20 | if type in "tTdDbBrR": |
| 21 | # strip generated symbols | 21 | # strip generated symbols |
| 22 | if name[:6] == "__mod_": continue | 22 | if name.startswith("__mod_"): continue |
| 23 | # function names begin with '.' on 64-bit powerpc | 23 | if name == "linux_banner": continue |
| 24 | if "." in name[1:]: name = "static." + name.split(".")[0] | 24 | # statics and some other optimizations adds random .NUMBER |
| 25 | name = re.sub(r'\.[0-9]+', '', name) | ||
| 25 | sym[name] = sym.get(name, 0) + int(size, 16) | 26 | sym[name] = sym.get(name, 0) + int(size, 16) |
| 26 | return sym | 27 | return sym |
| 27 | 28 | ||
| @@ -241,8 +241,11 @@ our $Sparse = qr{ · 240 unmodified lines | |||
| 241 | __ref| | 241 | __ref| |
| 242 | __rcu | 242 | __rcu |
| 243 | }x; | 243 | }x; |
| 244 | 244 | our $InitAttributePrefix = qr{__(?:mem|cpu|dev|net_|)}; | |
| 245 | our $InitAttribute = qr{__(?:mem|cpu|dev|net_|)(?:initdata|initconst|init\b)}; | 245 | our $InitAttributeData = qr{$InitAttributePrefix(?:initdata\b)}; |
| 246 | our $InitAttributeConst = qr{$InitAttributePrefix(?:initconst\b)}; | ||
| 247 | our $InitAttributeInit = qr{$InitAttributePrefix(?:init\b)}; | ||
| 248 | our $InitAttribute = qr{$InitAttributeData|$InitAttributeConst|$InitAttributeInit}; | ||
| 246 | 249 | ||
| 247 | # Notes to $Attribute: | 250 | # Notes to $Attribute: |
| 248 | # We need \b after 'init' otherwise 'initconst' will cause a false positive in a check | 251 | # We need \b after 'init' otherwise 'initconst' will cause a false positive in a check |
| @@ -323,7 +326,8 @@ our $logFunctions = qr{(?x: · 74 unmodified lines | |||
| 323 | (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| | 326 | (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| |
| 324 | WARN(?:_RATELIMIT|_ONCE|)| | 327 | WARN(?:_RATELIMIT|_ONCE|)| |
| 325 | panic| | 328 | panic| |
| 326 | MODULE_[A-Z_]+ | 329 | MODULE_[A-Z_]+| |
| 330 | seq_vprintf|seq_printf|seq_puts | ||
| 327 | )}; | 331 | )}; |
| 328 | 332 | ||
| 329 | our $signature_tags = qr{(?xi: | 333 | our $signature_tags = qr{(?xi: |
| @@ -442,8 +446,9 @@ sub seed_camelcase_file { · 112 unmodified lines | |||
| 442 | next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/); | 446 | next if ($line !~ /(?:[A-Z][a-z]|[a-z][A-Z])/); |
| 443 | if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) { | 447 | if ($line =~ /^[ \t]*(?:#[ \t]*define|typedef\s+$Type)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)/) { |
| 444 | $camelcase{$1} = 1; | 448 | $camelcase{$1} = 1; |
| 445 | } | 449 | } elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[\(\[,;]/) { |
| 446 | elsif ($line =~ /^\s*$Declare\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*\(/) { | 450 | $camelcase{$1} = 1; |
| 451 | } elsif ($line =~ /^\s*(?:union|struct|enum)\s+(\w*(?:[A-Z][a-z]|[a-z][A-Z])\w*)\s*[;\{]/) { | ||
| 447 | $camelcase{$1} = 1; | 452 | $camelcase{$1} = 1; |
| 448 | } | 453 | } |
| 449 | } | 454 | } |
| @@ -1512,6 +1517,14 @@ sub rtrim { · 1062 unmodified lines | |||
| 1512 | return $string; | 1517 | return $string; |
| 1513 | } | 1518 | } |
| 1514 | 1519 | ||
| 1520 | sub string_find_replace { | ||
| 1521 | my ($string, $find, $replace) = @_; | ||
| 1522 | |||
| 1523 | $string =~ s/$find/$replace/g; | ||
| 1524 | |||
| 1525 | return $string; | ||
| 1526 | } | ||
| 1527 | |||
| 1515 | sub tabify { | 1528 | sub tabify { |
| 1516 | my ($leading) = @_; | 1529 | my ($leading) = @_; |
| 1517 | 1530 | ||
| @@ -1612,6 +1625,8 @@ sub process { · 94 unmodified lines | |||
| 1612 | my @setup_docs = (); | 1625 | my @setup_docs = (); |
| 1613 | my $setup_docs = 0; | 1626 | my $setup_docs = 0; |
| 1614 | 1627 | ||
| 1628 | my $camelcase_file_seeded = 0; | ||
| 1629 | |||
| 1615 | sanitise_line_reset(); | 1630 | sanitise_line_reset(); |
| 1616 | my $line; | 1631 | my $line; |
| 1617 | foreach my $rawline (@rawlines) { | 1632 | foreach my $rawline (@rawlines) { |
| @@ -1754,11 +1769,11 @@ sub process { · 136 unmodified lines | |||
| 1754 | # extract the filename as it passes | 1769 | # extract the filename as it passes |
| 1755 | if ($line =~ /^diff --git.*?(\S+)$/) { | 1770 | if ($line =~ /^diff --git.*?(\S+)$/) { |
| 1756 | $realfile = $1; | 1771 | $realfile = $1; |
| 1757 | $realfile =~ s@^([^/]*)/@@; | 1772 | $realfile =~ s@^([^/]*)/@@ if (!$file); |
| 1758 | $in_commit_log = 0; | 1773 | $in_commit_log = 0; |
| 1759 | } elsif ($line =~ /^\+\+\+\s+(\S+)/) { | 1774 | } elsif ($line =~ /^\+\+\+\s+(\S+)/) { |
| 1760 | $realfile = $1; | 1775 | $realfile = $1; |
| 1761 | $realfile =~ s@^([^/]*)/@@; | 1776 | $realfile =~ s@^([^/]*)/@@ if (!$file); |
| 1762 | $in_commit_log = 0; | 1777 | $in_commit_log = 0; |
| 1763 | 1778 | ||
| 1764 | $p1_prefix = $1; | 1779 | $p1_prefix = $1; |
| @@ -1947,6 +1962,18 @@ sub process { · 182 unmodified lines | |||
| 1947 | $rpt_cleaners = 1; | 1962 | $rpt_cleaners = 1; |
| 1948 | } | 1963 | } |
| 1949 | 1964 | ||
| 1965 | # Check for FSF mailing addresses. | ||
| 1966 | if ($rawline =~ /You should have received a copy/ || | ||
| 1967 | $rawline =~ /write to the Free Software/ || | ||
| 1968 | $rawline =~ /59 Temple Place/ || | ||
| 1969 | $rawline =~ /51 Franklin Street/) { | ||
| 1970 | my $herevet = "$here\n" . cat_vet($rawline) . "\n"; | ||
| 1971 | my $msg_type = \&ERROR; | ||
| 1972 | $msg_type = \&CHK if ($file); | ||
| 1973 | &{$msg_type}("FSF_MAILING_ADDRESS", | ||
| 1974 | "Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL.\n" . $herevet) | ||
| 1975 | } | ||
| 1976 | |||
| 1950 | # check for Kconfig help text having a real description | 1977 | # check for Kconfig help text having a real description |
| 1951 | # Only applies when adding the entry originally, after that we do not have | 1978 | # Only applies when adding the entry originally, after that we do not have |
| 1952 | # sufficient context to determine whether it is indeed long enough. | 1979 | # sufficient context to determine whether it is indeed long enough. |
| @@ -2838,7 +2865,7 @@ sub process { · 885 unmodified lines | |||
| 2838 | \+=|-=|\*=|\/=|%=|\^=|\|=|&=| | 2865 | \+=|-=|\*=|\/=|%=|\^=|\|=|&=| |
| 2839 | =>|->|<<|>>|<|>|=|!|~| | 2866 | =>|->|<<|>>|<|>|=|!|~| |
| 2840 | &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%| | 2867 | &&|\|\||,|\^|\+\+|--|&|\||\+|-|\*|\/|%| |
| 2841 | \?|: | 2868 | \?:|\?|: |
| 2842 | }x; | 2869 | }x; |
| 2843 | my @elements = split(/($ops|;)/, $opline); | 2870 | my @elements = split(/($ops|;)/, $opline); |
| 2844 | 2871 | ||
| @@ -3061,15 +3088,13 @@ sub process { · 216 unmodified lines | |||
| 3061 | $ok = 1; | 3088 | $ok = 1; |
| 3062 | } | 3089 | } |
| 3063 | 3090 | ||
| 3064 | # Ignore ?: | 3091 | # messages are ERROR, but ?: are CHK |
| 3065 | if (($opv eq ':O' && $ca =~ /\?$/) || | ||
| 3066 | ($op eq '?' && $cc =~ /^:/)) { | ||
| 3067 | $ok = 1; | ||
| 3068 | } | ||
| 3069 | |||
| 3070 | if ($ok == 0) { | 3092 | if ($ok == 0) { |
| 3071 | if (ERROR("SPACING", | 3093 | my $msg_type = \&ERROR; |
| 3072 | "spaces required around that '$op' $at\n" . $hereptr)) { | 3094 | $msg_type = \&CHK if (($op eq '?:' || $op eq '?' || $op eq ':') && $ctx =~ /VxV/); |
| 3095 | |||
| 3096 | if (&{$msg_type}("SPACING", | ||
| 3097 | "spaces required around that '$op' $at\n" . $hereptr)) { | ||
| 3073 | $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; | 3098 | $good = rtrim($fix_elements[$n]) . " " . trim($fix_elements[$n + 1]) . " "; |
| 3074 | if (defined $fix_elements[$n + 2]) { | 3099 | if (defined $fix_elements[$n + 2]) { |
| 3075 | $fix_elements[$n + 2] =~ s/^\s+//; | 3100 | $fix_elements[$n + 2] =~ s/^\s+//; |
| @@ -3208,21 +3233,10 @@ sub process { · 132 unmodified lines | |||
| 3208 | } | 3233 | } |
| 3209 | 3234 | ||
| 3210 | # Return is not a function. | 3235 | # Return is not a function. |
| 3211 | if (defined($stat) && $stat =~ /^.\s*return(\s*)(\(.*);/s) { | 3236 | if (defined($stat) && $stat =~ /^.\s*return(\s*)\(/s) { |
| 3212 | my $spacing = $1; | 3237 | my $spacing = $1; |
| 3213 | my $value = $2; | 3238 | if ($^V && $^V ge 5.10.0 && |
| 3214 | 3239 | $stat =~ /^.\s*return\s*$balanced_parens\s*;\s*$/) { | |
| 3215 | # Flatten any parentheses | ||
| 3216 | $value =~ s/\(/ \(/g; | ||
| 3217 | $value =~ s/\)/\) /g; | ||
| 3218 | while ($value =~ s/\[[^\[\]]*\]/1/ || | ||
| 3219 | $value !~ /(?:$Ident|-?$Constant)\s* | ||
| 3220 | $Compare\s* | ||
| 3221 | (?:$Ident|-?$Constant)/x && | ||
| 3222 | $value =~ s/\([^\(\)]*\)/1/) { | ||
| 3223 | } | ||
| 3224 | #print "value<$value>\n"; | ||
| 3225 | if ($value =~ /^\s*(?:$Ident|-?$Constant)\s*$/) { | ||
| 3226 | ERROR("RETURN_PARENTHESES", | 3240 | ERROR("RETURN_PARENTHESES", |
| 3227 | "return is not a function, parentheses are not required\n" . $herecurr); | 3241 | "return is not a function, parentheses are not required\n" . $herecurr); |
| 3228 | 3242 | ||
| @@ -3231,6 +3245,7 @@ sub process { · 2 unmodified lines | |||
| 3231 | "space required before the open parenthesis '('\n" . $herecurr); | 3245 | "space required before the open parenthesis '('\n" . $herecurr); |
| 3232 | } | 3246 | } |
| 3233 | } | 3247 | } |
| 3248 | |||
| 3234 | # Return of what appears to be an errno should normally be -'ve | 3249 | # Return of what appears to be an errno should normally be -'ve |
| 3235 | if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { | 3250 | if ($line =~ /^.\s*return\s*(E[A-Z]*)\s*;/) { |
| 3236 | my $name = $1; | 3251 | my $name = $1; |
| @@ -3274,6 +3289,7 @@ sub process { · 37 unmodified lines | |||
| 3274 | } | 3289 | } |
| 3275 | } | 3290 | } |
| 3276 | if (!defined $suppress_whiletrailers{$linenr} && | 3291 | if (!defined $suppress_whiletrailers{$linenr} && |
| 3292 | defined($stat) && defined($cond) && | ||
| 3277 | $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) { | 3293 | $line =~ /\b(?:if|while|for)\s*\(/ && $line !~ /^.\s*#/) { |
| 3278 | my ($s, $c) = ($stat, $cond); | 3294 | my ($s, $c) = ($stat, $cond); |
| 3279 | 3295 | ||
| @@ -3396,7 +3412,13 @@ sub process { · 116 unmodified lines | |||
| 3396 | while ($var =~ m{($Ident)}g) { | 3412 | while ($var =~ m{($Ident)}g) { |
| 3397 | my $word = $1; | 3413 | my $word = $1; |
| 3398 | next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/); | 3414 | next if ($word !~ /[A-Z][a-z]|[a-z][A-Z]/); |
| 3399 | seed_camelcase_includes() if ($check); | 3415 | if ($check) { |
| 3416 | seed_camelcase_includes(); | ||
| 3417 | if (!$file && !$camelcase_file_seeded) { | ||
| 3418 | seed_camelcase_file($realfile); | ||
| 3419 | $camelcase_file_seeded = 1; | ||
| 3420 | } | ||
| 3421 | } | ||
| 3400 | if (!defined $camelcase{$word}) { | 3422 | if (!defined $camelcase{$word}) { |
| 3401 | $camelcase{$word} = 1; | 3423 | $camelcase{$word} = 1; |
| 3402 | CHK("CAMELCASE", | 3424 | CHK("CAMELCASE", |
| @@ -3725,14 +3747,6 @@ sub process { · 322 unmodified lines | |||
| 3725 | } | 3747 | } |
| 3726 | } | 3748 | } |
| 3727 | 3749 | ||
| 3728 | sub string_find_replace { | ||
| 3729 | my ($string, $find, $replace) = @_; | ||
| 3730 | |||
| 3731 | $string =~ s/$find/$replace/g; | ||
| 3732 | |||
| 3733 | return $string; | ||
| 3734 | } | ||
| 3735 | |||
| 3736 | # check for bad placement of section $InitAttribute (e.g.: __initdata) | 3750 | # check for bad placement of section $InitAttribute (e.g.: __initdata) |
| 3737 | if ($line =~ /(\b$InitAttribute\b)/) { | 3751 | if ($line =~ /(\b$InitAttribute\b)/) { |
| 3738 | my $attr = $1; | 3752 | my $attr = $1; |
| @@ -3751,6 +3765,35 @@ sub string_find_replace { · 12 unmodified lines | |||
| 3751 | } | 3765 | } |
| 3752 | } | 3766 | } |
| 3753 | 3767 | ||
| 3768 | # check for $InitAttributeData (ie: __initdata) with const | ||
| 3769 | if ($line =~ /\bconst\b/ && $line =~ /($InitAttributeData)/) { | ||
| 3770 | my $attr = $1; | ||
| 3771 | $attr =~ /($InitAttributePrefix)(.*)/; | ||
| 3772 | my $attr_prefix = $1; | ||
| 3773 | my $attr_type = $2; | ||
| 3774 | if (ERROR("INIT_ATTRIBUTE", | ||
| 3775 | "Use of const init definition must use ${attr_prefix}initconst\n" . $herecurr) && | ||
| 3776 | $fix) { | ||
| 3777 | $fixed[$linenr - 1] =~ | ||
| 3778 | s/$InitAttributeData/${attr_prefix}initconst/; | ||
| 3779 | } | ||
| 3780 | } | ||
| 3781 | |||
| 3782 | # check for $InitAttributeConst (ie: __initconst) without const | ||
| 3783 | if ($line !~ /\bconst\b/ && $line =~ /($InitAttributeConst)/) { | ||
| 3784 | my $attr = $1; | ||
| 3785 | if (ERROR("INIT_ATTRIBUTE", | ||
| 3786 | "Use of $attr requires a separate use of const\n" . $herecurr) && | ||
| 3787 | $fix) { | ||
| 3788 | my $lead = $fixed[$linenr - 1] =~ | ||
| 3789 | /(^\+\s*(?:static\s+))/; | ||
| 3790 | $lead = rtrim($1); | ||
| 3791 | $lead = "$lead " if ($lead !~ /^\+$/); | ||
| 3792 | $lead = "${lead}const "; | ||
| 3793 | $fixed[$linenr - 1] =~ s/(^\+\s*(?:static\s+))/$lead/; | ||
| 3794 | } | ||
| 3795 | } | ||
| 3796 | |||
| 3754 | # prefer usleep_range over udelay | 3797 | # prefer usleep_range over udelay |
| 3755 | if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) { | 3798 | if ($line =~ /\budelay\s*\(\s*(\d+)\s*\)/) { |
| 3756 | # ignore udelay's < 10, however | 3799 | # ignore udelay's < 10, however |
| @@ -3810,8 +3853,8 @@ sub string_find_replace { · 53 unmodified lines | |||
| 3810 | # check for memory barriers without a comment. | 3853 | # check for memory barriers without a comment. |
| 3811 | if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) { | 3854 | if ($line =~ /\b(mb|rmb|wmb|read_barrier_depends|smp_mb|smp_rmb|smp_wmb|smp_read_barrier_depends)\(/) { |
| 3812 | if (!ctx_has_comment($first_line, $linenr)) { | 3855 | if (!ctx_has_comment($first_line, $linenr)) { |
| 3813 | CHK("MEMORY_BARRIER", | 3856 | WARN("MEMORY_BARRIER", |
| 3814 | "memory barrier without comment\n" . $herecurr); | 3857 | "memory barrier without comment\n" . $herecurr); |
| 3815 | } | 3858 | } |
| 3816 | } | 3859 | } |
| 3817 | # check of hardware specific defines | 3860 | # check of hardware specific defines |
| @@ -3835,7 +3878,8 @@ sub string_find_replace { · 17 unmodified lines | |||
| 3835 | } | 3878 | } |
| 3836 | 3879 | ||
| 3837 | # Check for __inline__ and __inline, prefer inline | 3880 | # Check for __inline__ and __inline, prefer inline |
| 3838 | if ($line =~ /\b(__inline__|__inline)\b/) { | 3881 | if ($realfile !~ m@\binclude/uapi/@ && |
| 3882 | $line =~ /\b(__inline__|__inline)\b/) { | ||
| 3839 | if (WARN("INLINE", | 3883 | if (WARN("INLINE", |
| 3840 | "plain inline is preferred over $1\n" . $herecurr) && | 3884 | "plain inline is preferred over $1\n" . $herecurr) && |
| 3841 | $fix) { | 3885 | $fix) { |
| @@ -3845,19 +3889,22 @@ sub string_find_replace { · 3 unmodified lines | |||
| 3845 | } | 3889 | } |
| 3846 | 3890 | ||
| 3847 | # Check for __attribute__ packed, prefer __packed | 3891 | # Check for __attribute__ packed, prefer __packed |
| 3848 | if ($line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) { | 3892 | if ($realfile !~ m@\binclude/uapi/@ && |
| 3893 | $line =~ /\b__attribute__\s*\(\s*\(.*\bpacked\b/) { | ||
| 3849 | WARN("PREFER_PACKED", | 3894 | WARN("PREFER_PACKED", |
| 3850 | "__packed is preferred over __attribute__((packed))\n" . $herecurr); | 3895 | "__packed is preferred over __attribute__((packed))\n" . $herecurr); |
| 3851 | } | 3896 | } |
| 3852 | 3897 | ||
| 3853 | # Check for __attribute__ aligned, prefer __aligned | 3898 | # Check for __attribute__ aligned, prefer __aligned |
| 3854 | if ($line =~ /\b__attribute__\s*\(\s*\(.*aligned/) { | 3899 | if ($realfile !~ m@\binclude/uapi/@ && |
| 3900 | $line =~ /\b__attribute__\s*\(\s*\(.*aligned/) { | ||
| 3855 | WARN("PREFER_ALIGNED", | 3901 | WARN("PREFER_ALIGNED", |
| 3856 | "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr); | 3902 | "__aligned(size) is preferred over __attribute__((aligned(size)))\n" . $herecurr); |
| 3857 | } | 3903 | } |
| 3858 | 3904 | ||
| 3859 | # Check for __attribute__ format(printf, prefer __printf | 3905 | # Check for __attribute__ format(printf, prefer __printf |
| 3860 | if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) { | 3906 | if ($realfile !~ m@\binclude/uapi/@ && |
| 3907 | $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf/) { | ||
| 3861 | if (WARN("PREFER_PRINTF", | 3908 | if (WARN("PREFER_PRINTF", |
| 3862 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr) && | 3909 | "__printf(string-index, first-to-check) is preferred over __attribute__((format(printf, string-index, first-to-check)))\n" . $herecurr) && |
| 3863 | $fix) { | 3910 | $fix) { |
| @@ -3867,7 +3914,8 @@ sub string_find_replace { · 3 unmodified lines | |||
| 3867 | } | 3914 | } |
| 3868 | 3915 | ||
| 3869 | # Check for __attribute__ format(scanf, prefer __scanf | 3916 | # Check for __attribute__ format(scanf, prefer __scanf |
| 3870 | if ($line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) { | 3917 | if ($realfile !~ m@\binclude/uapi/@ && |
| 3918 | $line =~ /\b__attribute__\s*\(\s*\(\s*format\s*\(\s*scanf\b/) { | ||
| 3871 | if (WARN("PREFER_SCANF", | 3919 | if (WARN("PREFER_SCANF", |
| 3872 | "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr) && | 3920 | "__scanf(string-index, first-to-check) is preferred over __attribute__((format(scanf, string-index, first-to-check)))\n" . $herecurr) && |
| 3873 | $fix) { | 3921 | $fix) { |
| @@ -3903,9 +3951,9 @@ sub string_find_replace { · 29 unmodified lines | |||
| 3903 | } | 3951 | } |
| 3904 | 3952 | ||
| 3905 | # check for seq_printf uses that could be seq_puts | 3953 | # check for seq_printf uses that could be seq_puts |
| 3906 | if ($line =~ /\bseq_printf\s*\(/) { | 3954 | if ($sline =~ /\bseq_printf\s*\(.*"\s*\)\s*;\s*$/) { |
| 3907 | my $fmt = get_quoted_string($line, $rawline); | 3955 | my $fmt = get_quoted_string($line, $rawline); |
| 3908 | if ($fmt !~ /[^\\]\%/) { | 3956 | if ($fmt ne "" && $fmt !~ /[^\\]\%/) { |
| 3909 | if (WARN("PREFER_SEQ_PUTS", | 3957 | if (WARN("PREFER_SEQ_PUTS", |
| 3910 | "Prefer seq_puts to seq_printf\n" . $herecurr) && | 3958 | "Prefer seq_puts to seq_printf\n" . $herecurr) && |
| 3911 | $fix) { | 3959 | $fix) { |
| @@ -3972,11 +4020,28 @@ sub string_find_replace { · 60 unmodified lines | |||
| 3972 | } | 4020 | } |
| 3973 | } | 4021 | } |
| 3974 | 4022 | ||
| 4023 | # check for naked sscanf | ||
| 4024 | if ($^V && $^V ge 5.10.0 && | ||
| 4025 | defined $stat && | ||
| 4026 | $stat =~ /\bsscanf\b/ && | ||
| 4027 | ($stat !~ /$Ident\s*=\s*sscanf\s*$balanced_parens/ && | ||
| 4028 | $stat !~ /\bsscanf\s*$balanced_parens\s*(?:$Compare)/ && | ||
| 4029 | $stat !~ /(?:$Compare)\s*\bsscanf\s*$balanced_parens/)) { | ||
| 4030 | my $lc = $stat =~ tr@\n@@; | ||
| 4031 | $lc = $lc + $linenr; | ||
| 4032 | my $stat_real = raw_line($linenr, 0); | ||
| 4033 | for (my $count = $linenr + 1; $count <= $lc; $count++) { | ||
| 4034 | $stat_real = $stat_real . "\n" . raw_line($count, 0); | ||
| 4035 | } | ||
| 4036 | WARN("NAKED_SSCANF", | ||
| 4037 | "unchecked sscanf return value\n" . "$here\n$stat_real\n"); | ||
| 4038 | } | ||
| 4039 | |||
| 3975 | # check for new externs in .h files. | 4040 | # check for new externs in .h files. |
| 3976 | if ($realfile =~ /\.h$/ && | 4041 | if ($realfile =~ /\.h$/ && |
| 3977 | $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) { | 4042 | $line =~ /^\+\s*(extern\s+)$Type\s*$Ident\s*\(/s) { |
| 3978 | if (WARN("AVOID_EXTERNS", | 4043 | if (CHK("AVOID_EXTERNS", |
| 3979 | "extern prototypes should be avoided in .h files\n" . $herecurr) && | 4044 | "extern prototypes should be avoided in .h files\n" . $herecurr) && |
| 3980 | $fix) { | 4045 | $fix) { |
| 3981 | $fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/; | 4046 | $fixed[$linenr - 1] =~ s/(.*)\bextern\b\s*(.*)/$1$2/; |
| 3982 | } | 4047 | } |
| @@ -4190,6 +4255,12 @@ sub string_find_replace { · 207 unmodified lines | |||
| 4190 | "usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); | 4255 | "usage of NR_CPUS is often wrong - consider using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(), etc\n" . $herecurr); |
| 4191 | } | 4256 | } |
| 4192 | 4257 | ||
| 4258 | # Use of __ARCH_HAS_<FOO> or ARCH_HAVE_<BAR> is wrong. | ||
| 4259 | if ($line =~ /\+\s*#\s*define\s+((?:__)?ARCH_(?:HAS|HAVE)\w*)\b/) { | ||
| 4260 | ERROR("DEFINE_ARCH_HAS", | ||
| 4261 | "#define of '$1' is wrong - use Kconfig variables or standard guards instead\n" . $herecurr); | ||
| 4262 | } | ||
| 4263 | |||
| 4193 | # check for %L{u,d,i} in strings | 4264 | # check for %L{u,d,i} in strings |
| 4194 | my $string; | 4265 | my $string; |
| 4195 | while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { | 4266 | while ($line =~ /(?:^|")([X\t]*)(?:"|$)/g) { |
| @@ -72,6 +72,7 @@ FILELINE * docsection; · 71 unmodified lines | |||
| 72 | #define FUNCTION "-function" | 72 | #define FUNCTION "-function" |
| 73 | #define NOFUNCTION "-nofunction" | 73 | #define NOFUNCTION "-nofunction" |
| 74 | #define NODOCSECTIONS "-no-doc-sections" | 74 | #define NODOCSECTIONS "-no-doc-sections" |
| 75 | #define SHOWNOTFOUND "-show-not-found" | ||
| 75 | 76 | ||
| 76 | static char *srctree, *kernsrctree; | 77 | static char *srctree, *kernsrctree; |
| 77 | 78 | ||
| @@ -294,6 +295,7 @@ static void singfunc(char * filename, char * line) · 216 unmodified lines | |||
| 294 | int startofsym = 1; | 295 | int startofsym = 1; |
| 295 | vec[idx++] = KERNELDOC; | 296 | vec[idx++] = KERNELDOC; |
| 296 | vec[idx++] = DOCBOOK; | 297 | vec[idx++] = DOCBOOK; |
| 298 | vec[idx++] = SHOWNOTFOUND; | ||
| 297 | 299 | ||
| 298 | /* Split line up in individual parameters preceded by FUNCTION */ | 300 | /* Split line up in individual parameters preceded by FUNCTION */ |
| 299 | for (i=0; line[i]; i++) { | 301 | for (i=0; line[i]; i++) { |
| @@ -325,7 +327,8 @@ static void singfunc(char * filename, char * line) · 25 unmodified lines | |||
| 325 | */ | 327 | */ |
| 326 | static void docsect(char *filename, char *line) | 328 | static void docsect(char *filename, char *line) |
| 327 | { | 329 | { |
| 328 | char *vec[6]; /* kerneldoc -docbook -function "section" file NULL */ | 330 | /* kerneldoc -docbook -show-not-found -function "section" file NULL */ |
| 331 | char *vec[7]; | ||
| 329 | char *s; | 332 | char *s; |
| 330 | 333 | ||
| 331 | for (s = line; *s; s++) | 334 | for (s = line; *s; s++) |
| @@ -341,10 +344,11 @@ static void docsect(char *filename, char *line) · 9 unmodified lines | |||
| 341 | 344 | ||
| 342 | vec[0] = KERNELDOC; | 345 | vec[0] = KERNELDOC; |
| 343 | vec[1] = DOCBOOK; | 346 | vec[1] = DOCBOOK; |
| 344 | vec[2] = FUNCTION; | 347 | vec[2] = SHOWNOTFOUND; |
| 345 | vec[3] = line; | 348 | vec[3] = FUNCTION; |
| 346 | vec[4] = filename; | 349 | vec[4] = line; |
| 347 | vec[5] = NULL; | 350 | vec[5] = filename; |
| 351 | vec[6] = NULL; | ||
| 348 | exec_kernel_doc(vec); | 352 | exec_kernel_doc(vec); |
| 349 | } | 353 | } |
| 350 | 354 | ||
| @@ -240,12 +240,24 @@ case "$arg" in · 239 unmodified lines | |||
| 240 | output_file="$1" | 240 | output_file="$1" |
| 241 | cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" | 241 | cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" |
| 242 | output=${cpio_list} | 242 | output=${cpio_list} |
| 243 | echo "$output_file" | grep -q "\.gz$" && compr="gzip -n -9 -f" | 243 | echo "$output_file" | grep -q "\.gz$" \ |
| 244 | echo "$output_file" | grep -q "\.bz2$" && compr="bzip2 -9 -f" | 244 | && [ -x "`which gzip 2> /dev/null`" ] \ |
| 245 | echo "$output_file" | grep -q "\.lzma$" && compr="lzma -9 -f" | 245 | && compr="gzip -n -9 -f" |
| 246 | echo "$output_file" | grep -q "\.xz$" && \ | 246 | echo "$output_file" | grep -q "\.bz2$" \ |
| 247 | compr="xz --check=crc32 --lzma2=dict=1MiB" | 247 | && [ -x "`which bzip2 2> /dev/null`" ] \ |
| 248 | echo "$output_file" | grep -q "\.lzo$" && compr="lzop -9 -f" | 248 | && compr="bzip2 -9 -f" |
| 249 | echo "$output_file" | grep -q "\.lzma$" \ | ||
| 250 | && [ -x "`which lzma 2> /dev/null`" ] \ | ||
| 251 | && compr="lzma -9 -f" | ||
| 252 | echo "$output_file" | grep -q "\.xz$" \ | ||
| 253 | && [ -x "`which xz 2> /dev/null`" ] \ | ||
| 254 | && compr="xz --check=crc32 --lzma2=dict=1MiB" | ||
| 255 | echo "$output_file" | grep -q "\.lzo$" \ | ||
| 256 | && [ -x "`which lzop 2> /dev/null`" ] \ | ||
| 257 | && compr="lzop -9 -f" | ||
| 258 | echo "$output_file" | grep -q "\.lz4$" \ | ||
| 259 | && [ -x "`which lz4 2> /dev/null`" ] \ | ||
| 260 | && compr="lz4 -9 -f" | ||
| 249 | echo "$output_file" | grep -q "\.cpio$" && compr="cat" | 261 | echo "$output_file" | grep -q "\.cpio$" && compr="cat" |
| 250 | shift | 262 | shift |
| 251 | ;; | 263 | ;; |
| @@ -55,6 +55,7 @@ static struct sym_entry *table; · 54 unmodified lines | |||
| 55 | static unsigned int table_size, table_cnt; | 55 | static unsigned int table_size, table_cnt; |
| 56 | static int all_symbols = 0; | 56 | static int all_symbols = 0; |
| 57 | static char symbol_prefix_char = '\0'; | 57 | static char symbol_prefix_char = '\0'; |
| 58 | static unsigned long long kernel_start_addr = 0; | ||
| 58 | 59 | ||
| 59 | int token_profit[0x10000]; | 60 | int token_profit[0x10000]; |
| 60 | 61 | ||
| @@ -65,7 +66,10 @@ unsigned char best_table_len[256]; · 4 unmodified lines | |||
| 65 | 66 | ||
| 66 | static void usage(void) | 67 | static void usage(void) |
| 67 | { | 68 | { |
| 68 | fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\n"); | 69 | fprintf(stderr, "Usage: kallsyms [--all-symbols] " |
| 70 | "[--symbol-prefix=<prefix char>] " | ||
| 71 | "[--page-offset=<CONFIG_PAGE_OFFSET>] " | ||
| 72 | "< in.map > out.S\n"); | ||
| 69 | exit(1); | 73 | exit(1); |
| 70 | } | 74 | } |
| 71 | 75 | ||
| @@ -111,6 +115,12 @@ static int read_symbol(FILE *in, struct sym_entry *s) · 39 unmodified lines | |||
| 111 | fprintf(stderr, "Read error or end of file.\n"); | 115 | fprintf(stderr, "Read error or end of file.\n"); |
| 112 | return -1; | 116 | return -1; |
| 113 | } | 117 | } |
| 118 | if (strlen(str) > KSYM_NAME_LEN) { | ||
| 119 | fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" | ||
| 120 | "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", | ||
| 121 | str, strlen(str), KSYM_NAME_LEN); | ||
| 122 | return -1; | ||
| 123 | } | ||
| 114 | 124 | ||
| 115 | sym = str; | 125 | sym = str; |
| 116 | /* skip prefix char */ | 126 | /* skip prefix char */ |
| @@ -194,6 +204,9 @@ static int symbol_valid(struct sym_entry *s) · 77 unmodified lines | |||
| 194 | int i; | 204 | int i; |
| 195 | int offset = 1; | 205 | int offset = 1; |
| 196 | 206 | ||
| 207 | if (s->addr < kernel_start_addr) | ||
| 208 | return 0; | ||
| 209 | |||
| 197 | /* skip prefix char */ | 210 | /* skip prefix char */ |
| 198 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) | 211 | if (symbol_prefix_char && *(s->sym + 1) == symbol_prefix_char) |
| 199 | offset++; | 212 | offset++; |
| @@ -646,6 +659,9 @@ int main(int argc, char **argv) · 446 unmodified lines | |||
| 646 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) | 659 | if ((*p == '"' && *(p+2) == '"') || (*p == '\'' && *(p+2) == '\'')) |
| 647 | p++; | 660 | p++; |
| 648 | symbol_prefix_char = *p; | 661 | symbol_prefix_char = *p; |
| 662 | } else if (strncmp(argv[i], "--page-offset=", 14) == 0) { | ||
| 663 | const char *p = &argv[i][14]; | ||
| 664 | kernel_start_addr = strtoull(p, NULL, 16); | ||
| 649 | } else | 665 | } else |
| 650 | usage(); | 666 | usage(); |
| 651 | } | 667 | } |
| @@ -93,7 +93,7 @@ struct symbol { · 92 unmodified lines | |||
| 93 | #define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */ | 93 | #define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */ |
| 94 | #define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */ | 94 | #define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */ |
| 95 | #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ | 95 | #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ |
| 96 | #define SYMBOL_WRITE 0x0200 /* ? */ | 96 | #define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */ |
| 97 | #define SYMBOL_CHANGED 0x0400 /* ? */ | 97 | #define SYMBOL_CHANGED 0x0400 /* ? */ |
| 98 | #define SYMBOL_AUTO 0x1000 /* value from environment variable */ | 98 | #define SYMBOL_AUTO 0x1000 /* value from environment variable */ |
| 99 | #define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ | 99 | #define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ |
| @@ -25,7 +25,7 @@ · 24 unmodified lines | |||
| 25 | static const char mconf_readme[] = N_( | 25 | static const char mconf_readme[] = N_( |
| 26 | "Overview\n" | 26 | "Overview\n" |
| 27 | "--------\n" | 27 | "--------\n" |
| 28 | "This interface let you select features and parameters for the build.\n" | 28 | "This interface lets you select features and parameters for the build.\n" |
| 29 | "Features can either be built-in, modularized, or ignored. Parameters\n" | 29 | "Features can either be built-in, modularized, or ignored. Parameters\n" |
| 30 | "must be entered in as decimal or hexadecimal numbers or text.\n" | 30 | "must be entered in as decimal or hexadecimal numbers or text.\n" |
| 31 | "\n" | 31 | "\n" |
| @@ -39,15 +39,15 @@ static const char mconf_readme[] = N_( · 7 unmodified lines | |||
| 39 | "\n" | 39 | "\n" |
| 40 | "To change any of these features, highlight it with the cursor\n" | 40 | "To change any of these features, highlight it with the cursor\n" |
| 41 | "keys and press <Y> to build it in, <M> to make it a module or\n" | 41 | "keys and press <Y> to build it in, <M> to make it a module or\n" |
| 42 | "<N> to removed it. You may also press the <Space Bar> to cycle\n" | 42 | "<N> to remove it. You may also press the <Space Bar> to cycle\n" |
| 43 | "through the available options (ie. Y->N->M->Y).\n" | 43 | "through the available options (i.e. Y->N->M->Y).\n" |
| 44 | "\n" | 44 | "\n" |
| 45 | "Some additional keyboard hints:\n" | 45 | "Some additional keyboard hints:\n" |
| 46 | "\n" | 46 | "\n" |
| 47 | "Menus\n" | 47 | "Menus\n" |
| 48 | "----------\n" | 48 | "----------\n" |
| 49 | "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" | 49 | "o Use the Up/Down arrow keys (cursor keys) to highlight the item you\n" |
| 50 | " you wish to change or submenu wish to select and press <Enter>.\n" | 50 | " wish to change or the submenu you wish to select and press <Enter>.\n" |
| 51 | " Submenus are designated by \"--->\", empty ones by \"----\".\n" | 51 | " Submenus are designated by \"--->\", empty ones by \"----\".\n" |
| 52 | "\n" | 52 | "\n" |
| 53 | " Shortcut: Press the option's highlighted letter (hotkey).\n" | 53 | " Shortcut: Press the option's highlighted letter (hotkey).\n" |
| @@ -65,7 +65,7 @@ static const char mconf_readme[] = N_( · 11 unmodified lines | |||
| 65 | " there is a delayed response which you may find annoying.\n" | 65 | " there is a delayed response which you may find annoying.\n" |
| 66 | "\n" | 66 | "\n" |
| 67 | " Also, the <TAB> and cursor keys will cycle between <Select>,\n" | 67 | " Also, the <TAB> and cursor keys will cycle between <Select>,\n" |
| 68 | " <Exit> and <Help>.\n" | 68 | " <Exit>, <Help>, <Save>, and <Load>.\n" |
| 69 | "\n" | 69 | "\n" |
| 70 | "o To get help with an item, use the cursor keys to highlight <Help>\n" | 70 | "o To get help with an item, use the cursor keys to highlight <Help>\n" |
| 71 | " and press <ENTER>.\n" | 71 | " and press <ENTER>.\n" |
| @@ -105,7 +105,7 @@ static const char mconf_readme[] = N_( · 33 unmodified lines | |||
| 105 | "Text Box (Help Window)\n" | 105 | "Text Box (Help Window)\n" |
| 106 | "--------\n" | 106 | "--------\n" |
| 107 | "o Use the cursor keys to scroll up/down/left/right. The VI editor\n" | 107 | "o Use the cursor keys to scroll up/down/left/right. The VI editor\n" |
| 108 | " keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for \n" | 108 | " keys h,j,k,l function here as do <u>, <d>, <SPACE BAR> and <B> for\n" |
| 109 | " those who are familiar with less and lynx.\n" | 109 | " those who are familiar with less and lynx.\n" |
| 110 | "\n" | 110 | "\n" |
| 111 | "o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n" | 111 | "o Press <E>, <X>, <q>, <Enter> or <Esc><Esc> to exit.\n" |
| @@ -117,23 +117,21 @@ static const char mconf_readme[] = N_( · 5 unmodified lines | |||
| 117 | "those who, for various reasons, find it necessary to switch\n" | 117 | "those who, for various reasons, find it necessary to switch\n" |
| 118 | "between different configurations.\n" | 118 | "between different configurations.\n" |
| 119 | "\n" | 119 | "\n" |
| 120 | "At the end of the main menu you will find two options. One is\n" | 120 | "The <Save> button will let you save the current configuration to\n" |
| 121 | "for saving the current configuration to a file of your choosing.\n" | 121 | "a file of your choosing. Use the <Load> button to load a previously\n" |
| 122 | "The other option is for loading a previously saved alternate\n" | 122 | "saved alternate configuration.\n" |
| 123 | "configuration.\n" | ||
| 124 | "\n" | 123 | "\n" |
| 125 | "Even if you don't use alternate configuration files, but you\n" | 124 | "Even if you don't use alternate configuration files, but you find\n" |
| 126 | "find during a Menuconfig session that you have completely messed\n" | 125 | "during a Menuconfig session that you have completely messed up your\n" |
| 127 | "up your settings, you may use the \"Load Alternate...\" option to\n" | 126 | "settings, you may use the <Load> button to restore your previously\n" |
| 128 | "restore your previously saved settings from \".config\" without\n" | 127 | "saved settings from \".config\" without restarting Menuconfig.\n" |
| 129 | "restarting Menuconfig.\n" | ||
| 130 | "\n" | 128 | "\n" |
| 131 | "Other information\n" | 129 | "Other information\n" |
| 132 | "-----------------\n" | 130 | "-----------------\n" |
| 133 | "If you use Menuconfig in an XTERM window make sure you have your\n" | 131 | "If you use Menuconfig in an XTERM window, make sure you have your\n" |
| 134 | "$TERM variable set to point to a xterm definition which supports color.\n" | 132 | "$TERM variable set to point to an xterm definition which supports\n" |
| 135 | "Otherwise, Menuconfig will look rather bad. Menuconfig will not\n" | 133 | "color. Otherwise, Menuconfig will look rather bad. Menuconfig will\n" |
| 136 | "display correctly in a RXVT window because rxvt displays only one\n" | 134 | "not display correctly in an RXVT window because rxvt displays only one\n" |
| 137 | "intensity of color, bright.\n" | 135 | "intensity of color, bright.\n" |
| 138 | "\n" | 136 | "\n" |
| 139 | "Menuconfig will display larger menus on screens or xterms which are\n" | 137 | "Menuconfig will display larger menus on screens or xterms which are\n" |
| @@ -148,8 +146,8 @@ static const char mconf_readme[] = N_( · 8 unmodified lines | |||
| 148 | "\n" | 146 | "\n" |
| 149 | "Optional personality available\n" | 147 | "Optional personality available\n" |
| 150 | "------------------------------\n" | 148 | "------------------------------\n" |
| 151 | "If you prefer to have all of the options listed in a single menu, rather\n" | 149 | "If you prefer to have all of the options listed in a single menu,\n" |
| 152 | "than the default multimenu hierarchy, run the menuconfig with\n" | 150 | "rather than the default multimenu hierarchy, run the menuconfig with\n" |
| 153 | "MENUCONFIG_MODE environment variable set to single_menu. Example:\n" | 151 | "MENUCONFIG_MODE environment variable set to single_menu. Example:\n" |
| 154 | "\n" | 152 | "\n" |
| 155 | "make MENUCONFIG_MODE=single_menu menuconfig\n" | 153 | "make MENUCONFIG_MODE=single_menu menuconfig\n" |
| @@ -172,7 +170,7 @@ static const char mconf_readme[] = N_( · 16 unmodified lines | |||
| 172 | " mono => selects colors suitable for monochrome displays\n" | 170 | " mono => selects colors suitable for monochrome displays\n" |
| 173 | " blackbg => selects a color scheme with black background\n" | 171 | " blackbg => selects a color scheme with black background\n" |
| 174 | " classic => theme with blue background. The classic look\n" | 172 | " classic => theme with blue background. The classic look\n" |
| 175 | " bluetitle => a LCD friendly version of classic. (default)\n" | 173 | " bluetitle => an LCD friendly version of classic. (default)\n" |
| 176 | "\n"), | 174 | "\n"), |
| 177 | menu_instructions[] = N_( | 175 | menu_instructions[] = N_( |
| 178 | "Arrow keys navigate the menu. " | 176 | "Arrow keys navigate the menu. " |
| @@ -238,24 +236,24 @@ search_help[] = N_( · 59 unmodified lines | |||
| 238 | "Symbol: FOO [=m]\n" | 236 | "Symbol: FOO [=m]\n" |
| 239 | "Type : tristate\n" | 237 | "Type : tristate\n" |
| 240 | "Prompt: Foo bus is used to drive the bar HW\n" | 238 | "Prompt: Foo bus is used to drive the bar HW\n" |
| 241 | " Defined at drivers/pci/Kconfig:47\n" | ||
| 242 | " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" | ||
| 243 | " Location:\n" | 239 | " Location:\n" |
| 244 | " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" | 240 | " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" |
| 245 | " -> PCI support (PCI [=y])\n" | 241 | " -> PCI support (PCI [=y])\n" |
| 246 | "(1) -> PCI access mode (<choice> [=y])\n" | 242 | "(1) -> PCI access mode (<choice> [=y])\n" |
| 243 | " Defined at drivers/pci/Kconfig:47\n" | ||
| 244 | " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" | ||
| 247 | " Selects: LIBCRC32\n" | 245 | " Selects: LIBCRC32\n" |
| 248 | " Selected by: BAR\n" | 246 | " Selected by: BAR [=n]\n" |
| 249 | "-----------------------------------------------------------------\n" | 247 | "-----------------------------------------------------------------\n" |
| 250 | "o The line 'Type:' shows the type of the configuration option for\n" | 248 | "o The line 'Type:' shows the type of the configuration option for\n" |
| 251 | " this symbol (boolean, tristate, string, ...)\n" | 249 | " this symbol (boolean, tristate, string, ...)\n" |
| 252 | "o The line 'Prompt:' shows the text used in the menu structure for\n" | 250 | "o The line 'Prompt:' shows the text used in the menu structure for\n" |
| 253 | " this symbol\n" | 251 | " this symbol\n" |
| 254 | "o The 'Defined at' line tell at what file / line number the symbol\n" | 252 | "o The 'Defined at' line tells at what file / line number the symbol\n" |
| 255 | " is defined\n" | 253 | " is defined\n" |
| 256 | "o The 'Depends on:' line tell what symbols needs to be defined for\n" | 254 | "o The 'Depends on:' line tells what symbols need to be defined for\n" |
| 257 | " this symbol to be visible in the menu (selectable)\n" | 255 | " this symbol to be visible in the menu (selectable)\n" |
| 258 | "o The 'Location:' lines tell where in the menu structure this symbol\n" | 256 | "o The 'Location:' lines tells where in the menu structure this symbol\n" |
| 259 | " is located\n" | 257 | " is located\n" |
| 260 | " A location followed by a [=y] indicates that this is a\n" | 258 | " A location followed by a [=y] indicates that this is a\n" |
| 261 | " selectable menu item - and the current value is displayed inside\n" | 259 | " selectable menu item - and the current value is displayed inside\n" |
| @@ -263,9 +261,9 @@ search_help[] = N_( · 1 unmodified line | |||
| 263 | " Press the key in the (#) prefix to jump directly to that\n" | 261 | " Press the key in the (#) prefix to jump directly to that\n" |
| 264 | " location. You will be returned to the current search results\n" | 262 | " location. You will be returned to the current search results\n" |
| 265 | " after exiting this new menu.\n" | 263 | " after exiting this new menu.\n" |
| 266 | "o The 'Selects:' line tell what symbol will be automatically\n" | 264 | "o The 'Selects:' line tells what symbols will be automatically\n" |
| 267 | " selected if this symbol is selected (y or m)\n" | 265 | " selected if this symbol is selected (y or m)\n" |
| 268 | "o The 'Selected by' line tell what symbol has selected this symbol\n" | 266 | "o The 'Selected by' line tells what symbol has selected this symbol\n" |
| 269 | "\n" | 267 | "\n" |
| 270 | "Only relevant lines are shown.\n" | 268 | "Only relevant lines are shown.\n" |
| 271 | "\n\n" | 269 | "\n\n" |
| @@ -119,9 +119,10 @@ void menu_set_type(int type) · 118 unmodified lines | |||
| 119 | sym->type = type; | 119 | sym->type = type; |
| 120 | return; | 120 | return; |
| 121 | } | 121 | } |
| 122 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'", | 122 | menu_warn(current_entry, |
| 123 | sym->name ? sym->name : "<choice>", | 123 | "ignoring type redefinition of '%s' from '%s' to '%s'", |
| 124 | sym_type_name(sym->type), sym_type_name(type)); | 124 | sym->name ? sym->name : "<choice>", |
| 125 | sym_type_name(sym->type), sym_type_name(type)); | ||
| 125 | } | 126 | } |
| 126 | 127 | ||
| 127 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) | 128 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) |
| @@ -583,7 +584,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, · 455 unmodified lines | |||
| 583 | for (j = 4; --i >= 0; j += 2) { | 584 | for (j = 4; --i >= 0; j += 2) { |
| 584 | menu = submenu[i]; | 585 | menu = submenu[i]; |
| 585 | if (head && location && menu == location) | 586 | if (head && location && menu == location) |
| 586 | jump->offset = r->len - 1; | 587 | jump->offset = strlen(r->s); |
| 587 | str_printf(r, "%*c-> %s", j, ' ', | 588 | str_printf(r, "%*c-> %s", j, ' ', |
| 588 | _(menu_get_prompt(menu))); | 589 | _(menu_get_prompt(menu))); |
| 589 | if (menu->sym) { | 590 | if (menu->sym) { |
| @@ -597,7 +598,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop, · 7 unmodified lines | |||
| 597 | } | 598 | } |
| 598 | 599 | ||
| 599 | /* | 600 | /* |
| 600 | * get peoperty of type P_SYMBOL | 601 | * get property of type P_SYMBOL |
| 601 | */ | 602 | */ |
| 602 | static struct property *get_symbol_prop(struct symbol *sym) | 603 | static struct property *get_symbol_prop(struct symbol *sym) |
| 603 | { | 604 | { |
| @@ -69,6 +69,11 @@ static inline QString qgettext(const QString& str) · 68 unmodified lines | |||
| 69 | return QString::fromLocal8Bit(gettext(str.latin1())); | 69 | return QString::fromLocal8Bit(gettext(str.latin1())); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | ConfigSettings::ConfigSettings() | ||
| 73 | : QSettings("kernel.org", "qconf") | ||
| 74 | { | ||
| 75 | } | ||
| 76 | |||
| 72 | /** | 77 | /** |
| 73 | * Reads a list of integer values from the application settings. | 78 | * Reads a list of integer values from the application settings. |
| 74 | */ | 79 | */ |
| @@ -32,6 +32,7 @@ class ConfigMainWindow; · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | class ConfigSettings : public QSettings { | 33 | class ConfigSettings : public QSettings { |
| 34 | public: | 34 | public: |
| 35 | ConfigSettings(); | ||
| 35 | Q3ValueList<int> readSizes(const QString& key, bool *ok); | 36 | Q3ValueList<int> readSizes(const QString& key, bool *ok); |
| 36 | bool writeSizes(const QString& key, const Q3ValueList<int>& value); | 37 | bool writeSizes(const QString& key, const Q3ValueList<int>& value); |
| 37 | }; | 38 | }; |
| @@ -1047,7 +1047,7 @@ sym_re_search_free: · 1046 unmodified lines | |||
| 1047 | * When we check for recursive dependencies we use a stack to save | 1047 | * When we check for recursive dependencies we use a stack to save |
| 1048 | * current state so we can print out relevant info to user. | 1048 | * current state so we can print out relevant info to user. |
| 1049 | * The entries are located on the call stack so no need to free memory. | 1049 | * The entries are located on the call stack so no need to free memory. |
| 1050 | * Note inser() remove() must always match to properly clear the stack. | 1050 | * Note insert() remove() must always match to properly clear the stack. |
| 1051 | */ | 1051 | */ |
| 1052 | static struct dep_stack { | 1052 | static struct dep_stack { |
| 1053 | struct dep_stack *prev, *next; | 1053 | struct dep_stack *prev, *next; |
| @@ -68,7 +68,6 @@ static void alloc_string(const char *str, int size) · 67 unmodified lines | |||
| 68 | } | 68 | } |
| 69 | %} | 69 | %} |
| 70 | 70 | ||
| 71 | ws [ \n\t] | ||
| 72 | n [A-Za-z0-9_] | 71 | n [A-Za-z0-9_] |
| 73 | 72 | ||
| 74 | %% | 73 | %% |
| @@ -257,6 +257,7 @@ my $man_date = ('January', 'February', 'March', 'April', 'May', 'June', · 256 unmodified lines | |||
| 257 | 'July', 'August', 'September', 'October', | 257 | 'July', 'August', 'September', 'October', |
| 258 | 'November', 'December')[(localtime)[4]] . | 258 | 'November', 'December')[(localtime)[4]] . |
| 259 | " " . ((localtime)[5]+1900); | 259 | " " . ((localtime)[5]+1900); |
| 260 | my $show_not_found = 0; | ||
| 260 | 261 | ||
| 261 | # Essentially these are globals. | 262 | # Essentially these are globals. |
| 262 | # They probably want to be tidied up, made more localised or something. | 263 | # They probably want to be tidied up, made more localised or something. |
| @@ -369,6 +370,8 @@ while ($ARGV[0] =~ m/^-(.*)/) { · 106 unmodified lines | |||
| 369 | usage(); | 370 | usage(); |
| 370 | } elsif ($cmd eq '-no-doc-sections') { | 371 | } elsif ($cmd eq '-no-doc-sections') { |
| 371 | $no_doc_sections = 1; | 372 | $no_doc_sections = 1; |
| 373 | } elsif ($cmd eq '-show-not-found') { | ||
| 374 | $show_not_found = 1; | ||
| 372 | } | 375 | } |
| 373 | } | 376 | } |
| 374 | 377 | ||
| @@ -2535,6 +2538,9 @@ sub process_file($) { · 2160 unmodified lines | |||
| 2535 | } | 2538 | } |
| 2536 | if ($initial_section_counter == $section_counter) { | 2539 | if ($initial_section_counter == $section_counter) { |
| 2537 | print STDERR "Warning(${file}): no structured comments found\n"; | 2540 | print STDERR "Warning(${file}): no structured comments found\n"; |
| 2541 | if (($function_only == 1) && ($show_not_found == 1)) { | ||
| 2542 | print STDERR " Was looking for '$_'.\n" for keys %function_table; | ||
| 2543 | } | ||
| 2538 | if ($output_mode eq "xml") { | 2544 | if ($output_mode eq "xml") { |
| 2539 | # The template wants at least one RefEntry here; make one. | 2545 | # The template wants at least one RefEntry here; make one. |
| 2540 | print "<refentry>\n"; | 2546 | print "<refentry>\n"; |
| @@ -82,6 +82,8 @@ kallsyms() · 81 unmodified lines | |||
| 82 | kallsymopt="${kallsymopt} --all-symbols" | 82 | kallsymopt="${kallsymopt} --all-symbols" |
| 83 | fi | 83 | fi |
| 84 | 84 | ||
| 85 | kallsymopt="${kallsymopt} --page-offset=$CONFIG_PAGE_OFFSET" | ||
| 86 | |||
| 85 | local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ | 87 | local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ |
| 86 | ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" | 88 | ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" |
| 87 | 89 | ||
| @@ -17,6 +17,7 @@ · 16 unmodified lines | |||
| 17 | #include <string.h> | 17 | #include <string.h> |
| 18 | #include <limits.h> | 18 | #include <limits.h> |
| 19 | #include <stdbool.h> | 19 | #include <stdbool.h> |
| 20 | #include <errno.h> | ||
| 20 | #include "modpost.h" | 21 | #include "modpost.h" |
| 21 | #include "../../include/generated/autoconf.h" | 22 | #include "../../include/generated/autoconf.h" |
| 22 | #include "../../include/linux/license.h" | 23 | #include "../../include/linux/license.h" |
| @@ -37,6 +38,8 @@ static int warn_unresolved = 0; · 14 unmodified lines | |||
| 37 | /* How a symbol is exported */ | 38 | /* How a symbol is exported */ |
| 38 | static int sec_mismatch_count = 0; | 39 | static int sec_mismatch_count = 0; |
| 39 | static int sec_mismatch_verbose = 1; | 40 | static int sec_mismatch_verbose = 1; |
| 41 | /* ignore missing files */ | ||
| 42 | static int ignore_missing_files; | ||
| 40 | 43 | ||
| 41 | enum export { | 44 | enum export { |
| 42 | export_plain, export_unused, export_gpl, | 45 | export_plain, export_unused, export_gpl, |
| @@ -161,7 +164,7 @@ struct symbol { · 118 unmodified lines | |||
| 161 | unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */ | 164 | unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */ |
| 162 | unsigned int kernel:1; /* 1 if symbol is from kernel | 165 | unsigned int kernel:1; /* 1 if symbol is from kernel |
| 163 | * (only for external modules) **/ | 166 | * (only for external modules) **/ |
| 164 | unsigned int preloaded:1; /* 1 if symbol from Module.symvers */ | 167 | unsigned int preloaded:1; /* 1 if symbol from Module.symvers, or crc */ |
| 165 | enum export export; /* Type of export */ | 168 | enum export export; /* Type of export */ |
| 166 | char name[0]; | 169 | char name[0]; |
| 167 | }; | 170 | }; |
| @@ -329,8 +332,11 @@ static void sym_update_crc(const char *name, struct module *mod, · 161 unmodified lines | |||
| 329 | { | 332 | { |
| 330 | struct symbol *s = find_symbol(name); | 333 | struct symbol *s = find_symbol(name); |
| 331 | 334 | ||
| 332 | if (!s) | 335 | if (!s) { |
| 333 | s = new_symbol(name, mod, export); | 336 | s = new_symbol(name, mod, export); |
| 337 | /* Don't complain when we find it later. */ | ||
| 338 | s->preloaded = 1; | ||
| 339 | } | ||
| 334 | s->crc = crc; | 340 | s->crc = crc; |
| 335 | s->crc_valid = 1; | 341 | s->crc_valid = 1; |
| 336 | } | 342 | } |
| @@ -407,6 +413,11 @@ static int parse_elf(struct elf_info *info, const char *filename) · 70 unmodified lines | |||
| 407 | 413 | ||
| 408 | hdr = grab_file(filename, &info->size); | 414 | hdr = grab_file(filename, &info->size); |
| 409 | if (!hdr) { | 415 | if (!hdr) { |
| 416 | if (ignore_missing_files) { | ||
| 417 | fprintf(stderr, "%s: %s (ignored)\n", filename, | ||
| 418 | strerror(errno)); | ||
| 419 | return 0; | ||
| 420 | } | ||
| 410 | perror(filename); | 421 | perror(filename); |
| 411 | exit(1); | 422 | exit(1); |
| 412 | } | 423 | } |
| @@ -599,18 +610,17 @@ static void handle_modversions(struct module *mod, struct elf_info *info, · 186 unmodified lines | |||
| 599 | else | 610 | else |
| 600 | export = export_from_sec(info, get_secindex(info, sym)); | 611 | export = export_from_sec(info, get_secindex(info, sym)); |
| 601 | 612 | ||
| 613 | /* CRC'd symbol */ | ||
| 614 | if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { | ||
| 615 | crc = (unsigned int) sym->st_value; | ||
| 616 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc, | ||
| 617 | export); | ||
| 618 | } | ||
| 619 | |||
| 602 | switch (sym->st_shndx) { | 620 | switch (sym->st_shndx) { |
| 603 | case SHN_COMMON: | 621 | case SHN_COMMON: |
| 604 | warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); | 622 | warn("\"%s\" [%s] is COMMON symbol\n", symname, mod->name); |
| 605 | break; | 623 | break; |
| 606 | case SHN_ABS: | ||
| 607 | /* CRC'd symbol */ | ||
| 608 | if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { | ||
| 609 | crc = (unsigned int) sym->st_value; | ||
| 610 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc, | ||
| 611 | export); | ||
| 612 | } | ||
| 613 | break; | ||
| 614 | case SHN_UNDEF: | 624 | case SHN_UNDEF: |
| 615 | /* undefined symbol */ | 625 | /* undefined symbol */ |
| 616 | if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && | 626 | if (ELF_ST_BIND(sym->st_info) != STB_GLOBAL && |
| @@ -1853,7 +1863,7 @@ static void add_header(struct buffer *b, struct module *mod) · 1236 unmodified lines | |||
| 1853 | buf_printf(b, "\n"); | 1863 | buf_printf(b, "\n"); |
| 1854 | buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); | 1864 | buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); |
| 1855 | buf_printf(b, "\n"); | 1865 | buf_printf(b, "\n"); |
| 1856 | buf_printf(b, "struct module __this_module\n"); | 1866 | buf_printf(b, "__visible struct module __this_module\n"); |
| 1857 | buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); | 1867 | buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); |
| 1858 | buf_printf(b, "\t.name = KBUILD_MODNAME,\n"); | 1868 | buf_printf(b, "\t.name = KBUILD_MODNAME,\n"); |
| 1859 | if (mod->has_init) | 1869 | if (mod->has_init) |
| @@ -2119,7 +2129,7 @@ int main(int argc, char **argv) · 259 unmodified lines | |||
| 2119 | struct ext_sym_list *extsym_iter; | 2129 | struct ext_sym_list *extsym_iter; |
| 2120 | struct ext_sym_list *extsym_start = NULL; | 2130 | struct ext_sym_list *extsym_start = NULL; |
| 2121 | 2131 | ||
| 2122 | while ((opt = getopt(argc, argv, "i:I:e:msST:o:awM:K:")) != -1) { | 2132 | while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:")) != -1) { |
| 2123 | switch (opt) { | 2133 | switch (opt) { |
| 2124 | case 'i': | 2134 | case 'i': |
| 2125 | kernel_read = optarg; | 2135 | kernel_read = optarg; |
| @@ -2139,6 +2149,9 @@ int main(int argc, char **argv) · 13 unmodified lines | |||
| 2139 | case 'm': | 2149 | case 'm': |
| 2140 | modversions = 1; | 2150 | modversions = 1; |
| 2141 | break; | 2151 | break; |
| 2152 | case 'n': | ||
| 2153 | ignore_missing_files = 1; | ||
| 2154 | break; | ||
| 2142 | case 'o': | 2155 | case 'o': |
| 2143 | dump_write = optarg; | 2156 | dump_write = optarg; |
| 2144 | break; | 2157 | break; |
| @@ -416,7 +416,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) · 415 unmodified lines | |||
| 416 | basename = strrchr(modname, '/') + 1; | 416 | basename = strrchr(modname, '/') + 1; |
| 417 | else | 417 | else |
| 418 | basename = modname; | 418 | basename = modname; |
| 419 | sprintf(filelist, "%s/%.*s.mod", modverdir, | 419 | snprintf(filelist, sizeof(filelist), "%s/%.*s.mod", modverdir, |
| 420 | (int) strlen(basename) - 2, basename); | 420 | (int) strlen(basename) - 2, basename); |
| 421 | 421 | ||
| 422 | file = grab_file(filelist, &len); | 422 | file = grab_file(filelist, &len); |
| @@ -115,7 +115,9 @@ git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/ \ · 114 unmodified lines | |||
| 115 | -o $(perf-tar).tar; \ | 115 | -o $(perf-tar).tar; \ |
| 116 | mkdir -p $(perf-tar); \ | 116 | mkdir -p $(perf-tar); \ |
| 117 | git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \ | 117 | git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD; \ |
| 118 | tar rf $(perf-tar).tar $(perf-tar)/HEAD; \ | 118 | (cd $(srctree)/tools/perf; \ |
| 119 | util/PERF-VERSION-GEN ../../$(perf-tar)/ 2>/dev/null); \ | ||
| 120 | tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \ | ||
| 119 | rm -r $(perf-tar); \ | 121 | rm -r $(perf-tar); \ |
| 120 | $(if $(findstring tar-src,$@),, \ | 122 | $(if $(findstring tar-src,$@),, \ |
| 121 | $(if $(findstring bz2,$@),bzip2, \ | 123 | $(if $(findstring bz2,$@),bzip2, \ |
| @@ -214,13 +214,13 @@ $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; · 213 unmodified lines | |||
| 214 | $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; | 214 | $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; |
| 215 | $section_regex = "Disassembly of section\\s+(\\S+):"; | 215 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
| 216 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 216 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
| 217 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; | 217 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)\$"; |
| 218 | $section_type = '@progbits'; | 218 | $section_type = '@progbits'; |
| 219 | $mcount_adjust = 0; | 219 | $mcount_adjust = 0; |
| 220 | $type = ".long"; | 220 | $type = ".long"; |
| 221 | 221 | ||
| 222 | if ($arch eq "x86_64") { | 222 | if ($arch eq "x86_64") { |
| 223 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; | 223 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s(mcount|__fentry__)([+-]0x[0-9a-zA-Z]+)?\$"; |
| 224 | $type = ".quad"; | 224 | $type = ".quad"; |
| 225 | $alignment = 8; | 225 | $alignment = 8; |
| 226 | $mcount_adjust = -1; | 226 | $mcount_adjust = -1; |
| @@ -152,6 +152,30 @@ static void (*w2)(uint16_t, uint16_t *); · 151 unmodified lines | |||
| 152 | 152 | ||
| 153 | typedef void (*table_sort_t)(char *, int); | 153 | typedef void (*table_sort_t)(char *, int); |
| 154 | 154 | ||
| 155 | /* | ||
| 156 | * Move reserved section indices SHN_LORESERVE..SHN_HIRESERVE out of | ||
| 157 | * the way to -256..-1, to avoid conflicting with real section | ||
| 158 | * indices. | ||
| 159 | */ | ||
| 160 | #define SPECIAL(i) ((i) - (SHN_HIRESERVE + 1)) | ||
| 161 | |||
| 162 | static inline int is_shndx_special(unsigned int i) | ||
| 163 | { | ||
| 164 | return i != SHN_XINDEX && i >= SHN_LORESERVE && i <= SHN_HIRESERVE; | ||
| 165 | } | ||
| 166 | |||
| 167 | /* Accessor for sym->st_shndx, hides ugliness of "64k sections" */ | ||
| 168 | static inline unsigned int get_secindex(unsigned int shndx, | ||
| 169 | unsigned int sym_offs, | ||
| 170 | const Elf32_Word *symtab_shndx_start) | ||
| 171 | { | ||
| 172 | if (is_shndx_special(shndx)) | ||
| 173 | return SPECIAL(shndx); | ||
| 174 | if (shndx != SHN_XINDEX) | ||
| 175 | return shndx; | ||
| 176 | return r(&symtab_shndx_start[sym_offs]); | ||
| 177 | } | ||
| 178 | |||
| 155 | /* 32 bit and 64 bit are very similar */ | 179 | /* 32 bit and 64 bit are very similar */ |
| 156 | #include "sortextable.h" | 180 | #include "sortextable.h" |
| 157 | #define SORTEXTABLE_64 | 181 | #define SORTEXTABLE_64 |
| @@ -98,6 +98,8 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) · 97 unmodified lines | |||
| 98 | Elf_Shdr *symtab_sec = NULL; | 98 | Elf_Shdr *symtab_sec = NULL; |
| 99 | Elf_Shdr *extab_sec = NULL; | 99 | Elf_Shdr *extab_sec = NULL; |
| 100 | Elf_Sym *sym; | 100 | Elf_Sym *sym; |
| 101 | const Elf_Sym *symtab; | ||
| 102 | Elf32_Word *symtab_shndx_start = NULL; | ||
| 101 | Elf_Sym *sort_needed_sym; | 103 | Elf_Sym *sort_needed_sym; |
| 102 | Elf_Shdr *sort_needed_sec; | 104 | Elf_Shdr *sort_needed_sec; |
| 103 | Elf_Rel *relocs = NULL; | 105 | Elf_Rel *relocs = NULL; |
| @@ -109,11 +111,22 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) · 5 unmodified lines | |||
| 109 | int extab_index = 0; | 111 | int extab_index = 0; |
| 110 | int i; | 112 | int i; |
| 111 | int idx; | 113 | int idx; |
| 114 | unsigned int num_sections; | ||
| 115 | unsigned int secindex_strings; | ||
| 112 | 116 | ||
| 113 | shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); | 117 | shdr = (Elf_Shdr *)((char *)ehdr + _r(&ehdr->e_shoff)); |
| 114 | shstrtab_sec = shdr + r2(&ehdr->e_shstrndx); | 118 | |
| 119 | num_sections = r2(&ehdr->e_shnum); | ||
| 120 | if (num_sections == SHN_UNDEF) | ||
| 121 | num_sections = _r(&shdr[0].sh_size); | ||
| 122 | |||
| 123 | secindex_strings = r2(&ehdr->e_shstrndx); | ||
| 124 | if (secindex_strings == SHN_XINDEX) | ||
| 125 | secindex_strings = r(&shdr[0].sh_link); | ||
| 126 | |||
| 127 | shstrtab_sec = shdr + secindex_strings; | ||
| 115 | secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset); | 128 | secstrtab = (const char *)ehdr + _r(&shstrtab_sec->sh_offset); |
| 116 | for (i = 0; i < r2(&ehdr->e_shnum); i++) { | 129 | for (i = 0; i < num_sections; i++) { |
| 117 | idx = r(&shdr[i].sh_name); | 130 | idx = r(&shdr[i].sh_name); |
| 118 | if (strcmp(secstrtab + idx, "__ex_table") == 0) { | 131 | if (strcmp(secstrtab + idx, "__ex_table") == 0) { |
| 119 | extab_sec = shdr + i; | 132 | extab_sec = shdr + i; |
| @@ -129,6 +142,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) · 9 unmodified lines | |||
| 129 | symtab_sec = shdr + i; | 142 | symtab_sec = shdr + i; |
| 130 | if (strcmp(secstrtab + idx, ".strtab") == 0) | 143 | if (strcmp(secstrtab + idx, ".strtab") == 0) |
| 131 | strtab_sec = shdr + i; | 144 | strtab_sec = shdr + i; |
| 145 | if (r(&shdr[i].sh_type) == SHT_SYMTAB_SHNDX) | ||
| 146 | symtab_shndx_start = (Elf32_Word *)( | ||
| 147 | (const char *)ehdr + _r(&shdr[i].sh_offset)); | ||
| 132 | } | 148 | } |
| 133 | if (strtab_sec == NULL) { | 149 | if (strtab_sec == NULL) { |
| 134 | fprintf(stderr, "no .strtab in file: %s\n", fname); | 150 | fprintf(stderr, "no .strtab in file: %s\n", fname); |
| @@ -138,6 +154,8 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) · 3 unmodified lines | |||
| 138 | fprintf(stderr, "no .symtab in file: %s\n", fname); | 154 | fprintf(stderr, "no .symtab in file: %s\n", fname); |
| 139 | fail_file(); | 155 | fail_file(); |
| 140 | } | 156 | } |
| 157 | symtab = (const Elf_Sym *)((const char *)ehdr + | ||
| 158 | _r(&symtab_sec->sh_offset)); | ||
| 141 | if (extab_sec == NULL) { | 159 | if (extab_sec == NULL) { |
| 142 | fprintf(stderr, "no __ex_table in file: %s\n", fname); | 160 | fprintf(stderr, "no __ex_table in file: %s\n", fname); |
| 143 | fail_file(); | 161 | fail_file(); |
| @@ -176,7 +194,9 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) · 32 unmodified lines | |||
| 176 | fname); | 194 | fname); |
| 177 | fail_file(); | 195 | fail_file(); |
| 178 | } | 196 | } |
| 179 | sort_needed_sec = &shdr[r2(&sort_needed_sym->st_shndx)]; | 197 | sort_needed_sec = &shdr[get_secindex(r2(&sym->st_shndx), |
| 198 | sort_needed_sym - symtab, | ||
| 199 | symtab_shndx_start)]; | ||
| 180 | sort_done_location = (void *)ehdr + | 200 | sort_done_location = (void *)ehdr + |
| 181 | _r(&sort_needed_sec->sh_offset) + | 201 | _r(&sort_needed_sec->sh_offset) + |
| 182 | _r(&sort_needed_sym->st_value) - | 202 | _r(&sort_needed_sym->st_value) - |