3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
4 # RUN: ld.lld -e A %t -o %t2
5 # RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=NOSORT
7 # RUN: echo "A B 10" > %t.call_graph
8 # RUN: echo "A B 10" >> %t.call_graph
9 # RUN: echo "Aa B 80" >> %t.call_graph
10 # RUN: echo "A C 40" >> %t.call_graph
11 # RUN: echo "B C 30" >> %t.call_graph
12 # RUN: echo "C D 90" >> %t.call_graph
13 # RUN: echo "PP TS 100" >> %t.call_graph
14 # RUN: echo "_init2 _init 24567837" >> %t.call_graph
15 # RUN: echo "TS QC 9001" >> %t.call_graph
16 # RUN: echo "TooManyPreds0 TooManyPreds 10" >> %t.call_graph
17 # RUN: echo "TooManyPreds1 TooManyPreds 10" >> %t.call_graph
18 # RUN: echo "TooManyPreds2 TooManyPreds 10" >> %t.call_graph
19 # RUN: echo "TooManyPreds3 TooManyPreds 10" >> %t.call_graph
20 # RUN: echo "TooManyPreds4 TooManyPreds 10" >> %t.call_graph
21 # RUN: echo "TooManyPreds5 TooManyPreds 10" >> %t.call_graph
22 # RUN: echo "TooManyPreds6 TooManyPreds 10" >> %t.call_graph
23 # RUN: echo "TooManyPreds7 TooManyPreds 10" >> %t.call_graph
24 # RUN: echo "TooManyPreds8 TooManyPreds 10" >> %t.call_graph
25 # RUN: echo "TooManyPreds9 TooManyPreds 10" >> %t.call_graph
26 # RUN: echo "TooManyPreds10 TooManyPreds 11" >> %t.call_graph
27 # RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=hfsort -o %t2
28 # RUN: llvm-readobj --symbols %t2 | FileCheck %s
29 ## --call-graph-profile-sort=hfsort is the default.
30 # RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph -o %t2b
33 # RUN: ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=cdsort -o %t2
34 # RUN: llvm-readobj --symbols %t2 | FileCheck %s --check-prefix=CDSORT
36 # RUN: not ld.lld -e A %t --call-graph-ordering-file %t.call_graph --call-graph-profile-sort=sort \
37 # RUN: -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNKNOWN
39 # UNKNOWN: error: unknown --call-graph-profile-sort= value: sort
41 .section .text.D,"ax",@progbits
45 .section .text.C,"ax",@progbits
50 .section .text.B,"ax",@progbits
55 .section .text.A,"ax",@progbits
61 .section .ponies,"ax",@progbits,unique,1
66 .section .ponies,"ax",@progbits,unique,2
71 .section .other,"ax",@progbits,unique,1
76 .section .other,"ax",@progbits,unique,2
81 .section .init,"ax",@progbits,unique,1
86 .section .init,"ax",@progbits,unique,2
91 .section .text.TooManyPreds,"ax",@progbits
104 .section .text.TooManyPreds0,"ax",@progbits
108 .section .text.TooManyPreds1,"ax",@progbits
112 .section .text.TooManyPreds2,"ax",@progbits
116 .section .text.TooManyPreds3,"ax",@progbits
120 .section .text.TooManyPreds4,"ax",@progbits
124 .section .text.TooManyPreds5,"ax",@progbits
128 .section .text.TooManyPreds6,"ax",@progbits
132 .section .text.TooManyPreds7,"ax",@progbits
136 .section .text.TooManyPreds8,"ax",@progbits
140 .section .text.TooManyPreds9,"ax",@progbits
144 .section .text.TooManyPreds10,"ax",@progbits
149 # CHECK-NEXT: Value: 0x201123
150 # CHECK: Name: TooManyPreds
151 # CHECK-NEXT: Value: 0x201124
152 # CHECK: Name: TooManyPreds10
153 # CHECK-NEXT: Value: 0x201138
155 # CHECK-NEXT: Value: 0x201122
157 # CHECK-NEXT: Value: 0x201121
159 # CHECK-NEXT: Value: 0x201120
161 # CHECK-NEXT: Value: 0x20113D
163 # CHECK-NEXT: Value: 0x20113C
165 # CHECK-NEXT: Value: 0x20113E
167 # CHECK-NEXT: Value: 0x20113F
169 # CHECK-NEXT: Value: 0x201140
170 # CHECK: Name: _init2
171 # CHECK-NEXT: Value: 0x201141
174 # CDSORT-NEXT: Value: 0x201123
175 # CDSORT: Name: TooManyPreds
176 # CDSORT-NEXT: Value: 0x20112F
177 # CDSORT: Name: TooManyPreds10
178 # CDSORT-NEXT: Value: 0x20112E
180 # CDSORT-NEXT: Value: 0x201122
182 # CDSORT-NEXT: Value: 0x201121
184 # CDSORT-NEXT: Value: 0x201120
186 # CDSORT-NEXT: Value: 0x20113D
188 # CDSORT-NEXT: Value: 0x20113C
190 # CDSORT-NEXT: Value: 0x20113E
192 # CDSORT-NEXT: Value: 0x20113F
193 # CDSORT: Name: _init
194 # CDSORT-NEXT: Value: 0x201140
195 # CDSORT: Name: _init2
196 # CDSORT-NEXT: Value: 0x201141
199 # NOSORT-NEXT: Value: 0x201120
200 # NOSORT: Name: TooManyPreds
201 # NOSORT-NEXT: Value: 0x201124
202 # NOSORT: Name: TooManyPreds10
203 # NOSORT-NEXT: Value: 0x201138
205 # NOSORT-NEXT: Value: 0x201121
207 # NOSORT-NEXT: Value: 0x201122
209 # NOSORT-NEXT: Value: 0x201123
211 # NOSORT-NEXT: Value: 0x201139
213 # NOSORT-NEXT: Value: 0x20113A
215 # NOSORT-NEXT: Value: 0x20113B
217 # NOSORT-NEXT: Value: 0x20113C
218 # NOSORT: Name: _init
219 # NOSORT-NEXT: Value: 0x20113D
220 # NOSORT: Name: _init2
221 # NOSORT-NEXT: Value: 0x20113E