On Mon, Nov 4, 2024 at 5:43 AM Toke Høiland-Jørgensen <toke@xxxxxxxxxx> wrote: > > Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> writes: > > > On Fri, Nov 1, 2024 at 1:29 AM Viktor Malik <vmalik@xxxxxxxxxx> wrote: > >> > >> In order to specify extra compilation or linking flags to BPF selftests, > >> it is possible to set EXTRA_CFLAGS and EXTRA_LDFLAGS from the command > >> line. The problem is that they are not propagated to sub-make calls > >> (runqslower, bpftool, libbpf) and in the better case are not applied, in > >> the worse case cause the entire build fail. > >> > >> Propagate EXTRA_CFLAGS and EXTRA_LDFLAGS to the sub-makes. > >> > >> This, for instance, allows to build selftests as PIE with > >> > >> $ make EXTRA_CFLAGS='-fPIE' EXTRA_LDFLAGS='-pie' > >> > >> Without this change, the command would fail because libbpf.a would not > >> be built with -fPIE and other PIE binaries would not link against it. > >> > >> The only problem is that we have to explicitly provide empty > >> EXTRA_CFLAGS='' and EXTRA_LDFLAGS='' to the builds of kernel modules as > >> we don't want to build modules with flags used for userspace (the above > >> example would fail as kernel doesn't support PIE). > >> > >> Signed-off-by: Viktor Malik <vmalik@xxxxxxxxxx> > >> --- > >> tools/testing/selftests/bpf/Makefile | 34 +++++++++++++++++++--------- > >> 1 file changed, 23 insertions(+), 11 deletions(-) > >> > > > > Ok, so this will conflict with Toke's [0]. Who should go first? :) > > I'm OK with rebasing on top of Viktor's patch :) Ok, then. Thanks for the review! I've applied this patch to bpf-next/master as well. Please rebase and resend your change. > > > > And given you guys touch these more obscure parts of BPF selftests > > Makefile, I'd really appreciate it if you can help reviewing them for > > each other :) > > Sure, can do! > > -Toke >