xref: /aosp_15_r20/external/llvm/test/MC/COFF/seh-section.s (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker// This test ensures functions in custom sections get unwind info emitted in a
2*9880d681SAndroid Build Coastguard Worker// distinct .xdata section.
3*9880d681SAndroid Build Coastguard Worker// RUN: llvm-mc -filetype=obj -triple x86_64-pc-win32 %s | llvm-readobj -s -sd | FileCheck %s
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker// CHECK:      Name: .xdata
6*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: VirtualSize
7*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: VirtualAddress
8*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: RawDataSize: 8
9*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToRawData
10*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToRelocations
11*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToLineNumbers
12*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: RelocationCount: 0
13*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: LineNumberCount: 0
14*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: Characteristics [
15*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_ALIGN_4BYTES
16*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_CNT_INITIALIZED_DATA
17*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_MEM_READ
18*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: ]
19*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: SectionData (
20*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   0000: 01050200 05500402
21*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: )
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker// CHECK:      Name: .xdata
24*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: VirtualSize
25*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: VirtualAddress
26*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: RawDataSize: 8
27*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToRawData
28*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToRelocations
29*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToLineNumbers
30*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: RelocationCount: 0
31*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: LineNumberCount: 0
32*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: Characteristics [
33*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_ALIGN_4BYTES
34*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_CNT_INITIALIZED_DATA
35*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_MEM_READ
36*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: ]
37*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: SectionData (
38*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   0000: 01050200 05500402
39*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: )
40*9880d681SAndroid Build Coastguard Worker
41*9880d681SAndroid Build Coastguard Worker// CHECK:      Name: .xdata
42*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: VirtualSize
43*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: VirtualAddress
44*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: RawDataSize: 8
45*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToRawData
46*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToRelocations
47*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: PointerToLineNumbers
48*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: RelocationCount: 0
49*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: LineNumberCount: 0
50*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: Characteristics [
51*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_ALIGN_4BYTES
52*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_CNT_INITIALIZED_DATA
53*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   IMAGE_SCN_MEM_READ
54*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: ]
55*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: SectionData (
56*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT:   0000: 01050200 05500402
57*9880d681SAndroid Build Coastguard Worker// CHECK-NEXT: )
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker    .section .text$foo,"x"
62*9880d681SAndroid Build Coastguard Worker    .globl foo
63*9880d681SAndroid Build Coastguard Worker    .def foo; .scl 2; .type 32; .endef
64*9880d681SAndroid Build Coastguard Worker    .seh_proc foo
65*9880d681SAndroid Build Coastguard Workerfoo:
66*9880d681SAndroid Build Coastguard Worker    subq $8, %rsp
67*9880d681SAndroid Build Coastguard Worker    .seh_stackalloc 8
68*9880d681SAndroid Build Coastguard Worker    pushq %rbp
69*9880d681SAndroid Build Coastguard Worker    .seh_pushreg %rbp
70*9880d681SAndroid Build Coastguard Worker    .seh_endprologue
71*9880d681SAndroid Build Coastguard Worker    popq %rbp
72*9880d681SAndroid Build Coastguard Worker    addq $8, %rsp
73*9880d681SAndroid Build Coastguard Worker    ret
74*9880d681SAndroid Build Coastguard Worker    .seh_endproc
75*9880d681SAndroid Build Coastguard Worker
76*9880d681SAndroid Build Coastguard Worker    .section .mytext,"x"
77*9880d681SAndroid Build Coastguard Worker    .globl bar
78*9880d681SAndroid Build Coastguard Worker    .def bar; .scl 2; .type 32; .endef
79*9880d681SAndroid Build Coastguard Worker    .seh_proc bar
80*9880d681SAndroid Build Coastguard Workerbar:
81*9880d681SAndroid Build Coastguard Worker    subq $8, %rsp
82*9880d681SAndroid Build Coastguard Worker    .seh_stackalloc 8
83*9880d681SAndroid Build Coastguard Worker    pushq %rbp
84*9880d681SAndroid Build Coastguard Worker    .seh_pushreg %rbp
85*9880d681SAndroid Build Coastguard Worker    .seh_endprologue
86*9880d681SAndroid Build Coastguard Worker    popq %rbp
87*9880d681SAndroid Build Coastguard Worker    addq $8, %rsp
88*9880d681SAndroid Build Coastguard Worker    ret
89*9880d681SAndroid Build Coastguard Worker    .seh_endproc
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard Worker    .section .text
92*9880d681SAndroid Build Coastguard Worker    .globl baz
93*9880d681SAndroid Build Coastguard Worker    .def baz; .scl 2; .type 32; .endef
94*9880d681SAndroid Build Coastguard Worker    .seh_proc baz
95*9880d681SAndroid Build Coastguard Workerbaz:
96*9880d681SAndroid Build Coastguard Worker    subq $8, %rsp
97*9880d681SAndroid Build Coastguard Worker    .seh_stackalloc 8
98*9880d681SAndroid Build Coastguard Worker    pushq %rbp
99*9880d681SAndroid Build Coastguard Worker    .seh_pushreg %rbp
100*9880d681SAndroid Build Coastguard Worker    .seh_endprologue
101*9880d681SAndroid Build Coastguard Worker    popq %rbp
102*9880d681SAndroid Build Coastguard Worker    addq $8, %rsp
103*9880d681SAndroid Build Coastguard Worker    ret
104*9880d681SAndroid Build Coastguard Worker    .seh_endproc
105*9880d681SAndroid Build Coastguard Worker
106