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

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