Package: gcc-2.95 Version: 2.95.4-7 The x86 version of GCC-2.95 doesn't link with profiled versions of the system libraries when the -pg option is invoked. Here's a sample C program to illustrate the problem:
#include <stdio.h> #include <math.h> int main(int argc, char *argv[]) { double x = sqrt(M_PI); printf("x = %f\n", x); return 0; } upon executing "gcc -pg foo.c -fprofile-arcs -lm && ./a.out" the file ./gmon.out will be created, which can then be examined with "gprof ./a.out". Notice that time spent in sqrt and printf has not been recorded. (I'm not including gprof output because it is so long.) A partial workaround is to use "gcc -pg -fprofile-arcs foo.c -lm_p", which will detect time spent in sqrt, but not in printf. Using "gcc -pg -fprofile-arc foo.c -lm_p -lc_p" produces the following error: /usr/bin/ld: BFD 2.12.90.0.1 20020307 Debian/GNU Linux assertion fail ../../bfd/elf-strtab.c:262 I consider this to be a gcc problem, not a binutils problem, because traditionally the -pg option to cc has caused the profiled libc to be linked and both the gcc and gprof info pages imply gcc is supposed to do the same. Furthermore, I can use "gcc -v" to find out how gcc invokes the linker and edit that line to use -lc_p instead and get the correct behavior, without ld failing any assertions, i.e. gprof also reports the stats on printf. LD_LIBRARY_PATH is not set. Here's a list of relevant packages installed: $ dpkg -l gcc-2.95 binutils libc6-prof libc6-dev libc6 Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii gcc-2.95 2.95.4-7 The GNU C compiler. ii binutils 2.12.90.0.1-4 The GNU assembler, linker and binary utiliti ii libc6-prof 2.2.5-11.2 GNU C Library: Profiling Libraries. ii libc6-dev 2.2.5-11.2 GNU C Library: Development Libraries and Hea ii libc6 2.2.5-11.2 GNU C Library: Shared libraries and Timezone