From: Brian Behlendorf Date: Fri, 23 Jul 2010 17:13:59 +0000 (-0700) Subject: Restrict usage of -fstack-check option X-Git-Tag: zfs-0.5.0~36^2^2^2^2^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7fa6f8b93a82608c2c6233f08db4a7a2e7c6e632;p=zfs 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 --- diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index 0aa6c2e46..804efccca 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -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 \ diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index b274b0d25..d40b6e53c 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -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]) ]) diff --git a/lib/libavl/Makefile.am b/lib/libavl/Makefile.am index 3ae2cb98a..50185e281 100644 --- a/lib/libavl/Makefile.am +++ b/lib/libavl/Makefile.am @@ -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 diff --git a/lib/libefi/Makefile.am b/lib/libefi/Makefile.am index 79849ad26..431179340 100644 --- a/lib/libefi/Makefile.am +++ b/lib/libefi/Makefile.am @@ -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 diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index 31e0b6a0c..9cac22c53 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -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 \ diff --git a/lib/libunicode/Makefile.am b/lib/libunicode/Makefile.am index fe1f39219..9d5785595 100644 --- a/lib/libunicode/Makefile.am +++ b/lib/libunicode/Makefile.am @@ -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 diff --git a/lib/libuutil/Makefile.am b/lib/libuutil/Makefile.am index 78eb75e27..591c046e3 100644 --- a/lib/libuutil/Makefile.am +++ b/lib/libuutil/Makefile.am @@ -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 \ diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index 744dbfce3..8a7fb195f 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -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 += \