git: cef65082ae12 - main - bsd.compiler.mk: Fix cross-building from non-FreeBSD
Jessica Clarke
jrtc27 at FreeBSD.org
Thu Aug 12 22:56:05 UTC 2021
The branch main has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=cef65082ae12aabaac176a61ffc49f37c97a58c3
commit cef65082ae12aabaac176a61ffc49f37c97a58c3
Author: Jessica Clarke <jrtc27 at FreeBSD.org>
AuthorDate: 2021-08-12 22:45:09 +0000
Commit: Jessica Clarke <jrtc27 at FreeBSD.org>
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 <bsd.endian.mk>
-.if ${TARGET_ENDIANNESS} == "1234"
+.if (${.MAKE.OS} == "FreeBSD" || defined(TARGET_ENDIANNESS)) && \
+ ${TARGET_ENDIANNESS} == "1234"
${X_}COMPILER_FEATURES+= compressed-debug
.endif
.endif
More information about the dev-commits-src-main
mailing list