fix llvm compilation errors
authorYonghong Song <yhs@fb.com>
Thu, 6 May 2021 02:11:13 +0000 (19:11 -0700)
committeryonghong-song <ys114321@gmail.com>
Thu, 6 May 2021 02:39:24 +0000 (19:39 -0700)
MCContext and InitMCObjectFileInfo name/signatures
are changed due to upstream patch
  https://reviews.llvm.org/D101462
Adjust related codes in bcc_debug.cc properly to resolve
the compilation error for llvm13.

Signed-off-by: Yonghong Song <yhs@fb.com>
src/cc/bcc_debug.cc

index 371b6ad36b4fe729ba95a36e21b8a816fe5052dd..775c914124b065e9518fe902d36360bd65c845f9 100644 (file)
@@ -128,11 +128,16 @@ void SourceDebugger::dump() {
     return;
   }
 
+  std::unique_ptr<MCSubtargetInfo> STI(
+      T->createMCSubtargetInfo(TripleStr, "", ""));
   MCObjectFileInfo MOFI;
+#if LLVM_MAJOR_VERSION >= 13
+  MCContext Ctx(TheTriple, MAI.get(), MRI.get(), &MOFI, STI.get(), nullptr);
+  MOFI.initMCObjectFileInfo(Ctx, false, false);
+#else
   MCContext Ctx(MAI.get(), MRI.get(), &MOFI, nullptr);
   MOFI.InitMCObjectFileInfo(TheTriple, false, Ctx, false);
-  std::unique_ptr<MCSubtargetInfo> STI(
-      T->createMCSubtargetInfo(TripleStr, "", ""));
+#endif
 
   std::unique_ptr<MCInstrInfo> MCII(T->createMCInstrInfo());
   MCInstPrinter *IP = T->createMCInstPrinter(TheTriple, 0, *MAI, *MCII, *MRI);