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

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