提交 42e007d0 编写于 作者: S Steven Rostedt 提交者: Ingo Molnar

ftrace: add support for powerpc to recordmcount.pl script

Impact: Add PowerPC port to recordmcount.pl script

This patch updates the recordmcount.pl script to process
PowerPC.
Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 0da85c09
...@@ -130,6 +130,7 @@ my %weak; # List of weak functions ...@@ -130,6 +130,7 @@ my %weak; # List of weak functions
my %convert; # List of local functions used that needs conversion my %convert; # List of local functions used that needs conversion
my $type; my $type;
my $nm_regex; # Find the local functions (return function)
my $section_regex; # Find the start of a section my $section_regex; # Find the start of a section
my $function_regex; # Find the name of a function my $function_regex; # Find the name of a function
# (return offset and func name) # (return offset and func name)
...@@ -145,6 +146,7 @@ if ($arch eq "x86") { ...@@ -145,6 +146,7 @@ if ($arch eq "x86") {
} }
if ($arch eq "x86_64") { if ($arch eq "x86_64") {
$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([+-]0x[0-9a-zA-Z]+)?\$"; $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
...@@ -158,6 +160,7 @@ if ($arch eq "x86_64") { ...@@ -158,6 +160,7 @@ if ($arch eq "x86_64") {
$cc .= " -m64"; $cc .= " -m64";
} elsif ($arch eq "i386") { } elsif ($arch eq "i386") {
$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\$";
...@@ -171,6 +174,7 @@ if ($arch eq "x86_64") { ...@@ -171,6 +174,7 @@ if ($arch eq "x86_64") {
$cc .= " -m32"; $cc .= " -m32";
} elsif ($arch eq "sh") { } elsif ($arch eq "sh") {
$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\$";
...@@ -181,6 +185,17 @@ if ($arch eq "x86_64") { ...@@ -181,6 +185,17 @@ if ($arch eq "x86_64") {
$objcopy .= " -O elf32-sh-linux"; $objcopy .= " -O elf32-sh-linux";
$cc .= " -m32"; $cc .= " -m32";
} elsif ($arch eq "powerpc") {
$nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
$section_regex = "Disassembly of section\\s+(\\S+):";
$function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:";
$mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
if ($bits == 64) {
$type = ".quad";
} else {
$type = ".long";
}
} else { } else {
die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
} }
...@@ -250,7 +265,7 @@ if (!$found_version) { ...@@ -250,7 +265,7 @@ if (!$found_version) {
# #
open (IN, "$nm $inputfile|") || die "error running $nm"; open (IN, "$nm $inputfile|") || die "error running $nm";
while (<IN>) { while (<IN>) {
if (/^[0-9a-fA-F]+\s+t\s+(\S+)/) { if (/$nm_regex/) {
$locals{$1} = 1; $locals{$1} = 1;
} elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) { } elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) {
$weak{$2} = $1; $weak{$2} = $1;
...@@ -302,7 +317,7 @@ sub update_funcs ...@@ -302,7 +317,7 @@ sub update_funcs
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\",\@progbits\n";
print FILE "\t.align $alignment\n"; 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册