]> granicus.if.org Git - zfs/commitdiff
Restrict usage of -fstack-check option
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 23 Jul 2010 17:13:59 +0000 (10:13 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 23 Jul 2010 17:38:07 +0000 (10:38 -0700)
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

cmd/ztest/Makefile.am
config/zfs-build.m4
lib/libavl/Makefile.am
lib/libefi/Makefile.am
lib/libnvpair/Makefile.am
lib/libunicode/Makefile.am
lib/libuutil/Makefile.am
lib/libzpool/Makefile.am

index 0aa6c2e4683faa721e5d669af6b03fc5cd793ea2..804efccca03acf2155fc47b710ed8e514becabc1 100644 (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 \
index b274b0d254c09cca078cf3fce5afdb7e8a7b0f8c..d40b6e53c916fefd5bab2c81a0ab71ca29d42850 100644 (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])
 ])
 
index 3ae2cb98a77a42b4590f4e51dcd72930bf2b0eea..50185e281f190bab6b6a8fa8f6780e8eda25914f 100644 (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
index 79849ad26d35e25af42dc31dfe77022ddd6bdedf..431179340a7e7fac729ffc0550ae1e9a721100cf 100644 (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
index 31e0b6a0ce0db5f482e1cc29a3d47d7a162ef647..9cac22c530457e29cb9760379f99062ed34c0645 100644 (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 \
index fe1f39219f118bf4f6acddcf0d2be7e2f6c7db51..9d5785595f4a5837b27efa3a07a685d79d2db978 100644 (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
index 78eb75e27f9a8e64ca6827bb36276b6a97001632..591c046e3bc4ba2658eee78349d6357a1c4cf23a 100644 (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 \
index 744dbfce30152f02fd0e976a851df119f60a49df..8a7fb195f929634b8dbe4ef66af12056474ab35a 100644 (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 += \