• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This test checks that the SEH directives emit the correct unwind data.
2// RUN: llvm-mc -triple x86_64-pc-win32 -filetype=obj %s | coff-dump.py | FileCheck %s
3
4// CHECK:      Name                 = .xdata
5// CHECK-NEXT: VirtualSize
6// CHECK-NEXT: VirtualAddress
7// CHECK-NEXT: SizeOfRawData        = 52
8// CHECK-NEXT: PointerToRawData
9// CHECK-NEXT: PointerToRelocations
10// CHECK-NEXT: PointerToLineNumbers
11// CHECK-NEXT: NumberOfRelocations  = 4
12// CHECK-NEXT: NumberOfLineNumbers  = 0
13// CHECK-NEXT: Charateristics
14// CHECK-NEXT:   IMAGE_SCN_CNT_INITIALIZED_DATA
15// CHECK-NEXT:   IMAGE_SCN_ALIGN_4BYTES
16// CHECK-NEXT:   IMAGE_SCN_MEM_READ
17// CHECK-NEXT: SectionData
18// CHECK-NEXT:   09 12 08 03 00 03 0F 30 - 0E 88 00 00 09 64 02 00
19// CHECK-NEXT:   04 22 00 1A 00 00 00 00 - 00 00 00 00 21 00 00 00
20// CHECK-NEXT:   00 00 00 00 1B 00 00 00 - 00 00 00 00 01 00 00 00
21// CHECK-NEXT:   00 00 00 00
22
23    .text
24    .globl func
25    .def func; .scl 2; .type 32; .endef
26    .seh_proc func
27func:
28    .seh_pushframe @code
29    subq $24, %rsp
30    .seh_stackalloc 24
31    movq %rsi, 16(%rsp)
32    .seh_savereg %rsi, 16
33    movups %xmm8, (%rsp)
34    .seh_savexmm %xmm8, 0
35    pushq %rbx
36    .seh_pushreg 3
37    mov %rsp, %rbx
38    .seh_setframe 3, 0
39    .seh_endprologue
40    .seh_handler __C_specific_handler, @except
41    .seh_handlerdata
42    .long 0
43    .text
44    .seh_startchained
45    .seh_endprologue
46    .seh_endchained
47    lea (%rbx), %rsp
48    pop %rbx
49    addq $24, %rsp
50    ret
51    .seh_endproc
52
53// Test emission of small functions.
54    .globl smallFunc
55    .def smallFunc; .scl 2; .type 32; .endef
56    .seh_proc smallFunc
57smallFunc:
58    ret
59    .seh_endproc
60