profiling support for i386-gnu specs file
Marcus Brinkmann
Marcus.Brinkmann@ruhr-uni-bochum.de
Mon Jun 4 17:55:00 GMT 2001
Hi,
I fixed the Hurd specs file to support profiling (which was broken for
statically linked programs). The specs file I successfully used is
attached, an analysis of what it does (or should do) is in the table below.
The only relevant part of the specs file (the only parts which I changed)
are "cc1" and "startfile".
The Hurd has the i386-gnu architecture.
Thanks,
Marcus
To profile the program only:
$ gcc -o main main.c -pg
$ ./main
$ gprof main gmon.out
To profile the program and the C library:
$ gcc -o main main.c -profile
$ ./main
$ gprof main gmon.out
The specs file implement the following option combinations:
Notes: -shared overrides (and prevents) profiling options at the linking stage
-profile forces to link the profiling C library statically
-pg/-p does link to the normal C library (dynamically or statically)
The cc1 option -p is added for all of -p/-pg/-profile (for the first
two automatically, for the third there is a rule in the specs file).
static shared pg p profile =>lib
Y/N N Y/N Y/N N -lc
N Y Y/N Y/N Y/N -lc
Y/N N Y/N Y/N Y -lc_p
static shared pg p profile =>startfile
N N N N N crt1.o crti.o crtbegin.o
Y N N N N crt0.o crti.o crtbegin.o
N Y Y/N Y/N Y/N crti.o crtbeginS.o
N N Y/N Y/N Y gcrt0.o crti.o crtbegin.o
Y N Y/N Y/N Y/N gcrt0.o crti.o crtbegin.o
^^^^^^^^^^^^^^^^^^^ at least one Y
N N Y/N Y/N N gcrt1.o crti.o crtbegin.o
^^^^^^^^^^^ at least one Y
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de
More information about the Gcc-bugs
mailing list