mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-07-14 21:43:02 +02:00
[ Upstream commit 4a423645bc ]
The mte selftest Makefile contains a check for GCC, to add the memtag
-march flag to the compiler options. This check fails if the compiler
is not explicitly specified, so reverts to the standard "cc", in which
case --version doesn't mention the "gcc" string we match against:
$ cc --version | head -n 1
cc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
This will not add the -march switch to the command line, so compilation
fails:
mte_helper.S: Assembler messages:
mte_helper.S:25: Error: selected processor does not support `irg x0,x0,xzr'
mte_helper.S:38: Error: selected processor does not support `gmi x1,x0,xzr'
...
Actually clang accepts the same -march option as well, so we can just
drop this check and add this unconditionally to the command line, to avoid
any future issues with this check altogether (gcc actually prints
basename(argv[0]) when called with --version).
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Mark Brown <broone@kernel.org>
Link: https://lore.kernel.org/r/20210319165334.29213-2-andre.przywara@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
28 lines
715 B
Makefile
28 lines
715 B
Makefile
# SPDX-License-Identifier: GPL-2.0
|
|
# Copyright (C) 2020 ARM Limited
|
|
|
|
CFLAGS += -std=gnu99 -I.
|
|
SRCS := $(filter-out mte_common_util.c,$(wildcard *.c))
|
|
PROGS := $(patsubst %.c,%,$(SRCS))
|
|
|
|
#Add mte compiler option
|
|
CFLAGS += -march=armv8.5-a+memtag
|
|
|
|
#check if the compiler works well
|
|
mte_cc_support := $(shell if ($(CC) $(CFLAGS) -E -x c /dev/null -o /dev/null 2>&1) then echo "1"; fi)
|
|
|
|
ifeq ($(mte_cc_support),1)
|
|
# Generated binaries to be installed by top KSFT script
|
|
TEST_GEN_PROGS := $(PROGS)
|
|
|
|
# Get Kernel headers installed and use them.
|
|
KSFT_KHDR_INSTALL := 1
|
|
endif
|
|
|
|
# Include KSFT lib.mk.
|
|
include ../../lib.mk
|
|
|
|
ifeq ($(mte_cc_support),1)
|
|
$(TEST_GEN_PROGS): mte_common_util.c mte_common_util.h mte_helper.S
|
|
endif
|