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
This commit is contained in:
Mitchell Horne 2020-03-24 23:25:54 +00:00
parent 7522682e5e
commit 52de22cae7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=359289

View file

@ -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