From owner-freebsd-toolchain@FreeBSD.ORG Thu Jan 20 21:45:04 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F40ED1065670; Thu, 20 Jan 2011 21:45:03 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) by mx1.freebsd.org (Postfix) with ESMTP id D48748FC24; Thu, 20 Jan 2011 21:45:03 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id p0KLj33u019122; Thu, 20 Jan 2011 13:45:03 -0800 (PST) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id p0KLj3RH019121; Thu, 20 Jan 2011 13:45:03 -0800 (PST) (envelope-from sgk) Date: Thu, 20 Jan 2011 13:45:03 -0800 From: Steve Kargl To: Roman Divacky Message-ID: <20110120214503.GA19077@troutmask.apl.washington.edu> References: <20110117184411.GA54556@troutmask.apl.washington.edu> <20110118143205.GA34216@freebsd.org> <20110118160252.GA6506@troutmask.apl.washington.edu> <20110120185449.GA92860@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110120185449.GA92860@freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: freebsd-toolchain@freebsd.org Subject: Re: How to build an executable with profiling? X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2011 21:45:04 -0000 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