Date: Wed, 26 Aug 2020 10:21:38 +0000 (UTC) From: Alex Richardson <arichardson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364809 - head/share/mk Message-ID: <202008261021.07QALcXZ030262@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: arichardson Date: Wed Aug 26 10:21:38 2020 New Revision: 364809 URL: https://svnweb.freebsd.org/changeset/base/364809 Log: Avoid recomputing COMPILER_/LINKER_ variables when set explicitly I noticed that when we build libraries for a different ABI (in CheriBSD) we were calling ${XCC}/${LD} --version for every directory. It turns out that this was caused by bsd.compat.mk explicitly setting (X_)COMPILER variables for that build stage and this stops the _can_export logic from working. To fix this, we change the check to only set _can_export=no if the variable is set and it is set to a different value than the cached value. This noticeably speeds up the tree walk while building compat libraries. During an upstream amd64 buildworld this also removes 8 --version calls. Obtained from: CheriBSD Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D25986 Modified: head/share/mk/bsd.compiler.mk head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Wed Aug 26 09:19:49 2020 (r364808) +++ head/share/mk/bsd.compiler.mk Wed Aug 26 10:21:38 2020 (r364809) @@ -146,10 +146,13 @@ _exported_vars= ${X_}COMPILER_TYPE ${X_}COMPILER_VERSI ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR ${X_}_cc_hash= ${${cc}}${MACHINE}${PATH} ${X_}_cc_hash:= ${${X_}_cc_hash:hash} -# Only import if none of the vars are set somehow else. +# Only import if none of the vars are set differently somehow else. _can_export= yes .for var in ${_exported_vars} -.if defined(${var}) +.if defined(${var}) && (!defined(${var}__${${X_}_cc_hash}) || ${${var}__${${X_}_cc_hash}} != ${${var}}) +.if defined(${var}__${${X_}_ld_hash}) +.info "Cannot import ${X_}COMPILER variables since cached ${var} is different: ${${var}__${${X_}_cc_hash}} != ${${var}}" +.endif _can_export= no .endif .endfor Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Wed Aug 26 09:19:49 2020 (r364808) +++ head/share/mk/bsd.linker.mk Wed Aug 26 10:21:38 2020 (r364809) @@ -41,10 +41,13 @@ _exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION $ ${X_}LINKER_FREEBSD_VERSION ${X_}_ld_hash= ${${ld}}${MACHINE}${PATH} ${X_}_ld_hash:= ${${X_}_ld_hash:hash} -# Only import if none of the vars are set somehow else. +# Only import if none of the vars are set differently somehow else. _can_export= yes .for var in ${_exported_vars} -.if defined(${var}) +.if defined(${var}) && (!defined(${var}__${${X_}_ld_hash}) || ${${var}__${${X_}_ld_hash}} != ${${var}}) +.if defined(${var}__${${X_}_ld_hash}) +.info "Cannot import ${X_}LINKER variables since cached ${var} is different: ${${var}__${${X_}_ld_hash}} != ${${var}}" +.endif _can_export= no .endif .endfor
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008261021.07QALcXZ030262>