From owner-dev-commits-src-all@freebsd.org Thu Aug 12 22:56:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9048E673D70; Thu, 12 Aug 2021 22:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gm29K37FVz4RwM; Thu, 12 Aug 2021 22:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FDBA2B0AF; Thu, 12 Aug 2021 22:56:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17CMu5gm084608; Thu, 12 Aug 2021 22:56:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17CMu5Gr084607; Thu, 12 Aug 2021 22:56:05 GMT (envelope-from git) Date: Thu, 12 Aug 2021 22:56:05 GMT Message-Id: <202108122256.17CMu5Gr084607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: cef65082ae12 - main - bsd.compiler.mk: Fix cross-building from non-FreeBSD MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cef65082ae12aabaac176a61ffc49f37c97a58c3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2021 22:56:05 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=cef65082ae12aabaac176a61ffc49f37c97a58c3 commit cef65082ae12aabaac176a61ffc49f37c97a58c3 Author: Jessica Clarke AuthorDate: 2021-08-12 22:45:09 +0000 Commit: Jessica Clarke CommitDate: 2021-08-12 22:45:09 +0000 bsd.compiler.mk: Fix cross-building from non-FreeBSD On non-FreeBSD, the various MACHINE variables for the host when bootstrapping can be missing or not match FreeBSD's naming, causing bsd.endian.mk to be unable to infer the endianness. Work around this by assuming it's unsupported. Note that we can't check BOOTSTRAPPING here as Makefile.inc1 includes bsd.compiler.mk before that is set, and so we are unable to catch errors during buildworld itself when cross-building and bsd.endian.mk failed, but such errors should also show up when building on FreeBSD. Fixes: 47363e99d3d3 ("Enable compressed debug on little-endian targets") --- share/mk/bsd.compiler.mk | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 757361a566dd..c58eb114f4b8 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -239,8 +239,14 @@ ${X_}COMPILER_FEATURES+= retpoline init-all # PR257638 lld fails with BE compressed debug. Fixed in main but external tool # chains will initially not have the fix. For now limit the feature to LE # targets. +# When compiling bootstrap tools on non-FreeBSD, the various MACHINE variables +# for the host can be missing or not match FreeBSD's naming (e.g. Linux/amd64 +# reports as MACHINE=x86_64 MACHINE_ARCH=x86_64), causing TARGET_ENDIANNESS to +# be undefined; be conservative and default to off until we turn this on by +# default everywhere. .include -.if ${TARGET_ENDIANNESS} == "1234" +.if (${.MAKE.OS} == "FreeBSD" || defined(TARGET_ENDIANNESS)) && \ + ${TARGET_ENDIANNESS} == "1234" ${X_}COMPILER_FEATURES+= compressed-debug .endif .endif