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)
Thu, Apr 25, 8:56 PM
Unknown Object (File)
Tue, Apr 23, 2:44 AM
Unknown Object (File)
Jan 14 2024, 7:26 AM
Unknown Object (File)
Jan 9 2024, 6:04 AM
Unknown Object (File)
Dec 20 2023, 7:04 AM
Unknown Object (File)
Sep 29 2023, 7:12 PM
Unknown Object (File)
Sep 26 2023, 3:56 AM
Unknown Object (File)
Jul 24 2023, 3:54 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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29613
Build 27474: arc lint + arc unit

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.