1 /* { dg-do run { target { *-*-linux* && { ! ia32 } } } } */
2 /* { dg-options "-fexceptions -fnon-call-exceptions -fasynchronous-unwind-tables -O2" } */
3 /* Test complex CFA value expressions. */
12 static _Unwind_Reason_Code
13 force_unwind_stop (int version
, _Unwind_Action actions
,
14 _Unwind_Exception_Class exc_class
,
15 struct _Unwind_Exception
*exc_obj
,
16 struct _Unwind_Context
*context
,
19 if (actions
& _UA_END_OF_STACK
)
21 return _URC_NO_REASON
;
27 struct _Unwind_Exception
*exc
= malloc (sizeof (*exc
));
28 memset (&exc
->exception_class
, 0, sizeof (exc
->exception_class
));
29 exc
->exception_cleanup
= 0;
31 _Unwind_ForcedUnwind (exc
, force_unwind_stop
, 0);
38 counter (void *p
__attribute__((unused
)))
44 handler (void *p
__attribute__((unused
)))
52 __attribute__((noinline
))
59 static int __attribute__((noinline
))
62 char dummy
__attribute__((cleanup (counter
)));
70 char dummy
__attribute__((cleanup (counter
)));
71 unsigned long tmp
[4] __attribute__((aligned(16)));
72 check ((intptr_t) tmp
);
76 void __attribute__((noinline
))
85 ".type _L_mutex_lock_%=, @function\n"
87 "1:\t" "leaq %1, %%rdi\n"
88 "2:\t" "subq $136, %%rsp\n"
90 "4:\t" "addq $136, %%rsp\n"
92 "6:\t" ".size _L_mutex_lock_%=, .-_L_mutex_lock_%=\n\t"
94 ".section .eh_frame,\"a\",@progbits\n"
95 "7:\t" ".long 9f-8f # Length of Common Information Entry\n"
96 "8:\t" ".long 0x0 # CIE Identifier Tag\n\t"
97 ".byte 0x1 # CIE Version\n\t"
98 ".ascii \"zR\\0\" # CIE Augmentation\n\t"
99 ".uleb128 0x1 # CIE Code Alignment Factor\n\t"
100 ".sleb128 -8 # CIE Data Alignment Factor\n\t"
101 ".byte 0x10 # CIE RA Column\n\t"
102 ".uleb128 0x1 # Augmentation size\n\t"
103 ".byte 0x1b # FDE Encoding (pcrel sdata4)\n\t"
104 ".byte 0xc # DW_CFA_def_cfa\n\t"
108 "9:\t" ".long 20f-10f # FDE Length\n"
109 "10:\t" ".long 10b-7b # FDE CIE offset\n\t"
110 ".long 1b-. # FDE initial location\n\t"
111 ".long 6b-1b # FDE address range\n\t"
112 ".uleb128 0x0 # Augmentation size\n\t"
113 /* This CFA expression computes the address right
114 past the jnz instruction above, from %rip somewhere
115 within the _L_mutex_lock_%= subsection. */
116 ".byte 0x16 # DW_CFA_val_expression\n\t"
119 "11:\t" ".byte 0x80 # DW_OP_breg16\n\t"
121 "12:\t" ".byte 0x12 # DW_OP_dup\n\t"
122 ".byte 0x94 # DW_OP_deref_size\n\t"
124 ".byte 0x12 # DW_OP_dup\n\t"
125 ".byte 0x08 # DW_OP_const1u\n\t"
127 ".byte 0x2e # DW_OP_ne\n\t"
128 ".byte 0x28 # DW_OP_bra\n\t"
130 "13:\t" ".byte 0x13 # DW_OP_drop\n\t"
131 ".byte 0x23 # DW_OP_plus_uconst\n\t"
133 ".byte 0x12 # DW_OP_dup\n\t"
134 ".byte 0x94 # DW_OP_deref_size\n\t"
136 ".byte 0x08 # DW_OP_const1u\n\t"
138 ".byte 0x2e # DW_OP_ne\n\t"
139 ".byte 0x28 # DW_OP_bra\n\t"
141 "14:\t" ".byte 0x23 # DW_OP_plus_uconst\n\t"
142 ".uleb128 3b-2b-1\n\t"
143 ".byte 0x2f # DW_OP_skip\n\t"
145 "15:\t" ".byte 0x23 # DW_OP_plus_uconst\n\t"
146 ".uleb128 2b-1b-1\n\t"
147 ".byte 0x2f # DW_OP_skip\n\t"
149 "16:\t" ".byte 0x08 # DW_OP_const1u\n\t"
151 ".byte 0x2e # DW_OP_ne\n\t"
152 ".byte 0x28 # DW_OP_bra\n\t"
154 "17:\t" ".byte 0x23 # DW_OP_plus_uconst\n\t"
156 ".byte 0x2f # DW_OP_skip\n\t"
158 "18:\t" ".byte 0x23 # DW_OP_plus_uconst\n\t"
160 ".byte 0x12 # DW_OP_dup\n\t"
161 ".byte 0x94 # DW_OP_deref_size\n\t"
163 ".byte 0x08 # DW_OP_const1u\n\t"
164 ".byte 72 - (6b-5b) * 8 # (6b-5b) == 5 ? 32 : 56\n\t"
165 ".byte 0x24 # DW_OP_shl\n\t"
166 ".byte 0x08 # DW_OP_const1u\n\t"
167 ".byte 72 - (6b-5b) * 8 # (6b-5b) == 5 ? 32 : 56\n\t"
168 ".byte 0x26 # DW_OP_shra\n\t"
169 ".byte 0x22 # DW_OP_plus\n\t"
170 ".byte 0x23 # DW_OP_plus_uconst\n\t"
172 "19:\t" ".byte 0x40 + (3b-1b) # DW_CFA_advance_loc\n\t"
173 ".byte 0xe # DW_CFA_def_cfa_offset\n\t"
175 ".byte 0x40 + (5b-3b) # DW_CFA_advance_loc\n\t"
176 ".byte 0xe # DW_CFA_def_cfa_offset\n\t"
179 "20:\t" ".previous\n"
181 : : "r" (x
), "m" (x
), "r" (buf
)
182 : "memory", "rax", "rdx", "rcx", "rsi", "rdi",
183 "r8", "r9", "r10", "r11");
185 # error Unsupported test architecture
189 static int __attribute__((noinline
))
196 static int __attribute__((noinline
))
206 char dummy
__attribute__((cleanup (handler
)));