coverage analyzing binaries built with clang

Hello,

I want to collect code coverage statistics of software built with clang (optimally the one in (FreeBSD10's) base), however building it in --coverage mode fails to link, diagnosing
Code:
# cc --coverage test.c
/usr/bin/ld: /usr/bin/../lib/libprofile_rt.a: No such file: No such file or directory

Replacing --coverage with -fprofile-arcs -ftest-coverage makes no difference.

The libprofile_rt.a file does not exist on the system (WITH_CLANG_FULL=YES, WITH_CLANG_EXTRAS=YES) in some unsearched path either, and is also not listed in the devel/llvm34 or lang/clang34 ports(7) package's pkg-plist.

Is there a way to generage coverage reports of clang built binaries?
 
devel/llvm33 provides the this library:
Code:
% locate profile_rt
/usr/local/llvm33/lib/libprofile_rt.a
/usr/local/llvm33/lib/libprofile_rt.so
%
However, attempts to use it fail:
Code:
% echo "int main(void){}" | clang33 --coverage -v -xc -
...snip...
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib /tmp/--bn5ChM.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o /usr/local/llvm33/bin/../lib/libprofile_rt.a
/tmp/--bn5ChM.o: In function `__llvm_gcov_writeout':
-:(.text+0x45): undefined reference to `llvm_gcda_start_file'
-:(.text+0x5b): undefined reference to `llvm_gcda_emit_function'
-:(.text+0x6d): undefined reference to `llvm_gcda_emit_arcs'
-:(.text+0x72): undefined reference to `llvm_gcda_end_file'
/tmp/--bn5ChM.o: In function `__llvm_gcov_init':
-:(.text+0xb5): undefined reference to `llvm_gcov_init'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
%

Looks like this stuff is currently b0rken/not available.
 
Back
Top