1 /* { dg-do "compile" } */
2 /* { dg-options "-O1" } */
3 /* { dg-final { check-function-bodies "**" "" } } */
4
5 /* Note: this test only checks the instructions in the function bodies,
6 not the placement of the patch label or nops before the futncion. */
7
8 /*
9 **f10_none:
10 ** nop
11 ** ret
12 */
13 void
14 __attribute__ ((target("branch-protection=none"),
15 patchable_function_entry (1, 0)))
16 f10_none ()
17 {
18 }
19
20 /*
21 **f10_pac:
22 ** hint 34 // bti c
23 ** nop
24 ** hint 25 // paciasp
25 ** hint 29 // autiasp
26 ** ret
27 */
28 void
29 __attribute__ ((target("branch-protection=bti+pac-ret+leaf"),
30 patchable_function_entry (1, 0)))
31 f10_pac ()
32 {
33 }
34
35 /*
36 **f10_bti:
37 ** hint 34 // bti c
38 ** nop
39 ** ret
40 */
41 void
42 __attribute__ ((target("branch-protection=bti"),
43 patchable_function_entry (1, 0)))
44 f10_bti ()
45 {
46 }
47
48 /*
49 **f11_none:
50 ** ret
51 */
52 void
53 __attribute__ ((target("branch-protection=none"),
54 patchable_function_entry (1, 1)))
55 f11_none ()
56 {
57 }
58
59 /*
60 **f11_pac:
61 ** hint 25 // paciasp
62 ** hint 29 // autiasp
63 ** ret
64 */
65 void
66 __attribute__ ((target("branch-protection=bti+pac-ret+leaf"),
67 patchable_function_entry (1, 1)))
68 f11_pac ()
69 {
70 }
71
72 /*
73 **f11_bti:
74 ** hint 34 // bti c
75 ** ret
76 */
77 void
78 __attribute__ ((target("branch-protection=bti"),
79 patchable_function_entry (1, 1)))
80 f11_bti ()
81 {
82 }
83
84 /*
85 **f21_none:
86 ** nop
87 ** ret
88 */
89 void
90 __attribute__ ((target("branch-protection=none"),
91 patchable_function_entry (2, 1)))
92 f21_none ()
93 {
94 }
95
96 /*
97 **f21_pac:
98 ** hint 34 // bti c
99 ** nop
100 ** hint 25 // paciasp
101 ** hint 29 // autiasp
102 ** ret
103 */
104 void
105 __attribute__ ((target("branch-protection=bti+pac-ret+leaf"),
106 patchable_function_entry (2, 1)))
107 f21_pac ()
108 {
109 }
110
111 /*
112 **f21_bti:
113 ** hint 34 // bti c
114 ** nop
115 ** ret
116 */
117 void
118 __attribute__ ((target("branch-protection=bti"),
119 patchable_function_entry (2, 1)))
120 f21_bti ()
121 {
122 }