[kvm-unit-tests PATCH v3 3/5] arm64: Implement the ./configure --processor option

Jean-Philippe Brucker
2025-03-25T16:07:52Z

From: Alexandru Elisei <alexandru.elisei@arm.com>

The help text for the ./configure --processor option says:

--processor=PROCESSOR processor to compile for (cortex-a57)

but, unlike arm, the build system does not pass a -mcpu argument to the
compiler. Fix it, and bring arm64 at parity with arm.

Note that this introduces a regression, which is also present on arm: if
the --processor argument is something that the compiler doesn't understand,
but qemu does (like 'max'), then compilation fails. This will be fixed in a
following patch; another fix is to specify a CPU model that gcc implements
by using --cflags=-mcpu=<cpu>.

Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
arm/Makefile.arm | 1 -
arm/Makefile.common | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arm/Makefile.arm b/arm/Makefile.arm
index 7fd39f3a..d6250b7f 100644
--- a/arm/Makefile.arm
+++ b/arm/Makefile.arm
@@ -12,7 +12,6 @@ $(error Cannot build arm32 tests as EFI apps)
endif

CFLAGS += $(machine)
-CFLAGS += -mcpu=$(PROCESSOR)
CFLAGS += -mno-unaligned-access

ifeq ($(TARGET),qemu)
diff --git a/arm/Makefile.common b/arm/Makefile.common
index f828dbe0..a5d97bcf 100644
--- a/arm/Makefile.common
+++ b/arm/Makefile.common
@@ -25,6 +25,7 @@ AUXFLAGS ?= 0x0
# stack.o relies on frame pointers.
KEEP_FRAME_POINTER := y

+CFLAGS += -mcpu=$(PROCESSOR)
CFLAGS += -std=gnu99
CFLAGS += -ffreestanding
CFLAGS += -O2
--
2.49.0