Fix Windows unwind info for functions in sections other than .text
[opencl/llvm.git] / test / MC / COFF / seh-section.s
1 // This test ensures functions in custom sections get unwind info emitted in a
2 // distinct .xdata section. Ideally we'd just emit a second .xdata section with
3 // the same name and characteristics, but MC uniques sections by name and
4 // characteristics, so that is not possible.
5 // RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -s -sd | FileCheck %s
7 // CHECK:      Name: .xdata$foo
8 // CHECK-NEXT: VirtualSize
9 // CHECK-NEXT: VirtualAddress
10 // CHECK-NEXT: RawDataSize: 8
11 // CHECK-NEXT: PointerToRawData
12 // CHECK-NEXT: PointerToRelocations
13 // CHECK-NEXT: PointerToLineNumbers
14 // CHECK-NEXT: RelocationCount: 0
15 // CHECK-NEXT: LineNumberCount: 0
16 // CHECK-NEXT: Characteristics [
17 // CHECK-NEXT:   IMAGE_SCN_ALIGN_4BYTES
18 // CHECK-NEXT:   IMAGE_SCN_CNT_INITIALIZED_DATA
19 // CHECK-NEXT:   IMAGE_SCN_MEM_READ
20 // CHECK-NEXT: ]
21 // CHECK-NEXT: SectionData (
22 // CHECK-NEXT:   0000: 01050200 05500402
23 // CHECK-NEXT: )
25 // CHECK:      Name: .xdata$.mytext
26 // CHECK-NEXT: VirtualSize
27 // CHECK-NEXT: VirtualAddress
28 // CHECK-NEXT: RawDataSize: 8
29 // CHECK-NEXT: PointerToRawData
30 // CHECK-NEXT: PointerToRelocations
31 // CHECK-NEXT: PointerToLineNumbers
32 // CHECK-NEXT: RelocationCount: 0
33 // CHECK-NEXT: LineNumberCount: 0
34 // CHECK-NEXT: Characteristics [
35 // CHECK-NEXT:   IMAGE_SCN_ALIGN_4BYTES
36 // CHECK-NEXT:   IMAGE_SCN_CNT_INITIALIZED_DATA
37 // CHECK-NEXT:   IMAGE_SCN_MEM_READ
38 // CHECK-NEXT: ]
39 // CHECK-NEXT: SectionData (
40 // CHECK-NEXT:   0000: 01050200 05500402
41 // CHECK-NEXT: )
43 // CHECK:      Name: .xdata
44 // CHECK-NEXT: VirtualSize
45 // CHECK-NEXT: VirtualAddress
46 // CHECK-NEXT: RawDataSize: 8
47 // CHECK-NEXT: PointerToRawData
48 // CHECK-NEXT: PointerToRelocations
49 // CHECK-NEXT: PointerToLineNumbers
50 // CHECK-NEXT: RelocationCount: 0
51 // CHECK-NEXT: LineNumberCount: 0
52 // CHECK-NEXT: Characteristics [
53 // CHECK-NEXT:   IMAGE_SCN_ALIGN_4BYTES
54 // CHECK-NEXT:   IMAGE_SCN_CNT_INITIALIZED_DATA
55 // CHECK-NEXT:   IMAGE_SCN_MEM_READ
56 // CHECK-NEXT: ]
57 // CHECK-NEXT: SectionData (
58 // CHECK-NEXT:   0000: 01050200 05500402
59 // CHECK-NEXT: )
63     .section .text$foo,"x"
64     .globl foo
65     .def foo; .scl 2; .type 32; .endef
66     .seh_proc foo
67 foo:
68     subq $8, %rsp
69     .seh_stackalloc 8
70     pushq %rbp
71     .seh_pushreg %rbp
72     .seh_endprologue
73     popq %rbp
74     addq $8, %rsp
75     ret
76     .seh_endproc
78     .section .mytext,"x"
79     .globl bar
80     .def bar; .scl 2; .type 32; .endef
81     .seh_proc bar
82 bar:
83     subq $8, %rsp
84     .seh_stackalloc 8
85     pushq %rbp
86     .seh_pushreg %rbp
87     .seh_endprologue
88     popq %rbp
89     addq $8, %rsp
90     ret
91     .seh_endproc
93     .section .text
94     .globl baz
95     .def baz; .scl 2; .type 32; .endef
96     .seh_proc baz
97 baz:
98     subq $8, %rsp
99     .seh_stackalloc 8
100     pushq %rbp
101     .seh_pushreg %rbp
102     .seh_endprologue
103     popq %rbp
104     addq $8, %rsp
105     ret
106     .seh_endproc