xref: /kvm-unit-tests/arm/Makefile.arm64 (revision 1b59c632c6894d3b77673fab71a92ed64872a00e)
1#
2# arm64 makefile
3#
4# Authors: Andrew Jones <drjones@redhat.com>
5#
6bits = 64
7ldarch = elf64-littleaarch64
8
9arch_LDFLAGS = -pie -n
10arch_LDFLAGS += -z notext
11CFLAGS += -mstrict-align
12
13sve_flag := $(call cc-option, -march=armv8.5-a+sve, "")
14ifneq ($(strip $(sve_flag)),)
15# Don't pass the option to the compiler, we don't
16# want the compiler to generate SVE instructions.
17CFLAGS += -DCC_HAS_SVE
18endif
19
20mte_flag := $(call cc-option, -march=armv8.5-a+memtag, "")
21ifneq ($(strip $(mte_flag)),)
22# MTE is supported by the compiler, generate MTE instructions
23CFLAGS += -DCC_HAS_MTE
24endif
25
26mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "")
27CFLAGS += $(mno_outline_atomics)
28CFLAGS += -DCONFIG_RELOC
29CFLAGS += -mgeneral-regs-only
30
31define arch_elf_check =
32	$(if $(shell ! $(READELF) -rW $(1) >&/dev/null && echo "nok"),
33		$(error $(shell $(READELF) -rW $(1) 2>&1)))
34	$(if $(shell $(READELF) -rW $(1) | grep R_ | grep -v R_AARCH64_RELATIVE),
35		$(error $(1) has unsupported reloc types))
36endef
37
38cstart.o = $(TEST_DIR)/cstart64.o
39cflatobjs += lib/arm64/stack.o
40cflatobjs += lib/arm64/processor.o
41cflatobjs += lib/arm64/spinlock.o
42cflatobjs += lib/arm64/gic-v3-its.o lib/arm64/gic-v3-its-cmd.o
43
44ifeq ($(CONFIG_EFI),y)
45cflatobjs += lib/acpi.o
46endif
47
48OBJDIRS += lib/arm64
49
50ifeq ($(CONFIG_EFI),y)
51# avoid jump tables before all relocations have been processed
52arm/efi/reloc_aarch64.o: CFLAGS += -fno-jump-tables
53cflatobjs += arm/efi/reloc_aarch64.o
54
55exe = efi
56else
57exe = flat
58endif
59
60# arm64 specific tests
61tests = $(TEST_DIR)/timer.$(exe)
62tests += $(TEST_DIR)/micro-bench.$(exe)
63tests += $(TEST_DIR)/cache.$(exe)
64tests += $(TEST_DIR)/debug.$(exe)
65tests += $(TEST_DIR)/fpu.$(exe)
66tests += $(TEST_DIR)/mte.$(exe)
67
68include $(SRCDIR)/$(TEST_DIR)/Makefile.common
69
70arch_clean: arm_clean
71	$(RM) lib/arm64/.*.d
72