aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Hong <lihong.hi@gmail.com>2009-10-28 01:05:23 -0400
committerSteven Rostedt <rostedt@goodmis.org>2009-10-29 15:11:48 -0400
commitdb24c7dcf42f78629d89b34e5d5a98ed56ea2ff5 (patch)
tree61767255769adbe8b367c77e632a2baccc58fb80
parent7b7edc27683e20624f4daf17c76041719184201c (diff)
tracing: Move mcount section search to front of loop in recordmcount.pl
Move the mcount section check to the beginning of the objdump read loop. This makes the code easier to follow since the search for the mcount section is performed first before the mcount callers are processed. Signed-off-by: Li Hong <lihong.hi@gmail.com> LKML-Reference: <20091028050523.GE30758@uhli> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rwxr-xr-xscripts/recordmcount.pl32
1 files changed, 18 insertions, 14 deletions
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index d6199fc4870a..02c80552b078 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -391,9 +391,27 @@ open(IN, "$objdump -hdr $inputfile|") || die "error running $objdump";
391 391
392my $text; 392my $text;
393 393
394
395# read headers first
394my $read_headers = 1; 396my $read_headers = 1;
395 397
396while (<IN>) { 398while (<IN>) {
399
400 if ($read_headers && /$mcount_section/) {
401 #
402 # Somehow the make process can execute this script on an
403 # object twice. If it does, we would duplicate the mcount
404 # section and it will cause the function tracer self test
405 # to fail. Check if the mcount section exists, and if it does,
406 # warn and exit.
407 #
408 print STDERR "ERROR: $mcount_section already in $inputfile\n" .
409 "\tThis may be an indication that your build is corrupted.\n" .
410 "\tDelete $inputfile and try again. If the same object file\n" .
411 "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n";
412 exit(-1);
413 }
414
397 # is it a section? 415 # is it a section?
398 if (/$section_regex/) { 416 if (/$section_regex/) {
399 $read_headers = 0; 417 $read_headers = 0;
@@ -434,21 +452,7 @@ while (<IN>) {
434 $offset = hex $1; 452 $offset = hex $1;
435 } 453 }
436 } 454 }
437 } elsif ($read_headers && /$mcount_section/) {
438 #
439 # Somehow the make process can execute this script on an
440 # object twice. If it does, we would duplicate the mcount
441 # section and it will cause the function tracer self test
442 # to fail. Check if the mcount section exists, and if it does,
443 # warn and exit.
444 #
445 print STDERR "ERROR: $mcount_section already in $inputfile\n" .
446 "\tThis may be an indication that your build is corrupted.\n" .
447 "\tDelete $inputfile and try again. If the same object file\n" .
448 "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n";
449 exit(-1);
450 } 455 }
451
452 # is this a call site to mcount? If so, record it to print later 456 # is this a call site to mcount? If so, record it to print later
453 if ($text_found && /$mcount_regex/) { 457 if ($text_found && /$mcount_regex/) {
454 $offsets[$#offsets + 1] = hex $1; 458 $offsets[$#offsets + 1] = hex $1;