This came up on the mips linux kernel mailing list. http://www.linux-mips.org/archives/linux-mips/2006-04/msg00231.html Suppose I am building a toolchain for the first time, and want to verify that gprof works. So you compile a trivial testcase with -pg, run it, run gprof on it, and you get an error. This is very confusing for a naive user. The problem here is that a trivial testcase has only one function, and hence no call graph info. However, gprof by default assumes you want to emit call graph info, and if there is none, it gives an error. I suspect this used to work OK, because in the past we used static libraries by default, and usually had static profiled libraries available to link with, so there was generally always a call graph. Even if it only included start and main. However, nowadays, we use shared libraries by default, and we don't link with profiled libraries unless you add extra options because this only works right for static libraries, so it is much more likely that there may be no call graph. I think it would be better if we emit a flat profile if no call graph is present. Of course, the flaw here is that people may now ask why they got a result but no call graph. However, I think this is easier to deal with. If you see a flat profile with only one function, then it is clear what is wrong. If you see an error with gprof, it isn't clear what is wrong, since the problem could be in gcc, glibc, or gprof or even somewhere else entirely. I tested this patch on x86_64-linux. There were no regressions. Not very meaningful since there is no gprof testsuite, but I tested it by hand on a trivial and non-trivial testcase. Without the patch I get an error on a trivial testcase. With the patch, I get a flat profile for a trivial testcase. Not checked in yet in case someone wanted to comment. -- Jim Wilson, GNU Tools Support, http://www.specifix.com