diff options
author | psykose <alice@ayaya.dev> | 2023-05-06 10:37:47 +0000 |
---|---|---|
committer | psykose <alice@ayaya.dev> | 2023-05-06 12:37:47 +0200 |
commit | c6dff4216ebbbbc7bfef7970fcd136ac3c2dc463 (patch) | |
tree | c58bfdfb7ee2a9eebaf49b6a06c38714419ee163 | |
parent | 9a92e7bae66774ae264ad3cf3ba4e6f6500b3095 (diff) |
community/bpftrace: use llvm16
-rw-r--r-- | community/bpftrace/APKBUILD | 6 | ||||
-rw-r--r-- | community/bpftrace/llvm16.patch | 57 |
2 files changed, 61 insertions, 2 deletions
diff --git a/community/bpftrace/APKBUILD b/community/bpftrace/APKBUILD index 297c024f584..b1436294ac2 100644 --- a/community/bpftrace/APKBUILD +++ b/community/bpftrace/APKBUILD @@ -2,12 +2,12 @@ # Maintainer: Adam Jensen <adam@acj.sh> pkgname=bpftrace pkgver=0.17.1 -pkgrel=0 +pkgrel=1 pkgdesc="High-level tracing language for Linux eBPF" url="https://github.com/iovisor/bpftrace" arch="aarch64 ppc64le x86_64" license="Apache-2.0" -_llvmver=15 +_llvmver=16 makedepends=" asciidoctor bcc-dev @@ -27,6 +27,7 @@ makedepends=" " source="$pkgname-$pkgver.tar.gz::https://github.com/iovisor/bpftrace/archive/v$pkgver.tar.gz 10-link-libbpf.patch + llvm16.patch " # Tests require root, network to download gmock and a few tests fail. # Stripping is done ourselves to keep the BEGIN_trigger symbol required @@ -81,4 +82,5 @@ tools_doc() { sha512sums=" 57f00a0b209d745efe5ce39d0e8efb90a21b5c499b41385814378d828ef507dc2c6d9497f9d23dbb610fcff21f077cba9f7481e7a6a6465825065743289ef4ad bpftrace-0.17.1.tar.gz 1f884e75ee7df8d28e8f613eca64cc56f859806c5a8d0f491c07709b0000be3a29be62a3eab6dfb04fcf9aadd1a4c3fde26e212ea0c40e5a54e59a197f148ed4 10-link-libbpf.patch +a7aba13fb7f60ce90571ea4f2078d2a64fcbd5067e950e4cf0bd961d9c4b1cce645b72834bb6ee6d073542c32c7e3e5fb3ae8d9f38cc96330972649a484f62c3 llvm16.patch " diff --git a/community/bpftrace/llvm16.patch b/community/bpftrace/llvm16.patch new file mode 100644 index 00000000000..2194d8c2c22 --- /dev/null +++ b/community/bpftrace/llvm16.patch @@ -0,0 +1,57 @@ +Patch-Source: https://github.com/iovisor/bpftrace/commit/70ee22cb14e2eedc5df17e53965824d7381f8e6f +https://github.com/iovisor/bpftrace/pull/2528 +-- +From 70ee22cb14e2eedc5df17e53965824d7381f8e6f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 13 Mar 2023 21:30:27 -0700 +Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call + +Fixes build with clang-16 + +src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'? + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/ast/passes/codegen_llvm.cpp | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e1221eb..f31c16f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -165,7 +165,7 @@ else() + endif() + + set(MIN_LLVM_MAJOR 6) +- set(MAX_LLVM_MAJOR 15) ++ set(MAX_LLVM_MAJOR 16) + + if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR})) + message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}") +diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp +index 4e2a18e..efeb416 100644 +--- a/src/ast/passes/codegen_llvm.cpp ++++ b/src/ast/passes/codegen_llvm.cpp +@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace) + throw std::runtime_error( + "Could not find bpf llvm target, does your llvm support it?"); + +- target_machine_.reset(target->createTargetMachine(LLVMTargetTriple, +- "generic", +- "", +- TargetOptions(), +- Optional<Reloc::Model>())); ++ target_machine_.reset( ++ target->createTargetMachine(LLVMTargetTriple, ++ "generic", ++ "", ++ TargetOptions(), ++#if LLVM_VERSION_MAJOR >= 16 ++ std::optional<Reloc::Model>() ++#else ++ Optional<Reloc::Model>() ++#endif ++ )); + target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive); + + module_->setTargetTriple(LLVMTargetTriple); |