git: a24fa22bf03c - stable/14 - share/mk: Fix a heuristic in bsd.cpu.mk

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Sun, 21 Sep 2025 14:53:03 UTC
The branch stable/14 has been updated by markj:

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

commit a24fa22bf03c78f7b2d78990d27663af29d6ba36
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-09-07 16:07:32 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-09-21 14:52:38 +0000

    share/mk: Fix a heuristic in bsd.cpu.mk
    
    When cross-building from MacOS we have MACHINE=arm64 MACHINE_ARCH=arm,
    so bsd.cpu.mk infers that sizeof(long) == 4, but of course it isn't.
    This breaks the bootstrap build of openssl, which tests
    MACHINE_ABI:Mlong64 to decide whether to build ecp_nistp224.c.  It
    doesn't, and crypto/openssl/freebsd/include/openssl/configuration.h
    undefines OPENSSL_NO_EC_NISTP_64_GCC_128, so we end up with a link
    error.
    
    Reviewed by:    ngie, emaste
    MFC after:      2 weeks
    Differential Revision:  https://reviews.freebsd.org/D52340
    
    (cherry picked from commit 4341f92251ae00c3f82904623bfd561bb8ea49fb)
---
 share/mk/bsd.cpu.mk | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index 730e4b4aa152..053069801439 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -402,8 +402,11 @@ MACHINE_ABI+=	soft-float
 .else
 MACHINE_ABI+=	hard-float
 .endif
-# Currently all 64-bit architectures include 64 in their name (see arch(7)).
-.if ${MACHINE_ARCH:M*64*}
+# Currently all 64-bit FreeBSD architectures include 64 in their name
+# (see arch(7)).  We need a special case for cross-building from macOS
+# (which uses arm64/arm).
+.if ${MACHINE_ARCH:M*64*} || \
+    (defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Darwin" && ${MACHINE} == "arm64")
 MACHINE_ABI+=  long64
 .else
 MACHINE_ABI+=  long32