This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]