[llvm-dev] llc generating code that writes below the stack pointer on darwin/x86-64

Stephen Checkoway via llvm-dev llvm-dev at lists.llvm.org
Sun Nov 13 09:48:27 PST 2016


> On Nov 13, 2016, at 11:12, Jonas Maebe via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> 
> 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. https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/LowLevelABI/140-x86-64_Function_Calling_Conventions/x86_64.html
2. http://web.archive.org/web/20160801075139/http://www.x86-64.org/documentation/abi.pdf

-- 
Stephen Checkoway







More information about the llvm-dev mailing list