lkml.org 
[lkml]   [2017]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2] riscv/ftrace: Add basic support
    On Tue, 12 Dec 2017 09:47:03 -0800
    Jim Wilson <jimw@sifive.com> wrote:


    > As Alan mentioned, all gcc does is call mcount with two args, parent
    > pc and self pc, same as most other linux targets. Most of the
    > interesting features of prof/gprof profiling happen inside glibc, with
    > the special start files provided by glibc, and some special functions
    > like profil(3). I think this is more of a glibc API issue than a gcc
    > ABI issue. If the glibc API changes, then the kernel support will
    > have to change too. I checked half a dozen different processor ABIs,
    > and I didn't find that one documents how mcount works.

    mcount appears to be totally undocumented in all archs. My way of
    figuring out what it did was simply reading the glibc code and how it
    handled it.

    Note, gcc on some archs supports the -mfentry option added with -pg,
    which will will not use "mcount" but instead "__fentry__" which comes
    before the prologue. This allows for ftrace to hijack the function, and
    this is how live kernel patching is implemented.

    -- Steve

    \
     
     \ /
      Last update: 2017-12-13 01:38    [W:7.331 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site