Date: Mon, 19 Nov 2001 10:39:06 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Richard Dawe cc: DJGPP workers Subject: Re: Building a profiled version of libc In-Reply-To: <3BF80E3C.3081575F@phekda.freeserve.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Sun, 18 Nov 2001, Richard Dawe wrote: > Using a copy of CVS sources I added '-a' and '-pg' to the list of options > to src/gcc.opt. I then rebuilt the library. I tried to build a profiled > version of src/libc/posix/sys/stat/stat.c using the following > command-line: > > gcc -Wall -g -DTEST -a -pg -I/develop/djgpp.rw/include \ > -L/develop/djgpp.rw/lib -o stat stat.c > > /develop/djgpp.rw is the root of the CVS tree. Unfortunately this resulted > in a bad executable. I got an illegal instruction exception every time I > tried to run 'stat'. That's because mcount.c cannot be compiled with -pg. Recompile mcount.c manually without -pg -a, put it into libc.a, then rebuild the distribution, and it will work (at least it does for me with djlsr203.zip). If this does solve the problem, could you please fix src/libc/crt0/makefile to DTRT? > Before I tried adding profiling to the whole library, I compiled relevant > files individually, e.g. xstat.c: > > gcc `cat /develop/djgpp.rw/src/gcc.opt` -pg -c xstat.c > > Compiling and linking individually profiled objects worked, but it didn't > produce any helpful profiling data (i.e. time spent in the stat functions > was shown as 0). That's because the test program runs less than a timer tick, I think.