On 03/02/16 18:27, Ulrich Weigand wrote:
Marcin Kościelnicki wrote:

libgcc/ChangeLog:

        * config.host: Use t-stack and t-stack-s390 for s390*-*-linux.
        * config/s390/morestack.S: New file.
        * config/s390/t-stack-s390: New file.
        * generic-morestack.c (__splitstack_find): Add s390-specific code.

gcc/ChangeLog:

        * common/config/s390/s390-common.c (s390_supports_split_stack):
        New function.
        (TARGET_SUPPORTS_SPLIT_STACK): New macro.
        * config/s390/s390-protos.h: Add s390_expand_split_stack_prologue.
        * config/s390/s390.c (struct machine_function): New field
        split_stack_varargs_pointer.
        (s390_register_info): Mark r12 as clobbered if it'll be used as temp
        in s390_emit_prologue.
        (s390_emit_prologue): Use r12 as temp if r1 is taken by split-stack
        vararg pointer.
        (morestack_ref): New global.
        (SPLIT_STACK_AVAILABLE): New macro.
        (s390_expand_split_stack_prologue): New function.
        (s390_live_on_entry): New function.
        (s390_va_start): Use split-stack vararg pointer if appropriate.
        (s390_asm_file_end): Emit the split-stack note sections.
        (TARGET_EXTRA_LIVE_ON_ENTRY): New macro.
        * config/s390/s390.md (UNSPEC_STACK_CHECK): New unspec.
        (UNSPECV_SPLIT_STACK_CALL): New unspec.
        (UNSPECV_SPLIT_STACK_DATA): New unspec.
        (split_stack_prologue): New expand.
        (split_stack_space_check): New expand.
        (split_stack_data): New insn.
        (split_stack_call): New expand.
        (split_stack_call_*): New insn.
        (split_stack_cond_call): New expand.
        (split_stack_cond_call_*): New insn.
---
Changes applied.  Testsuite still running, still works on my simple tests.

As for common code prerequisites: #3 is no longer needed, and very likely
so is #4 (it fixes problems that I've only seen with ESA mode, and testsuite
runs just fine without it now).

OK, I see.  The patch is OK for mainline then, assuming testing passes.

Well, testing passes (as in, is no worse than x86 - the testsuite doesn't really agree with -fsplit-stack in a few places involving backtraces). However, there's still the libgo issue to be taken care of. For my tests, I patched it up with:

diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index c25a217..efa6806 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -2016,17 +2016,19 @@ doentersyscall()
        m->locks++;

        // Leave SP around for GC and traceback.
+       {
 #ifdef USING_SPLIT_STACK
-       g->gcstack = __splitstack_find(nil, nil, &g->gcstack_size,
-                                      &g->gcnext_segment, &g->gcnext_sp,
-                                      &g->gcinitial_sp);
+               size_t size_tmp;
+               g->gcstack = __splitstack_find(nil, nil, &size_tmp,
+                                              &g->gcnext_segment, 
&g->gcnext_sp,
+                                              &g->gcinitial_sp);
+               g->gcstack_size = size_tmp;
 #else
-       {
                void *v;

                g->gcnext_sp = (byte *) &v;
-       }
 #endif
+       }

        g->status = Gsyscall;

@@ -2064,9 +2066,13 @@ runtime_entersyscallblock(void)

        // Leave SP around for GC and traceback.
 #ifdef USING_SPLIT_STACK
-       g->gcstack = __splitstack_find(nil, nil, &g->gcstack_size,
-                                      &g->gcnext_segment, &g->gcnext_sp,
-                                      &g->gcinitial_sp);
+       {
+               size_t size_tmp;
+               g->gcstack = __splitstack_find(nil, nil, &size_tmp,
+                                              &g->gcnext_segment, 
&g->gcnext_sp,
+                                              &g->gcinitial_sp);
+               g->gcstack_size = size_tmp;
+       }
 #else
        g->gcnext_sp = (byte *) &p;
 #endif

Andreas, did you have any luck with fixing this? If not, I'll try submitting the above patch to gofrontend.


Thanks again,
Ulrich


Reply via email to