diff options
| author | Matt Fleming <matt@console-pimps.org> | 2009-07-23 12:16:15 -0400 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2009-07-23 12:20:30 -0400 |
| commit | bd171d5ffc5cb2ba471e8205c679ee9d12b90116 (patch) | |
| tree | 0fdc1ae72f3e850368867c08ab5311262d8bce8b /scripts | |
| parent | fc4c73554c9d93b3e495f2f7acae1323b0d5db84 (diff) | |
ftrace: Only update $offset when we update $ref_func
The value of $offset should be the offset of $ref_func from the
beginning of the object file. Therefore, we should set both variables
together.
This fixes a bug I was hitting on sh where $offset (which is used to
calcualte the addends for the __mcount_loc entries) was being set
multiple times and didn't correspond to $ref_func's offset in the object
file. The addends in __mcount_loc were calculated incorrectly, resulting
in ftrace dynamically modifying addresses that weren't mcount call
sites.
Signed-off-by: Matt Fleming <matt@console-pimps.org>
LKML-Reference: <1248365775-25196-2-git-send-email-matt@console-pimps.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/recordmcount.pl | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index 16c5563b4129..d29baa2e063a 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
| @@ -403,7 +403,6 @@ while (<IN>) { | |||
| 403 | # section found, now is this a start of a function? | 403 | # section found, now is this a start of a function? |
| 404 | } elsif ($read_function && /$function_regex/) { | 404 | } elsif ($read_function && /$function_regex/) { |
| 405 | $text_found = 1; | 405 | $text_found = 1; |
| 406 | $offset = hex $1; | ||
| 407 | $text = $2; | 406 | $text = $2; |
| 408 | 407 | ||
| 409 | # if this is either a local function or a weak function | 408 | # if this is either a local function or a weak function |
| @@ -412,10 +411,12 @@ while (<IN>) { | |||
| 412 | if (!defined($locals{$text}) && !defined($weak{$text})) { | 411 | if (!defined($locals{$text}) && !defined($weak{$text})) { |
| 413 | $ref_func = $text; | 412 | $ref_func = $text; |
| 414 | $read_function = 0; | 413 | $read_function = 0; |
| 414 | $offset = hex $1; | ||
| 415 | } else { | 415 | } else { |
| 416 | # if we already have a function, and this is weak, skip it | 416 | # if we already have a function, and this is weak, skip it |
| 417 | if (!defined($ref_func) && !defined($weak{$text})) { | 417 | if (!defined($ref_func) && !defined($weak{$text})) { |
| 418 | $ref_func = $text; | 418 | $ref_func = $text; |
| 419 | $offset = hex $1; | ||
| 419 | } | 420 | } |
| 420 | } | 421 | } |
| 421 | } elsif ($read_headers && /$mcount_section/) { | 422 | } elsif ($read_headers && /$mcount_section/) { |
