aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hilliard <james.hilliard1@gmail.com>2022-01-30 21:47:38 -0700
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-01-31 16:42:07 +0900
commite3759ac43a3c0375e54799986343e2f101d14cc4 (patch)
treea0beef9e8f6dc395d06ee84217801729cb77d9c9
parentmeson: set minimum clang/llvm versions for bpf support (diff)
downloadsystemd-e3759ac43a3c0375e54799986343e2f101d14cc4.tar.xz
systemd-e3759ac43a3c0375e54799986343e2f101d14cc4.zip
meson: use bpftool based strip when available
This should be useable in bpftool v5.13 or newer based on: https://github.com/torvalds/linux/commit/d80b2fcbe0a023619e0fc73112f2a02c2662f6ab
-rw-r--r--meson.build34
-rw-r--r--src/core/bpf/meson.build24
2 files changed, 40 insertions, 18 deletions
diff --git a/meson.build b/meson.build
index 43c3252e361..b8b01e0deb7 100644
--- a/meson.build
+++ b/meson.build
@@ -1012,23 +1012,35 @@ else
clang_supports_bpf = false
endif
- if not meson.is_cross_build() and clang_found
- llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
- check : true).stdout().strip()
- else
- llvm_strip_bin = 'llvm-strip'
- endif
- llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
-
# Debian installs this in /usr/sbin/ which is not in $PATH.
# We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian.
# We use 'bpftool gen' subcommand, it was added by 985ead416df39d6fe8e89580cc1db6aa273e0175 (v5.6).
bpftool = find_program('bpftool',
'/usr/sbin/bpftool',
- required : bpf_framework_required,
- version : '>= 5.6')
+ required : false,
+ version : '>= 5.13.0')
+
+ if bpftool.found()
+ bpftool_strip = true
+ else
+ bpftool_strip = false
+ bpftool = find_program('bpftool',
+ '/usr/sbin/bpftool',
+ required : bpf_framework_required,
+ version : '>= 5.6.0')
+ endif
+
+ if not bpftool_strip
+ if not meson.is_cross_build() and clang_found
+ llvm_strip_bin = run_command(clang, '--print-prog-name', 'llvm-strip',
+ check : true).stdout().strip()
+ else
+ llvm_strip_bin = 'llvm-strip'
+ endif
+ llvm_strip = find_program(llvm_strip_bin, required : bpf_framework_required, version : '>= 10.0.0')
+ endif
- deps_found = clang_found and clang_supports_bpf and clang_supports_flags and llvm_strip.found() and bpftool.found()
+ deps_found = clang_found and clang_supports_bpf and clang_supports_flags and (bpftool_strip or llvm_strip.found()) and bpftool.found()
# Can build BPF program from source code in restricted C
conf.set10('BPF_FRAMEWORK', deps_found)
diff --git a/src/core/bpf/meson.build b/src/core/bpf/meson.build
index c2465a845f4..57a4c5393c9 100644
--- a/src/core/bpf/meson.build
+++ b/src/core/bpf/meson.build
@@ -65,13 +65,23 @@ bpf_o_unstripped_cmd += [
'@OUTPUT@'
]
-bpf_o_cmd = [
- llvm_strip,
- '-g',
- '@INPUT@',
- '-o',
- '@OUTPUT@'
-]
+if bpftool_strip
+ bpf_o_cmd = [
+ bpftool,
+ 'g',
+ 'o',
+ '@OUTPUT@',
+ '@INPUT@'
+ ]
+else
+ bpf_o_cmd = [
+ llvm_strip,
+ '-g',
+ '@INPUT@',
+ '-o',
+ '@OUTPUT@'
+ ]
+endif
skel_h_cmd = [
bpftool,