Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix a compilation error with latest llvm 10
Two issues: First, the recent llvm commit "[Alignment][NFC] CreateMemSet use MaybeAlign" (https://reviews.llvm.org/D71213) changed IR/IRBuilder.h CreateMemSet() signature which caused the following compilation error: [ 16%] Building CXX object src/cc/frontends/b/CMakeFiles/b_frontend.dir/codegen_llvm.cc.o /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function ‘virtual ebpf::StatusTuple ebpf::cc::CodegenLLVM::visit_table_index_expr_node(ebpf::cc::TableIndexExprNode*)’: /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:824:96: error: no matching function for call to ‘llvm::IRBuilder<>::CreateMemSet(llvm::Value*&, llvm::ConstantInt*, llvm::ConstantInt*, int)’ B.CreateMemSet(leaf_ptr, B.getInt8(0), B.getInt64(n->table_->leaf_id()->bit_width_ >> 3), 1); ^ .... /home/yhs/work/llvm-project/llvm/build/install/include/llvm/IR/IRBuilder.h:460:13: note: candidate: llvm::CallInst* llvm::IRBuilderBase::CreateMemSet(llvm::Value*, llvm::Value*, llvm::Value*, llvm::MaybeAlign, bool, llvm::MDNode*, llvm::MDNode*, llvm::MDNode*) CallInst *CreateMemSet(Value *Ptr, Value *Val, Value *Size, MaybeAlign Align, ^~~~~~~~~~~~ /home/yhs/work/llvm-project/llvm/build/install/include/llvm/IR/IRBuilder.h:460:13: note: no known conversion for argument 4 from ‘int’ to ‘llvm::MaybeAlign’ Second, the commit "[OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.h" (https://reviews.llvm.org/D69853) introduced a new library "FrontendOpenMP" which is used by clang Parser, and caused the following errors: [ 99%] Building CXX object tests/cc/CMakeFiles/test_libbcc.dir/test_hash_table.cc.o /home/yhs/work/llvm-project/llvm/build/install/lib/libclangParse.a(ParseOpenMP.cpp.o): In function `clang::Parser::ParseOpenMPDeclareReductionDirective(clang::AccessSpecifier)': ParseOpenMP.cpp:(.text._ZN5clang6Parser36ParseOpenMPDeclareReductionDirectiveENS_15AccessSpecifierE+0x86): undefined reference to `llvm::omp::getOpenMPDirectiveName(llvm::omp::Directive)' This patch fixed both issues and bcc can compile with latest llvm 10.
- Loading branch information