http://llvm.org/bugs/show_bug.cgi?id=16779
Bug ID: 16779
Summary: Invalid prolog/epilog on Win64
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
The "Prolog and Epilog" section
<http://msdn.microsoft.com/en-us/library/tawsa7cb.aspx> of Microsofts x64
conventions state:
"These are the only legal forms for an epilog. It must consist of either an
add RSP,constant or lea RSP,constant[FPReg], followed by a series of zero or
more 8-byte register pops and a return or a jmp. [...]"
But LLVM uses mov to restore RSP. Also, if a stack variable has an alignment
greater than 16, RSP is realigned during the prolog which is incompatible with
x64 unwind information.
Example:
// clang -std=c++11 -m64 -target x86_64-pc-win32 -o -
int foo()
{
alignas(32) int x = 0;
return x;
}
Produces:
.def _Z3foov;
.scl 2;
.type 32;
.endef
.text
.globl _Z3foov
.align 16, 0x90
_Z3foov:
pushq %rbp
movq %rsp, %rbp
andq $-32, %rsp // realignment before rsp is adjusted
subq $32, %rsp
movl $0, (%rsp)
xorl %eax, %eax
movq %rbp, %rsp // mov in epilog
popq %rbp
ret
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs