Page MenuHomeFreeBSD

Makefile.inc1: override MACHINE for native-xtools
ClosedPublic

Authored by mhorne on Feb 25 2020, 7:33 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, May 6, 12:22 PM
Unknown Object (File)
Wed, May 1, 10:35 PM
Unknown Object (File)
Wed, May 1, 9:26 PM
Unknown Object (File)
Wed, May 1, 9:26 PM
Unknown Object (File)
Wed, May 1, 6:40 PM
Unknown Object (File)
Thu, Apr 25, 8:56 PM
Unknown Object (File)
Tue, Apr 23, 2:44 AM
Unknown Object (File)
Jan 14 2024, 7:26 AM
Subscribers

Details

Summary

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", as the compiler is expecting an x86
processor, not rv64imafdc. These flags are set in bsd.cpu.mk 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
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 bsd.cpu.mk.

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.