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

--- !COFF
header:
  Machine:         IMAGE_FILE_MACHINE_AMD64
  Characteristics: [  ]
sections:
  - Name:            .text
    Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
    Alignment:       4
    SectionData:     4883EC184889742410440F110424534889E3488D235B4883C418C3C34881ECF0FF00004881ECF0FF80004881C4F0FF80004881C4F0FF0000C3
  - Name:            .xdata
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
    Alignment:       4
    SectionData:     0912080312030F300E880000096402000422001A000000000000000021000000000000001B000000000000000100000000000000010E06000E11F0FF80000701FE1F001A
    Relocations:
      - VirtualAddress:  20
        SymbolName:      __C_specific_handler
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  32
        SymbolName:      func
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  36
        SymbolName:      func
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  40
        SymbolName:      .xdata
        Type:            IMAGE_REL_AMD64_ADDR32NB
  - Name:            .pdata
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
    Alignment:       4
    SectionData:     000000001B0000000000000012000000120000001C00000000000000010000002C000000000000001D00000034000000
    Relocations:
      - VirtualAddress:  0
        SymbolName:      func
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  4
        SymbolName:      func
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  8
        SymbolName:      .xdata
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  12
        SymbolName:      func
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  16
        SymbolName:      func
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  20
        SymbolName:      .xdata
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  24
        SymbolName:      smallFunc
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  28
        SymbolName:      smallFunc
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  32
        SymbolName:      .xdata
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  36
        SymbolName:      allocFunc
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  40
        SymbolName:      allocFunc
        Type:            IMAGE_REL_AMD64_ADDR32NB
      - VirtualAddress:  44
        SymbolName:      .xdata
        Type:            IMAGE_REL_AMD64_ADDR32NB
  - Name:            .rdata
    Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
    Alignment:       4
    SectionData:     00000000
symbols:
  - Name:            .text
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          57
      NumberOfRelocations: 0
      NumberOfLinenumbers: 0
      CheckSum:        0
      Number:          1
  - Name:            .xdata
    Value:           0
    SectionNumber:   2
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          68
      NumberOfRelocations: 4
      NumberOfLinenumbers: 0
      CheckSum:        0
      Number:          2
  - Name:            .pdata
    Value:           0
    SectionNumber:   3
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_STATIC
    SectionDefinition:
      Length:          48
      NumberOfRelocations: 12
      NumberOfLinenumbers: 0
      CheckSum:        0
      Number:          3
  - Name:            func
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            __C_specific_handler
    Value:           0
    SectionNumber:   0
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            smallFunc
    Value:           27
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            allocFunc
    Value:           28
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_FUNCTION
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            main
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
  - Name:            __C_specific_handler
    Value:           0
    SectionNumber:   1
    SimpleType:      IMAGE_SYM_TYPE_NULL
    ComplexType:     IMAGE_SYM_DTYPE_NULL
    StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
...