提交 c4b8ac2c 编写于 作者: L Li Hong 提交者: Steven Rostedt

tracing: Exit with error if a weak function is used in recordmcount.pl

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: NLi Hong <lihong.hi@gmail.com>
LKML-Reference: <20091028050743.GH30758@uhli>
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
上级 6092858c
...@@ -350,15 +350,11 @@ sub update_funcs ...@@ -350,15 +350,11 @@ sub update_funcs
{ {
return unless ($ref_func and @offsets); return unless ($ref_func and @offsets);
# A section only had a weak function, to represent it. # Sanity check on weak function. A weak function may be overwritten by
# Unfortunately, a weak function may be overwritten by another # another function of the same name, making all these offsets incorrect.
# function of the same name, making all these offsets incorrect.
# To be safe, we simply print a warning and bail.
if (defined $weak{$ref_func}) { if (defined $weak{$ref_func}) {
print STDERR die "$inputfile: ERROR: referencing weak function" .
"$inputfile: WARNING: referencing weak function" .
" $ref_func for mcount\n"; " $ref_func for mcount\n";
return;
} }
# is this function static? If so, note this fact. # is this function static? If so, note this fact.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册