public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next v3 0/3] selftests/bpf: Improve building with extra
@ 2024-11-01  8:27 Viktor Malik
  2024-11-01  8:27 ` [PATCH bpf-next v3 1/3] selftests/bpf: Allow building with extra flags Viktor Malik
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Viktor Malik @ 2024-11-01  8:27 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).

Changelog:
----------
v2 -> v3:
- resolve conflicts between patch #1 and 4192bb294f80 ("selftests/bpf:
  Provide a generic [un]load_module helper")
- add Quentin's and Jiri's acks for patches #2 and #3

v1 -> v2:
- cover forgotten case in patch#1 (noted by Eduard)
- remove -D_GNU_SOURCE unconditionally in patch#2 (suggested by Andrii)
- rewrite patch#3 to just add -Wno-unused-command-line-argument
  (suggested by Andrii)

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

 tools/bpf/bpftool/Makefile           |  6 ++++-
 tools/testing/selftests/bpf/Makefile | 36 +++++++++++++++++++---------
 2 files changed, 30 insertions(+), 12 deletions(-)

-- 
2.47.0


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

end of thread, other threads:[~2024-11-06 20:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-01  8:27 [PATCH bpf-next v3 0/3] selftests/bpf: Improve building with extra Viktor Malik
2024-11-01  8:27 ` [PATCH bpf-next v3 1/3] selftests/bpf: Allow building with extra flags Viktor Malik
2024-11-01 19:34   ` Andrii Nakryiko
2024-11-04 13:43     ` Toke Høiland-Jørgensen
2024-11-06 20:37       ` Andrii Nakryiko
2024-11-04 14:03   ` Toke Høiland-Jørgensen
2024-11-01  8:27 ` [PATCH bpf-next v3 2/3] bpftool: Prevent setting duplicate _GNU_SOURCE in Makefile Viktor Malik
2024-11-04 14:05   ` Toke Høiland-Jørgensen
2024-11-01  8:27 ` [PATCH bpf-next v3 3/3] selftests/bpf: Disable warnings on unused flags for Clang builds Viktor Malik
2024-11-01 19:46 ` [PATCH bpf-next v3 0/3] selftests/bpf: Improve building with extra Andrii Nakryiko
2024-11-04 11:34   ` Viktor Malik
2024-11-01 19:50 ` patchwork-bot+netdevbpf
2024-11-06 20:40 ` patchwork-bot+netdevbpf

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