This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Weird startup issue with -fsplit-stack
- From: Ian Lance Taylor <iant at google dot com>
- To: Dmitry Antipov <dmantipov at yandex dot ru>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 20 May 2014 11:16:56 -0700
- Subject: Re: Weird startup issue with -fsplit-stack
- Authentication-results: sourceware.org; auth=none
- References: <537B6443 dot 2050807 at yandex dot ru>
On Tue, May 20, 2014 at 7:18 AM, Dmitry Antipov <dmantipov@yandex.ru> wrote:
>
> I'm trying to support -fsplit-stack in GNU Emacs. The most important problem
> is that
> GC uses conservative scanning of a C stack, so I need to iterate over stack
> segments.
> I'm doing this by using __splitstack_find, as described in
> libgcc/generic-morestack.c;
> but now I'm facing the weird issue with startup:
>
> Core was generated by `./temacs --batch --load loadup bootstrap'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 __morestack () at ../../../gcc-4.9.0/libgcc/config/i386/morestack.S:486
> 486 pushq %rax
> (gdb) bt 10
> #0 __morestack () at ../../../gcc-4.9.0/libgcc/config/i386/morestack.S:486
> #1 0x00000000005f15df in __morestack () at
> ../../../gcc-4.9.0/libgcc/config/i386/morestack.S:502
> #2 0x00000000005f15df in __morestack () at
> ../../../gcc-4.9.0/libgcc/config/i386/morestack.S:502
> #3 0x00000000005f15df in __morestack () at
> ../../../gcc-4.9.0/libgcc/config/i386/morestack.S:502
This is the call to __morestack_block_signals in morestack.S. It
should only be possible if __morestack_block_signals or something it
calls directly has a split stack. __morestack_block_signals has the
no_split_stack attribute, meaning that it should never call
__morestack. __morestack_block_signals only calls pthread_sigmark or
sigprocmask, neither of which should be compiled with -fsplit-stack.
So something has gone wrong, but I don't know what.
I would recommend tracing the code instruction by instruction to see
why __morestack_block_signals calls back into __morestack. Or, if
that analysis is wrong, see what else is happening.
I can advise but I don't have time to look at this in detail. Sorry.
Ian