Hello, I recently updated LLVM from version 6.0.0 to 10.0.0. I see the following issue when I compile an application only with code coverage compiler options. Thes issue does not appear in any other build type. *...:(__llvm_prf_data[__profv__**ZNK4llvm3cfg6UpdateIPNS_**10BasicBlockEE4dumpEv]+0x18): **undefined reference to `llvm::cfg::Update<llvm::**BasicBlock*>::dump() const'* I see this issue only when I compile the app with the following compiler options: *-g -O2 -fprofile-instr-generate -fcoverage-mapping* I don't use any special flags when I build LLVM. I used g++-7 (or clang++-9) to compile LLVM static libs. The issue does not appear with LLVM 6.0.0. I included all LLVM libraries in the same order whatever *llvm-config --libs *outputs. What lib am I missing? Or is this a known issue? Thank you, Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200909/c4d6b98d/attachment.html>
Fangrui Song via llvm-dev
2020-Sep-10 20:34 UTC
[llvm-dev] Code Coverage Compile Issue LLVM 10
On 2020-09-09, Aaron via llvm-dev wrote:>Hello, > >I recently updated LLVM from version 6.0.0 to 10.0.0. > >I see the following issue when I compile an application only with code >coverage compiler options. Thes issue does not appear in any other build >type. > >*...:(__llvm_prf_data[__profv__**ZNK4llvm3cfg6UpdateIPNS_**10BasicBlockEE4dumpEv]+0x18): >**undefined reference to `llvm::cfg::Update<llvm::**BasicBlock*>::dump() >const'* > >I see this issue only when I compile the app with the following compiler >options: > >*-g -O2 -fprofile-instr-generate -fcoverage-mapping* > >I don't use any special flags when I build LLVM. I used g++-7 (or >clang++-9) to compile LLVM static libs. The issue does not appear with LLVM >6.0.0. > >I included all LLVM libraries in the same order whatever *llvm-config >--libs *outputs. > >What lib am I missing? Or is this a known issue? > >Thank you, >Aaronllvm::cfg::Update<llvm::**BasicBlock*>::dump() is guarded by !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) I cannot find anywhere it is referenced. It seems that you call this function but do not provide the definition.
Thank you for your response. I don't use any "::dump()" method in my application. I found that removing compiler optimization parameter "-O2" resolved the issue. Any optimization parameter, such O1, O2 or O3 causes the same issue, not sure why. Any ideas? On Thu, Sep 10, 2020 at 1:34 PM Fangrui Song <maskray at google.com> wrote:> > On 2020-09-09, Aaron via llvm-dev wrote: > >Hello, > > > >I recently updated LLVM from version 6.0.0 to 10.0.0. > > > >I see the following issue when I compile an application only with code > >coverage compiler options. Thes issue does not appear in any other build > >type. > > > > >*...:(__llvm_prf_data[__profv__**ZNK4llvm3cfg6UpdateIPNS_**10BasicBlockEE4dumpEv]+0x18): > >**undefined reference to `llvm::cfg::Update<llvm::**BasicBlock*>::dump() > >const'* > > > >I see this issue only when I compile the app with the following compiler > >options: > > > >*-g -O2 -fprofile-instr-generate -fcoverage-mapping* > > > >I don't use any special flags when I build LLVM. I used g++-7 (or > >clang++-9) to compile LLVM static libs. The issue does not appear with > LLVM > >6.0.0. > > > >I included all LLVM libraries in the same order whatever *llvm-config > >--libs *outputs. > > > >What lib am I missing? Or is this a known issue? > > > >Thank you, > >Aaron > > llvm::cfg::Update<llvm::**BasicBlock*>::dump() is guarded by > !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) > > I cannot find anywhere it is referenced. > It seems that you call this function but do not provide the definition. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200910/60bcf9d0/attachment.html>