Compare commits

..

1 Commits

Author SHA1 Message Date
Viktor Malik
96375f26a5
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 <vmalik@redhat.com>
2026-02-17 13:17:23 +01:00

View File

@ -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
@ -19,6 +19,8 @@ Summary: Inspection and simple manipulation of eBPF programs and maps
License: GPL-2.0-only OR BSD-2-Clause
Source: %{source}.tar.xz
ExcludeArch: %{ix86}
BuildRequires: gcc
BuildRequires: make
BuildRequires: binutils-devel
@ -40,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