Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / text-section-prefix.s
blob950f9d788a2f51589f4167c3cdf9e032eb894409
1 # REQUIRES: x86
2 ## -z keep-text-section-prefix separates text sections with prefix .text.hot,
3 ## .text.unknown, .text.unlikely, .text.startup, or .text.exit, in the absence
4 ## of a SECTIONS command.
6 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
7 # RUN: ld.lld %t.o -o %t1
8 # RUN: llvm-readelf -S %t1 | FileCheck --check-prefix=NOKEEP %s
9 # RUN: ld.lld -z nokeep-text-section-prefix %t.o -o %t2
10 # RUN: cmp %t1 %t2
12 # RUN: ld.lld -z keep-text-section-prefix %t.o -o %t.keep
13 # RUN: llvm-readelf -S %t.keep | FileCheck --check-prefix=KEEP %s
15 # KEEP: [ 1] .text
16 # KEEP-NEXT: [ 2] .text.hot
17 # KEEP-NEXT: [ 3] .text.unknown
18 # KEEP-NEXT: [ 4] .text.split
19 # KEEP-NEXT: [ 5] .text.startup
20 # KEEP-NEXT: [ 6] .text.exit
21 # KEEP-NEXT: [ 7] .text.unlikely
23 # NOKEEP: [ 1] .text
24 # NOKEEP-NOT: .text
26 ## With a SECTIONS command, orphan sections are created verbatim.
27 ## No grouping is performed for them.
28 # RUN: echo 'SECTIONS {}' > %t.lds
29 # RUN: ld.lld -T %t.lds -z keep-text-section-prefix %t.o -o %t.script
30 # RUN: llvm-readelf -S %t.script | FileCheck --check-prefix=SCRIPT %s
32 # SCRIPT: .text
33 # SCRIPT-NEXT: .text.f
34 # SCRIPT-NEXT: .text.hot.f_hot
35 # SCRIPT-NEXT: .text.unknown.f_unknown
36 # SCRIPT-NEXT: .text.split.f_split
37 # SCRIPT-NEXT: .text.startup.f_startup
38 # SCRIPT-NEXT: .text.exit.f_exit
39 # SCRIPT-NEXT: .text.unlikely.f_unlikely
41 .globl _start
42 _start:
43 ret
45 .section .text.f,"ax"
46 nop
48 .section .text.hot.f_hot,"ax"
49 nop
51 .section .text.unknown.f_unknown,"ax"
52 nop
54 .section .text.split.f_split,"ax"
55 nop
57 .section .text.startup.f_startup,"ax"
58 nop
60 .section .text.exit.f_exit,"ax"
61 nop
63 .section .text.unlikely.f_unlikely,"ax"
64 nop