[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Profiling a library built with libtool

From: Benoit SIGOURE
Subject: Re: Profiling a library built with libtool
Date: Fri, 13 Jul 2007 18:01:09 +0200

On Jul 13, 2007, at 5:50 PM, Bob Friesenhahn wrote:

On Fri, 13 Jul 2007, Joseph Wakeling wrote:

I don't know whether I need to do more than add -pg to the CFLAGS when building the library or whether it's simply gprof I'm not using correctly.

It is important to know that profiling is based on both adding special code to functions during compilation (influenced by CFLAGS), and use of a special startup-module for linking. That means you should add -pg to LDFLAGS as well. Profiling will be easiest to deal with in a static build (might be a firm requirement). If adding -pg to LDFLAGS does not help, then it is quite possible that libtool itself has a bug. Watch to make sure that libtool is supplying this option to the linker (or compiler if it is used as the linker).

Adding -pg to CFLAGS is enough *when using libtool* because both CFLAGS and LDFLAGS are used when linking with libtool and libtool will let -pg pass through. It worked for me with a non-static build so this should not be a requirement (at least on some platforms -- I've tested on OSX).

Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory

Attachment: PGP.sig
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]