1# REQUIRES: x86
2# RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o %t.obj
3# RUN: lld-link %t.obj -dll -noentry -out:%t.dll -merge:.xdata=.xdata 2>&1 \
4# RUN:     | FileCheck %s --check-prefix=WARN
5# RUN: llvm-readobj --sections %t.dll | FileCheck %s --check-prefix=XDATA
6# RUN: lld-link %t.obj -dll -noentry -out:%t.dll
7# RUN: llvm-readobj --sections %t.dll | FileCheck %s --check-prefix=RDATA
8
9# There shouldn't be much xdata, because all three .pdata entries (12 bytes
10# each) should use the same .xdata unwind info.
11# XDATA:         Name: .rdata
12# XDATA-NEXT:    VirtualSize: 0x73
13# XDATA:         Name: .pdata
14# XDATA-NEXT:    VirtualSize: 0x24
15# XDATA:         Name: .xdata
16# XDATA-NEXT:    VirtualSize: 0x8
17#
18# WARN: warning: .xdata=.rdata: already merged into .xdata
19#
20# RDATA:         Name: .rdata
21# RDATA-NEXT:    VirtualSize: 0x7C
22# RDATA:         Name: .pdata
23# RDATA-NEXT:    VirtualSize: 0x24
24
25	.text
26callee:
27	ret
28
29	.def	 xdata1;
30	.scl	2;
31	.type	32;
32	.endef
33	.section	.text,"xr",one_only,xdata1
34	.globl	xdata1                  # -- Begin function xdata1
35	.p2align	4, 0x90
36xdata1:                                 # @xdata1
37.seh_proc xdata1
38# BB#0:                                 # %entry
39	subq	$40, %rsp
40	.seh_stackalloc 40
41	.seh_endprologue
42	callq	callee
43	nop
44	addq	$40, %rsp
45	jmp	callee                  # TAILCALL
46	.seh_handlerdata
47	.section	.text,"xr",one_only,xdata1
48	.seh_endproc
49                                        # -- End function
50	.def	 xdata2;
51	.scl	2;
52	.type	32;
53	.endef
54	.section	.text,"xr",one_only,xdata2
55	.globl	xdata2                  # -- Begin function xdata2
56	.p2align	4, 0x90
57xdata2:                                 # @xdata2
58.seh_proc xdata2
59# BB#0:                                 # %entry
60	subq	$40, %rsp
61	.seh_stackalloc 40
62	.seh_endprologue
63	callq	callee
64	callq	callee
65	nop
66	addq	$40, %rsp
67	jmp	callee                  # TAILCALL
68	.seh_handlerdata
69	.section	.text,"xr",one_only,xdata2
70	.seh_endproc
71                                        # -- End function
72	.def	 xdata3;
73	.scl	2;
74	.type	32;
75	.endef
76	.section	.text,"xr",one_only,xdata3
77	.globl	xdata3                  # -- Begin function xdata3
78	.p2align	4, 0x90
79xdata3:                                 # @xdata3
80.seh_proc xdata3
81# BB#0:                                 # %entry
82	subq	$40, %rsp
83	.seh_stackalloc 40
84	.seh_endprologue
85	callq	callee
86	callq	callee
87	callq	callee
88	nop
89	addq	$40, %rsp
90	jmp	callee                  # TAILCALL
91	.seh_handlerdata
92	.section	.text,"xr",one_only,xdata3
93	.seh_endproc
94                                        # -- End function
95	.section	.drectve,"yn"
96	.ascii	" -export:xdata1"
97	.ascii	" -export:xdata2"
98	.ascii	" -export:xdata3"
99
100