xref: /llvm-project/lld/test/COFF/icf-safe.s (revision 1d1f245270ffb739191023cd990ba6d7780026ee)
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 f1
10# CHECK-NEXT:   Removed f2
11# CHECK-NEXT:   Removed f3
12# CHECK-NEXT:   Removed f4
13# CHECK-NEXT: Selected g3
14# CHECK-NEXT:   Removed g4
15# CHECK-NOT:  {{.}}
16
17# EXPORT-NOT: Selected g3
18# EXPORT-NOT: Selected g4
19
20# SAFEICF-NOT:  Selected
21# SAFEICF:      Selected f3
22# SAFEICF-NEXT:   Removed f4
23# SAFEICF-NEXT: Selected g3
24# SAFEICF-NEXT:   Removed g4
25# SAFEICF-NOT:  {{.}}
26
27.section .rdata,"dr",one_only,g1
28.globl g1
29g1:
30.byte 1
31
32.section .rdata,"dr",one_only,g2
33.globl g2
34g2:
35.byte 1
36
37.section .rdata,"dr",one_only,g3
38.globl g3
39g3:
40.byte 2
41
42.section .rdata,"dr",one_only,g4
43.globl g4
44g4:
45.byte 2
46
47.section .text,"xr",one_only,f1
48.globl f1
49f1:
50 nop
51
52.section .text,"xr",one_only,f2
53.globl f2
54f2:
55 nop
56
57.section .text,"xr",one_only,f3
58.globl f3
59f3:
60 nop
61
62.section .text,"xr",one_only,f4
63.globl f4
64f4:
65 nop
66
67.addrsig
68.addrsig_sym g1
69.addrsig_sym g2
70.addrsig_sym f1
71.addrsig_sym f2
72