Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 1 May 2013 16:00:05 +0300
From: Timerlan Moldobaev <moldobaev@...il.com>
To: musl@...ts.openwall.com
Subject: Building musl with gcov support

Hi ,

I am trying to check musl source code coverage for  various test suites.
It's interesting to know  what percentage of musl source code is used by
these tests.
For this purpose I am trying to build musl and libc-testsuite with the
standard gcov tool instrumentation support.
The gcov documentation states that gcc flags  -fprofile-arcs
-ftest-coverage both for compilation and linking should be used  to enable
source coverage.
libc-testsuit is linked statically with libc.a located under musl/lib

This is how my compilation line looks like for a musl source file:
gcc -std=c99 -nostdinc -D_XOPEN_SOURCE=700 -I./arch/i386 -I./src/internal
-I./include  -fprofile-arcs -ftest-coverage  -c -o src/unistd/writev.o
src/unistd/writev.c

This is how my compilation and linker command line look for libc-testsuite
sources:

gcc -I/home/swproj/sw/users/moldobaev/projects/musl/include -fprofile-arcs
-ftest-coverage -o basename.o -c basename.c
gcc -I/home/swproj/sw/users/moldobaev/projects/musl/include -fprofile-arcs
-ftest-coverage -o dirname.o -c dirname.c
...
gcc -I/home/swproj/sw/users/moldobaev/projects//musl/include -fprofile-arcs
-ftest-coverage -o wcstol.o -c wcstol.c
gcc -fprofile-arcs  -static
 -L/home/swproj/sw/users/moldobaev/projects/musl/lib_i386 -lm -lrt
-lpthread -o testsuite basename.o dirname.o env.o fcntl.o fdopen.o
fnmatch.o fscanf.o fwscanf.o mbc.o memstream.o popen.o qsort.o sem.o
snprintf.o socket.o spawn.o sscanf.o stat.o string.o strtod.o strtol.o
swprintf.o testsuite.o time.o ungetc.o wcstol.o
/_TOOLS_/dist/gnu-gcc-4.1.1/i686-pc-linux2.4/lib/gcc/i686-pc-linux-gnu/4.1.1/libgcov.a(_gcov.o):
In function `strtol':
/usr/include/stdlib.h:317: undefined reference to `__strtol_internal'
collect2: ld returned 1 exit status
gmake: *** [testsuite] Error 1

I am using i686-pc-linux-gnu gcc version 4.1.1.

Seems that the sources of libgcov.a library call in some way
__strtol_internal function whose implementation cannot be found in musl
library.
Indeed,  here is the output of nm on libcov.a:

nm
/_TOOLS_/dist/gnu-gcc-4.1.1/i686-pc-linux2.4/lib/gcc/i686-pc-linux-gnu/4.1.1/libgcov.a
| grep __strtol_internal
         U __strtol_internal

I can build musl ,  libc-testsuite and run the tests without any problem
 by just omitting the  -fprofile-arcs -ftest-coverage gcc flags.

Did somebody try to check the sources code coverage of the test suits ?
If yes what tool and methodology did you use ?

Thanks,
Tim.

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.