1 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard=tls %s 2>&1 | \
2 // RUN:   FileCheck -check-prefix=CHECK-TLS %s
3 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard=global %s 2>&1 | \
4 // RUN:   FileCheck -check-prefix=CHECK-GLOBAL %s
5 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard=local %s 2>&1 | \
6 // RUN:   FileCheck -check-prefix=INVALID-VALUE %s
7 
8 // CHECK-TLS: "-cc1" {{.*}}"-mstack-protector-guard=tls"
9 // CHECK-GLOBAL: "-cc1" {{.*}}"-mstack-protector-guard=global"
10 // INVALID-VALUE: error: invalid value 'local' in 'mstack-protector-guard=','valid arguments to '-mstack-protector-guard=' are:tls global'
11 
12 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-reg=fs %s 2>&1 | \
13 // RUN:   FileCheck -check-prefix=CHECK-FS %s
14 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-reg=gs %s 2>&1 | \
15 // RUN:   FileCheck -check-prefix=CHECK-GS %s
16 
17 // Invalid arch
18 // RUN: not %clang -target arm-eabi-c -mstack-protector-guard=tls %s 2>&1 | \
19 // RUN:   FileCheck -check-prefix=INVALID-ARCH %s
20 // INVALID-ARCH: unsupported option '-mstack-protector-guard=tls' for target
21 
22 // RUN: not %clang -target powerpc64le-linux-gnu -mstack-protector-guard-reg=fs %s 2>&1 | \
23 // RUN:   FileCheck -check-prefix=INVALID-ARCH2 %s
24 // INVALID-ARCH2: unsupported option '-mstack-protector-guard-reg=fs' for target
25 
26 // RUN: not %clang -target aarch64-linux-gnu -mstack-protector-guard-offset=10 %s 2>&1 | \
27 // RUN:   FileCheck -check-prefix=INVALID-ARCH3 %s
28 // INVALID-ARCH3: unsupported option '-mstack-protector-guard-offset=10' for target
29 
30 // Invalid option value
31 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-reg=cs %s 2>&1 | \
32 // RUN:   FileCheck -check-prefix=INVALID-REG %s
33 // RUN: not %clang -target x86_64-unknown-unknown -c -mstack-protector-guard-reg=ds %s 2>&1 | \
34 // RUN:   FileCheck -check-prefix=INVALID-REG %s
35 
36 // CHECK-FS: "-cc1" {{.*}}"-mstack-protector-guard-reg=fs"
37 // CHECK-GS: "-cc1" {{.*}}"-mstack-protector-guard-reg=gs"
38 // INVALID-REG: error: invalid value {{.*}} in 'mstack-protector-guard-reg=','for X86, valid arguments to '-mstack-protector-guard-reg=' are:fs gs'
39 
40 // RUN: %clang -### -target x86_64-unknown-unknown -mstack-protector-guard-offset=30 %s 2>&1 | \
41 // RUN:   FileCheck -check-prefix=CHECK-OFFSET %s
42 
43 // CHECK-OFFSET: "-cc1" {{.*}}"-mstack-protector-guard-offset=30"
44