Skip to content

Commit

Permalink
adjust for llvm gcov calling convention
Browse files Browse the repository at this point in the history
  • Loading branch information
Vollstrecker committed Dec 25, 2024
1 parent 88954ef commit b9842cd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# make install prefix=$HOME

CC=cc
GCOV=GCOV
LLVM_GCOV_FLAG=LLMV_GCOV_FLAG

CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
Expand Down Expand Up @@ -121,7 +123,7 @@ infcover: infcover.o libz.a
cover: infcover
rm -f *.gcda
${QEMU_RUN} ./infcover
gcov inf*.c -o ./infcover.gcda
${GCOV} ${LLVM_GCOV_FLAG} inf*.c -o ./infcover.gcda

libz.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
Expand Down
29 changes: 24 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ zprefix=0
zconst=0
build64=0
gcc=0
clang=0
warn=0
debug=0
address=0
Expand Down Expand Up @@ -185,14 +186,31 @@ else
fi

case "$cc" in
*gcc*) gcc=1 ;;
*clang*) gcc=1 ;;
*gcc*) gcc=1
GCOV="gcov" ;;
*clang*) gcc=1
clang=1 ;;
esac
case `$cc -v 2>&1` in
*gcc*) gcc=1 ;;
*clang*) gcc=1 ;;
*gcc*) gcc=1
GCOV="gcov" ;;
*clang*) gcc=1
clang=1 ;;
esac

if test "$clang" -eq 1; then
clangV=`echo "$cc" | sed -e 's/^.*-//'`
if `llvm-cov-${clangV} --version > /dev/null`; then
GCOV="llvm-cov-${clangV}"
LLVM_GCOV_FLAG="gcov"
echo "Using ${GCOV} for coverage"
else
cover=0
LLVM_GCOV_FLAG=""
echo "Deactivating cover as no suitable gcov can be found"
fi
fi

show $cc -c $test.c
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
echo ... using gcc >> configure.log
Expand Down Expand Up @@ -620,7 +638,6 @@ fi

# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
if test $cover -eq 1; then
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
if test -n "$GCC_CLASSIC"; then
CC=$GCC_CLASSIC
fi
Expand Down Expand Up @@ -872,6 +889,8 @@ echo uname = $uname >> configure.log
# update Makefile with the configure results
sed < ${SRCDIR}Makefile.in "
/^CC *=/s#=.*#=$CC#
/^GCOV *=/s#=.*#=$GCOV#
/^LLVM_GCOV_FLAG *=/s#=.*#=$LLVM_GCOV_FLAG#
/^CFLAGS *=/s#=.*#=$CFLAGS#
/^SFLAGS *=/s#=.*#=$SFLAGS#
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
Expand Down

0 comments on commit b9842cd

Please sign in to comment.