Compiling this simple test case with GNU C version 4.2.0 20060118 (experimental) (x86_64-unknown-linux-gnu)
extern void f2(char *s); void f(void) { char x[100]; f2(x); } i get ... xorq __stack_chk_guard(%rip), %rax jne .L5 addq $120, %rsp ret .L5: .p2align 4,,5 call __stack_chk_fail Suggestions for improvement: - It shouldn't use p2align 4,,5 for the __stack_chk_fail trampoline because that wastes space in very infrequent code - It should use jne to jump the function directly because it should never return (when it is called the stack is compromised and it would be a security hole) -- Summary: -fstack-protector code on i386/x86-64 can be improved. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ak at muc dot de GCC host triplet: x86_64-linux GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25957