On 2011.12.04 at 18:35 +0000, Nathan Sidwell wrote: > I've committed this patch to break apart the gcov finalization routines, I > believe this will make it easier to fix the problem shown up by bug 51113 -- > although this patch does not. Notable changes: > > * rename coverage_begin_output to coverage_begin_function for consistency > with > coverage_end_function > > * Only call it once from the profile code -- I suspect in the past it was > called > from several locations where it wasn't possible to statically determine which > would be the first call. Now it's obvious. > > * Move the opening of the notes file to the coverage initialization. This > does > mean that we'll always create a notes file when generating coverage data, > even > if there are no functions in the resultant object file. I don't think that's > unsurprising -- and will stop gcov itself complaining about a missing notes > file > in this case. > > * Replace the trailing array of the gcov_info object with a pointer to an > array. > This doesn't require changes to libgcov.c's source but will of course > change > the resultant object file it compiles to and constitutes an ABI change. This > change allows the creation of the gcov_info data type without knowing the > number > of functions being instrumented. > > tested on i686-pc-linux-gnu with profiledbootstrap.
Nathan, this patch breaks profiled build of tramp3d: % c++ -w -Ofast -fprofile-generate -march=native tramp3d-v4.cpp /tmp/ccMmeivA.o:tramp3d-v4.cpp:function Inform::flush(): error: undefined reference to '__gcov0__ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv' /tmp/ccMmeivA.o:tramp3d-v4.cpp:function Inform::flush(): error: undefined reference to '__gcov0__ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv' ... see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51449 -- Markus