perf bpf: Enclose libbpf.h include within HAVE_LIBBPF_SUPPORT
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 20 Oct 2020 17:12:37 +0000 (14:12 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 4 Nov 2020 12:42:40 +0000 (09:42 -0300)
commitc18cf78d7969db89934587fa476220eefe7bd4bd
tree7758e69afc47c8d4371e49b6007e9d57f3470877
parentcc3b964d5eb49d0c9da08760f8760bb6945f1df5
perf bpf: Enclose libbpf.h include within HAVE_LIBBPF_SUPPORT

As it uses the 'deprecated' attribute in a way that breaks the build
with old gcc compilers, so to continue being able to build in such
systems where NO_LIBBPF=1 is being used, enclose it under
HAVE_LIBBPF_SUPPORT.

   1 centos:6          : FAIL gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
   2 oraclelinux:6     : FAIL gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)

    CC       /tmp/build/perf/builtin-record.o
  In file included from util/bpf-loader.h:11,
                   from builtin-record.c:39:
  /git/linux/tools/lib/bpf/libbpf.h:203: error: wrong number of arguments specified for 'deprecated' attribute

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/bpf-loader.h
tools/perf/util/parse-events.c