Mail Archives: djgpp-workers/2001/11/19/03:40:51
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 -