| # | |
| # arm64 makefile | |
| # | |
| # Authors: Andrew Jones <drjones@redhat.com> | |
| # | |
| bits = 64 | |
| ldarch = elf64-littleaarch64 | |
| arch_LDFLAGS = -pie -n | |
| arch_LDFLAGS += -z notext | |
| CFLAGS += -mstrict-align | |
| sve_flag := $(call cc-option, -march=armv8.5-a+sve, "") | |
| ifneq ($(strip $(sve_flag)),) | |
| # Don't pass the option to the compiler, we don't | |
| # want the compiler to generate SVE instructions. | |
| CFLAGS += -DCC_HAS_SVE | |
| endif | |
| mte_flag := $(call cc-option, -march=armv8.5-a+memtag, "") | |
| ifneq ($(strip $(mte_flag)),) | |
| # MTE is supported by the compiler, generate MTE instructions | |
| CFLAGS += -DCC_HAS_MTE | |
| endif | |
| mno_outline_atomics := $(call cc-option, -mno-outline-atomics, "") | |
| CFLAGS += $(mno_outline_atomics) | |
| CFLAGS += -DCONFIG_RELOC | |
| CFLAGS += -mgeneral-regs-only | |
| define arch_elf_check = | |
| $(if $(shell ! $(READELF) -rW $(1) >&/dev/null && echo "nok"), | |
| $(error $(shell $(READELF) -rW $(1) 2>&1))) | |
| $(if $(shell $(READELF) -rW $(1) | grep R_ | grep -v R_AARCH64_RELATIVE), | |
| $(error $(1) has unsupported reloc types)) | |
| endef | |
| cstart.o = $(TEST_DIR)/cstart64.o | |
| cflatobjs += lib/arm64/stack.o | |
| cflatobjs += lib/arm64/processor.o | |
| cflatobjs += lib/arm64/spinlock.o | |
| cflatobjs += lib/arm64/gic-v3-its.o lib/arm64/gic-v3-its-cmd.o | |
| ifeq ($(CONFIG_EFI),y) | |
| cflatobjs += lib/acpi.o | |
| endif | |
| OBJDIRS += lib/arm64 | |
| ifeq ($(CONFIG_EFI),y) | |
| # avoid jump tables before all relocations have been processed | |
| arm/efi/reloc_aarch64.o: CFLAGS += -fno-jump-tables | |
| cflatobjs += arm/efi/reloc_aarch64.o | |
| exe = efi | |
| else | |
| exe = flat | |
| endif | |
| # arm64 specific tests | |
| tests = $(TEST_DIR)/timer.$(exe) | |
| tests += $(TEST_DIR)/micro-bench.$(exe) | |
| tests += $(TEST_DIR)/cache.$(exe) | |
| tests += $(TEST_DIR)/debug.$(exe) | |
| tests += $(TEST_DIR)/fpu.$(exe) | |
| tests += $(TEST_DIR)/mte.$(exe) | |
| include $(SRCDIR)/$(TEST_DIR)/Makefile.common | |
| ifneq ($(KEEP_FRAME_POINTER),) | |
| # Force the generation of a regular stack frame even for leaf functions to make | |
| # stack walking reliable. | |
| LATE_CFLAGS += $(call cc-option, -mno-omit-leaf-frame-pointer, "") | |
| endif | |
| arch_clean: arm_clean | |
| $(RM) lib/arm64/.*.d |