From 96375f26a5074881dc88c0ab0968504c5961845b Mon Sep 17 00:00:00 2001 From: Viktor Malik Date: Wed, 5 Mar 2025 14:16:50 +0100 Subject: [PATCH] Fix LLVM feature detection and rebuild with LLVM 21 Resolves: RHEL-148264 bpftool disassembler optionally uses LLVM to improve its capabilities. Unfortunately, even if llvm-devel is installed, the feature detection of LLVM doesn't work: Auto-detecting system features: ... clang-bpf-co-re: [ on ] ... llvm: [ OFF ] ... libcap: [ on ] ... libbfd: [ on ] The reason is that the feature detection tries to compile a simple C++ program and link it against libLLVM which fails as LDFLAGS contains -pie while CXXFLAGS does not contain -fpie. Fix this by setting EXTRA_CXXFLAGS from the bpftool build. Signed-off-by: Viktor Malik --- bpftool.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bpftool.spec b/bpftool.spec index 4fe63c8..b7cd1f2 100644 --- a/bpftool.spec +++ b/bpftool.spec @@ -10,7 +10,7 @@ Name: bpftool Version: 7.7.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Inspection and simple manipulation of eBPF programs and maps %global libname libbpf @@ -42,7 +42,7 @@ manipulation of eBPF programs and maps. # We need to use vmlinux.h from kernel-devel rather than the one from the running system %define kernel_version %(rpm -q --qf "%%{VERSION}-%%{RELEASE}.%%{ARCH}" kernel-devel) pushd tools/bpf/bpftool -%make_build EXTRA_CFLAGS="%{build_cflags}" EXTRA_LDFLAGS="%{build_ldflags}" VMLINUX_H="/usr/src/kernels/%{kernel_version}/vmlinux.h" +%make_build EXTRA_CFLAGS="%{build_cflags}" EXTRA_CXXFLAGS="%{build_cflags}" EXTRA_LDFLAGS="%{build_ldflags}" VMLINUX_H="/usr/src/kernels/%{kernel_version}/vmlinux.h" %install pushd tools/bpf/bpftool