xref: /llvm-project/lld/test/ELF/print-icf.s (revision f4b4bc2f18dc0e44afde05735fb673d3de4d5c39)
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 --match-full-lines --strict-whitespace
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 | count 0
8
9#  CHECK-NOT:{{.}}
10#      CHECK:selected section {{.*}}:(.text.f1)
11# CHECK-NEXT:  removing identical section {{.*}}:(.text.f3)
12# CHECK-NEXT:  removing identical section {{.*}}:(.text.f5)
13# CHECK-NEXT:  removing identical section {{.*}}:(.text.f6)
14#      CHECK:selected section {{.*}}:(.text.f2)
15# CHECK-NEXT:  removing identical section {{.*}}:(.text.f4)
16# CHECK-NEXT:  removing identical section {{.*}}:(.text.f7)
17#  CHECK-NOT:{{.}}
18
19.globl _start, f1, f2
20_start:
21  ret
22
23.section .text.f1, "ax"
24f1:
25  mov $60, %rax
26  mov $42, %rdi
27  syscall
28
29  .section .text.f2, "ax"
30f2:
31  mov $0, %rax
32
33.section .text.f3, "ax"
34f3:
35  mov $60, %rax
36  mov $42, %rdi
37  syscall
38
39.section .text.f4, "ax"
40f4:
41  mov $0, %rax
42
43.section .text.f5, "ax"
44f5:
45  mov $60, %rax
46  mov $42, %rdi
47  syscall
48