diff options
3 files changed, 38 insertions, 45 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 6da2fae..d0964ab 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,27 +1,26 @@ | |||
1 | From a01f0fb44e704a8439e431acf47d6fb0eff5bf9d Mon Sep 17 00:00:00 2001 | 1 | From 3bbf76b52c9061f37ab963fd9b7d8b527df219ba Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Thu, 5 Aug 2021 22:15:27 -0700 | 3 | Date: Thu, 5 Aug 2021 22:15:27 -0700 |
4 | Subject: [PATCH 1/2] support clang upto version 13 | 4 | Subject: [PATCH 1/2] support clang upto version 13 |
5 | 5 | ||
6 | Upstream-Status: Submitted [https://github.com/iovisor/bpftrace/pull/1993] | ||
7 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
8 | --- | 7 | --- |
9 | CMakeLists.txt | 2 +- | 8 | CMakeLists.txt | 2 +- |
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 9 | 1 file changed, 1 insertion(+), 1 deletion(-) |
11 | 10 | ||
12 | diff --git a/CMakeLists.txt b/CMakeLists.txt | 11 | diff --git a/CMakeLists.txt b/CMakeLists.txt |
13 | index 596b6766..7aab66f1 100644 | 12 | index 1b59ba2a..156d8ba9 100644 |
14 | --- a/CMakeLists.txt | 13 | --- a/CMakeLists.txt |
15 | +++ b/CMakeLists.txt | 14 | +++ b/CMakeLists.txt |
16 | @@ -164,7 +164,7 @@ else() | 15 | @@ -165,7 +165,7 @@ else() |
17 | find_package(LLVM REQUIRED) | ||
18 | endif() | 16 | endif() |
19 | 17 | ||
20 | - if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 12)) | 18 | set(MIN_LLVM_MAJOR 6) |
21 | + if((${LLVM_VERSION_MAJOR} VERSION_LESS 6) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER 13)) | 19 | - set(MAX_LLVM_MAJOR 12) |
22 | message(SEND_ERROR "Unsupported LLVM version found: ${LLVM_INCLUDE_DIRS}") | 20 | + set(MAX_LLVM_MAJOR 13) |
23 | message(SEND_ERROR "Specify an LLVM major version using LLVM_REQUESTED_VERSION=<major version>") | 21 | |
24 | endif() | 22 | if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) |
23 | message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}") | ||
25 | -- | 24 | -- |
26 | 2.33.0 | 25 | 2.33.0 |
27 | 26 | ||
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 index a00b006..85f8d6e 100644 --- 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 | |||
@@ -1,4 +1,4 @@ | |||
1 | From fbdf215a0ee9002ae65e87673d50dd40d0cfcf78 Mon Sep 17 00:00:00 2001 | 1 | From 3bb232ef9eeea769985d550799f6a9d2accaf32a Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Sat, 4 Sep 2021 17:28:17 -0700 | 3 | Date: Sat, 4 Sep 2021 17:28:17 -0700 |
4 | Subject: [PATCH 2/2] orc: Fix build with clang >= 13 | 4 | Subject: [PATCH 2/2] orc: Fix build with clang >= 13 |
@@ -10,15 +10,14 @@ BpfOrc::BpfOrc(TargetMachine *TM, DataLayout DL) | |||
10 | 10 | ||
11 | Fixes https://github.com/iovisor/bpftrace/issues/1963 | 11 | Fixes https://github.com/iovisor/bpftrace/issues/1963 |
12 | 12 | ||
13 | Upstream-Status: Submitted [https://github.com/iovisor/bpftrace/pull/1993] | ||
14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
15 | --- | 14 | --- |
16 | src/ast/bpforc/bpforc.h | 17 ++++++++++++++++- | 15 | src/ast/bpforc/bpforc.h | 18 ++++++++++++++++-- |
17 | src/ast/bpforc/bpforcv2.cpp | 28 ++++++++++++++++++++++++++-- | 16 | src/ast/bpforc/bpforcv2.cpp | 23 ++++++++++++----------- |
18 | 2 files changed, 42 insertions(+), 3 deletions(-) | 17 | 2 files changed, 28 insertions(+), 13 deletions(-) |
19 | 18 | ||
20 | diff --git a/src/ast/bpforc/bpforc.h b/src/ast/bpforc/bpforc.h | 19 | diff --git a/src/ast/bpforc/bpforc.h b/src/ast/bpforc/bpforc.h |
21 | index 1b929dfd..fedfe975 100644 | 20 | index 1b929dfd..76913279 100644 |
22 | --- a/src/ast/bpforc/bpforc.h | 21 | --- a/src/ast/bpforc/bpforc.h |
23 | +++ b/src/ast/bpforc/bpforc.h | 22 | +++ b/src/ast/bpforc/bpforc.h |
24 | @@ -72,8 +72,12 @@ private: | 23 | @@ -72,8 +72,12 @@ private: |
@@ -34,26 +33,26 @@ index 1b929dfd..fedfe975 100644 | |||
34 | #if LLVM_VERSION_MAJOR >= 7 && LLVM_VERSION_MAJOR < 12 | 33 | #if LLVM_VERSION_MAJOR >= 7 && LLVM_VERSION_MAJOR < 12 |
35 | std::shared_ptr<SymbolResolver> Resolver; | 34 | std::shared_ptr<SymbolResolver> Resolver; |
36 | #endif | 35 | #endif |
37 | @@ -98,7 +102,18 @@ private: | 36 | @@ -98,7 +102,17 @@ private: |
38 | #endif | 37 | #endif |
39 | 38 | ||
40 | public: | 39 | public: |
41 | +#ifdef LLVM_ORC_V2 | 40 | - BpfOrc(TargetMachine *TM, DataLayout DL); |
41 | +#if LLVM_VERSION_MAJOR >= 13 | ||
42 | + ~BpfOrc() | 42 | + ~BpfOrc() |
43 | + { | 43 | + { |
44 | + if (auto Err = ES->endSession()) | 44 | + if (auto Err = ES->endSession()) |
45 | + ES->reportError(std::move(Err)); | 45 | + ES->reportError(std::move(Err)); |
46 | + } | 46 | + } |
47 | +#endif | ||
47 | + BpfOrc(TargetMachine *TM, | 48 | + BpfOrc(TargetMachine *TM, |
48 | + DataLayout DL, | 49 | + DataLayout DL, |
49 | + std::unique_ptr<ExecutionSession> ES); | 50 | + std::unique_ptr<ExecutionSession> ES); |
50 | +#else // LLVM_ORC_V1 | 51 | + |
51 | BpfOrc(TargetMachine *TM, DataLayout DL); | ||
52 | +#endif | ||
53 | void compile(std::unique_ptr<Module> M); | 52 | void compile(std::unique_ptr<Module> M); |
54 | 53 | ||
55 | /* Helper for creating a orc object, responsible for creating internal objects | 54 | /* Helper for creating a orc object, responsible for creating internal objects |
56 | @@ -134,7 +149,7 @@ public: | 55 | @@ -134,7 +148,7 @@ public: |
57 | #ifdef LLVM_ORC_V2 | 56 | #ifdef LLVM_ORC_V2 |
58 | Expected<JITEvaluatedSymbol> lookup(StringRef Name) | 57 | Expected<JITEvaluatedSymbol> lookup(StringRef Name) |
59 | { | 58 | { |
@@ -63,54 +62,49 @@ index 1b929dfd..fedfe975 100644 | |||
63 | #endif | 62 | #endif |
64 | }; | 63 | }; |
65 | diff --git a/src/ast/bpforc/bpforcv2.cpp b/src/ast/bpforc/bpforcv2.cpp | 64 | diff --git a/src/ast/bpforc/bpforcv2.cpp b/src/ast/bpforc/bpforcv2.cpp |
66 | index 9876625b..41ec7ca3 100644 | 65 | index 9876625b..ca8d214e 100644 |
67 | --- a/src/ast/bpforc/bpforcv2.cpp | 66 | --- a/src/ast/bpforc/bpforcv2.cpp |
68 | +++ b/src/ast/bpforc/bpforcv2.cpp | 67 | +++ b/src/ast/bpforc/bpforcv2.cpp |
69 | @@ -1,5 +1,23 @@ | 68 | @@ -1,21 +1,21 @@ |
70 | // Included by bpforc.cpp | 69 | // Included by bpforc.cpp |
71 | 70 | ||
72 | +#if LLVM_VERSION_MAJOR >= 13 | 71 | -BpfOrc::BpfOrc(TargetMachine *TM, DataLayout DL) |
73 | +BpfOrc::BpfOrc(TargetMachine *TM, | 72 | +BpfOrc::BpfOrc(TargetMachine *TM, |
74 | + DataLayout DL, | 73 | + DataLayout DL, |
75 | + std::unique_ptr<ExecutionSession> ES) | 74 | + std::unique_ptr<ExecutionSession> ES) |
76 | + : TM(std::move(TM)), | 75 | : TM(std::move(TM)), |
77 | + DL(std::move(DL)), | 76 | DL(std::move(DL)), |
77 | - ObjectLayer(ES, | ||
78 | - [this]() { | ||
79 | - return std::make_unique<MemoryManager>(sections_); | ||
80 | - }), | ||
81 | - CompileLayer(ES, | ||
78 | + ES(std::move(ES)), | 82 | + ES(std::move(ES)), |
79 | + ObjectLayer(*this->ES, | 83 | + ObjectLayer(*this->ES, |
80 | + []() { return std::make_unique<SectionMemoryManager>(); }), | 84 | + []() { return std::make_unique<SectionMemoryManager>(); }), |
81 | + CompileLayer(*this->ES, | 85 | + CompileLayer(*this->ES, |
82 | + ObjectLayer, | 86 | ObjectLayer, |
83 | + std::make_unique<SimpleCompiler>(*this->TM)), | 87 | std::make_unique<SimpleCompiler>(*this->TM)), |
88 | - Mangle(ES, this->DL), | ||
84 | + Mangle(*this->ES, this->DL), | 89 | + Mangle(*this->ES, this->DL), |
85 | + CTX(std::make_unique<LLVMContext>()), | 90 | CTX(std::make_unique<LLVMContext>()), |
91 | - MainJD(cantFail(ES.createJITDylib("<main>"))) | ||
86 | + MainJD(cantFail(this->ES->createJITDylib("<main>"))) | 92 | + 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 | { | 93 | { |
95 | } | 94 | } |
96 | 95 | - | |
97 | +#endif | ||
98 | LLVMContext &BpfOrc::getContext() | 96 | LLVMContext &BpfOrc::getContext() |
99 | { | 97 | { |
100 | return *CTX.getContext(); | 98 | return *CTX.getContext(); |
101 | @@ -34,8 +53,13 @@ std::unique_ptr<BpfOrc> BpfOrc::Create() | 99 | @@ -34,8 +34,9 @@ std::unique_ptr<BpfOrc> BpfOrc::Create() |
102 | // return unique_ptrs | 100 | // return unique_ptrs |
103 | auto DL = cantFail(JTMB.getDefaultDataLayoutForTarget()); | 101 | auto DL = cantFail(JTMB.getDefaultDataLayoutForTarget()); |
104 | auto TM = cantFail(JTMB.createTargetMachine()); | 102 | auto TM = cantFail(JTMB.createTargetMachine()); |
105 | - | 103 | - |
106 | - return std::make_unique<BpfOrc>(TM.release(), std::move(DL)); | 104 | - return std::make_unique<BpfOrc>(TM.release(), std::move(DL)); |
107 | +#if LLVM_VERSION_MAJOR >= 13 | ||
108 | + auto EPC = SelfExecutorProcessControl::Create(); | 105 | + auto EPC = SelfExecutorProcessControl::Create(); |
109 | + auto ES = std::make_unique<ExecutionSession>(std::move(*EPC)); | 106 | + auto ES = std::make_unique<ExecutionSession>(std::move(*EPC)); |
110 | + return std::make_unique<BpfOrc>(TM.release(), std::move(DL), std::move(ES)); | 107 | + 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 | } | 108 | } |
115 | 109 | ||
116 | void BpfOrc::compile(std::unique_ptr<Module> M) | 110 | void BpfOrc::compile(std::unique_ptr<Module> M) |
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 09d1fd2..f521d33 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 | |||
@@ -20,7 +20,7 @@ SRC_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 | file://0002-orc-Fix-build-with-clang-13.patch \ |
22 | " | 22 | " |
23 | SRCREV = "283fe526dfc262fdecddec4beb921835ea0cc89e" | 23 | SRCREV = "9b929db174be11888f60d16b1b090e4603bc3a51" |
24 | 24 | ||
25 | S = "${WORKDIR}/git" | 25 | S = "${WORKDIR}/git" |
26 | 26 | ||