From 049cbc1bf259ab109160987cbd43a485069957a6 Mon Sep 17 00:00:00 2001 From: Marcin Naczk Date: Tue, 17 May 2022 09:50:31 +0000 Subject: [PATCH 2/2] LLVM13 changed MCContext constructor For LLVM13, MCContext constructor changed. In the list of arguments appeared MCSubtargetInfo which is not used by us. ObjectFileInfo was removed from the list of arguments, so we need to set it in the next command. Upstream-Status: Backport Signed-off-by: Anuj Mittal --- IGC/WrapperLLVM/include/llvmWrapper/MC/MCContext.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/IGC/WrapperLLVM/include/llvmWrapper/MC/MCContext.h b/IGC/WrapperLLVM/include/llvmWrapper/MC/MCContext.h index 3725864ef..f3e7e2b4e 100644 --- a/IGC/WrapperLLVM/include/llvmWrapper/MC/MCContext.h +++ b/IGC/WrapperLLVM/include/llvmWrapper/MC/MCContext.h @@ -24,10 +24,13 @@ namespace IGCLLVM bool DoAutoReset = true) { #if LLVM_VERSION_MAJOR >= 13 - std::string Err; - const llvm::Target *T = llvm::TargetRegistry::lookupTarget(TheTriple.str(), Err); - std::unique_ptr STI(T->createMCSubtargetInfo(TheTriple.str(), "", "")); - return new llvm::MCContext(TheTriple, MAI, MRI, STI.get(), Mgr, TargetOpts, DoAutoReset); +// Refactor MCObjectFileInfo initialization and allow targets to create MCObjectFileInfo +// +// Differential Revision: https://reviews.llvm.org/D101921 + + auto *Context = new llvm::MCContext(TheTriple, MAI, MRI, nullptr, Mgr, TargetOpts, DoAutoReset); + Context->setObjectFileInfo(MOFI); + return Context; #elif LLVM_VERSION_MAJOR >= 10 return new llvm::MCContext(MAI, MRI, MOFI, Mgr, TargetOpts, DoAutoReset); #else -- 2.35.3