From 52de22cae7f1dd2f9655c2ceb4fc27538c4c8a99 Mon Sep 17 00:00:00 2001 From: Mitchell Horne Date: Tue, 24 Mar 2020 23:25:54 +0000 Subject: [PATCH] Makefile.inc1: override MACHINE for native-xtools For the final step of the native-xtools target, "everything" is built with TARGET and TARGET_ARCH set to the architecture we wish to cross-build for. However, CROSSENV overwrites the values of MACHINE and MACHINE_ARCH, setting them to be identical to TARGET and TARGET_ARCH. For native-xtools this is undesirable since we are building binaries to run on the host architecture, that can cross compile for the target architecture. When building native-xtools for RISC-V, this issue manifests as an invalid argument for "-march". The compiler is invoked with the target triple of the host architecture, but the CFLAGS inherited from bsd.cpu.mk are that of the target architecture. Reviewed by: imp, bdrewery MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D23838 --- Makefile.inc1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.inc1 b/Makefile.inc1 index 68ef5f34b285..7b04a2e7bd81 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2650,6 +2650,7 @@ NXBMAKE+= XCC="${NXBOBJTOP}/tmp/usr/bin/cc" \ XCPP="${NXBOBJTOP}/tmp/usr/bin/cpp" .endif NXBMAKE+= ${NXBMAKEENV} ${MAKE} -f Makefile.inc1 ${NXBMAKEARGS} \ + MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \ TARGET=${NXB_TARGET} TARGET_ARCH=${NXB_TARGET_ARCH} \ TARGET_TRIPLE=${MACHINE_TRIPLE:Q} # NXBDIRS is improperly based on MACHINE rather than NXB_TARGET. Need to