Using the stack from inline assembly

Florian Weimer fweimer@redhat.com
Tue Dec 13 16:00:00 GMT 2016


On 12/13/2016 04:56 PM, Jeff Law wrote:

> It's probably wise to ensure the stack pointer keeps proper alignment
> and such, but that's entirely within the asm itself.

Right.  But I still need a way to express that the red zone is 
clobbered.  I just don't see *anything* that would allow me to express that.

> No idea what's going on with Andrew's example, I haven't dug into it.

Without optimization, GCC keeps a temporary in the red zone (%rbp is 
equal to %rsp), and the push/pop pair destroys that:

	movq	%rax, -8(%rbp)
#APP
# 6 "t.c" 1
	push %rbp;
  pop %rbp
# 0 "" 2
#NO_APP
	movq	-8(%rbp), %rax

Florian



More information about the Gcc-help mailing list