Reputation: 41
Trying to compiler our code for code coverage using gcov. Getting following error:
hidden symbol `__gcov_merge_add' in /usr/lib/gcc/i686-redhat-linux/4.4.4/libgcov.a(_gcov_merge_add.o) is referenced by DSO /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: ld returned 1 exit status
Following compiler options are newly added for gcov:
-O0 -fprofile-arcs -ftest-coverage -Xlinker -zmuldefs
and ld flags:
-fprofile-generate -fprofile-arcs
and linked with library -lgcov
Please suggest.
Upvotes: 4
Views: 4100
Reputation: 13464
Solution for this issue is
-fprofile-arcs -ftest-coverage
-fprofile-arcs -lgcov
I also got this same error when I was not using -fprofile-arcs
while linking.
Upvotes: 2
Reputation: 41
We are able to enable the code coverage using simply --coverage -O0
compiler options and finally linking with -lgcov
for RHEL 6.* version.
However same doesnt with debian where we had to use -O0 -fprofile-arcs -ftest-coverage -Xlinker -zmuldefs
to make code coverage enabled binaries.
Upvotes: 0