Skip to content

Commit

Permalink
fix llvm compilation errors
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yonghong-song committed May 6, 2021
1 parent 46af130 commit 5e1be54
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cc/bcc_debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5e1be54

Please sign in to comment.