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
4# RUN: llvm-readobj --sections --coff-exports %t.dll | FileCheck %s
5
6# CHECK:         Name: .pdata
7# CHECK-NEXT:    VirtualSize: 0x18
8# CHECK:         Name: .xdata
9# CHECK-NEXT:    VirtualSize: 0x10
10
11# CHECK:         Name: xdata1
12# CHECK-NEXT:    RVA: 0x1010
13# CHECK:         Name: xdata1a
14# CHECK-NEXT:    RVA: 0x1010
15# CHECK:         Name: xdata1b
16# CHECK-NEXT:    RVA: 0x1030
17
18	.text
19callee:
20	ret
21
22	.def	 xdata1;
23	.scl	2;
24	.type	32;
25	.endef
26	.section	.text,"xr",one_only,xdata1
27	.globl	xdata1                  # -- Begin function xdata1
28	.p2align	4, 0x90
29xdata1:                                 # @xdata1
30.seh_proc xdata1
31# BB#0:                                 # %entry
32	subq	$40, %rsp
33	.seh_stackalloc 40
34	.seh_endprologue
35	callq	callee
36	nop
37	addq	$40, %rsp
38	jmp	callee                  # TAILCALL
39	.seh_handlerdata
40	.section	.text,"xr",one_only,xdata1
41	.seh_endproc
42                                        # -- End function
43
44# xdata1a is identical to xdata1, so it should be ICFd, and so should its pdata.
45# It also has associative debug and CFG sections which should be ignored by ICF.
46	.def	 xdata1a;
47	.scl	2;
48	.type	32;
49	.endef
50	.section	.text,"xr",one_only,xdata1a
51	.globl	xdata1a                  # -- Begin function xdata1a
52	.p2align	4, 0x90
53xdata1a:                                 # @xdata1a
54.seh_proc xdata1a
55# BB#0:                                 # %entry
56	subq	$40, %rsp
57	.seh_stackalloc 40
58	.seh_endprologue
59	callq	callee
60	nop
61	addq	$40, %rsp
62	jmp	callee                  # TAILCALL
63	.seh_handlerdata
64	.section	.text,"xr",one_only,xdata1a
65	.seh_endproc
66
67	.section .debug$S,"r",associative,xdata1a
68	.section .gfids$y,"r",associative,xdata1a
69	.section .gljmp$y,"r",associative,xdata1a
70
71# xdata1b's text is identical to xdata1, but its xdata specifies a different
72# stack size, so it cannot be ICFd with xdata1.
73	.def	 xdata1b;
74	.scl	2;
75	.type	32;
76	.endef
77	.section	.text,"xr",one_only,xdata1b
78	.globl	xdata1b                  # -- Begin function xdata1b
79	.p2align	4, 0x90
80xdata1b:                                 # @xdata1b
81.seh_proc xdata1b
82# BB#0:                                 # %entry
83	subq	$40, %rsp
84	.seh_stackalloc 48
85	.seh_endprologue
86	callq	callee
87	nop
88	addq	$40, %rsp
89	jmp	callee                  # TAILCALL
90	.seh_handlerdata
91	.section	.text,"xr",one_only,xdata1b
92	.seh_endproc
93                                        # -- End function
94
95	.section	.drectve,"yn"
96	.ascii	" -export:xdata1"
97	.ascii	" -export:xdata1a"
98	.ascii	" -export:xdata1b"
99