Hi,
(as small heads up) As we have this problem with the Win64 code calling us with non-16 byte aligned stacks, the gcc folks have now commited code to trunk gcc that allows -mincoming-stack-boundary=3 on October 7th.
Uros also plans a backport for gcc 5.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66697
$ cat xx.c #include <stdio.h> int f(int a,int b) { printf("a=%d, b=%d\n", a, b); }
-O2 build: 0000000000000000 <f>: 0: 89 f2 mov %esi,%edx 2: 31 c0 xor %eax,%eax 4: 89 fe mov %edi,%esi 6: bf 00 00 00 00 mov $0x0,%edi b: e9 00 00 00 00 jmpq 10 <f+0x10>
-O2 -mincoming-stack-boundary=3 0000000000000000 <f>: 0: 4c 8d 54 24 08 lea 0x8(%rsp),%r10 5: 48 83 e4 f0 and $0xfffffffffffffff0,%rsp 9: 89 f2 mov %esi,%edx b: 31 c0 xor %eax,%eax d: 89 fe mov %edi,%esi f: bf 00 00 00 00 mov $0x0,%edi 14: 41 ff 72 f8 pushq -0x8(%r10) 18: 55 push %rbp 19: 48 89 e5 mov %rsp,%rbp 1c: 41 52 push %r10 1e: 48 83 ec 08 sub $0x8,%rsp 22: e8 00 00 00 00 callq 27 <f+0x27> 27: 48 83 c4 08 add $0x8,%rsp 2b: 41 5a pop %r10 2d: 5d pop %rbp 2e: 49 8d 62 f8 lea -0x8(%r10),%rsp 32: c3 retq
It is more code emitted, but we can at least fix it without generating our own thunks.
Ciao, Marcus