summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch')
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch
new file mode 100644
index 0000000..b1f56e6
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch
@@ -0,0 +1,89 @@
1From 675fca6a646812361c16884ccd2ff789f40c4ce8 Mon Sep 17 00:00:00 2001
2From: Yonghong Song <yhs@fb.com>
3Date: Tue, 3 Nov 2020 22:11:57 -0800
4Subject: [PATCH 1/2] fix compilation issues with latest llvm12 trunk
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9With latest llvm12 trunk, we got two compilation bugs.
10
11Bug #1:
12 /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc:
13 In member function ‘void ebpf::BFrontendAction::DoMiscWorkAround()’:
14 /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc:1706:31:
15 error: ‘class clang::SourceManage’ has no member named ‘getBuffer’; did you mean ‘getBufferData’?
16 rewriter_->getSourceMgr().getBuffer(rewriter_->getSourceMgr().getMainFileID())->getBufferSize(),
17 ^~~~~~~~~
18 getBufferData
19
20 This is due to upstream change https://reviews.llvm.org/D89394.
21 To fix, follow upstream examples in https://reviews.llvm.org/D89394.
22
23Bug #2:
24 /home/yhs/work/bcc/src/cc/bpf_module.cc: In member function ‘int ebpf::BPFModule::finalize()’:
25 /home/yhs/work/bcc/src/cc/bpf_module.cc:470:11:
26 error: ‘class llvm::EngineBuilder’ has no member named ‘setUseOrcMCJITReplacement’
27 builder.setUseOrcMCJITReplacement(false);
28 ^~~~~~~~~~~~~~~~~~~~~~~~~
29
30 This is due to upstream
31 https://github.com/llvm/llvm-project/commit/6154c4115cd4b78d0171892aac21e340e72e32bd
32
33 It seems builder.setUseOrcMCJITReplacement() is not needed any more. So just remove it
34 from bcc.
35
36Signed-off-by: Yonghong Song <yhs@fb.com>
37---
38 src/cc/bpf_module.cc | 2 ++
39 src/cc/bpf_module_rw_engine.cc | 2 ++
40 src/cc/frontends/clang/b_frontend_action.cc | 4 ++++
41 3 files changed, 8 insertions(+)
42
43diff --git a/src/cc/bpf_module.cc b/src/cc/bpf_module.cc
44index 8fba8d27..c194b815 100644
45--- a/src/cc/bpf_module.cc
46+++ b/src/cc/bpf_module.cc
47@@ -466,7 +466,9 @@ int BPFModule::finalize() {
48 builder.setErrorStr(&err);
49 builder.setMCJITMemoryManager(ebpf::make_unique<MyMemoryManager>(sections_p));
50 builder.setMArch("bpf");
51+#if LLVM_MAJOR_VERSION <= 11
52 builder.setUseOrcMCJITReplacement(false);
53+#endif
54 engine_ = unique_ptr<ExecutionEngine>(builder.create());
55 if (!engine_) {
56 fprintf(stderr, "Could not create ExecutionEngine: %s\n", err.c_str());
57diff --git a/src/cc/bpf_module_rw_engine.cc b/src/cc/bpf_module_rw_engine.cc
58index d7e31a71..9890af69 100644
59--- a/src/cc/bpf_module_rw_engine.cc
60+++ b/src/cc/bpf_module_rw_engine.cc
61@@ -356,7 +356,9 @@ unique_ptr<ExecutionEngine> BPFModule::finalize_rw(unique_ptr<Module> m) {
62 string err;
63 EngineBuilder builder(move(m));
64 builder.setErrorStr(&err);
65+#if LLVM_MAJOR_VERSION <= 11
66 builder.setUseOrcMCJITReplacement(false);
67+#endif
68 auto engine = unique_ptr<ExecutionEngine>(builder.create());
69 if (!engine)
70 fprintf(stderr, "Could not create ExecutionEngine: %s\n", err.c_str());
71diff --git a/src/cc/frontends/clang/b_frontend_action.cc b/src/cc/frontends/clang/b_frontend_action.cc
72index 154a3794..80b03b9b 100644
73--- a/src/cc/frontends/clang/b_frontend_action.cc
74+++ b/src/cc/frontends/clang/b_frontend_action.cc
75@@ -1694,7 +1694,11 @@ void BFrontendAction::DoMiscWorkAround() {
76 false);
77
78 rewriter_->getEditBuffer(rewriter_->getSourceMgr().getMainFileID()).InsertTextAfter(
79+#if LLVM_MAJOR_VERSION >= 12
80+ rewriter_->getSourceMgr().getBufferOrFake(rewriter_->getSourceMgr().getMainFileID()).getBufferSize(),
81+#else
82 rewriter_->getSourceMgr().getBuffer(rewriter_->getSourceMgr().getMainFileID())->getBufferSize(),
83+#endif
84 "\n#include <bcc/footer.h>\n");
85 }
86
87--
882.30.0
89