Commit e58918ab authored by Jim Radford's avatar Jim Radford Committed by Ingo Molnar

ftrace: scripts/recordmcount.pl support for ARM

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 ]
Signed-off-by: default avatarJim Radford <radford@galvanix.com>
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 3a3d04ae
...@@ -136,6 +136,7 @@ my $function_regex; # Find the name of a function ...@@ -136,6 +136,7 @@ my $function_regex; # Find the name of a function
# (return offset and func name) # (return offset and func name)
my $mcount_regex; # Find the call site to mcount (return offset) my $mcount_regex; # Find the call site to mcount (return offset)
my $alignment; # The .align value to use for $mcount_section my $alignment; # The .align value to use for $mcount_section
my $section_type; # Section header plus possible alignment command
if ($arch eq "x86") { if ($arch eq "x86") {
if ($bits == 64) { if ($bits == 64) {
...@@ -153,6 +154,7 @@ $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; ...@@ -153,6 +154,7 @@ $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)";
$section_regex = "Disassembly of section\\s+(\\S+):"; $section_regex = "Disassembly of section\\s+(\\S+):";
$function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$";
$section_type = '@progbits';
$type = ".long"; $type = ".long";
if ($arch eq "x86_64") { if ($arch eq "x86_64") {
...@@ -192,6 +194,10 @@ if ($arch eq "x86_64") { ...@@ -192,6 +194,10 @@ if ($arch eq "x86_64") {
$type = ".quad"; $type = ".quad";
} }
} elsif ($arch eq "arm") {
$alignment = 2;
$section_type = '%progbits';
} else { } else {
die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
} }
...@@ -312,7 +318,7 @@ sub update_funcs ...@@ -312,7 +318,7 @@ sub update_funcs
if (!$opened) { if (!$opened) {
open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
$opened = 1; $opened = 1;
print FILE "\t.section $mcount_section,\"a\",\@progbits\n"; print FILE "\t.section $mcount_section,\"a\",$section_type\n";
print FILE "\t.align $alignment\n" if (defined($alignment)); print FILE "\t.align $alignment\n" if (defined($alignment));
} }
printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment