From: Yonghong Song Date: Wed, 26 May 2021 02:58:00 +0000 (-0700) Subject: Fix a llvm compilation error X-Git-Tag: v0.21.0~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5d77f50e929e4ee22b1dc08924960913e32d9e3b;p=platform%2Fupstream%2Fbcc.git Fix a llvm compilation error Current llvm trunk (https://github.com/llvm/llvm-project) will cause the following compilation errors: /home/yhs/work/bcc/src/cc/bcc_debug.cc: In member function ‘void ebpf::SourceDebugger::dump()’: /home/yhs/work/bcc/src/cc/bcc_debug.cc:135:75: error: no matching function for call to ‘llvm::MCContext::MCContext(llvm::Triple&, std::unique_ptr::pointer, std::unique_ptr::pointer, llvm::MCObjectFileInfo*, std::unique_ptr::pointer, std::nullptr_t)’ MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr); ^ ...... This is because upstream patch https://reviews.llvm.org/D101921 refactored MCObjectFileInfo initialization and changed MCContext constructor signature. This patch fixed the issue by following the new code patterns in https://reviews.llvm.org/D101921. --- diff --git a/src/cc/bcc_debug.cc b/src/cc/bcc_debug.cc index 775c9141..97d6d95b 100644 --- a/src/cc/bcc_debug.cc +++ b/src/cc/bcc_debug.cc @@ -132,7 +132,8 @@ void SourceDebugger::dump() { T->createMCSubtargetInfo(TripleStr, "", "")); MCObjectFileInfo MOFI; #if LLVM_MAJOR_VERSION >= 13 - MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr); + MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), nullptr); + Ctx.setObjectFileInfo(&MOFI); MOFI.initMCObjectFileInfo(Ctx, false, false); #else MCContext Ctx(MAI.get(), MRI.get(), &MOFI, nullptr);