1e9b60476SAmit Daniel Kachhap# SPDX-License-Identifier: GPL-2.0 2e9b60476SAmit Daniel Kachhap# Copyright (C) 2020 ARM Limited 3e9b60476SAmit Daniel Kachhap 4e5decefdSAndre PrzywaraCFLAGS += -std=gnu99 -I. -pthread 5e5decefdSAndre PrzywaraLDFLAGS += -pthread 6e9b60476SAmit Daniel KachhapSRCS := $(filter-out mte_common_util.c,$(wildcard *.c)) 7e9b60476SAmit Daniel KachhapPROGS := $(patsubst %.c,%,$(SRCS)) 8e9b60476SAmit Daniel Kachhap 9*343d5911SMark Brownifeq ($(LLVM),) 10*343d5911SMark Brown# For GCC check that the toolchain has MTE support. 11*343d5911SMark Brown 12*343d5911SMark Brown# preserve CC value from top level Makefile 13*343d5911SMark Brownifeq ($(CC),cc) 14*343d5911SMark BrownCC := $(CROSS_COMPILE)gcc 15*343d5911SMark Brownendif 16*343d5911SMark Brown 17e9b60476SAmit Daniel Kachhap#check if the compiler works well 1855c8a987SMark Brownmte_cc_support := $(shell if ($(CC) $(CFLAGS) -march=armv8.5-a+memtag -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi) 19e9b60476SAmit Daniel Kachhap 20*343d5911SMark Brownelse 21*343d5911SMark Brown 22*343d5911SMark Brown# All supported clang versions also support MTE. 23*343d5911SMark Brownmte_cc_support := 1 24*343d5911SMark Brown 25*343d5911SMark Brownendif 26*343d5911SMark Brown 27e9b60476SAmit Daniel Kachhapifeq ($(mte_cc_support),1) 28e9b60476SAmit Daniel Kachhap# Generated binaries to be installed by top KSFT script 29e9b60476SAmit Daniel KachhapTEST_GEN_PROGS := $(PROGS) 30e9b60476SAmit Daniel Kachhap 318bbb58a3SAndre Przywaraelse 328bbb58a3SAndre Przywara $(warning compiler "$(CC)" does not support the ARMv8.5 MTE extension.) 338bbb58a3SAndre Przywara $(warning test program "mte" will not be created.) 34e9b60476SAmit Daniel Kachhapendif 35e9b60476SAmit Daniel Kachhap 36e9b60476SAmit Daniel Kachhap# Include KSFT lib.mk. 37e9b60476SAmit Daniel Kachhapinclude ../../lib.mk 38e9b60476SAmit Daniel Kachhap 39e9b60476SAmit Daniel Kachhapifeq ($(mte_cc_support),1) 409466ecacSAndre Przywara$(TEST_GEN_PROGS): mte_common_util.c mte_helper.S 41e9b60476SAmit Daniel Kachhapendif 42