@@ -35,6 +35,7 @@
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
AM_CFLAGS = -fexceptions -fplan9-extensions $(SPLIT_STACK) $(WARN_CFLAGS) \
+ $(STRINGOPS_FLAG) \
-I $(srcdir)/../gcc -I $(MULTIBUILDTOP)../../gcc/include
if USING_SPLIT_STACK
@@ -1155,7 +1156,8 @@
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
GOFLAGS = $(CFLAGS)
-GOCOMPILE = $(GCCGO) $(DEFAULT_INCLUDES) $(INCLUDES) $(GOFLAGS)
+AM_GOFLAGS = $(STRINGOPS_FLAG)
+GOCOMPILE = $(GCCGO) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOFLAGS) $(GOFLAGS)
LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GCCGO) $(INCLUDES) \
$(AM_GOFLAGS) $(GOFLAGS)
@@ -195,6 +195,22 @@
AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
AC_CHECK_FUNCS(srandom random strsignal)
+dnl For x86 we want to use the -minline-all-stringops option to avoid
+dnl forcing a stack split when calling memcpy and friends.
+AC_CACHE_CHECK([whether compiler supports -minline-all-stringops],
+[ac_cv_libgo_compiler_supports_inline_all_stringops],
+[CFLAGS_hold=$CFLAGS
+CFLAGS="$CFLAGS -minline-all-stringops"
+AC_COMPILE_IFELSE([int i;],
+[ac_cv_libgo_compiler_supports_inline_all_stringops=yes],
+[ac_cv_libgo_compiler_supports_inline_all_stringops=no])
+CFLAGS=$CFLAGS_hold])
+STRINGOPS_FLAG=
+if test "$ac_cv_libgo_compiler_supports_inline_all_stringops" = yes; then
+ STRINGOPS_FLAG=-minline-all-stringops
+fi
+AC_SUBST(STRINGOPS_FLAG)
+
CFLAGS_hold=$CFLAGS
CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
AC_CHECK_TYPES(off64_t)