1# REQUIRES: x86
2
3# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/print-icf.s -o %t1
5# RUN: ld.lld %t %t1 -o %t2 --icf=all --print-icf-sections | FileCheck %s
6# RUN: ld.lld %t %t1 -o %t2 --icf=all --no-print-icf-sections --print-icf-sections | FileCheck %s
7# RUN: ld.lld %t %t1 -o %t2 --icf=all --print-icf-sections --no-print-icf-sections | FileCheck -allow-empty -check-prefix=PRINT %s
8
9# CHECK: selected section {{.*}}:(.text.f2)
10# CHECK:   removing identical section {{.*}}:(.text.f4)
11# CHECK:   removing identical section {{.*}}:(.text.f7)
12# CHECK: selected section {{.*}}:(.text.f1)
13# CHECK:   removing identical section {{.*}}:(.text.f3)
14# CHECK:   removing identical section {{.*}}:(.text.f5)
15# CHECK:   removing identical section {{.*}}:(.text.f6)
16
17# PRINT-NOT: selected
18# PRINT-NOT: removing
19
20.globl _start, f1, f2
21_start:
22  ret
23
24.section .text.f1, "ax"
25f1:
26  mov $60, %rax
27  mov $42, %rdi
28  syscall
29
30  .section .text.f2, "ax"
31f2:
32  mov $0, %rax
33
34.section .text.f3, "ax"
35f3:
36  mov $60, %rax
37  mov $42, %rdi
38  syscall
39
40.section .text.f4, "ax"
41f4:
42  mov $0, %rax
43
44.section .text.f5, "ax"
45f5:
46  mov $60, %rax
47  mov $42, %rdi
48  syscall
49