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

samples/bpf: Use __LINUX_ARM_ARCH__ selector for arm

For arm, -D__LINUX_ARM_ARCH__=X is min version used as instruction
set selector and is absolutely required while parsing some parts of
headers. It's present in KBUILD_CFLAGS but not in autoconf.h, so let's
retrieve it from and add to programs cflags. In another case errors
like "SMP is not supported" for armv7 and bunch of other errors are
issued resulting to incorrect final object.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20191011002808.28206-6-ivan.khoronzhuk@linaro.org

authored by

Ivan Khoronzhuk and committed by
Alexei Starovoitov
0e865aed 2a560df7

+8
+8
samples/bpf/Makefile
··· 185 185 HOSTLDLIBS_test_overhead += -lrt 186 186 HOSTLDLIBS_xdpsock += -pthread 187 187 188 + ifeq ($(ARCH), arm) 189 + # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux 190 + # headers when arm instruction set identification is requested. 191 + ARM_ARCH_SELECTOR := $(filter -D__LINUX_ARM_ARCH__%, $(KBUILD_CFLAGS)) 192 + BPF_EXTRA_CFLAGS := $(ARM_ARCH_SELECTOR) 193 + KBUILD_HOSTCFLAGS += $(ARM_ARCH_SELECTOR) 194 + endif 195 + 188 196 # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: 189 197 # make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang 190 198 LLC ?= llc