lkml.org 
[lkml]   [2011]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] recordmcount: Fix handling of elf64 big-endian objects.
    From
    Date
    On Mon, 2011-12-19 at 17:42 -0800, David Daney wrote:
    > From: David Daney <david.daney@cavium.com>
    >
    > In ELF64, the sh_flags field is 64-bits wide. recordmcount was
    > erroneously treating it as a 32-bit wide field. For little endian
    > objects this works because the flags of interest (SHF_EXECINSTR)
    > reside in the lower 32 bits of the word, and you get the same result
    > with either a 32-bit or 64-bit read. Big endian objects on the
    > other hand do not work at all with this error.
    >
    > The fix: Correctly treat sh_flags as 64-bits wide in elf64 objects.
    >
    > The symptom I observed was that my
    > __start_mcount_loc..__stop_mcount_loc was empty even though ftrace
    > function tracing was enabled.
    >

    OUCH!

    This looks like something that needs to go to stable. Let me play with
    this on my PPC64 tomorrow.

    Thanks!

    -- Steve

    > Signed-off-by: David Daney <david.daney@cavium.com>
    > ---
    > scripts/recordmcount.h | 2 +-
    > 1 files changed, 1 insertions(+), 1 deletions(-)
    >
    > diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
    > index f40a6af6..54e35c1 100644
    > --- a/scripts/recordmcount.h
    > +++ b/scripts/recordmcount.h
    > @@ -462,7 +462,7 @@ __has_rel_mcount(Elf_Shdr const *const relhdr, /* is SHT_REL or SHT_RELA */
    > succeed_file();
    > }
    > if (w(txthdr->sh_type) != SHT_PROGBITS ||
    > - !(w(txthdr->sh_flags) & SHF_EXECINSTR))
    > + !(_w(txthdr->sh_flags) & SHF_EXECINSTR))
    > return NULL;
    > return txtname;
    > }




    \
     
     \ /
      Last update: 2011-12-20 04:11    [W:0.022 / U:92.204 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site