Commit e9611808 authored by Junchao Zhang's avatar Junchao Zhang Committed by Huiwei Lu
Browse files

Add -lgcov to LIBS when --enable-coverage



When mpich is configured with ./configure --enable-coverage ..., we put
-fprofile-arcs -ftest-coverage to CXXFLAGS. According to gcc manual,
-fprofile-arcs -ftest-coverage can be replaced by --coverage. But unfortunately,
I found though both add -lgcov when linking libmpichcxx.so, -lgcov is put to the
end of the link command, which is too late.

Adding -lgcov directly to LIBS will put -lgcov before -lc, which makes
the linker correctly resolve symbol 'atexit' in linking.

Fixes #2000
Signed-off-by: default avatarHuiwei Lu <huiweilu@mcs.anl.gov>
parent 2b829d4a
......@@ -25,6 +25,7 @@ AC_ARG_ENABLE([coverage],
if test "$enable_coverage" = "yes" ; then
if test "$ac_cv_prog_gcc" = "yes" ; then
CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
LIBS="$LIBS -lgcov"
if test ${WRAPPER_CFLAGS+set} = set ; then
WRAPPER_CFLAGS="$WRAPPER_CFLAGS -fprofile-arcs -ftest-coverage"
fi
......@@ -34,6 +35,7 @@ if test "$enable_coverage" = "yes" ; then
if test "$enable_cxx" = "yes" ; then
if test "$ac_cv_cxx_compiler_gnu" = "yes" ; then
CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
LIBS="$LIBS -lgcov"
if test ${WRAPPER_CXXFLAGS+set} = set ; then
WRAPPER_CXXFLAGS="$WRAPPER_CXXFLAGS -fprofile-arcs -ftest-coverage"
fi
......@@ -46,6 +48,7 @@ if test "$enable_coverage" = "yes" ; then
if test "$enable_f77" = yes ; then
if test "$ac_cv_f77_compiler_gnu" = "yes" ; then
FFLAGS="$FFLAGS -fprofile-arcs -ftest-coverage"
LIBS="$LIBS -lgcov"
if test ${WRAPPER_FFLAGS+set} = set ; then
WRAPPER_FFLAGS="$WRAPPER_FFLAGS -fprofile-arcs -ftest-coverage"
fi
......@@ -56,6 +59,7 @@ if test "$enable_coverage" = "yes" ; then
if test "$enable_fc" = yes ; then
if test "$ac_cv_fc_compiler_gnu" = "yes" ; then
FCFLAGS="$FCFLAGS -fprofile-arcs -ftest-coverage"
LIBS="$LIBS -lgcov"
if test ${WRAPPER_FCFLAGS+set} = set ; then
WRAPPER_FCFLAGS="$WRAPPER_FCFLAGS -fprofile-arcs -ftest-coverage"
fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment