Skip to content

Commit bd171d5

Browse files
mflemingrostedt
authored andcommitted
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>
1 parent fc4c735 commit bd171d5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎scripts/recordmcount.pl‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,6 @@ sub update_funcs
403403
# section found, now is this a start of a function?
404404
} elsif ($read_function && /$function_regex/) {
405405
$text_found = 1;
406-
$offset = hex $1;
407406
$text = $2;
408407

409408
# if this is either a local function or a weak function
@@ -412,10 +411,12 @@ sub update_funcs
412411
if (!defined($locals{$text}) && !defined($weak{$text})) {
413412
$ref_func = $text;
414413
$read_function = 0;
414+
$offset = hex $1;
415415
} else {
416416
# if we already have a function, and this is weak, skip it
417417
if (!defined($ref_func) && !defined($weak{$text})) {
418418
$ref_func = $text;
419+
$offset = hex $1;
419420
}
420421
}
421422
} elsif ($read_headers && /$mcount_section/) {

0 commit comments

Comments
 (0)