meta-intel/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-LLVM13-changed-MCContext-constructor.patch
Anuj Mittal 3403a58137 intel-graphics-compiler: LLVM 13 fixes
Backport LLVM 13 fixes from upstream. This fixes the crashes when
invoking ocloc after enabling built-ins in compute-runtime.

Also see:
https://github.com/intel/intel-graphics-compiler/issues/204

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
2022-05-19 12:02:58 +08:00

42 lines
1.8 KiB
Diff

From 049cbc1bf259ab109160987cbd43a485069957a6 Mon Sep 17 00:00:00 2001
From: Marcin Naczk <marcin.naczk@intel.com>
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 <anuj.mittal@intel.com>
---
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<llvm::MCSubtargetInfo> 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