From owner-freebsd-toolchain@FreeBSD.ORG Wed Jan 19 16:40:27 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 5069110656A5; Wed, 19 Jan 2011 16:40:27 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.208.78.105]) by mx1.freebsd.org (Postfix) with ESMTP id 2A4788FC20; Wed, 19 Jan 2011 16:40:27 +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 p0JGeQOd014056; Wed, 19 Jan 2011 08:40:26 -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 p0JGeQlA014055; Wed, 19 Jan 2011 08:40:26 -0800 (PST) (envelope-from sgk) Date: Wed, 19 Jan 2011 08:40:26 -0800 From: Steve Kargl To: Hans Ottevanger Message-ID: <20110119164026.GA13969@troutmask.apl.washington.edu> References: <20110117184411.GA54556@troutmask.apl.washington.edu> <20110118143205.GA34216@freebsd.org> <20110118144313.GO2518@deviant.kiev.zoral.com.ua> <20110118171657.GA68321@freebsd.org> <20110118173517.GA60201@troutmask.apl.washington.edu> <20110118211200.GA3586@freebsd.org> <4D36BA6E.5030202@iae.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D36BA6E.5030202@iae.nl> 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: Wed, 19 Jan 2011 16:40:27 -0000 On Wed, Jan 19, 2011 at 11:18:22AM +0100, Hans Ottevanger wrote: > On 01/18/11 22:12, Roman Divacky wrote: > >On Tue, Jan 18, 2011 at 09:35:17AM -0800, Steve Kargl wrote: > >>On Tue, Jan 18, 2011 at 06:16:57PM +0100, Roman Divacky wrote: > >>>On Tue, Jan 18, 2011 at 04:43:13PM +0200, Kostik Belousov wrote: > >>>>On Tue, Jan 18, 2011 at 03:32:05PM +0100, Roman Divacky wrote: > >>>>>On Mon, Jan 17, 2011 at 10:44:11AM -0800, Steve Kargl wrote: > >>>>>>How does one build an executable for profiling with clang? > >>>>> > >>>>>LLVM (and thus clang) does not support GPROF profiling. > >>>>> > >>>>>>clang -o testf -O2 -march=native -pipe -static -pg > >>>>>>-I/usr/local/include -I../mp testf.c -L/usr/local/lib -L../mp -lsgk > >>>>>>-lmpfr -lgmp -L/usr/home/kargl/work/lib -lm_clang_p > >>>>>>clang: warning: the clang compiler does not support '-pg' > >>>>>> > > If you are really desperate to find the hotspots in your program when > compiled with clang, you could call clang with -v to find the call to > /bin/ld. Then append _p to the appropriate libs if still needed and > replace crt1.o by gcrt1.o while calling ld directly. E.g. I am working on implementations of missing long double functions and complex function from libm. In doing this work, there are two overriding desires: accuracy and speed. In addition, I want to compare and *profile* a clang built libm against a gcc built libm. I already have anecdotal evidence that a clang libm is usually slower and sometime less accurate than a gcc libm. Thus, the desire to build a clang libm with something equivalent to 'gcc -pg'. > "/usr/bin/ld" -Bstatic -o testcoll /usr/lib/gcrt1.o /usr/lib/crti.o > /usr/lib/crtbegin.o testcoll.o angle.o apsis.o error.o minmax.o qags.o > qext.o qk21.o sort.o timint.o zero.o vmol.o -lm_p -lgcc -lgcc_eh -lc_p > -lgcc -lgcc_eh -t /usr/lib/crtend.o /usr/lib/crtn.o How do I create libm_p.a with clang? That's the issue. -- Steve