From owner-svn-src-head@freebsd.org Tue Apr 7 17:04:25 2020 Return-Path: Delivered-To: svn-src-head@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 92EAA275CEE; Tue, 7 Apr 2020 17:04:25 +0000 (UTC) (envelope-from kevans@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48xYfd3J61z3xJG; Tue, 7 Apr 2020 17:04:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C35BD1CB; Tue, 7 Apr 2020 17:04:25 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 037H4PIs066174; Tue, 7 Apr 2020 17:04:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 037H4Oko066171; Tue, 7 Apr 2020 17:04:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202004071704.037H4Oko066171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 7 Apr 2020 17:04:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r359702 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 359702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Apr 2020 17:04:25 -0000 Author: kevans Date: Tue Apr 7 17:04:24 2020 New Revision: 359702 URL: https://svnweb.freebsd.org/changeset/base/359702 Log: Add -fno-common to all userland/kernel src builds -fno-common will become the default in GCC10/LLVM11. Plenty of work has been put in to make sure our world builds are no -fno-common clean, so let's slap the build with this until it becomes the compiler default to ensure we don't regress. At this time, we will not be enforcing -fno-common on ports builds. I suspect most ports will be or quickly become -fno-common clean as they're naturally built against compilers that default to it, so this will hopefully become a non-issue in due time. The exception to this, which is actually the status quo, is that kmods built from ports will continue to build with -fno-common. As of the time of writing, I intend to also make stable/12 -fno-common clean. What's been done will be MFC'd to stable/11 if it's easily applicable and/or not much work to massage it into being functional, but I anticipate adding -fcommon to stable/11 builds to maintain its ability to be built with newer compilers for the rest of its lifetime instead of putting in a third branch's worth of effort. Modified: head/share/mk/src.sys.mk head/sys/conf/kern.pre.mk head/sys/conf/kmod.mk Modified: head/share/mk/src.sys.mk ============================================================================== --- head/share/mk/src.sys.mk Tue Apr 7 16:57:23 2020 (r359701) +++ head/share/mk/src.sys.mk Tue Apr 7 17:04:24 2020 (r359702) @@ -34,6 +34,11 @@ __postrcconf_${var}:= ${MK_${var}:U-}${WITHOUT_${var}: .endif # SRCCONF .endif +# The following should be removed no earlier than LLVM11 being imported into the +# tree, to ensure we don't regress the build. LLVM11 and GCC10 will switch the +# default over to -fno-common, making this redundant. +CFLAGS+= -fno-common + # tempting, but bsd.compiler.mk causes problems this early # probably need to remove dependence on bsd.own.mk #.include "src.opts.mk" Modified: head/sys/conf/kern.pre.mk ============================================================================== --- head/sys/conf/kern.pre.mk Tue Apr 7 16:57:23 2020 (r359701) +++ head/sys/conf/kern.pre.mk Tue Apr 7 17:04:24 2020 (r359702) @@ -86,7 +86,7 @@ CFLAGS_PARAM_LARGE_FUNCTION_GROWTH?=1000 .if ${MACHINE_CPUARCH} == "mips" CFLAGS_ARCH_PARAMS?=--param max-inline-insns-single=1000 -DMACHINE_ARCH='"${MACHINE_ARCH}"' .endif -CFLAGS.gcc+= -fno-common -fms-extensions -finline-limit=${INLINE_LIMIT} +CFLAGS.gcc+= -fms-extensions -finline-limit=${INLINE_LIMIT} CFLAGS.gcc+= --param inline-unit-growth=${CFLAGS_PARAM_INLINE_UNIT_GROWTH} CFLAGS.gcc+= --param large-function-growth=${CFLAGS_PARAM_LARGE_FUNCTION_GROWTH} CFLAGS.gcc+= -fms-extensions @@ -98,6 +98,10 @@ WERROR?= -Wno-error .else WERROR?= -Werror .endif +# The following should be removed no earlier than LLVM11 being imported into the +# tree, to ensure we don't regress the build. LLVM11 and GCC10 will switch the +# default over to -fno-common, making this redundant. +CFLAGS+= -fno-common # XXX LOCORE means "don't declare C stuff" not "for locore.s". ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Tue Apr 7 16:57:23 2020 (r359701) +++ head/sys/conf/kmod.mk Tue Apr 7 17:04:24 2020 (r359702) @@ -133,6 +133,13 @@ CFLAGS.gcc+= --param large-function-growth=1000 # Disallow common variables, and if we end up with commons from # somewhere unexpected, allocate storage for them in the module itself. +# +# -fno-common is the default for src builds, but this should be left in place +# until at least we catch up to GCC10/LLVM11 or otherwise enable -fno-common +# in instead. For now, we will have duplicate -fno-common in +# CFLAGS for in-tree module builds as they will also pick it up from +# share/mk/src.sys.mk, but the following is important for out-of-tree modules +# (e.g. ports). CFLAGS+= -fno-common LDFLAGS+= -d -warn-common