1 // Check the -mharden-sls= option, which has a required argument to select
3 // RUN: %clang -target aarch64--none-eabi -c %s -### 2>&1 | \
4 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
5 // RUN: %clang -target armv7a--none-eabi -c %s -### 2>&1 | \
6 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
8 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=none 2>&1 | \
9 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
10 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=none 2>&1 | \
11 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
13 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr 2>&1 | \
14 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
15 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=retbr 2>&1 | \
16 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
18 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=blr 2>&1 | \
19 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
20 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=blr 2>&1 | \
21 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
23 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=blr -mharden-sls=none 2>&1 | \
24 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
25 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=blr -mharden-sls=none 2>&1 | \
26 // RUN: FileCheck %s --check-prefix=RETBR-OFF --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
28 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=blr -mharden-sls=retbr 2>&1 | \
29 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
30 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=blr -mharden-sls=retbr 2>&1 | \
31 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-OFF --check-prefix=NOCOMDAT-OFF
33 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr 2>&1 | \
34 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
35 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=retbr,blr 2>&1 | \
36 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
38 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=all 2>&1 | \
39 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
40 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=all 2>&1 | \
41 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
43 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr,retbr 2>&1 | \
44 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
45 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=retbr,blr,retbr 2>&1 | \
46 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT-OFF
48 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr,r 2>&1 | \
49 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
50 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=retbr,blr,r 2>&1 | \
51 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
53 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=none,blr 2>&1 | \
54 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
55 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=none,blr 2>&1 | \
56 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
58 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=all,-blr 2>&1 | \
59 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
60 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=all,-blr 2>&1 | \
61 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
63 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr,nocomdat 2>&1 | \
64 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT
65 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=retbr,blr,nocomdat 2>&1 | \
66 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT
68 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=all,nocomdat 2>&1 | \
69 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT
70 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=all,nocomdat 2>&1 | \
71 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT
73 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,blr,retbr,nocomdat 2>&1 | \
74 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT
75 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=retbr,blr,retbr,nocomdat 2>&1 | \
76 // RUN: FileCheck %s --check-prefix=RETBR-ON --check-prefix=BLR-ON --check-prefix=NOCOMDAT
78 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=retbr,comdat,r 2>&1 | \
79 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
80 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=retbr,comdat,r 2>&1 | \
81 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
83 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=none,comdat 2>&1 | \
84 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
85 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=none,comdat 2>&1 | \
86 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
88 // RUN: %clang -target aarch64--none-eabi -c %s -### -mharden-sls=all,-comdat 2>&1 | \
89 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
90 // RUN: %clang -target armv7a--none-eabi -c %s -### -mharden-sls=all,-comdat 2>&1 | \
91 // RUN: FileCheck %s --check-prefix=BAD-SLS-SPEC
93 // RETBR-OFF-NOT: "harden-sls-retbr"
94 // RETBR-ON: "+harden-sls-retbr"
96 // BLR-OFF-NOT: "harden-sls-blr"
97 // BLR-ON: "+harden-sls-blr"
99 // NOCOMDAT-OFF-NOT: "harden-sls-nocomdat"
100 // NOCOMDAT: "+harden-sls-nocomdat"
102 // BAD-SLS-SPEC: unsupported argument '{{[^']+}}' to option '-mharden-sls='
104 // RUN: %clang -target armv6a--none-eabi -c %s -### -mharden-sls=all 2>&1 | \
105 // RUN: FileCheck %s --check-prefix=SLS-NOT-SUPPORTED
107 // RUN: %clang -target armv6a--none-eabi -c %s -### -mharden-sls=retbr 2>&1 | \
108 // RUN: FileCheck %s --check-prefix=SLS-NOT-SUPPORTED
110 // RUN: %clang -target armv6a--none-eabi -c %s -### -mharden-sls=blr 2>&1 | \
111 // RUN: FileCheck %s --check-prefix=SLS-NOT-SUPPORTED
113 // RUN: %clang -target armv7r--none-eabi -c %s -### -mharden-sls=all 2>&1 | \
114 // RUN: FileCheck %s --check-prefix=SLS-NOT-SUPPORTED
116 // RUN: %clang -target armv7m--none-eabi -c %s -### -mharden-sls=all 2>&1 | \
117 // RUN: FileCheck %s --check-prefix=SLS-NOT-SUPPORTED
119 // RUN: %clang -target armv6a--none-eabi -c %s -### -mharden-sls=none 2>&1 | \
120 // RUN: FileCheck %s --check-prefix=SLS-SUPPORTED
122 // RUN: %clang -target armv7a-linux-gnueabihf -c %s -### -mharden-sls=all 2>&1 | \
123 // RUN: FileCheck %s --check-prefix=SLS-SUPPORTED
125 // RUN: %clang -target armv8a-linux-gnueabihf -c %s -### -mharden-sls=all 2>&1 | \
126 // RUN: FileCheck %s --check-prefix=SLS-SUPPORTED
128 // SLS-NOT-SUPPORTED: -mharden-sls is only supported on armv7-a or later
129 // SLS-SUPPORTED-NOT: mharden-sls