On Tue, Mar 10, 2020 at 3:45 PM Quentin Monnet <quentin@xxxxxxxxxxxxx> wrote: > > 2020-03-10 11:36 UTC-0700 ~ Song Liu <songliubraving@xxxxxx> > > bpftool-prog-profile requires clang of version 11.0.0 or newer. If > > bpftool is built with older clang, show a hint of to the user. > > > > Signed-off-by: Song Liu <songliubraving@xxxxxx> > > --- > > tools/bpf/bpftool/Makefile | 13 +++++++++++-- > > tools/bpf/bpftool/prog.c | 2 ++ > > 2 files changed, 13 insertions(+), 2 deletions(-) > > > > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile > > index 20a90d8450f8..05a37f0f76a9 100644 > > --- a/tools/bpf/bpftool/Makefile > > +++ b/tools/bpf/bpftool/Makefile > > @@ -60,6 +60,15 @@ LIBS = $(LIBBPF) -lelf -lz > > INSTALL ?= install > > RM ?= rm -f > > CLANG ?= clang > > +CLANG_VERS = $(shell $(CLANG) --version | head -n 1 | awk '{print $$3}') > > +CLANG_MAJ = $(shell echo $(CLANG_VERS) | cut -d '.' -f 1) > > This will produce error messages on stderr if clang is not installed on > the system. > > > +WITHOUT_SKELETONS = -DBPFTOOL_WITHOUT_SKELETONS > > + > > +ifeq ($(shell test $(CLANG_MAJ) -ge 11; echo $$?),0) > > Not exactly what I had in mind. I thought about the feature detection > facility we have under tools/build/feature/, as is used for e.g. > detecting libbfd. It would allow to check the feature is available, > instead of tying the build to a numeric version number. +1 I think the global data feature is actually present in v10. Version check won't work for backported clangs. So please do feature check.