aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-09-15 17:05:14 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-09-15 17:05:14 +0000
commitc33c18cdc6b29a312464cb16996530b47a333c98 (patch)
tree48f95ab84097839a2967b885b72d89e96a35bcf7
parent10e0393ceb569239f7ea1bfb2f3116df4effe747 (diff)
downloadgcc-c33c18cdc6b29a312464cb16996530b47a333c98.zip
gcc-c33c18cdc6b29a312464cb16996530b47a333c98.tar.gz
gcc-c33c18cdc6b29a312464cb16996530b47a333c98.tar.bz2
libgo: test linking split-stack and non-split-stack together
PPC has split-stack support in current GCC, but old version of gold will reject attempts to link PPC split-stack and non-split-stack code together. Test for that, and don't compile the C code with -fsplit-stack if it doesn't work. Reviewed-on: https://go-review.googlesource.com/14594 From-SVN: r227802
-rw-r--r--gcc/go/gofrontend/MERGE2
-rwxr-xr-xlibgo/configure29
-rw-r--r--libgo/configure.ac28
3 files changed, 54 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index afb257e..b1a7895 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-23392287e9a26956977987fe95f337c5be4d6417
+6f0ac34e139755c319368757fe2a093f1e5bde49
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/libgo/configure b/libgo/configure
index 29d16e7..9c79574 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -14007,7 +14007,32 @@ CFLAGS=$CFLAGS_hold
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_split_stack_supported" >&5
$as_echo "$libgo_cv_c_split_stack_supported" >&6; }
-if test "$libgo_cv_c_split_stack_supported" = yes; then
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether linker supports split/non-split linked together" >&5
+$as_echo_n "checking whether linker supports split/non-split linked together... " >&6; }
+if test "${libgo_cv_c_linker_split_non_split+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat > conftest1.c << EOF
+extern void f();
+int main() { f(); return 0; }
+EOF
+cat > conftest2.c << EOF
+void f() {}
+EOF
+$CC -c -fsplit-stack $CFLAGS $CPPFLAGS conftest1.c
+$CC -c $CFLAGS $CPPFLAGS conftest2.c
+if $CC -o conftest conftest1.$ac_objext conftest2.$ac_objext; then
+ libgo_cv_c_linker_split_non_split=yes
+else
+ libgo_cv_c_linker_split_non_split=no
+fi
+rm -f conftest1.* conftest2.* conftest
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgo_cv_c_linker_split_non_split" >&5
+$as_echo "$libgo_cv_c_linker_split_non_split" >&6; }
+
+if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes; then
SPLIT_STACK=-fsplit-stack
$as_echo "#define USING_SPLIT_STACK 1" >>confdefs.h
@@ -14016,7 +14041,7 @@ else
SPLIT_STACK=
fi
- if test "$libgo_cv_c_split_stack_supported" = yes; then
+ if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes; then
USING_SPLIT_STACK_TRUE=
USING_SPLIT_STACK_FALSE='#'
else
diff --git a/libgo/configure.ac b/libgo/configure.ac
index a175d46..ca5325a 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -374,7 +374,29 @@ AC_COMPILE_IFELSE([[int i;]],
[libgo_cv_c_split_stack_supported=yes],
[libgo_cv_c_split_stack_supported=no])
CFLAGS=$CFLAGS_hold])
-if test "$libgo_cv_c_split_stack_supported" = yes; then
+
+dnl Make sure the linker permits -fsplit-stack. Old versions of gold will
+dnl reject split-stack code calling non-split-stack code on targets
+dnl they don't support.
+AC_CACHE_CHECK([whether linker supports split/non-split linked together],
+[libgo_cv_c_linker_split_non_split],
+[cat > conftest1.c << EOF
+extern void f();
+int main() { f(); return 0; }
+EOF
+cat > conftest2.c << EOF
+void f() {}
+EOF
+$CC -c -fsplit-stack $CFLAGS $CPPFLAGS conftest1.c
+$CC -c $CFLAGS $CPPFLAGS conftest2.c
+if $CC -o conftest conftest1.$ac_objext conftest2.$ac_objext; then
+ libgo_cv_c_linker_split_non_split=yes
+else
+ libgo_cv_c_linker_split_non_split=no
+fi
+rm -f conftest1.* conftest2.* conftest])
+
+if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes; then
SPLIT_STACK=-fsplit-stack
AC_DEFINE(USING_SPLIT_STACK, 1,
[Define if the compiler supports -fsplit-stack])
@@ -383,13 +405,15 @@ else
fi
AC_SUBST(SPLIT_STACK)
AM_CONDITIONAL(USING_SPLIT_STACK,
- test "$libgo_cv_c_split_stack_supported" = yes)
+ test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes)
dnl Check whether the linker does stack munging when calling from
dnl split-stack into non-split-stack code. We check this by looking
dnl at the --help output. FIXME: This is only half right: it's
dnl possible for the linker to support this for some targets but not
dnl others.
+dnl This is slightly different from the above check, which is whether
+dnl the linker permits the call at all.
AC_CACHE_CHECK([whether linker supports split stack],
[libgo_cv_c_linker_supports_split_stack],
[libgo_cv_c_linker_supports_split_stack=no