Hi, I started hacking on gcc to support profiling a few days ago, and here is a small status update (just so that we don't get duplicate work around here), including a patch for any brave souls that want to play with it (it's against the gcc-3_3-branch from the GCC CVS).
Simple programs like say showtrans, show a interesting call graph, but things that could be more interesting to analyze like ids just go bonkers and hang. Havn't been able to figure out why since I can't attach GDB to it. I haven't tested it on much more at this time... The changes to the header files that are used to create the specs file are cannibalised from Marcus' specs file hack he did for gcc 3.0. In theory you could edit your specs file and get away without recompiling gcc, I haven't tried this. Index: gcc/config/gnu.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/gnu.h,v retrieving revision 1.4 diff -u -r1.4 gnu.h --- gcc/config/gnu.h 15 Apr 2002 20:44:32 -0000 1.4 +++ gcc/config/gnu.h 2 Aug 2003 14:27:58 -0000 @@ -6,7 +6,8 @@ /* Default C library spec. Use -lbsd-compat for gcc -bsd. */ #undef LIB_SPEC -#define LIB_SPEC "%{bsd:-lbsd-compat} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" +/* #define LIB_SPEC "%{bsd:-lbsd-compat} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}" */ +#define LIB_SPEC "%{bsd:-lbsd-compat} %{shared:-lc}%{!shared:%{profile:-lc_p}%{!profile:-lc}}" /* Standard include directory. In GNU, "/usr" is a four-letter word. */ #undef STANDARD_INCLUDE_DIR Index: gcc/config/i386/gnu.h =================================================================== RCS file: /cvsroot/gcc/gcc/gcc/config/i386/gnu.h,v retrieving revision 1.16 diff -u -r1.16 gnu.h --- gcc/config/i386/gnu.h 5 Jun 2002 17:01:30 -0000 1.16 +++ gcc/config/i386/gnu.h 2 Aug 2003 14:27:59 -0000 @@ -28,7 +28,8 @@ #define CPP_SPEC "%{posix:-D_POSIX_SOURCE} %{bsd:-D_BSD_SOURCE}" #undef CC1_SPEC -#define CC1_SPEC "%(cc1_cpu)" +/* #define CC1_SPEC "%(cc1_cpu)" */ +#define CC1_SPEC "%(cc1_cpu) %{profile:-p}" #undef LINK_SPEC #define LINK_SPEC "-m elf_i386 %{shared:-shared} \ @@ -39,13 +40,24 @@ %{static:-static}}" #undef STARTFILE_SPEC -#define STARTFILE_SPEC \ - "%{!shared: \ - %{!static: \ - %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \ - %{static:crt0.o%s}} \ - crti.o%s %{static:crtbeginT.o%s}\ - %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" +/* #define STARTFILE_SPEC \ */ +/* "%{!shared: \ */ +/* %{!static: \ */ +/* %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}} \ */ +/* %{static:crt0.o%s}} \ */ +/* crti.o%s %{static:crtbeginT.o%s}\ */ +/* %{!static:%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}}" */ + +#define STARTFILE_SPEC \ + "%{!shared: \ + %{!static: \ + %{profile:gcrt0.o%s} \ + %{!profile:%{pg:gcrt1.o%s}%{!pg:%{p:gcrt1.o%s}%{!p:crt1.o%s}}}} \ + %{static: \ + %{profile:gcrt0.o%s} \ + %{!profile:%{pg:gcrt0.o%s}%{!pg:%{p:gcrt0.o%s}%{!p:crt0.o%s}}}}} \ + crti.o%s %{!shared:crtbegin.o%s} \ + %{shared:crtbeginS.o%s}" /* FIXME: Is a Hurd-specific fallback mechanism necessary? */ #undef MD_FALLBACK_FRAME_STATE_FOR _______________________________________________ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-hurd