This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Only use -fsplit-stack if the compiler supports it
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 23 Nov 2009 06:55:56 -0800
- Subject: [gccgo] Only use -fsplit-stack if the compiler supports it
I committed this patch to the gccgo branch to only use -fsplit-stack
when compiling .c code in libgo if the compiler supports it.
Ian
Index: configure.ac
===================================================================
--- configure.ac (revision 154387)
+++ configure.ac (working copy)
@@ -143,6 +143,22 @@ AM_CONDITIONAL(LIBGO_IS_386, test $is_38
AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
+dnl Use -fsplit-stack when compiling C code if available.
+AC_CACHE_CHECK([whether -fsplit-stack is supported],
+[ac_cv_libgo_split_stack_supported],
+[CFLAGS_hold=$CFLAGS
+CFLAGS="$CFLAGS -fsplit-stack"
+AC_COMPILE_IFELSE([[int i;]],
+[ac_cv_libgo_split_stack_supported=yes],
+[ac_cv_libgo_split_stack_supported=no])
+CFLAGS=$CFLAGS_hold])
+if test "$ac_cv_libgo_split_stack_supported" = yes; then
+ SPLIT_STACK=-fsplit-stack
+else
+ SPLIT_STACK=
+fi
+AC_SUBST(SPLIT_STACK)
+
AC_CACHE_SAVE
if test ${multilib} = yes; then
Index: Makefile.am
===================================================================
--- Makefile.am (revision 154387)
+++ Makefile.am (working copy)
@@ -28,7 +28,7 @@ AM_CPPFLAGS = -I $(srcdir)/runtime $(LIB
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
-AM_CFLAGS = -fplan9-extensions -fsplit-stack $(WARN_CFLAGS)
+AM_CFLAGS = -fplan9-extensions $(SPLIT_STACK) $(WARN_CFLAGS)
# Multilib support.
MAKEOVERRIDES=