Error in Gcov for ARM
Kai Ruottu
kai.ruottu@wippies.com
Tue Sep 20 10:08:00 GMT 2011
20.9.2011 8:13, Harry Trinta kirjoitti:
> I am having a problem when compiling a program with options
> -ftest-coverage and -fprofile-arcs to run on an embedded system with
> ARM processor.
> I'm using a GCC cross-compiler (arm-elf) to compile the program.
>
> The errors is as follows:
>
> - undefined reference to `__gcov_merge_add'
> - undefined reference to `__gcov_init'
>
> is there any restriction on the use of these parameters for this type
> of processor?
Not for the processor but maybe for the target itself, as you told:
"an embedded system".
So could you please elaborate where the file 'auxname.gcda' or something
would appear :
-fprofile-arcs
Add code so that program flow arcs are instrumented. During
execution the program records how many times each branch and
call is executed and how many times it is taken or returns.
When the compiled program exits it saves this data to a file
called ‘auxname.gcda’ for each source file. The data may be
used for profile-directed optimizations (‘-fbranch-probabilities’),
or for test coverage analysis (‘-ftest-coverage’). Each object
fileÂ’s auxname is generated from the name of the output file,
if explicitly specified and it is not the final executable,
otherwise it is the basename of the source file. In both cases
any suffix is removed (e.g. ‘foo.gcda’ for input file ‘dir/foo.c’,
or ‘dir/foo.gcda’ for output file specified as ‘-o dir/foo.o’).
See Section 9.5 [Cross-profiling],
As default these files would be written onto the runtime system's
filesystem. What is this with an 'arm-elf' system?
The "cross profiling", what it needs from the standard C library
(implementing the '__gcov_merge_add()' and '__gcov_init()' routines?)
etc. consulting the GCC manual, would be your homework. For instance:
http://sysrun.haifa.il.ibm.com/hrl/greps2007/papers/gcov-on-an-embedded-system.pdf
If the basic prerequisites are ok and you know that they should
work, then you can ask why they however don't work.
More information about the Gcc-help
mailing list