git: ed7910fbac07 - main - Revert "Avoid using TARGET_ARCH in"

From: Kyle Evans <>
Date: Fri, 14 Oct 2022 03:04:59 UTC
The branch main has been updated by kevans:


commit ed7910fbac07ee39d10528994e49ada2d0f2d754
Author:     Kyle Evans <>
AuthorDate: 2022-10-14 03:04:47 +0000
Commit:     Kyle Evans <>
CommitDate: 2022-10-14 03:04:47 +0000

    Revert "Avoid using TARGET_ARCH in"
    This reverts commit 8534e6be8110a8126268a38dc0557a2d15615ce9, and adds
    a cautionary note that there are dragons about that should be considered
    when changing it.
    PR:             267026
    Reviewed by:    dim, imp
    MFC after:      3 days
    Differential Revision:
 lib/clang/ | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/clang/ b/lib/clang/
index cd8b523cb423..575b6b2d9c62 100644
--- a/lib/clang/
+++ b/lib/clang/
@@ -30,21 +30,26 @@ CFLAGS+=	-DHAVE_VCS_VERSION_INC
+# Note that using TARGET_ARCH here is essential for a functional native-xtools
+# build!  For native-xtools, we're building binaries that will work on the
+# *host* machine (MACHINE_ARCH), but they should default to producing binaries
+# for the *target* machine (TARGET_ARCH).
 # Armv6 and armv7 uses hard float abi, unless the CPUTYPE has soft in it.
 # arm (for armv4 and armv5 CPUs) always uses the soft float ABI.
 # For all other targets, we stick with 'unknown'.
-.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
+.if ${TARGET_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
 TARGET_TRIPLE_ABI=	-gnueabihf
-.elif ${MACHINE_ARCH:Marm*}
+.elif ${TARGET_ARCH:Marm*}
 VENDOR=		unknown
-LLVM_TARGET_TRIPLE?=	${MACHINE_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-freebsd${OS_REVISION}${TARGET_TRIPLE_ABI}
+LLVM_TARGET_TRIPLE?=	${TARGET_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-freebsd${OS_REVISION}${TARGET_TRIPLE_ABI}
 LLVM_BUILD_TRIPLE?=	${BUILD_ARCH:C/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${VENDOR}-freebsd${OS_REVISION}