diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-09-14 08:52:27 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-09-24 09:00:51 -0700 |
commit | f0baed1fb6cd6ed7c7a3dce1f555d3f72b1575a5 (patch) | |
tree | f234dacd8a985fee4c59ebfe096e98faf4f51be9 /gcc/testsuite/gcc.target/i386/pr97032.c | |
parent | 71c83e108de7b54f604eeebefbc9e97672310ca7 (diff) | |
download | gcc-f0baed1fb6cd6ed7c7a3dce1f555d3f72b1575a5.tar.gz |
rtl_data: Add sp_is_clobbered_by_asm
Add sp_is_clobbered_by_asm to rtl_data to inform backends that the stack
pointer is clobbered by asm statement.
gcc/
PR target/97032
* cfgexpand.c (asm_clobber_reg_kind): Set sp_is_clobbered_by_asm
to true if the stack pointer is clobbered by asm statement.
* emit-rtl.h (rtl_data): Add sp_is_clobbered_by_asm.
* config/i386/i386.c (ix86_get_drap_rtx): Set need_drap to true
if the stack pointer is clobbered by asm statement.
gcc/testsuite/
PR target/97032
* gcc.target/i386/pr97032.c: New test.
(cherry picked from commit 453a20c65722719b9e2d84339f215e7ec87692dc)
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/pr97032.c')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr97032.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/pr97032.c b/gcc/testsuite/gcc.target/i386/pr97032.c new file mode 100644 index 00000000000..7cbbe9bc22a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr97032.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target { ia32 && fstack_protector } } } */ +/* { dg-options "-O2 -mincoming-stack-boundary=2 -fstack-protector-all" } */ + +#include <stdarg.h> + +extern int *__errno_location (void); + +long +sys_socketcall (int op, ...) +{ + long int res; + va_list ap; + va_start (ap, op); + asm volatile ("push %%ebx; movl %2, %%ebx; int $0x80; pop %%ebx" + /* { dg-warning "listing the stack pointer register" "" { target *-*-* } .-1 } */ + : "=a" (res) : "0" (102), "ri" (16), "c" (ap) : "memory", "esp"); + if (__builtin_expect (res > 4294963200UL, 0)) + *__errno_location () = -res; + va_end (ap); + return res; +} + +/* { dg-final { scan-assembler "call\[ \t\]*_?__errno_location" } } */ |