1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %s -o %t1.obj
3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %S/Inputs/icf-safe.s -o %t2.obj
4# RUN: lld-link /dll /noentry /out:%t.dll /verbose /opt:noref,icf %t1.obj %t2.obj 2>&1 | FileCheck %s
5# RUN: lld-link /dll /noentry /out:%t.dll /verbose /opt:noref,icf /export:g3 /export:g4 %t1.obj %t2.obj 2>&1 | FileCheck --check-prefix=EXPORT %s
6# RUN: lld-link /dll /noentry /out:%t.dll /verbose /opt:noref,safeicf %t1.obj %t2.obj 2>&1 | FileCheck %s --check-prefix=SAFEICF
7
8# CHECK-NOT: Selected
9# CHECK: Selected g3
10# CHECK-NEXT:   Removed g4
11# CHECK: Selected f1
12# CHECK-NEXT:   Removed f2
13# CHECK-NEXT:   Removed f3
14# CHECK-NEXT:   Removed f4
15# CHECK-NOT: Removed
16# CHECK-NOT: Selected
17
18# EXPORT-NOT: Selected g3
19# EXPORT-NOT: Selected g4
20
21# SAFEICF-NOT: Selected
22# SAFEICF: Selected g3
23# SAFEICF-NEXT:   Removed g4
24# SAFEICF: Selected f3
25# SAFEICF-NEXT:   Removed f4
26# SAFEICF-NOT: Removed
27# SAFEICF-NOT: Selected
28
29.section .rdata,"dr",one_only,g1
30.globl g1
31g1:
32.byte 1
33
34.section .rdata,"dr",one_only,g2
35.globl g2
36g2:
37.byte 1
38
39.section .rdata,"dr",one_only,g3
40.globl g3
41g3:
42.byte 2
43
44.section .rdata,"dr",one_only,g4
45.globl g4
46g4:
47.byte 2
48
49.section .text,"xr",one_only,f1
50.globl f1
51f1:
52 nop
53
54.section .text,"xr",one_only,f2
55.globl f2
56f2:
57 nop
58
59.section .text,"xr",one_only,f3
60.globl f3
61f3:
62 nop
63
64.section .text,"xr",one_only,f4
65.globl f4
66f4:
67 nop
68
69.addrsig
70.addrsig_sym g1
71.addrsig_sym g2
72.addrsig_sym f1
73.addrsig_sym f2
74