Ubuntu 16.04 の mingw で gcov シンボルが見つからない

Ubuntu 16.04 の mingw で gcov シンボルが見つからない

Ubuntu 14.04からUbuntu 16.04にアップグレードする前は、mingw-64-gccで次のコードをコンパイルできました。

x86_64-w64-mingw32-gcc -fprofile-generate -o test.exe test.c -lgcov -static

//test.c
#include <stdio.h>
int main(void)
{puts("test");return 0;}

現在、__gcov シンボルがないため、プログラムをリンクできません。

x86_64-w64-mingw32-gcc -fprofile-generate -o test test.c
/tmp/cccj8pnx.o:test.c:(.text+0x1a): undefined reference to `__gcov_indirect_call_profiler_v2'
/tmp/cccj8pnx.o:test.c:(.text+0x46): undefined reference to `__gcov_time_profiler'
/tmp/cccj8pnx.o:test.c:(.data+0xa0): undefined reference to `__gcov_merge_time_profile'
/tmp/cccj8pnx.o:test.c:(.rdata$.refptr.__gcov_indirect_call_callee[.refptr.__gcov_indirect_call_callee]+0x0): undefined reference to `__gcov_indirect_call_callee'
collect2: error: ld returned 1 exit status

2 つの Ubuntu バージョン間で何が変わったのでしょうか。ご協力いただければ幸いです。

答え1

-fprofile-arcs私も同じ問題に遭遇しましたが、ではなくにリンクすることで回避できました-lgcov

関連情報