Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jan 2011 08:40:26 -0800
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        Hans Ottevanger <hansot@iae.nl>
Cc:        freebsd-toolchain@freebsd.org
Subject:   Re: How to build an executable with profiling?
Message-ID:  <20110119164026.GA13969@troutmask.apl.washington.edu>
In-Reply-To: <4D36BA6E.5030202@iae.nl>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110119164026.GA13969>