Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf bpf: Fix build breakage due to libbpf

perf build is currently (v4.4-rc5) broken on powerpc:

bpf.c:28:4: error: #error __NR_bpf not defined. libbpf does not support
your arch.
# error __NR_bpf not defined. libbpf does not support your arch.
^

Fix this by including tools/scripts/Makefile.arch for the proper $ARCH
macro. While at it, remove redundant LP64 macro definition.

Also, since libbpf require $(srctree) now, detect the path of srctree
like perf.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1452520124-2073-10-git-send-email-wangnan0@huawei.com
[Use tools/scripts/Makefile.arch]
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Naveen N. Rao and committed by
Arnaldo Carvalho de Melo
d5ef3140 935e6bd3

+8 -8
+8 -8
tools/lib/bpf/Makefile
··· 6 6 7 7 MAKEFLAGS += --no-print-directory 8 8 9 + ifeq ($(srctree),) 10 + srctree := $(patsubst %/,%,$(dir $(shell pwd))) 11 + srctree := $(patsubst %/,%,$(dir $(srctree))) 12 + srctree := $(patsubst %/,%,$(dir $(srctree))) 13 + #$(info Determined 'srctree' to be $(srctree)) 14 + endif 9 15 10 16 # Makefiles suck: This macro sets a default value of $(2) for the 11 17 # variable named by $(1), unless the variable has been set by ··· 37 31 DESTDIR ?= 38 32 DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))' 39 33 40 - LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) 34 + include $(srctree)/tools/scripts/Makefile.arch 35 + 41 36 ifeq ($(LP64), 1) 42 37 libdir_relative = lib64 43 38 else ··· 62 55 endif 63 56 ifndef VERBOSE 64 57 VERBOSE = 0 65 - endif 66 - 67 - ifeq ($(srctree),) 68 - srctree := $(patsubst %/,%,$(dir $(shell pwd))) 69 - srctree := $(patsubst %/,%,$(dir $(srctree))) 70 - srctree := $(patsubst %/,%,$(dir $(srctree))) 71 - #$(info Determined 'srctree' to be $(srctree)) 72 58 endif 73 59 74 60 FEATURE_USER = .libbpf