Date: Wed, 27 Jun 2018 16:57:52 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335706 - in head: . share/mk tools/build/options Message-ID: <201806271657.w5RGvqwZ072896@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Wed Jun 27 16:57:51 2018 New Revision: 335706 URL: https://svnweb.freebsd.org/changeset/base/335706 Log: Add LLVM_TARGET_ALL option. LLVM_TARGET_* will auto be set based on LLVM_TARGET_ALL and MK_CLANG. If LLVM_TARGET_ALL is disabled, during a cross-build, then SYSTEM_COMPILER and SYSTEM_LINKER are auto disabled. This option should be used by users rather than the per-arch LLVM_TARGET options as it is simpler to maintain for them should the supported target list change. MFC after: 2 weeks Reviewed by: sbruno, dim Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D16020 Added: head/tools/build/options/WITHOUT_LLVM_TARGET_ALL (contents, props changed) head/tools/build/options/WITH_LLVM_TARGET_ALL (contents, props changed) Modified: head/Makefile.inc1 head/share/mk/src.opts.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Jun 27 16:57:47 2018 (r335705) +++ head/Makefile.inc1 Wed Jun 27 16:57:51 2018 (r335706) @@ -130,6 +130,15 @@ MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$// TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd12.0 +# If all targets are disabled for system llvm then don't expect it to work +# for cross-builds. +.if ${MK_LLVM_TARGET_ALL} == "no" && \ + ${MACHINE} != ${TARGET} && ${MACHINE_ARCH} != ${TARGET_ARCH} && \ + !make(showconfig) +MK_SYSTEM_COMPILER= no +MK_SYSTEM_LINKER= no +.endif + # Handle external binutils. .if defined(CROSS_TOOLCHAIN_PREFIX) CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Jun 27 16:57:47 2018 (r335705) +++ head/share/mk/src.opts.mk Wed Jun 27 16:57:51 2018 (r335706) @@ -211,6 +211,7 @@ __DEFAULT_NO_OPTIONS = \ # RIGHT option is disabled. __DEFAULT_DEPENDENT_OPTIONS= \ CLANG_FULL/CLANG \ + LLVM_TARGET_ALL/CLANG \ # MK_*_SUPPORT options which default to "yes" unless their corresponding # MK_* variable is set to "no". @@ -249,6 +250,27 @@ __TT=${TARGET} __TT=${MACHINE} .endif +# All supported backends for LLVM_TARGET_XXX +__LLVM_TARGETS= \ + aarch64 \ + arm \ + mips \ + powerpc \ + sparc \ + x86 +__LLVM_TARGET_FILT= C/(amd64|i386)/x86/:S/sparc64/sparc/:S/arm64/aarch64/ +# Default the given TARGET_ARCH's LLVM_TARGET support to the value of +# MK_CLANG. +# Default the rest of the LLVM_TARGETs to the value of MK_LLVM_TARGET_ALL +# which is based on MK_CLANG. +.for __llt in ${__LLVM_TARGETS} +.if ${__llt} != ${__T:${__LLVM_TARGET_FILT}} +__DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/LLVM_TARGET_ALL +.else +__DEFAULT_DEPENDENT_OPTIONS+= LLVM_TARGET_${__llt:${__LLVM_TARGET_FILT}:tu}/CLANG +.endif +.endfor + .include <bsd.compiler.mk> # If the compiler is not C++11 capable, disable Clang and use GCC instead. # This means that architectures that have GCC 4.2 as default can not @@ -258,23 +280,17 @@ __TT=${MACHINE} ${__T} == "amd64" || ${__TT} == "arm" || ${__T} == "i386") # Clang is enabled, and will be installed as the default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD -__DEFAULT_YES_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS -__DEFAULT_YES_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC .elif ${COMPILER_FEATURES:Mc++11} && ${__T:Mriscv*} == "" && ${__T} != "sparc64" # If an external compiler that supports C++11 is used as ${CC} and Clang # supports the target, then Clang is enabled but GCC is installed as the # default /usr/bin/cc. __DEFAULT_YES_OPTIONS+=CLANG GCC GCC_BOOTSTRAP GNUCXX GPL_DTC LLD -__DEFAULT_YES_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS -__DEFAULT_YES_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 __DEFAULT_NO_OPTIONS+=CLANG_BOOTSTRAP CLANG_IS_CC .else # Everything else disables Clang, and uses GCC instead. __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX GPL_DTC __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC LLD -__DEFAULT_NO_OPTIONS+=LLVM_TARGET_AARCH64 LLVM_TARGET_ARM LLVM_TARGET_MIPS -__DEFAULT_NO_OPTIONS+=LLVM_TARGET_POWERPC LLVM_TARGET_SPARC LLVM_TARGET_X86 .endif # In-tree binutils/gcc are older versions without modern architecture support. .if ${__T} == "aarch64" || ${__T:Mriscv*} != "" Added: head/tools/build/options/WITHOUT_LLVM_TARGET_ALL ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_LLVM_TARGET_ALL Wed Jun 27 16:57:51 2018 (r335706) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to only build the required LLVM target support. +This option is preferred to specific target support options. Added: head/tools/build/options/WITH_LLVM_TARGET_ALL ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_LLVM_TARGET_ALL Wed Jun 27 16:57:51 2018 (r335706) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build support for all LLVM targets.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806271657.w5RGvqwZ072896>