3 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4 # RUN: ld.lld -pie %t.o --icf=all --print-icf-sections -o /dev/null | \
5 # RUN: FileCheck --check-prefixes=EXE %s
7 # RUN: ld.lld -shared %t.o --icf=all --print-icf-sections -o /dev/null | \
8 # RUN: FileCheck --check-prefix=DSO %s
10 ## Definitions are non-preemptible in an executable.
12 # EXE: selected section {{.*}}:(.text.g1)
13 # EXE-NEXT: removing identical section {{.*}}:(.text.g2)
14 # EXE-NEXT: removing identical section {{.*}}:(.text.g3)
15 # EXE-NEXT: selected section {{.*}}:(.text.f1)
16 # EXE-NEXT: removing identical section {{.*}}:(.text.f2)
17 # EXE-NEXT: selected section {{.*}}:(.text.h1)
18 # EXE-NEXT: removing identical section {{.*}}:(.text.h2)
19 # EXE-NEXT: removing identical section {{.*}}:(.text.h3)
22 ## Definitions are preemptible in a DSO. Only leaf functions can be folded.
24 # DSO: selected section {{.*}}:(.text.g1)
25 # DSO-NEXT: removing identical section {{.*}}:(.text.g3)
26 # DSO-NEXT: selected section {{.*}}:(.text.f1)
27 # DSO-NEXT: removing identical section {{.*}}:(.text.f2)
30 .globl _start, f1, f2, g1, g2, g3
38 ## In -shared mode, .text.g1 and .text.g2 cannot be folded because f1 and f2 are
39 ## preemptible and may refer to different functions at runtime.
47 ## In -shared mode, the sections below cannot be folded because g1, g2 and g3
48 ## are preemptible and may refer to different functions at runtime.