mbox series

[bpf-next,0/3] selftests/bpf: Improve building with extra

Message ID cover.1728975031.git.vmalik@redhat.com (mailing list archive)
Headers show
Series selftests/bpf: Improve building with extra | expand

Message

Viktor Malik Oct. 15, 2024, 6:54 a.m. UTC
When trying to build BPF selftests with additional compiler and linker
flags, we're running into multiple problems. This series addresses all
of them:

- CFLAGS are not passed to sub-makes of bpftool and libbpf. This is a
  problem when compiling with PIE as libbpf.a ends up being non-PIE and
  cannot be linked with other binaries (patch #1).

- bpftool Makefile runs `llvm-config --cflags` and appends the result to
  CFLAGS. The result typically contains `-D_GNU_SOURCE` which may be
  already set in CFLAGS. That causes a compilation error (patch #2).

- Some GCC flags are not supported by Clang but there are binaries which
  are always built with Clang but reuse user-defined CFLAGS. When CFLAGS
  contain such flags, compilation fails (patch #3).

Viktor Malik (3):
  selftests/bpf: Allow building with extra flags
  bpftool: Prevent setting duplicate _GNU_SOURCE in Makefile
  selftests/bpf: Allow ignoring some flags for Clang builds

 tools/bpf/bpftool/Makefile           |  8 ++++++-
 tools/testing/selftests/bpf/Makefile | 31 +++++++++++++++++++---------
 2 files changed, 28 insertions(+), 11 deletions(-)