Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/bpftrace/files/, dev-util/bpftrace/
Date: Sun, 19 Mar 2023 17:34:39
Message-Id: 1679247271.25470c4c3bcdad4ae67fbe3a65b21682fe0fe670.mgorny@gentoo
1 commit: 25470c4c3bcdad4ae67fbe3a65b21682fe0fe670
2 Author: Holger Hoffstätte <holger <AT> applied-asynchrony <DOT> com>
3 AuthorDate: Sun Mar 19 12:40:51 2023 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 19 17:34:31 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25470c4c
7
8 dev-util/bpftrace: fixes for llvm-16
9
10 Closes: https://bugs.gentoo.org/902135
11 Signed-off-by: Holger Hoffstätte <holger <AT> applied-asynchrony.com>
12 Closes: https://github.com/gentoo/gentoo/pull/30234
13 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
14
15 ...-0.17.0-r2.ebuild => bpftrace-0.17.0-r3.ebuild} | 2 +
16 .../bpftrace/files/bpftrace-0.17.0-llvm-16.patch | 26 +++++++++++++
17 .../files/bpftrace-0.17.0-use-std-optional.patch | 44 ++++++++++++++++++++++
18 3 files changed, 72 insertions(+)
19
20 diff --git a/dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild b/dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
21 similarity index 94%
22 rename from dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild
23 rename to dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
24 index f976f34e8416..161c441420f7 100644
25 --- a/dev-util/bpftrace/bpftrace-0.17.0-r2.ebuild
26 +++ b/dev-util/bpftrace/bpftrace-0.17.0-r3.ebuild
27 @@ -55,6 +55,8 @@ PATCHES=(
28 "${FILESDIR}/bpftrace-0.17.0-install-libs.patch"
29 "${FILESDIR}/bpftrace-0.15.0-dont-compress-man.patch"
30 "${FILESDIR}/bpftrace-0.11.4-old-kernels.patch"
31 + "${FILESDIR}/bpftrace-0.17.0-llvm-16.patch"
32 + "${FILESDIR}/bpftrace-0.17.0-use-std-optional.patch"
33 )
34
35 pkg_pretend() {
36
37 diff --git a/dev-util/bpftrace/files/bpftrace-0.17.0-llvm-16.patch b/dev-util/bpftrace/files/bpftrace-0.17.0-llvm-16.patch
38 new file mode 100644
39 index 000000000000..5d845c134bea
40 --- /dev/null
41 +++ b/dev-util/bpftrace/files/bpftrace-0.17.0-llvm-16.patch
42 @@ -0,0 +1,26 @@
43 +
44 +From: https://github.com/iovisor/bpftrace/pull/2528
45 +
46 +From a91064d7fb26626d79719c2e2a13cc2acab9549a Mon Sep 17 00:00:00 2001
47 +From: Khem Raj <raj.khem@×××××.com>
48 +Date: Fri, 10 Mar 2023 00:08:27 -0800
49 +Subject: [PATCH] cmake: Raise max llvm major version to 16
50 +
51 +Signed-off-by: Khem Raj <raj.khem@×××××.com>
52 +---
53 + CMakeLists.txt | 2 +-
54 + 1 file changed, 1 insertion(+), 1 deletion(-)
55 +
56 +diff --git a/CMakeLists.txt b/CMakeLists.txt
57 +index 0a7914f580d..341ac7e9c1f 100644
58 +--- a/CMakeLists.txt
59 ++++ b/CMakeLists.txt
60 +@@ -165,7 +165,7 @@ else()
61 + endif()
62 +
63 + set(MIN_LLVM_MAJOR 6)
64 +- set(MAX_LLVM_MAJOR 15)
65 ++ set(MAX_LLVM_MAJOR 16)
66 +
67 + if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
68 + message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
69
70 diff --git a/dev-util/bpftrace/files/bpftrace-0.17.0-use-std-optional.patch b/dev-util/bpftrace/files/bpftrace-0.17.0-use-std-optional.patch
71 new file mode 100644
72 index 000000000000..21b4b7e6c267
73 --- /dev/null
74 +++ b/dev-util/bpftrace/files/bpftrace-0.17.0-use-std-optional.patch
75 @@ -0,0 +1,44 @@
76 +
77 +From: https://github.com/iovisor/bpftrace/pull/2525
78 +
79 +From a794397394aa836f776da17c8e08876a2f64d477 Mon Sep 17 00:00:00 2001
80 +From: Khem Raj <raj.khem@×××××.com>
81 +Date: Mon, 13 Mar 2023 21:30:27 -0700
82 +Subject: [PATCH] ast: Use std::optional in CodegenLLVM::CodegenLLVM call
83 +
84 +Fixes build with clang-16
85 +
86 +src/ast/passes/codegen_llvm.cpp:63:53: error: use of undeclared identifier 'Optional'; did you mean 'std::optional'?
87 +
88 +Signed-off-by: Khem Raj <raj.khem@×××××.com>
89 +---
90 + src/ast/passes/codegen_llvm.cpp | 16 +++++++++++-----
91 + 1 file changed, 11 insertions(+), 5 deletions(-)
92 +
93 +diff --git a/src/ast/passes/codegen_llvm.cpp b/src/ast/passes/codegen_llvm.cpp
94 +index 616ff89ddbc..fe440adf373 100644
95 +--- a/src/ast/passes/codegen_llvm.cpp
96 ++++ b/src/ast/passes/codegen_llvm.cpp
97 +@@ -56,11 +56,17 @@ CodegenLLVM::CodegenLLVM(Node *root, BPFtrace &bpftrace)
98 + throw std::runtime_error(
99 + "Could not find bpf llvm target, does your llvm support it?");
100 +
101 +- target_machine_.reset(target->createTargetMachine(LLVMTargetTriple,
102 +- "generic",
103 +- "",
104 +- TargetOptions(),
105 +- Optional<Reloc::Model>()));
106 ++ target_machine_.reset(
107 ++ target->createTargetMachine(LLVMTargetTriple,
108 ++ "generic",
109 ++ "",
110 ++ TargetOptions(),
111 ++#if LLVM_VERSION_MAJOR >= 16
112 ++ std::optional<Reloc::Model>()
113 ++#else
114 ++ Optional<Reloc::Model>()
115 ++#endif
116 ++ ));
117 + target_machine_->setOptLevel(llvm::CodeGenOpt::Aggressive);
118 +
119 + module_->setTargetTriple(LLVMTargetTriple);