1 @ RUN: llvm-mc %s -triple=armv7-unknown-linux-gnueabi -filetype=obj -o - \
2 @ RUN: | llvm-readobj -s -sd | FileCheck %s
4 @ Check for .setfp directive.
6 @ The .setfp directive will track the offset between the frame pointer and
7 @ the stack pointer. This is required for the function that will change
8 @ the stack pointer out of the function prologue. If the exception is thrown,
9 @ then libunwind will reconstruct the stack pointer from the frame pointer.
10 @ The reconstruction code is implemented by two different unwind opcode:
11 @ (i) the unwind opcode to copy stack offset from the other register, and
12 @ (ii) the unwind opcode to add or subtract the stack offset.
14 @ This file includes several cases separated by different range of -offset
18 @ 0x04 <= (-offset) <= 0x100
19 @ 0x104 <= (-offset) <= 0x200
25 @-------------------------------------------------------------------------------
27 @-------------------------------------------------------------------------------
38 .personality __gxx_personality_v0
42 @-------------------------------------------------------------------------------
43 @ The assembler should emit 0x9B to copy stack pointer from r11.
44 @-------------------------------------------------------------------------------
46 @ CHECK: Name: .ARM.extab.TEST1
47 @ CHECK: SectionData (
48 @ CHECK: 0000: 00000000 B0B09B00 |........|
54 @-------------------------------------------------------------------------------
56 @-------------------------------------------------------------------------------
60 .type func2a,%function
67 .personality __gxx_personality_v0
73 .type func2b,%function
76 .setfp fp, sp, #-0x100
80 .personality __gxx_personality_v0
84 @-------------------------------------------------------------------------------
85 @ The assembler should emit 0x9B to copy stack pointer from r11.
86 @ The assembler should emit ((-offset - 4) >> 2) for offset.
87 @-------------------------------------------------------------------------------
89 @ CHECK: Name: .ARM.extab.TEST2
90 @ CHECK: SectionData (
91 @ CHECK: 0000: 00000000 B0009B00 00000000 B03F9B00 |.............?..|
97 @-------------------------------------------------------------------------------
99 @-------------------------------------------------------------------------------
103 .type func3a,%function
106 .setfp fp, sp, #-0x104
110 .personality __gxx_personality_v0
116 .type func3b,%function
119 .setfp fp, sp, #-0x200
123 .personality __gxx_personality_v0
127 @-------------------------------------------------------------------------------
128 @ The assembler should emit 0x9B to copy stack pointer from r11.
129 @ The assembler should emit 0x3F and ((-offset - 0x104) >> 2) for offset.
130 @-------------------------------------------------------------------------------
132 @ CHECK: Name: .ARM.extab.TEST3
133 @ CHECK: SectionData (
134 @ CHECK: 0000: 00000000 3F009B00 00000000 3F3F9B00 |....?.......??..|
140 @-------------------------------------------------------------------------------
142 @-------------------------------------------------------------------------------
146 .type func4a,%function
149 .setfp fp, sp, #-0x204
153 .personality __gxx_personality_v0
159 .type func4b,%function
162 .setfp fp, sp, #-0x580
166 .personality __gxx_personality_v0
170 @-------------------------------------------------------------------------------
171 @ The assembler should emit 0x9B to copy stack pointer from r11.
172 @ The assembler should emit 0xB2 and the ULEB128 encoding of
173 @ ((-offset - 0x204) >> 2) for offset.
174 @-------------------------------------------------------------------------------
176 @ CHECK: Name: .ARM.extab.TEST4
177 @ CHECK: SectionData (
178 @ CHECK: 0000: 00000000 00B29B00 00000000 DFB29B01 |................|
179 @ CHECK: 0010: B0B0B001 |....|
185 @-------------------------------------------------------------------------------
187 @-------------------------------------------------------------------------------
191 .type func5a,%function
198 .personality __gxx_personality_v0
204 .type func5b,%function
207 .setfp fp, sp, #0x104
211 .personality __gxx_personality_v0
217 .type func5c,%function
220 .setfp fp, sp, #0x204
224 .personality __gxx_personality_v0
228 @-------------------------------------------------------------------------------
229 @ The assembler should emit 0x9B to copy stack pointer from r11.
230 @ The assembler should emit (0x40 | (offset - 4)) >> 2 for offset.
231 @ If (offset - 4) is greater than 0x3f, then multiple 0x7f should be emitted.
232 @-------------------------------------------------------------------------------
234 @ CHECK: Name: .ARM.extab.TEST5
235 @ CHECK: SectionData (
236 @ CHECK: 0000: 00000000 B0409B00 00000000 7F409B00 |.....@.......@..|
237 @ CHECK: 0010: 00000000 7F409B01 B0B0B07F |.....@......|