[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / Driver / stack-protector.c
blobe082b3361d058a3e7a0de74dbb871dc4b8436333
1 // RUN: %clang -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=NOSSP
2 // NOSSP-NOT: "-stack-protector"
3 // NOSSP-NOT: "-stack-protector-buffer-size"
5 // RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP
6 // SSP: "-stack-protector" "1"
7 // SSP-NOT: "-stack-protector-buffer-size"
9 // RUN: %clang -target i386-unknown-linux -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF
10 // SSP-BUF: "-stack-protector" "1"
11 // SSP-BUF: "-stack-protector-buffer-size" "16"
13 // RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD
14 // OPENBSD: "-stack-protector" "2"
16 // RUN: %clang -target i386-pc-openbsd -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD_SPS
17 // OPENBSD_SPS: "-stack-protector" "2"
19 // RUN: %clang -fstack-protector-strong -### %s 2>&1 | FileCheck %s -check-prefix=SSP-STRONG
20 // SSP-STRONG: "-stack-protector" "2"
21 // SSP-STRONG-NOT: "-stack-protector-buffer-size"
23 // RUN: %clang -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SSP-ALL
24 // SSP-ALL: "-stack-protector" "3"
25 // SSP-ALL-NOT: "-stack-protector-buffer-size"
27 // RUN: %clang -target x86_64-scei-ps4 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4
28 // RUN: %clang -target x86_64-scei-ps4 -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4
29 // SSP-PS4: "-stack-protector" "2"
30 // SSP-PS4-NOT: "-stack-protector-buffer-size"
32 // RUN: %clang -target x86_64-scei-ps4 -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-PS4-BUF
33 // SSP-PS4-BUF: "-stack-protector" "2"
34 // SSP-PS4-BUF: "-stack-protector-buffer-size" "16"
36 // Test default stack protector values for Darwin platforms
38 // RUN: %clang -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
39 // RUN: %clang -ffreestanding -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
40 // SSP_WATCHOS: "-stack-protector" "1"
41 // RUN: %clang -target x86_64-apple-driverkit19.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_DRIVERKIT
42 // SSP_DRIVERKIT: "-stack-protector" "1"
43 // RUN: %clang -target arm64-apple-ios8.0.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_IOS
44 // RUN: %clang -ffreestanding -target arm64-apple-ios8.0.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_IOS
45 // SSP_IOS: "-stack-protector" "1"
46 // RUN: %clang -target x86_64-apple-darwin10 -mmacos-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX
47 // RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacos-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX
48 // SSP_MACOSX: "-stack-protector" "1"
49 // RUN: %clang -target x86_64-apple-darwin10 -mmacos-version-min=10.5 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_5
50 // RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacos-version-min=10.5 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_5
51 // SSP_MACOSX_10_5: "-stack-protector" "1"
52 // RUN: %clang -target x86_64-apple-darwin10 -mmacos-version-min=10.5 -mkernel -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_KERNEL
53 // SSP_MACOSX_KERNEL-NOT: "-stack-protector"
54 // RUN: %clang -target x86_64-apple-darwin10 -mmacos-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_6_KERNEL
55 // RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacos-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_6_KERNEL
56 // SSP_MACOSX_10_6_KERNEL: "-stack-protector" "1"