FreeBSD module --enable-debug --enable-invariants
Wire up the --enable-debug flag for configure to the FreeBSD module build. Add --enable-invariants. The running FreeBSD kernel config is used to detect whether to enable INVARIANTS if not explicitly specified with --enable-invariants or --disable-invariants. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #11678
This commit is contained in:
parent
fd1c366f82
commit
ba74de88c0
|
@ -11,6 +11,7 @@ AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [
|
||||||
DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG"
|
DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG"
|
||||||
DEBUG_LDFLAGS=""
|
DEBUG_LDFLAGS=""
|
||||||
DEBUG_ZFS="_with_debug"
|
DEBUG_ZFS="_with_debug"
|
||||||
|
WITH_DEBUG="true"
|
||||||
AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
|
AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
|
||||||
|
|
||||||
KERNEL_DEBUG_CFLAGS="-Werror"
|
KERNEL_DEBUG_CFLAGS="-Werror"
|
||||||
|
@ -22,6 +23,7 @@ AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [
|
||||||
DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG"
|
DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG"
|
||||||
DEBUG_LDFLAGS=""
|
DEBUG_LDFLAGS=""
|
||||||
DEBUG_ZFS="_without_debug"
|
DEBUG_ZFS="_without_debug"
|
||||||
|
WITH_DEBUG=""
|
||||||
|
|
||||||
KERNEL_DEBUG_CFLAGS=""
|
KERNEL_DEBUG_CFLAGS=""
|
||||||
KERNEL_DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG"
|
KERNEL_DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG"
|
||||||
|
@ -51,6 +53,7 @@ AC_DEFUN([ZFS_AC_DEBUG], [
|
||||||
AC_SUBST(DEBUG_CPPFLAGS)
|
AC_SUBST(DEBUG_CPPFLAGS)
|
||||||
AC_SUBST(DEBUG_LDFLAGS)
|
AC_SUBST(DEBUG_LDFLAGS)
|
||||||
AC_SUBST(DEBUG_ZFS)
|
AC_SUBST(DEBUG_ZFS)
|
||||||
|
AC_SUBST(WITH_DEBUG)
|
||||||
|
|
||||||
AC_SUBST(KERNEL_DEBUG_CFLAGS)
|
AC_SUBST(KERNEL_DEBUG_CFLAGS)
|
||||||
AC_SUBST(KERNEL_DEBUG_CPPFLAGS)
|
AC_SUBST(KERNEL_DEBUG_CPPFLAGS)
|
||||||
|
@ -152,6 +155,39 @@ AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [
|
||||||
AC_MSG_RESULT([$enable_debug_kmem_tracking])
|
AC_MSG_RESULT([$enable_debug_kmem_tracking])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], [
|
||||||
|
AS_IF([sysctl -n kern.conftxt | fgrep -qx $'options\tINVARIANTS'],
|
||||||
|
[enable_invariants="yes"],
|
||||||
|
[enable_invariants="no"])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT], [
|
||||||
|
AM_COND_IF([BUILD_FREEBSD],
|
||||||
|
[ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD],
|
||||||
|
[enable_invariants="no"])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl #
|
||||||
|
dnl # Detected for the running kernel by default, enables INVARIANTS features
|
||||||
|
dnl # in the FreeBSD kernel module. This feature must be used when building
|
||||||
|
dnl # for a FreeBSD kernel with "options INVARIANTS" in the KERNCONF and must
|
||||||
|
dnl # not be used when the INVARIANTS option is absent.
|
||||||
|
dnl #
|
||||||
|
AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS], [
|
||||||
|
AC_MSG_CHECKING([whether FreeBSD kernel INVARIANTS checks are enabled])
|
||||||
|
AC_ARG_ENABLE([invariants],
|
||||||
|
[AS_HELP_STRING([--enable-invariants],
|
||||||
|
[Enable FreeBSD kernel INVARIANTS checks [[default: detect]]])],
|
||||||
|
[], [ZFS_AC_DEBUG_INVARIANTS_DETECT])
|
||||||
|
|
||||||
|
AS_IF([test "x$enable_invariants" = xyes],
|
||||||
|
[WITH_INVARIANTS="true"],
|
||||||
|
[WITH_INVARIANTS=""])
|
||||||
|
AC_SUBST(WITH_INVARIANTS)
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$enable_invariants])
|
||||||
|
])
|
||||||
|
|
||||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
|
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
|
||||||
AX_COUNT_CPUS([])
|
AX_COUNT_CPUS([])
|
||||||
AC_SUBST(CPU_COUNT)
|
AC_SUBST(CPU_COUNT)
|
||||||
|
|
|
@ -61,6 +61,7 @@ ZFS_AC_DEBUG
|
||||||
ZFS_AC_DEBUGINFO
|
ZFS_AC_DEBUGINFO
|
||||||
ZFS_AC_DEBUG_KMEM
|
ZFS_AC_DEBUG_KMEM
|
||||||
ZFS_AC_DEBUG_KMEM_TRACKING
|
ZFS_AC_DEBUG_KMEM_TRACKING
|
||||||
|
ZFS_AC_DEBUG_INVARIANTS
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
|
|
|
@ -17,6 +17,10 @@ check:
|
||||||
modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD \
|
modules_uninstall modules_uninstall-Linux modules_uninstall-FreeBSD \
|
||||||
cppcheck cppcheck-Linux cppcheck-FreeBSD
|
cppcheck cppcheck-Linux cppcheck-FreeBSD
|
||||||
|
|
||||||
|
# For FreeBSD, use debug options from ./configure if not overridden.
|
||||||
|
export WITH_DEBUG ?= @WITH_DEBUG@
|
||||||
|
export WITH_INVARIANTS ?= @WITH_INVARIANTS@
|
||||||
|
|
||||||
# Filter out options that FreeBSD make doesn't understand
|
# Filter out options that FreeBSD make doesn't understand
|
||||||
getflags = ( \
|
getflags = ( \
|
||||||
set -- \
|
set -- \
|
||||||
|
@ -42,6 +46,7 @@ FMAKEFLAGS = -C @abs_srcdir@ -f Makefile.bsd $(shell $(getflags))
|
||||||
ifneq (@abs_srcdir@,@abs_builddir@)
|
ifneq (@abs_srcdir@,@abs_builddir@)
|
||||||
FMAKEFLAGS += MAKEOBJDIR=@abs_builddir@
|
FMAKEFLAGS += MAKEOBJDIR=@abs_builddir@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
|
FMAKE = env -u MAKEFLAGS make $(FMAKEFLAGS)
|
||||||
|
|
||||||
modules-Linux:
|
modules-Linux:
|
||||||
|
|
Loading…
Reference in New Issue