How to build an executable with profiling?

Roman Divacky rdivacky at freebsd.org
Fri Jan 21 15:06:16 UTC 2011


On Thu, Jan 20, 2011 at 12:57:39PM -0600, Nathan Whitehorn wrote:
> On 01/20/11 12:54, Roman Divacky wrote:
> >ok, I sat down and implemented what Hans Ottevanger told me to do :)
> >
> >         http://lev.vlakno.cz/~rdivacky/clang-gprof.patch
> >
> >This patch does three things:
> >
> >1) emits "call .mcount" at the begining of every function body
> 
> It's not always called .mcount. See /sys/$ARCH/include/profile.h
> -Nathan

fwiw - I updated the patch to use different names on different archs,
can you guys review?

        case llvm::Triple::x86:
        case llvm::Triple::x86_64:
          return ".mcount";
        case llvm::Triple::mips:
        case llvm::Triple::mipsel:
        case llvm::Triple::ppc:
        case llvm::Triple::ppc64:
          return "_mcount";
        case llvm::Triple::arm:
          return "__mcount";


More information about the freebsd-toolchain mailing list