Skip to content

Commit

Permalink
tracing: Exit with error if a weak function is used in recordmcount.pl
Browse files Browse the repository at this point in the history
If a weak function is used as a relocation reference for mcount callers
and that function is overridden, it will cause ftrace to fail at run time.

The current code should prevent a weak function from being used, but if
one is, the code should exit with an error to fail at compile time.

Signed-off-by: Li Hong <[email protected]>
LKML-Reference: <20091028050743.GH30758@uhli>
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
swanli authored and rostedt committed Oct 29, 2009
1 parent 6092858 commit c4b8ac2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions scripts/recordmcount.pl
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,11 @@ sub update_funcs
{
return unless ($ref_func and @offsets);

# A section only had a weak function, to represent it.
# Unfortunately, a weak function may be overwritten by another
# function of the same name, making all these offsets incorrect.
# To be safe, we simply print a warning and bail.
# Sanity check on weak function. A weak function may be overwritten by
# another function of the same name, making all these offsets incorrect.
if (defined $weak{$ref_func}) {
print STDERR
"$inputfile: WARNING: referencing weak function" .
die "$inputfile: ERROR: referencing weak function" .
" $ref_func for mcount\n";
return;
}

# is this function static? If so, note this fact.
Expand Down

0 comments on commit c4b8ac2

Please sign in to comment.