Commit c33c18cd by Ian Lance Taylor

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
parent 10e0393c
23392287e9a26956977987fe95f337c5be4d6417
6f0ac34e139755c319368757fe2a093f1e5bde49
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment