[lkml]   [2009]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH -tip] ftrace: Correctly calculate the first function in the .text section
    This patch fixes a bug whereby didn't stop searching
    once it had correctly detected the function at the beginning of the
    .text section. To stop it searching, I needed to reset $read_function.
    The effect of this bug was that some entries in __mcount_loc section
    were created with the negative reloc addends. The last text section
    found was used as the base and all mcount calls were at a relative
    offset to that, so at final link time the addresses were fixed up to
    point to somewhere completely bogus.

    This all resulted in ftrace dynamically modifying addresses that weren't
    actually mcount callsites.

    I also noticed another bug and fixed up the condition from,

    if (!defined($ref_func) || !defined($weak{$text})) {
    if (!defined($ref_func) && !defined($weak{$text})) {

    This now matches the comment above the conditional.

    Signed-off-by: Matt Fleming <>
    scripts/ | 3 ++-
    1 files changed, 2 insertions(+), 1 deletions(-)

    diff --git a/scripts/ b/scripts/
    index 7109e2b..356ff6a 100755
    --- a/scripts/
    +++ b/scripts/
    @@ -414,8 +414,9 @@ while (<IN>) {
    $read_function = 0;
    } else {
    # if we already have a function, and this is weak, skip it
    - if (!defined($ref_func) || !defined($weak{$text})) {
    + if (!defined($ref_func) && !defined($weak{$text})) {
    $ref_func = $text;
    + $read_function = 0;
    } elsif ($read_headers && /$mcount_section/) {

     \ /
      Last update: 2009-07-23 11:55    [W:2.915 / U:0.264 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site