[cfe-dev] Correct way to generate coverage data

İsmail Dönmez ismail at donmez.ws
Thu Apr 25 04:45:49 PDT 2013


Hi,

Using recent SVN;

[/havana/t]> clang -v
SUSE Linux clang version 3.3 (trunk 180017) (based on LLVM 3.3svn)
Target: x86_64-unknown-linux-gnu
Thread model: posix

[/havana/t]> cat t.cpp
#include <iostream>

int main()
{
    std::cout << "Foo, bar!" << std::endl;
    return 0;
}

This works fine with clang 3.2:

[/havana/t]> clang++ -coverage t.cpp
/tmp/t-QAe5WH.o: In function `__llvm_gcov_writeout':
t.cpp:(.text+0x75): undefined reference to `llvm_gcda_start_file'
t.cpp:(.text+0x8b): undefined reference to `llvm_gcda_emit_function'
t.cpp:(.text+0x9d): undefined reference to `llvm_gcda_emit_arcs'
t.cpp:(.text+0xb4): undefined reference to `llvm_gcda_emit_function'
t.cpp:(.text+0xc6): undefined reference to `llvm_gcda_emit_arcs'
t.cpp:(.text+0xdd): undefined reference to `llvm_gcda_emit_function'
t.cpp:(.text+0xef): undefined reference to `llvm_gcda_emit_arcs'
t.cpp:(.text+0xf4): undefined reference to `llvm_gcda_end_file'
/tmp/t-QAe5WH.o: In function `__llvm_gcov_init':
t.cpp:(.text+0x145): undefined reference to `llvm_gcov_init'
clang: error: linker command failed with exit code 1 (use -v to see
invocation)

Manually giving path to libclang_rt.profile-%{arch}.a

[/havana/t]> clang++ -coverage t.cpp
/usr/lib64/clang/3.3/lib/linux/libclang_rt.profile-x86_64.a
[/havana/t]>

works. So the question is should the driver automatically link to the
correct library when -coverage option is present?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130425/15ea84bb/attachment.html>


More information about the cfe-dev mailing list