git: 1ee66195db08 - main - armv8crypto: Avoid overriding -march when compiling some source files

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 15 Jun 2023 16:39:38 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=1ee66195db08c7f1f902e139ecdb63587ee36364

commit 1ee66195db08c7f1f902e139ecdb63587ee36364
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-06-15 16:10:19 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-06-15 16:38:45 +0000

    armv8crypto: Avoid overriding -march when compiling some source files
    
    At least one downstream (CheriBSD) overrides -march here.  Instead of
    hard-coding the target, simply append the crypto extension to whatever's
    already there.
    
    No functional change intended.
    
    Reviewed by:    imp, andrew
    MFC after:      1 week
    Sponsored by:   Innovate UK
    Differential Revision:  https://reviews.freebsd.org/D40537
---
 sys/conf/files.arm64 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64
index 1fed31af0761..da71606a4b84 100644
--- a/sys/conf/files.arm64
+++ b/sys/conf/files.arm64
@@ -119,17 +119,17 @@ dev/iommu/iommu_gas.c				optional iommu
 crypto/armv8/armv8_crypto.c			optional armv8crypto
 armv8_crypto_wrap.o				optional armv8crypto	\
 	dependency	"$S/crypto/armv8/armv8_crypto_wrap.c"		\
-	compile-with	"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} -march=armv8-a+crypto ${.IMPSRC}" \
+	compile-with	"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} ${CFLAGS:M-march=*:S/^$/-march=armv8-a/}+crypto ${.IMPSRC}" \
 	no-implicit-rule						\
 	clean		"armv8_crypto_wrap.o"
 aesv8-armx.o					optional armv8crypto | ossl	\
 	dependency	"$S/crypto/openssl/aarch64/aesv8-armx.S"		\
-	compile-with	"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} -march=armv8-a+crypto ${.IMPSRC}" \
+	compile-with	"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} ${CFLAGS:M-march=*:S/^$/-march=armv8-a/}+crypto ${.IMPSRC}" \
 	no-implicit-rule						\
 	clean		"aesv8-armx.o"
 ghashv8-armx.o					optional armv8crypto	\
 	dependency	"$S/crypto/openssl/aarch64/ghashv8-armx.S"	\
-	compile-with	"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} -march=armv8-a+crypto ${.IMPSRC}" \
+	compile-with	"${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc:N-mgeneral-regs-only} -I$S/crypto/armv8/ ${WERROR} ${NO_WCAST_QUAL} ${CFLAGS:M-march=*:S/^$/-march=armv8-a/}+crypto ${.IMPSRC}" \
 	no-implicit-rule						\
 	clean		"ghashv8-armx.o"