summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/clang-layer/recipes-opencl/igc/files/0002-LLVM13-changed-MCContext-constructor.patch
blob: df6fa613014f201edb9507b89004d98769f07774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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