delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/11/19/03:40:51

Date: Mon, 19 Nov 2001 10:39:06 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
cc: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Re: Building a profiled version of libc
In-Reply-To: <3BF80E3C.3081575F@phekda.freeserve.co.uk>
Message-ID: <Pine.SUN.3.91.1011119103715.8761F-100000@is>
MIME-Version: 1.0
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

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019