diff options
-rwxr-xr-x | scripts/recordmcount.pl | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 02c80552b078..7265a7dcac4b 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -92,7 +92,7 @@ | |||
92 | # | 92 | # |
93 | # Here are the steps we take: | 93 | # Here are the steps we take: |
94 | # | 94 | # |
95 | # 1) Record all the local symbols by using 'nm' | 95 | # 1) Record all the local and weak symbols by using 'nm' |
96 | # 2) Use objdump to find all the call site offsets and sections for | 96 | # 2) Use objdump to find all the call site offsets and sections for |
97 | # mcount. | 97 | # mcount. |
98 | # 3) Compile the list into its own object. | 98 | # 3) Compile the list into its own object. |
@@ -152,7 +152,8 @@ my %weak; # List of weak functions | |||
152 | my %convert; # List of local functions used that needs conversion | 152 | my %convert; # List of local functions used that needs conversion |
153 | 153 | ||
154 | my $type; | 154 | my $type; |
155 | my $nm_regex; # Find the local functions (return function) | 155 | my $local_regex; # Match a local function (return function) |
156 | my $weak_regex; # Match a weak function (return function) | ||
156 | my $section_regex; # Find the start of a section | 157 | my $section_regex; # Find the start of a section |
157 | my $function_regex; # Find the name of a function | 158 | my $function_regex; # Find the name of a function |
158 | # (return offset and func name) | 159 | # (return offset and func name) |
@@ -197,7 +198,8 @@ if ($arch eq "x86") { | |||
197 | # We base the defaults off of i386, the other archs may | 198 | # We base the defaults off of i386, the other archs may |
198 | # feel free to change them in the below if statements. | 199 | # feel free to change them in the below if statements. |
199 | # | 200 | # |
200 | $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; | 201 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; |
202 | $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; | ||
201 | $section_regex = "Disassembly of section\\s+(\\S+):"; | 203 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
202 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 204 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
203 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; | 205 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; |
@@ -246,7 +248,7 @@ if ($arch eq "x86_64") { | |||
246 | $cc .= " -m32"; | 248 | $cc .= " -m32"; |
247 | 249 | ||
248 | } elsif ($arch eq "powerpc") { | 250 | } elsif ($arch eq "powerpc") { |
249 | $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; | 251 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; |
250 | $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:"; | 252 | $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:"; |
251 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$"; | 253 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$"; |
252 | 254 | ||
@@ -322,13 +324,13 @@ check_objcopy(); | |||
322 | 324 | ||
323 | # | 325 | # |
324 | # Step 1: find all the local (static functions) and weak symbols. | 326 | # Step 1: find all the local (static functions) and weak symbols. |
325 | # 't' is local, 'w/W' is weak (we never use a weak function) | 327 | # 't' is local, 'w/W' is weak |
326 | # | 328 | # |
327 | open (IN, "$nm $inputfile|") || die "error running $nm"; | 329 | open (IN, "$nm $inputfile|") || die "error running $nm"; |
328 | while (<IN>) { | 330 | while (<IN>) { |
329 | if (/$nm_regex/) { | 331 | if (/$local_regex/) { |
330 | $locals{$1} = 1; | 332 | $locals{$1} = 1; |
331 | } elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) { | 333 | } elsif (/$weak_regex/) { |
332 | $weak{$2} = $1; | 334 | $weak{$2} = $1; |
333 | } | 335 | } |
334 | } | 336 | } |