Skip to content

Commit 3fb0e36

Browse files
committed
Force --enable-debug on FreeBSD if INVARIANTS is set
There's already logic to force INVARIANTS on for building if it's present in the running kernel; however, not having DEBUG enabled when DEBUG and INVARIANTS are can cause strange panics. Closes: #12163 Signed-off-by: Rich Ercolani <[email protected]>
1 parent d484a72 commit 3fb0e36

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

config/zfs-build.m4

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ dnl # When debugging is enabled:
3434
dnl # - Enable all ASSERTs (-DDEBUG)
3535
dnl # - Promote all compiler warnings to errors (-Werror)
3636
dnl #
37+
dnl # (If INVARIANTS is detected, we need to force DEBUG, or strange panics
38+
dnl # can ensue.)
39+
dnl #
3740
AC_DEFUN([ZFS_AC_DEBUG], [
3841
AC_MSG_CHECKING([whether assertion support will be enabled])
3942
AC_ARG_ENABLE([debug],
@@ -49,6 +52,20 @@ AC_DEFUN([ZFS_AC_DEBUG], [
4952
[ZFS_AC_DEBUG_DISABLE],
5053
[AC_MSG_ERROR([Unknown option $enable_debug])])
5154
55+
AS_CASE(["x$enable_invariants"],
56+
["xyes"],
57+
[],
58+
["xno"],
59+
[],
60+
[ZFS_AC_DEBUG_INVARIANTS_DETECT])
61+
62+
AS_CASE(["x$enable_invariants"],
63+
["xyes"],
64+
[ZFS_AC_DEBUG_ENABLE],
65+
["xno"],
66+
[],
67+
[AC_MSG_ERROR([Unknown option $enable_invariants])])
68+
5269
AC_SUBST(DEBUG_CFLAGS)
5370
AC_SUBST(DEBUG_CPPFLAGS)
5471
AC_SUBST(DEBUG_LDFLAGS)

0 commit comments

Comments
 (0)