1 // Check the -mharden-sls= option, which has a required argument to select
2 // scope.
3 // RUN: %clang -target aarch64--none-eabi -c %s -### 2>&1 | \
4 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF
5 
6 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=none 2>&1 | \
7 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF
8 
9 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr 2>&1 | \
10 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-OFF
11 
12 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=blr 2>&1 | \
13 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-ON
14 
15 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=blr -mharden-sls=none 2>&1 | \
16 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF
17 
18 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=blr -mharden-sls=retbr 2>&1 | \
19 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-OFF
20 
21 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr 2>&1 | \
22 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON
23 
24 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=all 2>&1 | \
25 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON
26 
27 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr,retbr 2>&1 | \
28 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON
29 
30 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr,r 2>&1 | \
31 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
32 
33 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=none,blr 2>&1 | \
34 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
35 
36 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=all,-blr 2>&1 | \
37 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
38 
39 // RETBR-OFF-NOT: "harden-sls-retbr"
40 // RETBR-ON:  "+harden-sls-retbr"
41 
42 // BLR-OFF-NOT: "harden-sls-blr"
43 // BLR-ON:  "+harden-sls-blr"
44 
45 // BAD-SLS-SPEC: invalid sls hardening option '{{[^']+}}' in '-mharden-sls=
46