Impact: extend scripts/recordmcount.pl to ARM Arm uses %progbits instead of @progbits and requires only 4 byte alignment. [ Thanks to Sam Ravnborg for mentioning that ARM uses %progbits ]
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -136,6 +136,7 @@ my $function_regex; # Find the name of a function · 135 unmodified lines | |||
| 136 | # (return offset and func name) | 136 | # (return offset and func name) |
| 137 | my $mcount_regex; # Find the call site to mcount (return offset) | 137 | my $mcount_regex; # Find the call site to mcount (return offset) |
| 138 | my $alignment; # The .align value to use for $mcount_section | 138 | my $alignment; # The .align value to use for $mcount_section |
| 139 | my $section_type; # Section header plus possible alignment command | ||
| 139 | 140 | ||
| 140 | if ($arch eq "x86") { | 141 | if ($arch eq "x86") { |
| 141 | if ($bits == 64) { | 142 | if ($bits == 64) { |
| @@ -153,6 +154,7 @@ $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; · 11 unmodified lines | |||
| 153 | $section_regex = "Disassembly of section\\s+(\\S+):"; | 154 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
| 154 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 155 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
| 155 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; | 156 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; |
| 157 | $section_type = '@progbits'; | ||
| 156 | $type = ".long"; | 158 | $type = ".long"; |
| 157 | 159 | ||
| 158 | if ($arch eq "x86_64") { | 160 | if ($arch eq "x86_64") { |
| @@ -192,6 +194,10 @@ if ($arch eq "x86_64") { · 33 unmodified lines | |||
| 192 | $type = ".quad"; | 194 | $type = ".quad"; |
| 193 | } | 195 | } |
| 194 | 196 | ||
| 197 | } elsif ($arch eq "arm") { | ||
| 198 | $alignment = 2; | ||
| 199 | $section_type = '%progbits'; | ||
| 200 | |||
| 195 | } else { | 201 | } else { |
| 196 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; | 202 | die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; |
| 197 | } | 203 | } |
| @@ -312,7 +318,7 @@ sub update_funcs · 114 unmodified lines | |||
| 312 | if (!$opened) { | 318 | if (!$opened) { |
| 313 | open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; | 319 | open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; |
| 314 | $opened = 1; | 320 | $opened = 1; |
| 315 | print FILE "\t.section $mcount_section,\"a\",\@progbits\n"; | 321 | print FILE "\t.section $mcount_section,\"a\",$section_type\n"; |
| 316 | print FILE "\t.align $alignment\n" if (defined($alignment)); | 322 | print FILE "\t.align $alignment\n" if (defined($alignment)); |
| 317 | } | 323 | } |
| 318 | printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; | 324 | printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; |