code coverage: llvm-ar: undefined reference to `llvm::raw_fd_ostream::current_pos() const'

Rafael EspĂ­ndola rafael.espindola at gmail.com
Wed Jul 31 10:38:27 PDT 2013


I tried to reproduce this locally, but so far I have failed. What I am
trying with gcc 4.7 is

CC=/usr/bin/gcc CXX=/usr/bin/g++ ../llvm/configure
--disable-assertions --enable-shared --enable-optimized
--with-optimize-option="-g -O2"
 make -j8 CXXFLAGS="-fprofile-arcs -ftest-coverage -std=c++0x"
LDFLAGS="-coverage -lgcov" REQUIRES_RTTI=1


It looks like llvm::raw_ostream::tell() was always being inlined in my
case, so I added  __attribute__((noinline)) to try to reproduce what
you are getting.  Still no success, I now get a copy of it in
llvm-ar.o, but it is:

   0:   48 8b 07                mov    (%rdi),%rax
   3:   53                      push   %rbx
   4:   48 89 fb                mov    %rdi,%rbx
   7:   48 83 05 00 00 00 00    addq   $0x1,0x0(%rip)        # f
<_ZNK4llvm11raw_ostream4tellEv+0xf>
   e:   01
   f:   ff 50 48                callq  *0x48(%rax)
  12:   48 8b 53 18             mov    0x18(%rbx),%rdx
  16:   48 2b 53 08             sub    0x8(%rbx),%rdx
  1a:   48 83 05 00 00 00 00    addq   $0x1,0x0(%rip)        # 22
<_ZNK4llvm11raw_ostream4tellEv+0x22>
  21:   01
  22:   5b                      pop    %rbx
  23:   48 01 d0                add    %rdx,%rax
  26:   c3                      retq


In the error message you posted it has a direct reference to
lvm::raw_fd_ostream::current_pos(). Is your host compiler producing a
devirtualized copy of the tell function? Maybe it is then forgetting
to output a copy of current_pos?

Which host compiler are you using?
Cheers,
Rafael



More information about the llvm-commits mailing list