Lines Matching +full:cross +full:- +full:arm64 +full:- +full:system

1 # SPDX-License-Identifier: GPL-2.0
9 tprogs-y += hid_mouse
10 tprogs-y += hid_surface_dial
22 hid_mouse-objs := hid_mouse.o
23 hid_surface_dial-objs := hid_surface_dial.o
26 always-y := $(tprogs-y)
29 # Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux
31 ARM_ARCH_SELECTOR := $(filter -D__LINUX_ARM_ARCH__%, $(KBUILD_CFLAGS))
37 TPROGS_CFLAGS += -D__SANE_USERSPACE_TYPES__
39 BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-loongson64
40 BPF_EXTRA_CFLAGS += -I$(srctree)/arch/mips/include/asm/mach-generic
44 TPROGS_CFLAGS += -Wall -O2
45 TPROGS_CFLAGS += -Wmissing-prototypes
46 TPROGS_CFLAGS += -Wstrict-prototypes
48 TPROGS_CFLAGS += -I$(objtree)/usr/include
49 TPROGS_CFLAGS += -I$(LIBBPF_INCLUDE)
50 TPROGS_CFLAGS += -I$(srctree)/tools/include
53 TPROGS_CFLAGS += --sysroot=$(SYSROOT)
54 TPROGS_LDFLAGS := -L$(SYSROOT)/usr/lib
57 TPROGS_LDLIBS += $(LIBBPF) -lelf -lz
60 # make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/…
64 LLVM_DIS ?= llvm-dis
65 LLVM_OBJCOPY ?= llvm-objcopy
66 LLVM_READELF ?= llvm-readelf
69 # Detect that we're cross compiling and use the cross compiler
71 CLANG_ARCH_ARGS = --target=$(notdir $(CROSS_COMPILE:%-=%))
77 $(CC) $(TPROGS_CFLAGS) $(TPROGS_LDFLAGS) -x c - \
78 -o /dev/null 2>/dev/null && echo okay)
85 BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris)
86 BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF)
87 BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm')
89 $(CLANG) --target=bpf -O2 -g -c -x c - -o ./llvm_btf_verify.o; \
90 $(LLVM_READELF) -S ./llvm_btf_verify.o | grep BTF; \
91 /bin/rm -f ./llvm_btf_verify.o)
93 BPF_EXTRA_CFLAGS += -fno-stack-protector
95 BPF_EXTRA_CFLAGS += -g
98 BPF_EXTRA_CFLAGS += -g
99 LLC_FLAGS += -mattr=dwarfris
107 $(MAKE) -C ../../ M=$(CURDIR) HID_SAMPLES_PATH=$(CURDIR)
110 $(MAKE) -C ../../ M=$(CURDIR) clean
111 @find $(CURDIR) -type f -name '*~' -delete
112 @$(RM) -r $(CURDIR)/libbpf $(CURDIR)/bpftool
115 # Fix up variables inherited from Kbuild that tools/ build system won't like
116 $(MAKE) -C $(LIBBPF_SRC) RM='rm -rf' EXTRA_CFLAGS="$(TPROGS_CFLAGS)" \
125 $(MAKE) -C $(BPFTOOLDIR) srctree=$(HID_SAMPLES_PATH)/../../ \
130 $(Q)mkdir -p $@
140 if ! (which -- "$${TOOL}" > /dev/null 2>&1); then \
147 @if ! (${LLC} -march=bpf -mattr=help > /dev/null 2>&1); then \
163 -include $(HID_SAMPLES_PATH)/Makefile.target
181 clean-files += vmlinux.h
183 # Get Clang's default includes on this system, as opposed to those seen by
184 # '--target=bpf'. This fixes "missing" files on some architectures/distros,
187 # Use '-idirafter': Don't interfere with include mechanics except where the
190 $(shell $(1) -v -E - </dev/null 2>&1 \
191 … | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') \
192 $(shell $(1) -dM -E - </dev/null | grep '#define __riscv_xlen ' | sed 's/#define /-D/' | sed 's/ /=…
200 @echo " CLANG-BPF " $@
201 $(Q)$(CLANG) -g -O2 --target=bpf -D__TARGET_ARCH_$(SRCARCH) \
202 -Wno-compare-distinct-pointer-types -I$(srctree)/include \
203 -I$(srctree)/samples/bpf -I$(srctree)/tools/include \
204 -I$(LIBBPF_INCLUDE) $(CLANG_SYS_INCLUDES) \
205 -c $(filter %.bpf.c,$^) -o $@
208 clean-files += $(LINKED_SKELS)
210 hid_mouse.skel.h-deps := hid_mouse.bpf.o hid_bpf_attach.bpf.o
211 hid_surface_dial.skel.h-deps := hid_surface_dial.bpf.o hid_bpf_attach.bpf.o
213 LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.bpf.c,$(foreach skel,$(LINKED_SKELS),$($(skel)-deps)))
220 @echo " BPF GEN-OBJ " $(@:.skel.h=)
221 $(Q)$(BPFTOOL) gen object $(@:.skel.h=.lbpf.o) $(addprefix $(obj)/,$($(@F)-deps))
222 @echo " BPF GEN-SKEL" $(@:.skel.h=)
225 # asm/sysreg.h - inline assembly used by it is incompatible with llvm.
228 # below we use long chain of commands, clang | opt | llvm-dis | llc,
230 # with native target, e.g., x64, arm64, etc. 'opt' does bpf CORE IR builtin
231 # processing (llvm12) and IR optimizations. 'llvm-dis' converts
234 @echo " CLANG-bpf " $@
236 -I$(obj) -I$(srctree)/tools/testing/selftests/bpf/ \
237 -I$(LIBBPF_INCLUDE) \
238 -D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \
239 -D__TARGET_ARCH_$(SRCARCH) -Wno-compare-distinct-pointer-types \
240 -Wno-gnu-variable-sized-type-not-at-end \
241 -Wno-address-of-packed-member -Wno-tautological-compare \
242 -Wno-unknown-warning-option $(CLANG_ARCH_ARGS) \
243 -fno-asynchronous-unwind-tables \
244 -I$(srctree)/samples/hid/ \
245 -O2 -emit-llvm -Xclang -disable-llvm-passes -c $< -o - | \
246 $(OPT) -O2 -mtriple=bpf-pc-linux | $(LLVM_DIS) | \
247 $(LLC) -march=bpf $(LLC_FLAGS) -filetype=obj -o $@
249 $(BTF_PAHOLE) -J $@