1 // RUN: %clang -target i386-unknown-linux -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-i386 2 // RUN: %clang -target i386-unknown-linux -fno-stack-clash-protection -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-i386 3 // RUN: %clang -target i386-unknown-linux -fstack-clash-protection -fno-stack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-i386-NO 4 // SCP-i386: "-fstack-clash-protection" 5 // SCP-i386-NO-NOT: "-fstack-clash-protection" 6 7 // RUN: %clang -target x86_64-scei-linux -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-x86 8 // RUN: %clang -target x86_64-unknown-freebsd -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-x86 9 // SCP-x86: "-fstack-clash-protection" 10 11 // RUN: %clang -target armv7k-apple-linux -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-armv7 12 // SCP-armv7-NOT: "-fstack-clash-protection" 13 // SCP-armv7: argument unused during compilation: '-fstack-clash-protection' 14 15 // RUN: %clang -target x86_64-unknown-linux -fstack-clash-protection -S -emit-llvm -o %t.ll %s 2>&1 | FileCheck %s -check-prefix=SCP-warn 16 // SCP-warn: warning: unable to protect inline asm that clobbers stack pointer against stack clash 17 18 // RUN: %clang -target x86_64-pc-unknown-linux -fstack-clash-protection -S -emit-llvm -o- %s | FileCheck %s -check-prefix=SCP-ll-linux64 19 // SCP-ll-linux64: attributes {{.*}} "probe-stack"="inline-asm" 20 21 // RUN: %clang -target x86_64-pc-windows-msvc -fstack-clash-protection -S -emit-llvm -o- %s 2>&1 | FileCheck %s -check-prefix=SCP-ll-win64 22 // SCP-ll-win64-NOT: attributes {{.*}} "probe-stack"="inline-asm" 23 // SCP-ll-win64: argument unused during compilation: '-fstack-clash-protection' 24 25 // RUN: %clang -target x86_64-unknown-fuchsia -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-FUCHSIA 26 // RUN: %clang -target aarch64-unknown-fuchsia -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-FUCHSIA 27 // RUN: %clang -target riscv64-unknown-fuchsia -fstack-clash-protection -### %s 2>&1 | FileCheck %s -check-prefix=SCP-FUCHSIA 28 // SCP-FUCHSIA: "-fstack-clash-protection" 29 30 int foo(int c) { 31 int r; 32 __asm__("sub %0, %%rsp" 33 : 34 : "rm"(c) 35 : "rsp"); 36 __asm__("mov %%rsp, %0" 37 : "=rm"(r)::); 38 return r; 39 } 40