Commit c4b8ac2c1aee1398b9378b8730bac56294b3410b

Authored by Li Hong
Committed by Steven Rostedt
1 parent 6092858c60

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: Li Hong <lihong.hi@gmail.com>
LKML-Reference: <20091028050743.GH30758@uhli>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Showing 1 changed file with 3 additions and 7 deletions Side-by-side Diff

scripts/recordmcount.pl
... ... @@ -350,15 +350,11 @@
350 350 {
351 351 return unless ($ref_func and @offsets);
352 352  
353   - # A section only had a weak function, to represent it.
354   - # Unfortunately, a weak function may be overwritten by another
355   - # function of the same name, making all these offsets incorrect.
356   - # To be safe, we simply print a warning and bail.
  353 + # Sanity check on weak function. A weak function may be overwritten by
  354 + # another function of the same name, making all these offsets incorrect.
357 355 if (defined $weak{$ref_func}) {
358   - print STDERR
359   - "$inputfile: WARNING: referencing weak function" .
  356 + die "$inputfile: ERROR: referencing weak function" .
360 357 " $ref_func for mcount\n";
361   - return;
362 358 }
363 359  
364 360 # is this function static? If so, note this fact.