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

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