llc generating code that writes below the stack pointer on darwin/x86-64

Hi,

Is there something wrong with my inline assembly below?

This code use a negative stack offset, which is forbidden on x86-64 (there's no red zone). This happens with llc from llvm 3.7, 3.8 and 3.9.

Doesn't Darwin use the System V ABI [1]? As I understand it, there's a 128-byte red zone on x86-64.

The 128-byte area beyond the location pointed to by %rsp is considered to be reserved and shall not be modified by signal or interrupt handlers. Therefore, functions may use this area for temporary data that is not needed across function calls. In particular, leaf functions may use this area for their entire stack frame, rather than adjusting the stack pointer in the prologue and epilogue. This area is known as the red zone. [2]

1. x86-64 Function Calling Conventions
2. http://web.archive.org/web/20160801075139/http://www.x86-64.org/documentation/abi.pdf

You're right, sorry. I got a crash in this routine, saw the negative stack offset, quickly searched to check whether there was a red zone, and from a summary of a found page assumed there wasn't, but the quoted section was about the Win64 ABI.

I'll have to look further to determine what caused the actual crash.

Thanks,

Jonas