Blame SOURCES/bcc-0.20.0-Fix-a-llvm-compilation-error.patch

605647
From e2a4a556755d3c5ae7538ba9bcb731f93b9f81c9 Mon Sep 17 00:00:00 2001
605647
From: Yonghong Song <yhs@fb.com>
605647
Date: Tue, 25 May 2021 19:58:00 -0700
605647
Subject: [PATCH] Fix a llvm compilation error
605647
MIME-Version: 1.0
605647
Content-Type: text/plain; charset=UTF-8
605647
Content-Transfer-Encoding: 8bit
605647
605647
Current llvm trunk (https://github.com/llvm/llvm-project)
605647
will cause the following compilation errors:
605647
  /home/yhs/work/bcc/src/cc/bcc_debug.cc: In member function ‘void ebpf::SourceDebugger::dump()’:
605647
  /home/yhs/work/bcc/src/cc/bcc_debug.cc:135:75: error: no matching function for call to
605647
     ‘llvm::MCContext::MCContext(llvm::Triple&, std::unique_ptr<llvm::MCAsmInfo>::pointer,
605647
      std::unique_ptr<llvm::MCRegisterInfo>::pointer, llvm::MCObjectFileInfo*,
605647
      std::unique_ptr<llvm::MCSubtargetInfo>::pointer, std::nullptr_t)’
605647
     MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr);
605647
                                                                             ^
605647
     ......
605647
605647
This is because upstream patch https://reviews.llvm.org/D101921
605647
refactored MCObjectFileInfo initialization and changed MCContext
605647
constructor signature.
605647
605647
This patch fixed the issue by following the new code patterns
605647
in https://reviews.llvm.org/D101921.
605647
---
605647
 src/cc/bcc_debug.cc | 3 ++-
605647
 1 file changed, 2 insertions(+), 1 deletion(-)
605647
605647
diff --git a/src/cc/bcc_debug.cc b/src/cc/bcc_debug.cc
605647
index 775c9141..97d6d95b 100644
605647
--- a/src/cc/bcc_debug.cc
605647
+++ b/src/cc/bcc_debug.cc
605647
@@ -132,7 +132,8 @@ void SourceDebugger::dump() {
605647
       T->createMCSubtargetInfo(TripleStr, "", ""));
605647
   MCObjectFileInfo MOFI;
605647
 #if LLVM_MAJOR_VERSION >= 13
605647
-  MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr);
605647
+  MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), nullptr);
605647
+  Ctx.setObjectFileInfo(&MOFI);
605647
   MOFI.initMCObjectFileInfo(Ctx, false, false);
605647
 #else
605647
   MCContext Ctx(MAI.get(), MRI.get(), &MOFI, nullptr);
605647
-- 
605647
2.31.1
605647