This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [split] Add x86 support
- From: rridge at csclub dot uwaterloo dot ca (Ross Ridge)
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 25 Sep 2009 23:08:57 -0400 (EDT)
- Subject: Re: [split] Add x86 support
Ian Lance Taylor writes:
>This adds x86-specific support for -fsplit-stack. This uses the stack
>protector field in the TCB.
You should be able to simplify things creating an unspec almost exactly
like UNSPEC_TP and using that as a part of a memory operand with the
existing compare instructions, rather than defining new insns with
UNSPEC_STACK_CHECK.
I'm not sure if this is something you're concerned with at this point,
but munging the return address in __morestack will totally invalidate
the processor's return stack branch predictor. You can avoid that by
generating code something like (in Intel syntax):
foo:
; ...
jg 0f
; push ecx
; ...
call __morestack
ret
; pop ecx
0:
; ...
__morestack:
mov ecx, [esp]
; ...
add ecx, 1
call ecx
__releasestack:
; ...
ret