aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2008-11-20 10:16:16 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-23 05:37:08 -0500
commit42e007d0400155fbc12c5344c808889e6ae33d32 (patch)
tree7ca4e60e2ef6d8079363b32de8bd48555682d64a /scripts
parent0da85c09b44bfea07e63ed5324aabc7cfc8a889a (diff)
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: Steven Rostedt <srostedt@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/recordmcount.pl19
1 files changed, 17 insertions, 2 deletions
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 9f75438f65e2..7ec032e3c3fa 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -130,6 +130,7 @@ my %weak; # List of weak functions
130my %convert; # List of local functions used that needs conversion 130my %convert; # List of local functions used that needs conversion
131 131
132my $type; 132my $type;
133my $nm_regex; # Find the local functions (return function)
133my $section_regex; # Find the start of a section 134my $section_regex; # Find the start of a section
134my $function_regex; # Find the name of a function 135my $function_regex; # Find the name of a function
135 # (return offset and func name) 136 # (return offset and func name)
@@ -145,6 +146,7 @@ if ($arch eq "x86") {
145} 146}
146 147
147if ($arch eq "x86_64") { 148if ($arch eq "x86_64") {
149 $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)";
148 $section_regex = "Disassembly of section\\s+(\\S+):"; 150 $section_regex = "Disassembly of section\\s+(\\S+):";
149 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; 151 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
150 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$"; 152 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount([+-]0x[0-9a-zA-Z]+)?\$";
@@ -158,6 +160,7 @@ if ($arch eq "x86_64") {
158 $cc .= " -m64"; 160 $cc .= " -m64";
159 161
160} elsif ($arch eq "i386") { 162} elsif ($arch eq "i386") {
163 $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)";
161 $section_regex = "Disassembly of section\\s+(\\S+):"; 164 $section_regex = "Disassembly of section\\s+(\\S+):";
162 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; 165 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
163 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; 166 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$";
@@ -171,6 +174,7 @@ if ($arch eq "x86_64") {
171 $cc .= " -m32"; 174 $cc .= " -m32";
172 175
173} elsif ($arch eq "sh") { 176} elsif ($arch eq "sh") {
177 $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)";
174 $section_regex = "Disassembly of section\\s+(\\S+):"; 178 $section_regex = "Disassembly of section\\s+(\\S+):";
175 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; 179 $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:";
176 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; 180 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$";
@@ -181,6 +185,17 @@ if ($arch eq "x86_64") {
181 $objcopy .= " -O elf32-sh-linux"; 185 $objcopy .= " -O elf32-sh-linux";
182 $cc .= " -m32"; 186 $cc .= " -m32";
183 187
188} elsif ($arch eq "powerpc") {
189 $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
190 $section_regex = "Disassembly of section\\s+(\\S+):";
191 $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:";
192 $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
193 if ($bits == 64) {
194 $type = ".quad";
195 } else {
196 $type = ".long";
197 }
198
184} else { 199} else {
185 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD"; 200 die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
186} 201}
@@ -250,7 +265,7 @@ if (!$found_version) {
250# 265#
251open (IN, "$nm $inputfile|") || die "error running $nm"; 266open (IN, "$nm $inputfile|") || die "error running $nm";
252while (<IN>) { 267while (<IN>) {
253 if (/^[0-9a-fA-F]+\s+t\s+(\S+)/) { 268 if (/$nm_regex/) {
254 $locals{$1} = 1; 269 $locals{$1} = 1;
255 } elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) { 270 } elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) {
256 $weak{$2} = $1; 271 $weak{$2} = $1;
@@ -302,7 +317,7 @@ sub update_funcs
302 open(FILE, ">$mcount_s") || die "can't create $mcount_s\n"; 317 open(FILE, ">$mcount_s") || die "can't create $mcount_s\n";
303 $opened = 1; 318 $opened = 1;
304 print FILE "\t.section $mcount_section,\"a\",\@progbits\n"; 319 print FILE "\t.section $mcount_section,\"a\",\@progbits\n";
305 print FILE "\t.align $alignment\n"; 320 print FILE "\t.align $alignment\n" if (defined($alignment));
306 } 321 }
307 printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset; 322 printf FILE "\t%s %s + %d\n", $type, $ref_func, $offsets[$i] - $offset;
308 } 323 }