How to build an executable with profiling?
Steve Kargl
sgk at troutmask.apl.washington.edu
Thu Jan 20 21:45:04 UTC 2011
On Thu, Jan 20, 2011 at 07:54:49PM +0100, Roman Divacky wrote:
>
> ok, I sat down and implemented what Hans Ottevanger told me to do :)
>
> http://lev.vlakno.cz/~rdivacky/clang-gprof.patch
>
Wow. Thanks.
I tried applying your patch to
% svn update
At revision 217661.
% cd /usr/src/contrib/llvm/tools/clang
% patch < /usr/home/kargl/clang-gprof.patch | & tee sgk.log
Inspection of sgk.log found
|Index: include/clang/Frontend/CodeGenOptions.h
|===================================================================
|--- include/clang/Frontend/CodeGenOptions.h (revision 123935)
|+++ include/clang/Frontend/CodeGenOptions.h (working copy)
--------------------------
Patching file include/clang/Frontend/CodeGenOptions.h using Plan A...
Hunk #1 failed at 56.
Hunk #2 failed at 126.
2 out of 2 hunks failed--saving rejects to include/clang/Frontend/CodeGenOptions.h.rej
|Index: lib/Driver/Tools.cpp
|===================================================================
|--- lib/Driver/Tools.cpp (revision 123935)
|+++ lib/Driver/Tools.cpp (working copy)
--------------------------
Patching file lib/Driver/Tools.cpp using Plan A...
Hunk #1 failed at 1280.
Hunk #2 succeeded at 1452 (offset -259 lines).
Hunk #3 succeeded at 3131 (offset -7 lines).
Hunk #4 succeeded at 2967 (offset -245 lines).
1 out of 4 hunks failed--saving rejects to lib/Driver/Tools.cpp.rej
I applied the rejected parts by hand (which might be a cause for
the problem below).
% cd ../../
% svn status
? tools/clang/sgk.log
M tools/clang/include/clang/Frontend/CodeGenOptions.h
M tools/clang/include/clang/Driver/CC1Options.td
M tools/clang/lib/Frontend/CompilerInvocation.cpp
M tools/clang/lib/Driver/Tools.cpp
M tools/clang/lib/CodeGen/CodeGenFunction.cpp
M tools/clang/lib/CodeGen/CodeGenFunction.h
% cd /usr/src/usr.bin/clang
% make clean && make && make install
troutmask:kargl[211] make testf
clang -o testf -O2 -march=native -pipe -pg -v -I/usr/local/include -I../mp testf.c -L/usr/local/lib -L../mp -lsgk -lmpfr -lgmp -lm
FreeBSD clang version 2.8 (tags/RELEASE_28 115870) 20101007
Target: x86_64-undermydesk-freebsd9.0
Thread model: posix
clang: warning: the clang compiler does not support '-pg'
"/usr/bin/clang" -cc1 -triple x86_64-undermydesk-freebsd9.0 -S -disable-free -main-file-name testf.c -mrelocation-model static -mdisable-fp-elim -mconstructor-aliases -munwind-tables -target-cpu athlon-fx -v -resource-dir /usr/lib/clang/2.8 -I /usr/local/include -I ../mp -O2 -ferror-limit 19 -fmessage-length 96 -fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/cc-sShp59.s -x c testf.c
clang -cc1 version 2.8 based upon llvm 2.8svn hosted on x86_64-undermydesk-freebsd9.0
ignoring nonexistent directory "/usr/lib/clang/2.8/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
../mp
/usr/include/clang/2.8
/usr/include
End of search list.
"/usr/bin/as" -o /tmp/cc-Rz3bps.o /tmp/cc-sShp59.s
"/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 -o testf /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib -L../mp /tmp/cc-Rz3bps.o -lsgk -lmpfr -lgmp -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
So, I must be doing something wrong. I'll poke around in my tree. :(
--
Steve
More information about the freebsd-toolchain
mailing list