summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch
diff options
context:
space:
mode:
Diffstat (limited to 'dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch')
-rw-r--r--dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch
new file mode 100644
index 0000000..ded9f28
--- /dev/null
+++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch
@@ -0,0 +1,60 @@
1From 35ff839b1b70b3cd7a9a025d0fd96173e7be566e Mon Sep 17 00:00:00 2001
2From: Yonghong Song <yhs@fb.com>
3Date: Mon, 4 Jan 2021 19:09:20 -0800
4Subject: [PATCH 2/2] fix compilation error with latest llvm12 trunk
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9With latest llvm trunk (llvm12), I hit the following compilation
10error:
11 ...
12 [ 17%] Building CXX object src/cc/frontends/b/CMakeFiles/b_frontend.dir/codegen_llvm.cc.o
13 /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function
14 ‘virtual ebpf::StatusTuple ebpf::cc::CodegenLLVM::visit_table_decl_stmt_node(ebpf::cc::TableDeclStmtNode*)’:
15 /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:1122:37:
16 error: ‘class llvm::Module’ has no member named ‘getTypeB yName’; did you mean ‘getName’?
17 StructType *decl_struct = mod_->getTypeByName("_struct." + n->id_->name_);
18 ^~~~~~~~~~~~~
19 getName
20
21This is due to llvm patch https://reviews.llvm.org/D78793 which
22changed how to use getTypeByName(). This patch adjusted the usage
23in bcc based on this patch.
24
25Signed-off-by: Yonghong Song <yhs@fb.com>
26---
27 src/cc/frontends/b/codegen_llvm.cc | 8 ++++++++
28 1 file changed, 8 insertions(+)
29
30diff --git a/src/cc/frontends/b/codegen_llvm.cc b/src/cc/frontends/b/codegen_llvm.cc
31index d8c9470a..71c83b41 100644
32--- a/src/cc/frontends/b/codegen_llvm.cc
33+++ b/src/cc/frontends/b/codegen_llvm.cc
34@@ -1119,7 +1119,11 @@ StatusTuple CodegenLLVM::visit_table_decl_stmt_node(TableDeclStmtNode *n) {
35 StructType *key_stype, *leaf_stype;
36 TRY2(lookup_struct_type(n->key_type_, &key_stype));
37 TRY2(lookup_struct_type(n->leaf_type_, &leaf_stype));
38+#if LLVM_MAJOR_VERSION >= 12
39+ StructType *decl_struct = StructType::getTypeByName(mod_->getContext(), "_struct." + n->id_->name_);
40+#else
41 StructType *decl_struct = mod_->getTypeByName("_struct." + n->id_->name_);
42+#endif
43 if (!decl_struct)
44 decl_struct = StructType::create(ctx(), "_struct." + n->id_->name_);
45 if (decl_struct->isOpaque())
46@@ -1182,7 +1186,11 @@ StatusTuple CodegenLLVM::visit_func_decl_stmt_node(FuncDeclStmtNode *n) {
47 StructType *stype;
48 //TRY2(lookup_struct_type(formal, &stype));
49 auto var = (StructVariableDeclStmtNode *)formal;
50+#if LLVM_MAJOR_VERSION >= 12
51+ stype = StructType::getTypeByName(mod_->getContext(), "_struct." + var->struct_id_->name_);
52+#else
53 stype = mod_->getTypeByName("_struct." + var->struct_id_->name_);
54+#endif
55 if (!stype) return mkstatus_(n, "could not find type %s", var->struct_id_->c_str());
56 formals.push_back(PointerType::getUnqual(stype));
57 } else {
58--
592.30.0
60