Date: Mon, 27 Apr 2020 19:49:35 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r360391 - in stable/12: gnu/usr.bin/gdb share/mk sys/conf Message-ID: <202004271949.03RJnZjB021735@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Mon Apr 27 19:49:35 2020 New Revision: 360391 URL: https://svnweb.freebsd.org/changeset/base/360391 Log: MFC r359702, r359774: enforce -fno-common for userland/kernel src builds r359702: 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. r359774: userland build: replace -fno-common with ${CFCOMMONFLAG} This change allows any downstream or otherwise consumer to easily override the new -fno-common default on a temporary basis without having to hack into src.sys.mk, and also makes it a bit easier to search for these specific cases where -fno-common must be overridden with -fcommon or else the build will fail. The gdb build, the only program requiring -fcommon on head/, is switched over as an example usage. It will need it on all branches, so this does not harm future mergability. Modified: stable/12/gnu/usr.bin/gdb/Makefile.inc stable/12/share/mk/src.sys.mk stable/12/sys/conf/kern.pre.mk stable/12/sys/conf/kmod.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/gnu/usr.bin/gdb/Makefile.inc ============================================================================== --- stable/12/gnu/usr.bin/gdb/Makefile.inc Mon Apr 27 19:29:48 2020 (r360390) +++ stable/12/gnu/usr.bin/gdb/Makefile.inc Mon Apr 27 19:49:35 2020 (r360391) @@ -50,7 +50,7 @@ CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/edit # Some bits here currently rely on some of the linker-merging magic that happens # with -fcommon. While this is the default right now, explicitly set -fcommon # so that it continues to build when the default flips. -CFLAGS+= -fcommon +CFCOMMONFLAG= -fcommon GENSRCS+= nm.h tm.h Modified: stable/12/share/mk/src.sys.mk ============================================================================== --- stable/12/share/mk/src.sys.mk Mon Apr 27 19:29:48 2020 (r360390) +++ stable/12/share/mk/src.sys.mk Mon Apr 27 19:49:35 2020 (r360391) @@ -34,6 +34,12 @@ __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. +CFCOMMONFLAG?= -fno-common +CFLAGS+= ${CFCOMMONFLAG} + # tempting, but bsd.compiler.mk causes problems this early # probably need to remove dependence on bsd.own.mk #.include "src.opts.mk" Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Mon Apr 27 19:29:48 2020 (r360390) +++ stable/12/sys/conf/kern.pre.mk Mon Apr 27 19:49:35 2020 (r360391) @@ -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: stable/12/sys/conf/kmod.mk ============================================================================== --- stable/12/sys/conf/kmod.mk Mon Apr 27 19:29:48 2020 (r360390) +++ stable/12/sys/conf/kmod.mk Mon Apr 27 19:49:35 2020 (r360391) @@ -149,6 +149,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 <bsd.sys.mk> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004271949.03RJnZjB021735>