]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/COFF/unwind.test
Vendor import of lld trunk r338150:
[FreeBSD/FreeBSD.git] / test / COFF / unwind.test
1 # RUN: yaml2obj < %s > %t.obj
2 #
3 # RUN: lld-link /out:%t.exe /entry:main %t.obj
4 # RUN: llvm-readobj -file-headers %t.exe | FileCheck -check-prefix=HEADER %s
5 # RUN: llvm-objdump -unwind-info %t.exe | FileCheck -check-prefix=UNWIND %s
6 #
7 # RUN: lld-link /merge:.pdata=.rdata /out:%t.exe /entry:main %t.obj
8 # RUN: llvm-readobj -file-headers -sections %t.exe | FileCheck -check-prefix=HEADER-MERGE %s
9 #
10 # HEADER: ExceptionTableRVA: 0x3000
11 #
12 # FIXME: llvm-readobj currently does not understand files with .pdata merged
13 # into .rdata. But we can at least check that the section headers look correct.
14 #
15 # HEADER-MERGE: ExceptionTableRVA: 0x2004
16 # HEADER-MERGE-NEXT: ExceptionTableSize: 0x30
17 # HEADER-MERGE: Name: .rdata
18 # HEADER-MERGE-NEXT: VirtualSize: 0x78
19 # HEADER-MERGE-NEXT: VirtualAddress: 0x2000
20 #
21 # UNWIND: Function Table:
22 # UNWIND:   Start Address: 0x1000
23 # UNWIND:   End Address: 0x101b
24 # UNWIND:   Unwind Info Address: 0x2004
25 # UNWIND:     Version: 1
26 # UNWIND:     Flags: 1 UNW_ExceptionHandler
27 # UNWIND:     Size of prolog: 18
28 # UNWIND:     Number of Codes: 8
29 # UNWIND:     Frame register: RBX
30 # UNWIND:     Frame offset: 0
31 # UNWIND:     Unwind Codes:
32 # UNWIND:       0x12: UOP_SetFPReg
33 # UNWIND:       0x0f: UOP_PushNonVol RBX
34 # UNWIND:       0x0e: UOP_SaveXMM128 XMM8 [0x0000]
35 # UNWIND:       0x09: UOP_SaveNonVol RSI [0x0010]
36 # UNWIND:       0x04: UOP_AllocSmall 24
37 # UNWIND:       0x00: UOP_PushMachFrame w/o error code
38 # UNWIND: Function Table:
39 # UNWIND:   Start Address: 0x1012
40 # UNWIND:   End Address: 0x1012
41 # UNWIND:   Unwind Info Address: 0x2020
42 # UNWIND:     Version: 1
43 # UNWIND:     Flags: 4 UNW_ChainInfo
44 # UNWIND:     Size of prolog: 0
45 # UNWIND:     Number of Codes: 0
46 # UNWIND:     No frame pointer used
47 # UNWIND: Function Table:
48 # UNWIND:   Start Address: 0x101b
49 # UNWIND:   End Address: 0x101c
50 # UNWIND:   Unwind Info Address: 0x2030
51 # UNWIND:     Version: 1
52 # UNWIND:     Flags: 0
53 # UNWIND:     Size of prolog: 0
54 # UNWIND:     Number of Codes: 0
55 # UNWIND:     No frame pointer used
56 # UNWIND: Function Table:
57 # UNWIND:   Start Address: 0x101c
58 # UNWIND:   End Address: 0x1039
59 # UNWIND:   Unwind Info Address: 0x2038
60 # UNWIND:     Version: 1
61 # UNWIND:     Flags: 0
62 # UNWIND:     Size of prolog: 14
63 # UNWIND:     Number of Codes: 6
64 # UNWIND:     No frame pointer used
65 # UNWIND:     Unwind Codes:
66 # UNWIND:       0x0e: UOP_AllocLarge 8454128
67 # UNWIND:       0x07: UOP_AllocLarge 8190
68 # UNWIND:       0x00: UOP_PushMachFrame w/o error code
69
70 --- !COFF
71 header:
72   Machine:         IMAGE_FILE_MACHINE_AMD64
73   Characteristics: [  ]
74 sections:
75   - Name:            .text
76     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
77     Alignment:       4
78     SectionData:     4883EC184889742410440F110424534889E3488D235B4883C418C3C34881ECF0FF00004881ECF0FF80004881C4F0FF80004881C4F0FF0000C3
79   - Name:            .xdata
80     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
81     Alignment:       4
82     SectionData:     0912080312030F300E880000096402000422001A000000000000000021000000000000001B000000000000000100000000000000010E06000E11F0FF80000701FE1F001A
83     Relocations:
84       - VirtualAddress:  20
85         SymbolName:      __C_specific_handler
86         Type:            IMAGE_REL_AMD64_ADDR32NB
87       - VirtualAddress:  32
88         SymbolName:      func
89         Type:            IMAGE_REL_AMD64_ADDR32NB
90       - VirtualAddress:  36
91         SymbolName:      func
92         Type:            IMAGE_REL_AMD64_ADDR32NB
93       - VirtualAddress:  40
94         SymbolName:      .xdata
95         Type:            IMAGE_REL_AMD64_ADDR32NB
96   - Name:            .pdata
97     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
98     Alignment:       4
99     SectionData:     000000001B0000000000000012000000120000001C00000000000000010000002C000000000000001D00000034000000
100     Relocations:
101       - VirtualAddress:  0
102         SymbolName:      func
103         Type:            IMAGE_REL_AMD64_ADDR32NB
104       - VirtualAddress:  4
105         SymbolName:      func
106         Type:            IMAGE_REL_AMD64_ADDR32NB
107       - VirtualAddress:  8
108         SymbolName:      .xdata
109         Type:            IMAGE_REL_AMD64_ADDR32NB
110       - VirtualAddress:  12
111         SymbolName:      func
112         Type:            IMAGE_REL_AMD64_ADDR32NB
113       - VirtualAddress:  16
114         SymbolName:      func
115         Type:            IMAGE_REL_AMD64_ADDR32NB
116       - VirtualAddress:  20
117         SymbolName:      .xdata
118         Type:            IMAGE_REL_AMD64_ADDR32NB
119       - VirtualAddress:  24
120         SymbolName:      smallFunc
121         Type:            IMAGE_REL_AMD64_ADDR32NB
122       - VirtualAddress:  28
123         SymbolName:      smallFunc
124         Type:            IMAGE_REL_AMD64_ADDR32NB
125       - VirtualAddress:  32
126         SymbolName:      .xdata
127         Type:            IMAGE_REL_AMD64_ADDR32NB
128       - VirtualAddress:  36
129         SymbolName:      allocFunc
130         Type:            IMAGE_REL_AMD64_ADDR32NB
131       - VirtualAddress:  40
132         SymbolName:      allocFunc
133         Type:            IMAGE_REL_AMD64_ADDR32NB
134       - VirtualAddress:  44
135         SymbolName:      .xdata
136         Type:            IMAGE_REL_AMD64_ADDR32NB
137   - Name:            .rdata
138     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
139     Alignment:       4
140     SectionData:     00000000
141 symbols:
142   - Name:            .text
143     Value:           0
144     SectionNumber:   1
145     SimpleType:      IMAGE_SYM_TYPE_NULL
146     ComplexType:     IMAGE_SYM_DTYPE_NULL
147     StorageClass:    IMAGE_SYM_CLASS_STATIC
148     SectionDefinition:
149       Length:          57
150       NumberOfRelocations: 0
151       NumberOfLinenumbers: 0
152       CheckSum:        0
153       Number:          1
154   - Name:            .xdata
155     Value:           0
156     SectionNumber:   2
157     SimpleType:      IMAGE_SYM_TYPE_NULL
158     ComplexType:     IMAGE_SYM_DTYPE_NULL
159     StorageClass:    IMAGE_SYM_CLASS_STATIC
160     SectionDefinition:
161       Length:          68
162       NumberOfRelocations: 4
163       NumberOfLinenumbers: 0
164       CheckSum:        0
165       Number:          2
166   - Name:            .pdata
167     Value:           0
168     SectionNumber:   3
169     SimpleType:      IMAGE_SYM_TYPE_NULL
170     ComplexType:     IMAGE_SYM_DTYPE_NULL
171     StorageClass:    IMAGE_SYM_CLASS_STATIC
172     SectionDefinition:
173       Length:          48
174       NumberOfRelocations: 12
175       NumberOfLinenumbers: 0
176       CheckSum:        0
177       Number:          3
178   - Name:            func
179     Value:           0
180     SectionNumber:   1
181     SimpleType:      IMAGE_SYM_TYPE_NULL
182     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
183     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
184   - Name:            __C_specific_handler
185     Value:           0
186     SectionNumber:   0
187     SimpleType:      IMAGE_SYM_TYPE_NULL
188     ComplexType:     IMAGE_SYM_DTYPE_NULL
189     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
190   - Name:            smallFunc
191     Value:           27
192     SectionNumber:   1
193     SimpleType:      IMAGE_SYM_TYPE_NULL
194     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
195     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
196   - Name:            allocFunc
197     Value:           28
198     SectionNumber:   1
199     SimpleType:      IMAGE_SYM_TYPE_NULL
200     ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
201     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
202   - Name:            main
203     Value:           0
204     SectionNumber:   1
205     SimpleType:      IMAGE_SYM_TYPE_NULL
206     ComplexType:     IMAGE_SYM_DTYPE_NULL
207     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
208   - Name:            __C_specific_handler
209     Value:           0
210     SectionNumber:   1
211     SimpleType:      IMAGE_SYM_TYPE_NULL
212     ComplexType:     IMAGE_SYM_DTYPE_NULL
213     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
214 ...