Restrict usage of -fstack-check option

The stack check implementation in older versions of gcc has
a fairly low default limit on STACK_CHECK_MAX_FRAME_SIZE of
roughly 4096.  This results in numerous warning when it is
used with code which was designed to run in user space and
thus may be relatively stack heavy.  The avoid these warnings,
which are fatal with -Werror, this patch targets the use of
-fstack-check to libraries which are compiled in both user
space and kernel space.  The only utility which uses this
flag is ztest which is designed to simulate running in the
kernel and must meet the -fstack-check requirements.  All
other user space utilities do not use -fstack-check.

  warning: frame size too large for reliable stack checking
  warning: try reducing the number of local variables
This commit is contained in:
Brian Behlendorf 2010-07-23 10:13:59 -07:00
parent acd6237623
commit 7fa6f8b93a
8 changed files with 16 additions and 3 deletions

View File

@ -1,6 +1,6 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(FRAME_LARGER_THAN)
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libspl/include \

View File

@ -18,15 +18,18 @@ AC_DEFUN([ZFS_AC_DEBUG], [
[
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
DEBUG_CFLAGS="-DDEBUG -Werror -fstack-check"
DEBUG_CFLAGS="-DDEBUG -Werror"
DEBUG_STACKFLAGS="-fstack-check"
],
[
KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
DEBUG_CFLAGS="-DNDEBUG"
DEBUG_STACKFLAGS=""
])
AC_SUBST(DEBUG_CFLAGS)
AC_SUBST(DEBUG_STACKFLAGS)
AC_MSG_RESULT([$enable_debug])
])

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
DEFAULT_INCLUDES += \
-I${top_srcdir}/module/avl/include \
-I${top_srcdir}/lib/libspl/include

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libefi/include \
-I${top_srcdir}/lib/libspl/include

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
DEFAULT_INCLUDES += \
-I${top_srcdir}/module/nvpair/include \
-I${top_srcdir}/lib/libnvpair/include \

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
DEFAULT_INCLUDES += \
-I${top_srcdir}/module/unicode/include \
-I${top_srcdir}/lib/libspl/include

View File

@ -1,5 +1,7 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
DEFAULT_INCLUDES += \
-I${top_srcdir}/lib/libuutil/include \
-I${top_srcdir}/lib/libspl/include \

View File

@ -1,6 +1,6 @@
include $(top_srcdir)/config/Rules.am
AM_CFLAGS += $(FRAME_LARGER_THAN)
AM_CFLAGS += $(DEBUG_STACKFLAGS) $(FRAME_LARGER_THAN)
SUBDIRS = include
DEFAULT_INCLUDES += \