BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/3] selftests/bpf: Improve building with extra
@ 2024-10-15  6:54 Viktor Malik
  2024-10-15  6:54 ` [PATCH bpf-next 1/3] selftests/bpf: Allow building with extra flags Viktor Malik
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Viktor Malik @ 2024-10-15  6:54 UTC (permalink / raw)
  To: bpf
  Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
	Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
	Hao Luo, Jiri Olsa, Shuah Khan, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Viktor Malik

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(-)

-- 
2.47.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-10-17  8:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15  6:54 [PATCH bpf-next 0/3] selftests/bpf: Improve building with extra Viktor Malik
2024-10-15  6:54 ` [PATCH bpf-next 1/3] selftests/bpf: Allow building with extra flags Viktor Malik
2024-10-16 23:17   ` Eduard Zingerman
2024-10-17  7:29     ` Viktor Malik
2024-10-15  6:54 ` [PATCH bpf-next 2/3] bpftool: Prevent setting duplicate _GNU_SOURCE in Makefile Viktor Malik
2024-10-15 10:03   ` Quentin Monnet
2024-10-15 10:17     ` Viktor Malik
2024-10-16 20:34   ` Andrii Nakryiko
2024-10-17  6:08     ` Viktor Malik
2024-10-15  6:54 ` [PATCH bpf-next 3/3] selftests/bpf: Allow ignoring some flags for Clang builds Viktor Malik
2024-10-16 20:37   ` Andrii Nakryiko
2024-10-16 22:18     ` Eduard Zingerman
2024-10-17  8:34       ` Viktor Malik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox