Changeset View
Changeset View
Standalone View
Standalone View
sys/conf/kern.pre.mk
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
# The following should be removed no earlier than LLVM11 being imported into the | # 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 | # tree, to ensure we don't regress the build. LLVM11 and GCC10 will switch the | ||||
# default over to -fno-common, making this redundant. | # default over to -fno-common, making this redundant. | ||||
CFLAGS+= -fno-common | CFLAGS+= -fno-common | ||||
# XXX LOCORE means "don't declare C stuff" not "for locore.s". | # XXX LOCORE means "don't declare C stuff" not "for locore.s". | ||||
ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} | ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} | ||||
.if defined(PROFLEVEL) && ${PROFLEVEL} >= 1 | |||||
CFLAGS+= -DGPROF | |||||
CFLAGS.gcc+= -falign-functions=16 | |||||
.if ${PROFLEVEL} >= 2 | |||||
CFLAGS+= -DGPROF4 -DGUPROF | |||||
PROF= -pg | |||||
.if ${COMPILER_TYPE} == "gcc" | |||||
PROF+= -mprofiler-epilogue | |||||
.endif | |||||
.else | |||||
PROF= -pg | |||||
.endif | |||||
.endif | |||||
DEFINED_PROF= ${PROF} | |||||
KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo | KCSAN_ENABLED!= grep KCSAN opt_global.h || true ; echo | ||||
.if !empty(KCSAN_ENABLED) | .if !empty(KCSAN_ENABLED) | ||||
SAN_CFLAGS+= -fsanitize=thread | SAN_CFLAGS+= -fsanitize=thread | ||||
.endif | .endif | ||||
KUBSAN_ENABLED!= grep KUBSAN opt_global.h || true ; echo | KUBSAN_ENABLED!= grep KUBSAN opt_global.h || true ; echo | ||||
.if !empty(KUBSAN_ENABLED) | .if !empty(KUBSAN_ENABLED) | ||||
SAN_CFLAGS+= -fsanitize=undefined | SAN_CFLAGS+= -fsanitize=undefined | ||||
Show All 15 Lines | |||||
.if !empty(GCOV_ENABLED) | .if !empty(GCOV_ENABLED) | ||||
.if ${COMPILER_TYPE} == "gcc" | .if ${COMPILER_TYPE} == "gcc" | ||||
GCOV_CFLAGS+= -fprofile-arcs -ftest-coverage | GCOV_CFLAGS+= -fprofile-arcs -ftest-coverage | ||||
.endif | .endif | ||||
.endif | .endif | ||||
CFLAGS+= ${GCOV_CFLAGS} | CFLAGS+= ${GCOV_CFLAGS} | ||||
# Put configuration-specific C flags last (except for ${PROF}) so that they | # Put configuration-specific C flags last so that they can override | ||||
# can override the others. | # the others. | ||||
CFLAGS+= ${CONF_CFLAGS} | CFLAGS+= ${CONF_CFLAGS} | ||||
.if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mbuild-id} | .if defined(LINKER_FEATURES) && ${LINKER_FEATURES:Mbuild-id} | ||||
LDFLAGS+= --build-id=sha1 | LDFLAGS+= --build-id=sha1 | ||||
.endif | .endif | ||||
.if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ | .if (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ | ||||
${MACHINE_CPUARCH} == "i386" || ${MACHINE} == "powerpc") && \ | ${MACHINE_CPUARCH} == "i386" || ${MACHINE} == "powerpc") && \ | ||||
Show All 20 Lines | |||||
# rewriting the instructions to generate an absolute address of 0); -fPIE | # rewriting the instructions to generate an absolute address of 0); -fPIE | ||||
# avoids this since it uses the GOT for all extern symbols, which is overly | # avoids this since it uses the GOT for all extern symbols, which is overly | ||||
# inefficient for us. Drop once undefined weak symbols work with medany. | # inefficient for us. Drop once undefined weak symbols work with medany. | ||||
.if ${LINKER_TYPE} == "lld" | .if ${LINKER_TYPE} == "lld" | ||||
CFLAGS+= -fPIE | CFLAGS+= -fPIE | ||||
.endif | .endif | ||||
.endif | .endif | ||||
NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} | NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC} | ||||
NORMAL_S= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} | NORMAL_S= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC} | ||||
PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC} | NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${.IMPSRC} | ||||
NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} | |||||
NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \ | NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \ | ||||
${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c | ${CC} -c ${CFLAGS} ${WERROR} ${.PREFIX}.c | ||||
NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC} | NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC} | ||||
NORMAL_FWO= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} -o ${.TARGET} \ | NORMAL_FWO= ${CC:N${CCACHE_BIN}} -c ${ASM_CFLAGS} ${WERROR} -o ${.TARGET} \ | ||||
$S/kern/firmw.S -DFIRMW_FILE="${.ALLSRC:M*.fw}" \ | $S/kern/firmw.S -DFIRMW_FILE="${.ALLSRC:M*.fw}" \ | ||||
-DFIRMW_SYMBOL="${.ALLSRC:M*.fw:C/[-.\/]/_/g}" | -DFIRMW_SYMBOL="${.ALLSRC:M*.fw:C/[-.\/]/_/g}" | ||||
# for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) | # for ZSTD in the kernel (include zstd/lib/freebsd before other CFLAGS) | ||||
ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} \ | ZSTD_C= ${CC} -c -DZSTD_HEAPMODE=1 -I$S/contrib/zstd/lib/freebsd ${CFLAGS} \ | ||||
-I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} \ | -I$S/contrib/zstd/lib -I$S/contrib/zstd/lib/common ${WERROR} \ | ||||
-Wno-missing-prototypes ${PROF} -U__BMI__ \ | -Wno-missing-prototypes -U__BMI__ -DZSTD_NO_INTRINSICS ${.IMPSRC} | ||||
-DZSTD_NO_INTRINSICS \ | |||||
${.IMPSRC} | |||||
# https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1] | # https://github.com/facebook/zstd/commit/812e8f2a [zstd 1.4.1] | ||||
# "Note that [GCC] autovectorization still does not do a good job on the | # "Note that [GCC] autovectorization still does not do a good job on the | ||||
# optimized version, so it's turned off via attribute and flag. I found | # optimized version, so it's turned off via attribute and flag. I found | ||||
# that neither attribute nor command-line flag were entirely successful in | # that neither attribute nor command-line flag were entirely successful in | ||||
# turning off vectorization, which is why there were both." | # turning off vectorization, which is why there were both." | ||||
.if ${COMPILER_TYPE} == "gcc" | .if ${COMPILER_TYPE} == "gcc" | ||||
ZSTD_DECOMPRESS_BLOCK_FLAGS= -fno-tree-vectorize | ZSTD_DECOMPRESS_BLOCK_FLAGS= -fno-tree-vectorize | ||||
.endif | .endif | ||||
Show All 26 Lines | CDDL_CFLAGS= \ | ||||
-Wno-switch \ | -Wno-switch \ | ||||
-Wno-undef \ | -Wno-undef \ | ||||
-Wno-uninitialized \ | -Wno-uninitialized \ | ||||
-Wno-unknown-pragmas \ | -Wno-unknown-pragmas \ | ||||
-Wno-unused \ | -Wno-unused \ | ||||
-include ${ZINCDIR}/os/freebsd/spl/sys/ccompile.h \ | -include ${ZINCDIR}/os/freebsd/spl/sys/ccompile.h \ | ||||
-I$S/cddl/contrib/opensolaris/uts/common \ | -I$S/cddl/contrib/opensolaris/uts/common \ | ||||
-I$S -I$S/cddl/compat/opensolaris | -I$S -I$S/cddl/compat/opensolaris | ||||
CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} | CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${.IMPSRC} | ||||
# Special flags for managing the compat compiles for ZFS | # Special flags for managing the compat compiles for ZFS | ||||
ZFS_CFLAGS+= ${CDDL_CFLAGS} -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY \ | ZFS_CFLAGS+= ${CDDL_CFLAGS} -DBUILDING_ZFS -DHAVE_UIO_ZEROCOPY \ | ||||
-DWITH_NETDUMP -D__KERNEL__ -D_SYS_CONDVAR_H_ -DSMP \ | -DWITH_NETDUMP -D__KERNEL__ -D_SYS_CONDVAR_H_ -DSMP \ | ||||
-DIN_FREEBSD_BASE -DHAVE_KSID | -DIN_FREEBSD_BASE -DHAVE_KSID | ||||
.if ${MACHINE_ARCH} == "amd64" | .if ${MACHINE_ARCH} == "amd64" | ||||
ZFS_CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F \ | ZFS_CFLAGS+= -DHAVE_AVX2 -DHAVE_AVX -D__x86_64 -DHAVE_SSE2 -DHAVE_AVX512F \ | ||||
-DHAVE_SSSE3 -DHAVE_AVX512BW | -DHAVE_SSSE3 -DHAVE_AVX512BW | ||||
.endif | .endif | ||||
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ | .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \ | ||||
${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm" | ${MACHINE_ARCH} == "powerpcspe" || ${MACHINE_ARCH} == "arm" | ||||
ZFS_CFLAGS+= -DBITS_PER_LONG=32 | ZFS_CFLAGS+= -DBITS_PER_LONG=32 | ||||
.else | .else | ||||
ZFS_CFLAGS+= -DBITS_PER_LONG=64 | ZFS_CFLAGS+= -DBITS_PER_LONG=64 | ||||
.endif | .endif | ||||
ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS} | ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS} | ||||
ZFS_C= ${CC} -c ${ZFS_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} | ZFS_C= ${CC} -c ${ZFS_CFLAGS} ${WERROR} ${.IMPSRC} | ||||
ZFS_RPC_C= ${CC} -c ${ZFS_CFLAGS} -DHAVE_RPC_TYPES ${WERROR} ${PROF} ${.IMPSRC} | ZFS_RPC_C= ${CC} -c ${ZFS_CFLAGS} -DHAVE_RPC_TYPES ${WERROR} ${.IMPSRC} | ||||
ZFS_S= ${CC} -c ${ZFS_ASM_CFLAGS} ${WERROR} ${.IMPSRC} | ZFS_S= ${CC} -c ${ZFS_ASM_CFLAGS} ${WERROR} ${.IMPSRC} | ||||
# Special flags for managing the compat compiles for DTrace | # Special flags for managing the compat compiles for DTrace | ||||
DTRACE_CFLAGS= -DBUILDING_DTRACE ${CDDL_CFLAGS} -I$S/cddl/dev/dtrace -I$S/cddl/dev/dtrace/${MACHINE_CPUARCH} | DTRACE_CFLAGS= -DBUILDING_DTRACE ${CDDL_CFLAGS} -I$S/cddl/dev/dtrace -I$S/cddl/dev/dtrace/${MACHINE_CPUARCH} | ||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" | .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" | ||||
DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/intel -I$S/cddl/dev/dtrace/x86 | DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/intel -I$S/cddl/dev/dtrace/x86 | ||||
.endif | .endif | ||||
DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/util -I$S -DDIS_MEM -DSMP -I$S/cddl/compat/opensolaris | DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/util -I$S -DDIS_MEM -DSMP -I$S/cddl/compat/opensolaris | ||||
DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common | DTRACE_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common | ||||
DTRACE_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${DTRACE_CFLAGS} | DTRACE_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${DTRACE_CFLAGS} | ||||
DTRACE_C= ${CC} -c ${DTRACE_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} | DTRACE_C= ${CC} -c ${DTRACE_CFLAGS} ${WERROR} ${.IMPSRC} | ||||
DTRACE_S= ${CC} -c ${DTRACE_ASM_CFLAGS} ${WERROR} ${.IMPSRC} | DTRACE_S= ${CC} -c ${DTRACE_ASM_CFLAGS} ${WERROR} ${.IMPSRC} | ||||
# Special flags for managing the compat compiles for DTrace/FBT | # Special flags for managing the compat compiles for DTrace/FBT | ||||
FBT_CFLAGS= -DBUILDING_DTRACE -nostdinc -I$S/cddl/dev/fbt/${MACHINE_CPUARCH} -I$S/cddl/dev/fbt ${CDDL_CFLAGS} -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common | FBT_CFLAGS= -DBUILDING_DTRACE -nostdinc -I$S/cddl/dev/fbt/${MACHINE_CPUARCH} -I$S/cddl/dev/fbt ${CDDL_CFLAGS} -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common | ||||
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" | .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" | ||||
FBT_CFLAGS+= -I$S/cddl/dev/fbt/x86 | FBT_CFLAGS+= -I$S/cddl/dev/fbt/x86 | ||||
.endif | .endif | ||||
FBT_C= ${CC} -c ${FBT_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} | FBT_C= ${CC} -c ${FBT_CFLAGS} ${WERROR} ${.IMPSRC} | ||||
.if ${MK_CTF} != "no" | .if ${MK_CTF} != "no" | ||||
NORMAL_CTFCONVERT= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} | NORMAL_CTFCONVERT= ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} | ||||
.elif ${MAKE_VERSION} >= 5201111300 | .elif ${MAKE_VERSION} >= 5201111300 | ||||
NORMAL_CTFCONVERT= | NORMAL_CTFCONVERT= | ||||
.else | .else | ||||
NORMAL_CTFCONVERT= @: | NORMAL_CTFCONVERT= @: | ||||
.endif | .endif | ||||
# Linux Kernel Programming Interface C-flags | # Linux Kernel Programming Interface C-flags | ||||
LINUXKPI_INCLUDES= -I$S/compat/linuxkpi/common/include | LINUXKPI_INCLUDES= -I$S/compat/linuxkpi/common/include | ||||
LINUXKPI_C= ${NORMAL_C} ${LINUXKPI_INCLUDES} | LINUXKPI_C= ${NORMAL_C} ${LINUXKPI_INCLUDES} | ||||
# Infiniband C flags. Correct include paths and omit errors that linux | # Infiniband C flags. Correct include paths and omit errors that linux | ||||
# does not honor. | # does not honor. | ||||
OFEDINCLUDES= -I$S/ofed/include -I$S/ofed/include/uapi ${LINUXKPI_INCLUDES} | OFEDINCLUDES= -I$S/ofed/include -I$S/ofed/include/uapi ${LINUXKPI_INCLUDES} | ||||
OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith | OFEDNOERR= -Wno-cast-qual -Wno-pointer-arith | ||||
OFEDCFLAGS= ${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_MEM \ | OFEDCFLAGS= ${CFLAGS:N-I*} -DCONFIG_INFINIBAND_USER_MEM \ | ||||
${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} | ${OFEDINCLUDES} ${CFLAGS:M-I*} ${OFEDNOERR} | ||||
OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} ${PROF} | OFED_C_NOIMP= ${CC} -c -o ${.TARGET} ${OFEDCFLAGS} ${WERROR} | ||||
OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} | OFED_C= ${OFED_C_NOIMP} ${.IMPSRC} | ||||
# mlxfw C flags. | # mlxfw C flags. | ||||
MLXFW_C= ${OFED_C_NOIMP} \ | MLXFW_C= ${OFED_C_NOIMP} \ | ||||
-I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ | -I${SRCTOP}/sys/contrib/xz-embedded/freebsd \ | ||||
-I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz \ | -I${SRCTOP}/sys/contrib/xz-embedded/linux/lib/xz \ | ||||
${.IMPSRC} | ${.IMPSRC} | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |