GCC 12 GCOV using __gcov_dump() doestn't create .gcda files?

133 Views Asked by At

When I use GCC v10 (arm_none_eabi), test coverage is ok. But when I update to GCC 12, using __gcc_dump() + __gcov_reset() instead of __gcov_flush. I'm getting the issue: in function _sub_D_00100_1':... undefined reference to __gcov_exit'. I have try many solutions, but it's not create .gcda files.

Reference tutorial: https://gcc.gnu.org/onlinedocs/gcc/Freestanding-Environments.html

1

There are 1 best solutions below

1
Erich Styger On

Try adding your own implementation of __gcov_exit(). In which you use your own exit code, e.g. dumping the file with __gcov_dump(). Note that it seems that recent distributions of the ARM GNU toolchain have included the gcov library with empty hooks/implementation, so not writing data files at all. I'm using the XPack arm-none-eabi-gcc-12.2.1-1.2 which has a full gcov library included.