Skip to content

Commit

Permalink
ftrace: Only update $offset when we update $ref_func
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Matt Fleming authored and Steven Rostedt committed Jul 23, 2009
1 parent fc4c735 commit bd171d5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/recordmcount.pl
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ sub update_funcs
# section found, now is this a start of a function?
} elsif ($read_function && /$function_regex/) {
$text_found = 1;
$offset = hex $1;
$text = $2;

# if this is either a local function or a weak function
Expand All @@ -412,10 +411,12 @@ sub update_funcs
if (!defined($locals{$text}) && !defined($weak{$text})) {
$ref_func = $text;
$read_function = 0;
$offset = hex $1;
} else {
# if we already have a function, and this is weak, skip it
if (!defined($ref_func) && !defined($weak{$text})) {
$ref_func = $text;
$offset = hex $1;
}
}
} elsif ($read_headers && /$mcount_section/) {
Expand Down

0 comments on commit bd171d5

Please sign in to comment.