https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115628
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|undefined reference to |undefined reference to |`__gcov_merge_add' |`__gcov_merge Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to sadineniharish8446 from comment #2) > I was trying build source code coverage for gcc but while running the tests > we are getting the following errors: > crtstuff.c:(.text.exit+0x5): undefined reference to `__gcov_exit'^M > collect2: error: ld returned 1 exit status^M > compiler exited with status 1 > FAIL: g++.old-deja/g++.other/static13.C -std=c++98 (test for excess errors) > Excess errors: > /usr/bin/ld: > /home/hsadineni/newgcc/gcc/build/gcc/testsuite/g++/../../crtbegin.o:(. > data+0x80): undefined reference to `__gcov_merge_add' > crtstuff.c:(.text.startup+0xa): undefined reference to `__gcov_init' > crtstuff.c:(.text.exit+0x5): undefined reference to `__gcov_exit' > > Reproducible steps: > > ../configure --enable-languages=c++ --enable-coverage --disable-bootstrap > --disable-multilib CFLAGS="-ftest-coverage -fprofile-arcs" > CXXFLAGS="-ftest-coverage -fprofile-arcs " LDFLAGS="--coverage" Yes this is not going to work as you are compiling libgcc with -ftest-coverage which will almost never work. you just need either --enable-coverage or --enable-coverage=opt .