diff --git a/share/mk/src.sys.mk b/share/mk/src.sys.mk index fff26b477c6..addc115b8ab 100644 --- a/share/mk/src.sys.mk +++ b/share/mk/src.sys.mk @@ -34,6 +34,11 @@ __postrcconf_${var}:= ${MK_${var}:U-}${WITHOUT_${var}:Uno:Dyes}${WITH_${var}:Uno .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" diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index 193d8f6c2fa..918a58b510b 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -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}} diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 55c8344e7da..e5c72030838 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -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