aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-09-15 21:38:22 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-09-15 21:38:22 +0000
commit09aef1cf70f22ab9875055e6222fb88900ec875b (patch)
treecc1561d9c684e30e43f7804a87ab7caab0047110
parente5e37b028491c35fd5867046a488817fb3527d98 (diff)
parenta2bf11d16a01ced5d2bd0500a6896627b7bed076 (diff)
downloadgcc-09aef1cf70f22ab9875055e6222fb88900ec875b.zip
gcc-09aef1cf70f22ab9875055e6222fb88900ec875b.tar.gz
gcc-09aef1cf70f22ab9875055e6222fb88900ec875b.tar.bz2
Merge from trunk revision 227811.
From-SVN: r227812
-rw-r--r--gcc/ChangeLog26
-rw-r--r--gcc/c/ChangeLog8
-rw-r--r--gcc/c/c-decl.c12
-rw-r--r--gcc/c/c-parser.c12
-rw-r--r--gcc/c/c-tree.h1
-rw-r--r--gcc/config/alpha/alpha.c8
-rw-r--r--gcc/config/xtensa/xtensa.c12
-rw-r--r--gcc/config/xtensa/xtensa.h4
-rw-r--r--gcc/config/xtensa/xtensa.md7
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gcc.dg/pr67580.c31
-rw-r--r--gcc/testsuite/gnat.dg/array24.adb11
-rw-r--r--gcc/testsuite/gnat.dg/blocklocs.adb26
-rw-r--r--gcc/tree-eh.c13
-rw-r--r--libgcc/ChangeLog5
-rw-r--r--libgcc/config/xtensa/linux-unwind.h30
-rw-r--r--libgo/Makefile.am2
-rw-r--r--libgo/Makefile.in3
-rwxr-xr-xlibgo/configure12
-rw-r--r--libgo/configure.ac9
-rw-r--r--libgo/testsuite/Makefile.in1
22 files changed, 196 insertions, 49 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 70cd063..6805c03 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,29 @@
+2015-09-15 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/xtensa/xtensa.h (DWARF_ALT_FRAME_RETURN_COLUMN): New
+ definition.
+ (DWARF_FRAME_REGISTERS): Reserve space for one extra register in
+ call0 ABI.
+
+2015-09-15 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/xtensa/xtensa.c (xtensa_call_tls_desc): Use a10 or a2
+ to pass TLS call argument, according to current ABI.
+ * config/xtensa/xtensa.md (tls_call pattern): Use callx8 or
+ callx0 for TLS call, according to current ABI.
+
+2015-09-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * tree-eh.c (lower_try_finally_dup_block): Clear location information
+ on stack restore statements.
+ (decide_copy_try_finally): Do not consider a stack restore statement as
+ coming from sources.
+
+2015-09-15 Uros Bizjak <ubizjak@gmail.com>
+
+ * config/alpha/alpha.c (alpha_expand_block_clear): Use
+ HOST_WIDE_INT_M1U instead of ~(HOST_WIDE_INT)0 when shifting.
+
2015-09-15 Jeff Law <law@redhat.com>
PR tree-optimization/47679
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 37124b3..27659e2 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,13 @@
2015-09-15 Marek Polacek <polacek@redhat.com>
+ PR c/67580
+ * c-decl.c (tag_exists_p): New function.
+ * c-parser.c (c_parser_declaration_or_fndef): Give a hint when
+ struct/union/enum keywords are missing.
+ * c-tree.h (tag_exists_p): Declare.
+
+2015-09-15 Marek Polacek <polacek@redhat.com>
+
* c-decl.c (lookup_label): Return NULL_TREE instead of 0.
(lookup_tag): Change the type of THISLEVEL_ONLY to bool.
Return NULL_TREE instead of 0.
diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index 989ff99..a110226 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -3856,6 +3856,18 @@ lookup_tag (enum tree_code code, tree name, bool thislevel_only,
return b->decl;
}
+/* Return true if a definition exists for NAME with code CODE. */
+
+bool
+tag_exists_p (enum tree_code code, tree name)
+{
+ struct c_binding *b = I_TAG_BINDING (name);
+
+ if (b == NULL || b->decl == NULL_TREE)
+ return false;
+ return TREE_CODE (b->decl) == code;
+}
+
/* Print an error message now
for a recent invalid struct, union or enum cross reference.
We don't print them immediately because they are not invalid
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 4d9cbe0..d5de102 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -1539,8 +1539,16 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
|| c_parser_peek_2nd_token (parser)->type == CPP_MULT)
&& (!nested || !lookup_name (c_parser_peek_token (parser)->value)))
{
- error_at (here, "unknown type name %qE",
- c_parser_peek_token (parser)->value);
+ tree name = c_parser_peek_token (parser)->value;
+ error_at (here, "unknown type name %qE", name);
+ /* Give a hint to the user. This is not C++ with its implicit
+ typedef. */
+ if (tag_exists_p (RECORD_TYPE, name))
+ inform (here, "use %<struct%> keyword to refer to the type");
+ else if (tag_exists_p (UNION_TYPE, name))
+ inform (here, "use %<union%> keyword to refer to the type");
+ else if (tag_exists_p (ENUMERAL_TYPE, name))
+ inform (here, "use %<enum%> keyword to refer to the type");
/* Parse declspecs normally to get a correct pointer type, but avoid
a further "fails to be a type name" error. Refuse nested functions
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index a3979dd..667529a 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -701,6 +701,7 @@ extern tree c_omp_reduction_lookup (tree, tree);
extern tree c_check_omp_declare_reduction_r (tree *, int *, void *);
extern void c_pushtag (location_t, tree, tree);
extern void c_bind (location_t, tree, bool);
+extern bool tag_exists_p (enum tree_code, tree);
/* In c-errors.c */
extern void pedwarn_c90 (location_t, int opt, const char *, ...)
diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c
index 32bb36e..cae819f 100644
--- a/gcc/config/alpha/alpha.c
+++ b/gcc/config/alpha/alpha.c
@@ -4057,10 +4057,10 @@ alpha_expand_block_clear (rtx operands[])
mem = adjust_address (orig_dst, mode, ofs - inv_alignofs);
set_mem_alias_set (mem, 0);
- mask = ~(~(HOST_WIDE_INT)0 << (inv_alignofs * 8));
+ mask = ~(HOST_WIDE_INT_M1U << (inv_alignofs * 8));
if (bytes < alignofs)
{
- mask |= ~(HOST_WIDE_INT)0 << ((inv_alignofs + bytes) * 8);
+ mask |= HOST_WIDE_INT_M1U << ((inv_alignofs + bytes) * 8);
ofs += bytes;
bytes = 0;
}
@@ -4206,7 +4206,7 @@ alpha_expand_block_clear (rtx operands[])
mem = adjust_address (orig_dst, DImode, ofs);
set_mem_alias_set (mem, 0);
- mask = ~(HOST_WIDE_INT)0 << (bytes * 8);
+ mask = HOST_WIDE_INT_M1U << (bytes * 8);
tmp = expand_binop (DImode, and_optab, mem, GEN_INT (mask),
NULL_RTX, 1, OPTAB_WIDEN);
@@ -4222,7 +4222,7 @@ alpha_expand_block_clear (rtx operands[])
mem = adjust_address (orig_dst, SImode, ofs);
set_mem_alias_set (mem, 0);
- mask = ~(HOST_WIDE_INT)0 << (bytes * 8);
+ mask = HOST_WIDE_INT_M1U << (bytes * 8);
tmp = expand_binop (SImode, and_optab, mem, GEN_INT (mask),
NULL_RTX, 1, OPTAB_WIDEN);
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 1910061..1e1ac6b 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -1874,23 +1874,23 @@ xtensa_tls_module_base (void)
static rtx_insn *
xtensa_call_tls_desc (rtx sym, rtx *retp)
{
- rtx fn, arg, a10;
+ rtx fn, arg, a_io;
rtx_insn *call_insn, *insns;
start_sequence ();
fn = gen_reg_rtx (Pmode);
arg = gen_reg_rtx (Pmode);
- a10 = gen_rtx_REG (Pmode, 10);
+ a_io = gen_rtx_REG (Pmode, WINDOW_SIZE + 2);
emit_insn (gen_tls_func (fn, sym));
emit_insn (gen_tls_arg (arg, sym));
- emit_move_insn (a10, arg);
- call_insn = emit_call_insn (gen_tls_call (a10, fn, sym, const1_rtx));
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), a10);
+ emit_move_insn (a_io, arg);
+ call_insn = emit_call_insn (gen_tls_call (a_io, fn, sym, const1_rtx));
+ use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), a_io);
insns = get_insns ();
end_sequence ();
- *retp = a10;
+ *retp = a_io;
return insns;
}
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index ebc8792..01d93e9 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -813,7 +813,9 @@ typedef struct xtensa_args
for debugging. */
#define INCOMING_RETURN_ADDR_RTX gen_rtx_REG (Pmode, 0)
#define DWARF_FRAME_RETURN_COLUMN DWARF_FRAME_REGNUM (0)
-#define DWARF_FRAME_REGISTERS 16
+#define DWARF_ALT_FRAME_RETURN_COLUMN 16
+#define DWARF_FRAME_REGISTERS (DWARF_ALT_FRAME_RETURN_COLUMN \
+ + (TARGET_WINDOWED_ABI ? 0 : 1))
#define EH_RETURN_DATA_REGNO(N) ((N) < 2 ? (N) + 2 : INVALID_REGNUM)
#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
(flag_pic \
diff --git a/gcc/config/xtensa/xtensa.md b/gcc/config/xtensa/xtensa.md
index 3a3a902..a4228da 100644
--- a/gcc/config/xtensa/xtensa.md
+++ b/gcc/config/xtensa/xtensa.md
@@ -1883,7 +1883,12 @@
UNSPEC_TLS_CALL))
(match_operand 3 "" "i")))]
"TARGET_THREADPTR && HAVE_AS_TLS"
- "callx8.tls %1, %2@TLSCALL"
+{
+ if (TARGET_WINDOWED_ABI)
+ return "callx8.tls %1, %2@TLSCALL";
+ else
+ return "callx0.tls %1, %2@TLSCALL";
+}
[(set_attr "type" "call")
(set_attr "mode" "none")
(set_attr "length" "3")])
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index b1a7895..21458cd 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-6f0ac34e139755c319368757fe2a093f1e5bde49
+eac8b31fec761c8da0606a70ae0547ff0b12e8db
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c8aa20a..b4eaf3d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2015-09-15 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/array24.adb: New test.
+ * gnat.dg/blocklocs.adb: Delete.
+
+2015-09-15 Marek Polacek <polacek@redhat.com>
+
+ PR c/67580
+ * gcc.dg/pr67580.c: New test.
+
2015-09-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/67470
diff --git a/gcc/testsuite/gcc.dg/pr67580.c b/gcc/testsuite/gcc.dg/pr67580.c
new file mode 100644
index 0000000..90e4b1b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr67580.c
@@ -0,0 +1,31 @@
+/* PR c/67580 */
+/* { dg-do compile } */
+
+struct S { int s; };
+union U { int s; };
+enum E { A };
+
+void
+f (void)
+{
+ S s; /* { dg-error "unknown type name" } */
+/* { dg-message "use .struct. keyword to refer to the type" "" { target *-*-* } 11 } */
+ U u; /* { dg-error "unknown type name" } */
+/* { dg-message "use .union. keyword to refer to the type" "" { target *-*-* } 13 } */
+ E e; /* { dg-error "unknown type name" } */
+/* { dg-message "use .enum. keyword to refer to the type" "" { target *-*-* } 15 } */
+}
+
+void
+g (void)
+{
+ struct T { int i; };
+ union V { int i; };
+ enum F { J };
+ T t; /* { dg-error "unknown type name" } */
+/* { dg-message "use .struct. keyword to refer to the type" "" { target *-*-* } 25 } */
+ V v; /* { dg-error "unknown type name" } */
+/* { dg-message "use .union. keyword to refer to the type" "" { target *-*-* } 27 } */
+ F f; /* { dg-error "unknown type name" } */
+/* { dg-message "use .enum. keyword to refer to the type" "" { target *-*-* } 29 } */
+}
diff --git a/gcc/testsuite/gnat.dg/array24.adb b/gcc/testsuite/gnat.dg/array24.adb
new file mode 100644
index 0000000..c697436
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/array24.adb
@@ -0,0 +1,11 @@
+-- { dg-do compile }
+-- { dg-options "-fdump-tree-optimized" }
+
+procedure Array24 (N : Natural) is
+ S : String (1 .. N);
+ pragma Volatile (S);
+begin
+ S := (others => '0');
+end;
+
+-- { dg-final { scan-tree-dump-not "builtin_unwind_resume" "optimized" } }
diff --git a/gcc/testsuite/gnat.dg/blocklocs.adb b/gcc/testsuite/gnat.dg/blocklocs.adb
deleted file mode 100644
index 20ff7b3..0000000
--- a/gcc/testsuite/gnat.dg/blocklocs.adb
+++ /dev/null
@@ -1,26 +0,0 @@
--- { dg-do compile { target *-*-linux* } }
--- { dg-options "-gdwarf-2" }
-
-procedure Blocklocs (Choice : Integer; N : in out Integer) is
-begin
- if Choice > 0 then
- declare -- line 7
- S : String (1 .. N * 2);
- pragma Volatile (S);
- begin
- S := (others => 'B');
- end; -- line 12
- else
- declare -- line 14
- S : String (1 .. N );
- pragma Volatile (S);
- begin
- S := (others => '1');
- end; -- line 19
- end if;
-end;
-
--- { dg-final { scan-assembler "loc 1 7" } }
--- { dg-final { scan-assembler "loc 1 12" } }
--- { dg-final { scan-assembler "loc 1 14" } }
--- { dg-final { scan-assembler "loc 1 19" } }
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index c1ca468..1a55d22 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -915,7 +915,12 @@ lower_try_finally_dup_block (gimple_seq seq, struct leh_state *outer_state,
for (gsi = gsi_start (new_seq); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
- if (LOCATION_LOCUS (gimple_location (stmt)) == UNKNOWN_LOCATION)
+ /* We duplicate __builtin_stack_restore at -O0 in the hope of eliminating
+ it on the EH paths. When it is not eliminated, make it transparent in
+ the debug info. */
+ if (gimple_call_builtin_p (stmt, BUILT_IN_STACK_RESTORE))
+ gimple_set_location (stmt, UNKNOWN_LOCATION);
+ else if (LOCATION_LOCUS (gimple_location (stmt)) == UNKNOWN_LOCATION)
{
tree block = gimple_block (stmt);
gimple_set_location (stmt, loc);
@@ -1604,8 +1609,12 @@ decide_copy_try_finally (int ndests, bool may_throw, gimple_seq finally)
for (gsi = gsi_start (finally); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ /* Duplicate __builtin_stack_restore in the hope of eliminating it
+ on the EH paths and, consequently, useless cleanups. */
gimple stmt = gsi_stmt (gsi);
- if (!is_gimple_debug (stmt) && !gimple_clobber_p (stmt))
+ if (!is_gimple_debug (stmt)
+ && !gimple_clobber_p (stmt)
+ && !gimple_call_builtin_p (stmt, BUILT_IN_STACK_RESTORE))
return false;
}
return true;
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 10fd462..472dd78 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-15 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/xtensa/linux-unwind.h (xtensa_fallback_frame_state):
+ Add support for call0 ABI.
+
2015-09-13 John David Anglin <danglin@gcc.gnu.org>
* config/pa/fptr.c (SIGN_EXTEND): Cast -1 to unsigned.
diff --git a/libgcc/config/xtensa/linux-unwind.h b/libgcc/config/xtensa/linux-unwind.h
index 9daf738..9a67b5d 100644
--- a/libgcc/config/xtensa/linux-unwind.h
+++ b/libgcc/config/xtensa/linux-unwind.h
@@ -52,7 +52,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define ENTRY_BYTE 0x36
#endif
-#ifdef __XTENSA_WINDOWED_ABI__
#define MD_FALLBACK_FRAME_STATE_FOR xtensa_fallback_frame_state
static _Unwind_Reason_Code
@@ -61,6 +60,10 @@ xtensa_fallback_frame_state (struct _Unwind_Context *context,
{
unsigned char *pc = context->ra;
struct sigcontext *sc;
+#if defined(__XTENSA_CALL0_ABI__)
+ _Unwind_Ptr new_cfa;
+ int i;
+#endif
struct rt_sigframe {
siginfo_t info;
@@ -76,6 +79,7 @@ xtensa_fallback_frame_state (struct _Unwind_Context *context,
|| pc[5] != SYSC_BYTE2)
return _URC_END_OF_STACK;
+#if defined(__XTENSA_WINDOWED_ABI__)
rt_ = context->sp;
sc = &rt_->uc.uc_mcontext;
fs->signal_regs = (_Unwind_Word *) sc->sc_a;
@@ -90,11 +94,33 @@ xtensa_fallback_frame_state (struct _Unwind_Context *context,
}
else
fs->signal_ra = sc->sc_pc;
+#elif defined(__XTENSA_CALL0_ABI__)
+ rt_ = context->cfa;
+ sc = &rt_->uc.uc_mcontext;
+
+ new_cfa = (_Unwind_Ptr) sc;
+ fs->regs.cfa_how = CFA_REG_OFFSET;
+ fs->regs.cfa_reg = __LIBGCC_STACK_POINTER_REGNUM__;
+ fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
+
+ for (i = 0; i < 16; i++)
+ {
+ fs->regs.reg[i].how = REG_SAVED_OFFSET;
+ fs->regs.reg[i].loc.offset = (_Unwind_Ptr) &(sc->sc_a[i]) - new_cfa;
+ }
+
+ fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].how =
+ REG_SAVED_VAL_OFFSET;
+ fs->regs.reg[__LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__].loc.offset =
+ (_Unwind_Ptr) (sc->sc_pc) - new_cfa;
+ fs->retaddr_column = __LIBGCC_DWARF_ALT_FRAME_RETURN_COLUMN__;
+#else
+#error Unsupported Xtensa ABI
+#endif
fs->signal_frame = 1;
return _URC_NO_REASON;
}
-#endif /* __XTENSA_WINDOWED_ABI__ */
#endif /* ifdef inhibit_libc */
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index 924dba0..ca2280d 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -2074,7 +2074,7 @@ libnetgo_a_LIBADD = netgo.o
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
GOCFLAGS = $(CFLAGS)
-AM_GOCFLAGS = $(STRINGOPS_FLAG)
+AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
diff --git a/libgo/Makefile.in b/libgo/Makefile.in
index 5072ceb..5d7b8c9 100644
--- a/libgo/Makefile.in
+++ b/libgo/Makefile.in
@@ -366,6 +366,7 @@ GOCFLAGS = $(CFLAGS)
GOOS = @GOOS@
GO_LIBCALL_OS_ARCH_FILE = @GO_LIBCALL_OS_ARCH_FILE@
GO_LIBCALL_OS_FILE = @GO_LIBCALL_OS_FILE@
+GO_SPLIT_STACK = @GO_SPLIT_STACK@
GO_SYSCALL_OS_ARCH_FILE = @GO_SYSCALL_OS_ARCH_FILE@
GO_SYSCALL_OS_FILE = @GO_SYSCALL_OS_FILE@
GREP = @GREP@
@@ -2153,7 +2154,7 @@ libgolibbegin_a_CFLAGS = $(AM_CFLAGS) -fPIC
libnetgo_a_SOURCES = $(go_netgo_files)
libnetgo_a_LIBADD = netgo.o
LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
-AM_GOCFLAGS = $(STRINGOPS_FLAG)
+AM_GOCFLAGS = $(STRINGOPS_FLAG) $(GO_SPLIT_STACK)
GOCOMPILE = $(GOC) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_GOCFLAGS) $(GOCFLAGS)
LTGOCOMPILE = $(LIBTOOL) --tag GO --mode=compile $(GOC) $(INCLUDES) \
$(AM_GOCFLAGS) $(GOCFLAGS)
diff --git a/libgo/configure b/libgo/configure
index 9c79574..3dfa1d8 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -620,6 +620,7 @@ NET_LIBS
MATH_LIBS
GOC_IS_LLGO_FALSE
GOC_IS_LLGO_TRUE
+GO_SPLIT_STACK
USING_SPLIT_STACK_FALSE
USING_SPLIT_STACK_TRUE
SPLIT_STACK
@@ -11123,7 +11124,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11126 "configure"
+#line 11127 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11229,7 +11230,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11232 "configure"
+#line 11233 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14050,6 +14051,13 @@ else
fi
+if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = no; then
+ GO_SPLIT_STACK=-fno-split-stack
+else
+ GO_SPLIT_STACK=
+fi
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether linker supports split stack" >&5
$as_echo_n "checking whether linker supports split stack... " >&6; }
if test "${libgo_cv_c_linker_supports_split_stack+set}" = set; then :
diff --git a/libgo/configure.ac b/libgo/configure.ac
index ca5325a..15814bab 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -407,6 +407,15 @@ AC_SUBST(SPLIT_STACK)
AM_CONDITIONAL(USING_SPLIT_STACK,
test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = yes)
+dnl If the compiler supports split-stack but the linker does not, then
+dnl we need to explicitly disable split-stack for Go.
+if test "$libgo_cv_c_split_stack_supported" = yes -a "$libgo_cv_c_linker_split_non_split" = no; then
+ GO_SPLIT_STACK=-fno-split-stack
+else
+ GO_SPLIT_STACK=
+fi
+AC_SUBST(GO_SPLIT_STACK)
+
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
diff --git a/libgo/testsuite/Makefile.in b/libgo/testsuite/Makefile.in
index b4547a3..ba04a50 100644
--- a/libgo/testsuite/Makefile.in
+++ b/libgo/testsuite/Makefile.in
@@ -108,6 +108,7 @@ GOCFLAGS = @GOCFLAGS@
GOOS = @GOOS@
GO_LIBCALL_OS_ARCH_FILE = @GO_LIBCALL_OS_ARCH_FILE@
GO_LIBCALL_OS_FILE = @GO_LIBCALL_OS_FILE@
+GO_SPLIT_STACK = @GO_SPLIT_STACK@
GO_SYSCALL_OS_ARCH_FILE = @GO_SYSCALL_OS_ARCH_FILE@
GO_SYSCALL_OS_FILE = @GO_SYSCALL_OS_FILE@
GREP = @GREP@