summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-09-04 17:41:52 -0700
committerKhem Raj <raj.khem@gmail.com>2021-09-05 08:53:01 -0700
commit3c131c2bac5ca105270a1ab075632f13cf8d8485 (patch)
treeb5d98f95277ef30a63610550394f98315022693a
parent46b8d34025d187ce093fcde4210768e2395a5fa4 (diff)
downloadmeta-clang-3c131c2bac5ca105270a1ab075632f13cf8d8485.tar.gz
bpftrace: Fix build with clang >= 13
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-support-clang-upto-version-13.patch15
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-orc-Fix-build-with-clang-13.patch119
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.13.0.bb1
3 files changed, 128 insertions, 7 deletions
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-support-clang-upto-version-13.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-support-clang-upto-version-13.patch
index c881904..6da2fae 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-support-clang-upto-version-13.patch
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0001-support-clang-upto-version-13.patch
@@ -1,26 +1,27 @@
1From 7b2f02a7b7d246b24cf029b3a75d8595b7b3c250 Mon Sep 17 00:00:00 2001 1From a01f0fb44e704a8439e431acf47d6fb0eff5bf9d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 5 Aug 2021 22:15:27 -0700 3Date: Thu, 5 Aug 2021 22:15:27 -0700
4Subject: [PATCH 1/2] support clang upto version 13 4Subject: [PATCH 1/2] support clang upto version 13
5 5
6Upstream-Status: Submitted [https://github.com/iovisor/bpftrace/pull/1962] 6Upstream-Status: Submitted [https://github.com/iovisor/bpftrace/pull/1993]
7Signed-off-by: Khem Raj <raj.khem@gmail.com> 7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8--- 8---
9 CMakeLists.txt | 2 +- 9 CMakeLists.txt | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-) 10 1 file changed, 1 insertion(+), 1 deletion(-)
11 11
12diff --git a/CMakeLists.txt b/CMakeLists.txt 12diff --git a/CMakeLists.txt b/CMakeLists.txt
13index 86daa195..73744207 100644 13index 596b6766..7aab66f1 100644
14--- a/CMakeLists.txt 14--- a/CMakeLists.txt
15+++ b/CMakeLists.txt 15+++ b/CMakeLists.txt
16@@ -162,7 +162,7 @@ else() 16@@ -164,7 +164,7 @@ else()
17 find_package(LLVM REQUIRED) 17 find_package(LLVM REQUIRED)
18 endif() 18 endif()
19 19
20- if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 12)) 20- if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 12))
21+ if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 13)) 21+ if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 13))
22 message(SEND_ERROR "Unsupported LLVM version found: ${LLVM_INCLUDE_DIRS}") 22 message(SEND_ERROR "Unsupported LLVM version found: ${LLVM_INCLUDE_DIRS}")
23 message(SEND_ERROR "Specify an LLVM major version using LLVM_REQUESTED_VERSION=<major version>") 23 message(SEND_ERROR "Specify an LLVM major version using LLVM_REQUESTED_VERSION=<major version>")
24 endif() 24 endif()
25-- 25--
262.32.0 262.33.0
27
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-orc-Fix-build-with-clang-13.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-orc-Fix-build-with-clang-13.patch
new file mode 100644
index 0000000..a00b006
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace/0002-orc-Fix-build-with-clang-13.patch
@@ -0,0 +1,119 @@
1From fbdf215a0ee9002ae65e87673d50dd40d0cfcf78 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 4 Sep 2021 17:28:17 -0700
4Subject: [PATCH 2/2] orc: Fix build with clang >= 13
5
6Fixes errors like
7src/ast/bpforc/bpforcv2.cpp:3:9: error: constructor for 'bpftrace::BpfOrc' must explicitly initialize the member 'ES' which does not have a default constructor
8BpfOrc::BpfOrc(TargetMachine *TM, DataLayout DL)
9 ^
10
11Fixes https://github.com/iovisor/bpftrace/issues/1963
12
13Upstream-Status: Submitted [https://github.com/iovisor/bpftrace/pull/1993]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 src/ast/bpforc/bpforc.h | 17 ++++++++++++++++-
17 src/ast/bpforc/bpforcv2.cpp | 28 ++++++++++++++++++++++++++--
18 2 files changed, 42 insertions(+), 3 deletions(-)
19
20diff --git a/src/ast/bpforc/bpforc.h b/src/ast/bpforc/bpforc.h
21index 1b929dfd..fedfe975 100644
22--- a/src/ast/bpforc/bpforc.h
23+++ b/src/ast/bpforc/bpforc.h
24@@ -72,8 +72,12 @@ private:
25 std::unique_ptr<TargetMachine> TM;
26 DataLayout DL;
27 #if LLVM_VERSION_MAJOR >= 7
28+#ifdef LLVM_ORC_V2
29+ std::unique_ptr<ExecutionSession> ES;
30+#else // LLVM_ORC_V1
31 ExecutionSession ES;
32 #endif
33+#endif
34 #if LLVM_VERSION_MAJOR >= 7 && LLVM_VERSION_MAJOR < 12
35 std::shared_ptr<SymbolResolver> Resolver;
36 #endif
37@@ -98,7 +102,18 @@ private:
38 #endif
39
40 public:
41+#ifdef LLVM_ORC_V2
42+ ~BpfOrc()
43+ {
44+ if (auto Err = ES->endSession())
45+ ES->reportError(std::move(Err));
46+ }
47+ BpfOrc(TargetMachine *TM,
48+ DataLayout DL,
49+ std::unique_ptr<ExecutionSession> ES);
50+#else // LLVM_ORC_V1
51 BpfOrc(TargetMachine *TM, DataLayout DL);
52+#endif
53 void compile(std::unique_ptr<Module> M);
54
55 /* Helper for creating a orc object, responsible for creating internal objects
56@@ -134,7 +149,7 @@ public:
57 #ifdef LLVM_ORC_V2
58 Expected<JITEvaluatedSymbol> lookup(StringRef Name)
59 {
60- return ES.lookup({ &MainJD }, Mangle(Name.str()));
61+ return ES->lookup({ &MainJD }, Mangle(Name.str()));
62 }
63 #endif
64 };
65diff --git a/src/ast/bpforc/bpforcv2.cpp b/src/ast/bpforc/bpforcv2.cpp
66index 9876625b..41ec7ca3 100644
67--- a/src/ast/bpforc/bpforcv2.cpp
68+++ b/src/ast/bpforc/bpforcv2.cpp
69@@ -1,5 +1,23 @@
70 // Included by bpforc.cpp
71
72+#if LLVM_VERSION_MAJOR >= 13
73+BpfOrc::BpfOrc(TargetMachine *TM,
74+ DataLayout DL,
75+ std::unique_ptr<ExecutionSession> ES)
76+ : TM(std::move(TM)),
77+ DL(std::move(DL)),
78+ ES(std::move(ES)),
79+ ObjectLayer(*this->ES,
80+ []() { return std::make_unique<SectionMemoryManager>(); }),
81+ CompileLayer(*this->ES,
82+ ObjectLayer,
83+ std::make_unique<SimpleCompiler>(*this->TM)),
84+ Mangle(*this->ES, this->DL),
85+ CTX(std::make_unique<LLVMContext>()),
86+ MainJD(cantFail(this->ES->createJITDylib("<main>")))
87+{
88+}
89+#else
90 BpfOrc::BpfOrc(TargetMachine *TM, DataLayout DL)
91 : TM(std::move(TM)),
92 DL(std::move(DL)),
93@@ -16,6 +34,7 @@ BpfOrc::BpfOrc(TargetMachine *TM, DataLayout DL)
94 {
95 }
96
97+#endif
98 LLVMContext &BpfOrc::getContext()
99 {
100 return *CTX.getContext();
101@@ -34,8 +53,13 @@ std::unique_ptr<BpfOrc> BpfOrc::Create()
102 // return unique_ptrs
103 auto DL = cantFail(JTMB.getDefaultDataLayoutForTarget());
104 auto TM = cantFail(JTMB.createTargetMachine());
105-
106- return std::make_unique<BpfOrc>(TM.release(), std::move(DL));
107+#if LLVM_VERSION_MAJOR >= 13
108+ auto EPC = SelfExecutorProcessControl::Create();
109+ auto ES = std::make_unique<ExecutionSession>(std::move(*EPC));
110+ return std::make_unique<BpfOrc>(TM.release(), std::move(DL), std::move(ES));
111+#else
112+ return std::make_unique<BpfOrc>(TM.release(), std::move(DL), 0);
113+#endif
114 }
115
116 void BpfOrc::compile(std::unique_ptr<Module> M)
117--
1182.33.0
119
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.13.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.13.0.bb
index 952a66f..09d1fd2 100644
--- a/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.13.0.bb
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.13.0.bb
@@ -18,6 +18,7 @@ RDEPENDS:${PN} += "bash python3 xz"
18 18
19SRC_URI = "git://github.com/iovisor/bpftrace;branch=master \ 19SRC_URI = "git://github.com/iovisor/bpftrace;branch=master \
20 file://0001-support-clang-upto-version-13.patch \ 20 file://0001-support-clang-upto-version-13.patch \
21 file://0002-orc-Fix-build-with-clang-13.patch \
21 " 22 "
22SRCREV = "283fe526dfc262fdecddec4beb921835ea0cc89e" 23SRCREV = "283fe526dfc262fdecddec4beb921835ea0cc89e"
23 24