blob: a3e40b50eed87aa25b848563994d016b86cd5038 [file] [log] [blame]
Chad Rosierdb3da832012-08-21 16:16:06 +00001// RUN: %clang -fno-stack-protector -### %s 2>&1 | FileCheck %s -check-prefix=NOSSP
Rafael Espindolad6f11a72014-06-01 13:45:09 +00002// NOSSP-NOT: "-stack-protector"
Chad Rosierdb3da832012-08-21 16:16:06 +00003// NOSSP-NOT: "-stack-protector-buffer-size"
4
Rafael Espindolad6f11a72014-06-01 13:45:09 +00005// RUN: %clang -target i386-unknown-linux -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=SSP
Chad Rosierdb3da832012-08-21 16:16:06 +00006// SSP: "-stack-protector" "1"
7// SSP-NOT: "-stack-protector-buffer-size"
8
Rafael Espindolad6f11a72014-06-01 13:45:09 +00009// RUN: %clang -target i386-unknown-linux -fstack-protector --param ssp-buffer-size=16 -### %s 2>&1 | FileCheck %s -check-prefix=SSP-BUF
Chad Rosierdb3da832012-08-21 16:16:06 +000010// SSP-BUF: "-stack-protector" "1"
11// SSP-BUF: "-stack-protector-buffer-size" "16"
Rafael Espindola044f7832013-06-05 04:28:55 +000012
13// RUN: %clang -target i386-pc-openbsd -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD
Rafael Espindola2d401f52014-05-22 12:52:35 +000014// OPENBSD: "-stack-protector" "2"
Rafael Espindola044f7832013-06-05 04:28:55 +000015
Rafael Espindolace5c6092014-05-22 22:57:39 +000016// RUN: %clang -target i386-pc-openbsd -fstack-protector -### %s 2>&1 | FileCheck %s -check-prefix=OPENBSD_SPS
17// OPENBSD_SPS: "-stack-protector" "2"
18
Josh Mageee0fc1a82014-02-11 01:35:14 +000019// 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"
22
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"
Filipe Cabecinhasc888e192015-10-14 12:25:43 +000026
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"
31
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"
Bruno Cardoso Lopes77bb4052016-12-07 23:20:30 +000035
36// Test default stack protector values for Darwin platforms
37
38// RUN: %clang -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
Bruno Cardoso Lopesc1843c22017-09-05 23:50:58 +000039// RUN: %clang -ffreestanding -target armv7k-apple-watchos2.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_WATCHOS
Bruno Cardoso Lopes77bb4052016-12-07 23:20:30 +000040// SSP_WATCHOS: "-stack-protector" "1"
41// RUN: %clang -target arm64-apple-ios8.0.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_IOS
Bruno Cardoso Lopesc1843c22017-09-05 23:50:58 +000042// RUN: %clang -ffreestanding -target arm64-apple-ios8.0.0 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_IOS
Bruno Cardoso Lopes77bb4052016-12-07 23:20:30 +000043// SSP_IOS: "-stack-protector" "1"
44// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX
Bruno Cardoso Lopesc1843c22017-09-05 23:50:58 +000045// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX
Bruno Cardoso Lopes77bb4052016-12-07 23:20:30 +000046// SSP_MACOSX: "-stack-protector" "1"
47// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.5 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_5
Bruno Cardoso Lopesc1843c22017-09-05 23:50:58 +000048// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.5 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_5
Bruno Cardoso Lopes77bb4052016-12-07 23:20:30 +000049// SSP_MACOSX_10_5: "-stack-protector" "1"
50// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.5 -mkernel -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_KERNEL
51// SSP_MACOSX_KERNEL-NOT: "-stack-protector"
52// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_6_KERNEL
Bruno Cardoso Lopesc1843c22017-09-05 23:50:58 +000053// RUN: %clang -ffreestanding -target x86_64-apple-darwin10 -mmacosx-version-min=10.6 -### %s 2>&1 | FileCheck %s -check-prefix=SSP_MACOSX_10_6_KERNEL
Bruno Cardoso Lopes77bb4052016-12-07 23:20:30 +000054// SSP_MACOSX_10_6_KERNEL: "-stack-protector" "1"
Bruno Cardoso Lopescfd183e2016-12-08 00:22:06 +000055