Page MenuHomeFreeBSD

Makefile.inc1: override MACHINE for native-xtools

Authored by mhorne on Feb 25 2020, 7:33 PM.
Referenced Files
Unknown Object (File)
Wed, Jul 10, 12:58 PM
Unknown Object (File)
May 14 2024, 11:37 PM
Unknown Object (File)
May 9 2024, 1:29 PM
Unknown Object (File)
May 6 2024, 12:22 PM
Unknown Object (File)
May 1 2024, 10:35 PM
Unknown Object (File)
May 1 2024, 9:26 PM
Unknown Object (File)
May 1 2024, 9:26 PM
Unknown Object (File)
May 1 2024, 6:40 PM



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

When building native-xtools for RISC-V, this issue manifests as an
invalid argument for "-march", as the compiler is expecting an x86
processor, not rv64imafdc. These flags are set in depending
on MACHINE_CPUARCH, therefore demonstrating the need for MACHINE and
MACHINE_ARCH to be set to the host's architecture.

Test Plan

Building native-xtools for RISC-V succeeds on an amd64 host.
Building native-xtools for arm64 and mips continues to succeed on an amd64 host.

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable

Event Timeline

Ping. I've created a snippet P376 showing the build failure. As you can see the target triple is set correctly to amd64, but RISC-V CFLAGS are being picked up from

I think this is fine but defer to @imp for anything ${MACHINE} or ${MACHINE_ARCH} related

Looks good to me. MACHINE may not be strictly necessary, but it doesn't hurt in this case, and may help a few stragglers that improperly depend on it.

This revision is now accepted and ready to land.Mar 24 2020, 7:47 PM
This revision was automatically updated to reflect the committed changes.