Viktor Malik <vmalik@xxxxxxxxxx> writes: > When building selftests with CFLAGS set via env variable, the value of > CFLAGS is propagated into bpftool Makefile (called from selftests > Makefile). This makes the compilation fail as _GNU_SOURCE is defined two > times - once from selftests Makefile (by including lib.mk) and once from > bpftool Makefile (by calling `llvm-config --cflags`): > > $ CFLAGS="" make -C tools/testing/selftests/bpf > [...] > CC /bpf-next/tools/testing/selftests/bpf/tools/build/bpftool/btf.o > <command-line>: error: "_GNU_SOURCE" redefined [-Werror] > <command-line>: note: this is the location of the previous definition > cc1: all warnings being treated as errors > [...] > > Filter out -D_GNU_SOURCE from the result of `llvm-config --cflags` in > bpftool Makefile to prevent this error. > > Signed-off-by: Viktor Malik <vmalik@xxxxxxxxxx> > Acked-by: Quentin Monnet <qmo@xxxxxxxxxx> > Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx> Reviewed-by: Toke Høiland-Jørgensen <toke@xxxxxxxxxx>