1# REQUIRES: x86
2
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
6
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 -o %t2
28# RUN: llvm-readobj --symbols %t2 | FileCheck %s
29
30    .section    .text.D,"ax",@progbits
31D:
32    retq
33
34    .section    .text.C,"ax",@progbits
35    .globl  C
36C:
37    retq
38
39    .section    .text.B,"ax",@progbits
40    .globl  B
41B:
42    retq
43
44    .section    .text.A,"ax",@progbits
45    .globl  A
46A:
47Aa:
48    retq
49
50    .section    .ponies,"ax",@progbits,unique,1
51    .globl TS
52TS:
53    retq
54
55    .section    .ponies,"ax",@progbits,unique,2
56    .globl PP
57PP:
58    retq
59
60    .section    .other,"ax",@progbits,unique,1
61    .globl QC
62QC:
63    retq
64
65    .section    .other,"ax",@progbits,unique,2
66    .globl GB
67GB:
68    retq
69
70    .section    .init,"ax",@progbits,unique,1
71    .globl _init
72_init:
73    retq
74
75    .section    .init,"ax",@progbits,unique,2
76    .globl _init2
77_init2:
78    retq
79
80    .section    .text.TooManyPreds,"ax",@progbits
81TooManyPreds:
82    retq
83	retq
84	retq
85	retq
86	retq
87	retq
88	retq
89	retq
90	retq
91	retq
92
93    .section    .text.TooManyPreds0,"ax",@progbits
94TooManyPreds0:
95    retq
96
97    .section    .text.TooManyPreds1,"ax",@progbits
98TooManyPreds1:
99    retq
100
101    .section    .text.TooManyPreds2,"ax",@progbits
102TooManyPreds2:
103    retq
104
105    .section    .text.TooManyPreds3,"ax",@progbits
106TooManyPreds3:
107    retq
108
109    .section    .text.TooManyPreds4,"ax",@progbits
110TooManyPreds4:
111    retq
112
113    .section    .text.TooManyPreds5,"ax",@progbits
114TooManyPreds5:
115    retq
116
117    .section    .text.TooManyPreds6,"ax",@progbits
118TooManyPreds6:
119    retq
120
121    .section    .text.TooManyPreds7,"ax",@progbits
122TooManyPreds7:
123    retq
124
125    .section    .text.TooManyPreds8,"ax",@progbits
126TooManyPreds8:
127    retq
128
129    .section    .text.TooManyPreds9,"ax",@progbits
130TooManyPreds9:
131    retq
132
133    .section    .text.TooManyPreds10,"ax",@progbits
134TooManyPreds10:
135    retq
136
137# CHECK:          Name: D
138# CHECK-NEXT:     Value: 0x201123
139# CHECK:          Name: TooManyPreds
140# CHECK-NEXT:     Value: 0x201124
141# CHECK:          Name: TooManyPreds10
142# CHECK-NEXT:     Value: 0x201138
143# CHECK:          Name: A
144# CHECK-NEXT:     Value: 0x201120
145# CHECK:          Name: B
146# CHECK-NEXT:     Value: 0x201121
147# CHECK:          Name: C
148# CHECK-NEXT:     Value: 0x201122
149# CHECK:          Name: GB
150# CHECK-NEXT:     Value: 0x20113F
151# CHECK:          Name: PP
152# CHECK-NEXT:     Value: 0x20113C
153# CHECK:          Name: QC
154# CHECK-NEXT:     Value: 0x20113E
155# CHECK:          Name: TS
156# CHECK-NEXT:     Value: 0x20113D
157# CHECK:          Name: _init
158# CHECK-NEXT:     Value: 0x201140
159# CHECK:          Name: _init2
160# CHECK-NEXT:     Value: 0x201141
161
162# NOSORT:          Name: D
163# NOSORT-NEXT:     Value: 0x201120
164# NOSORT:          Name: TooManyPreds
165# NOSORT-NEXT:     Value: 0x201124
166# NOSORT:          Name: TooManyPreds10
167# NOSORT-NEXT:     Value: 0x201138
168# NOSORT:          Name: A
169# NOSORT-NEXT:     Value: 0x201123
170# NOSORT:          Name: B
171# NOSORT-NEXT:     Value: 0x201122
172# NOSORT:          Name: C
173# NOSORT-NEXT:     Value: 0x201121
174# NOSORT:          Name: GB
175# NOSORT-NEXT:     Value: 0x20113C
176# NOSORT:          Name: PP
177# NOSORT-NEXT:     Value: 0x20113A
178# NOSORT:          Name: QC
179# NOSORT-NEXT:     Value: 0x20113B
180# NOSORT:          Name: TS
181# NOSORT-NEXT:     Value: 0x201139
182# NOSORT:          Name: _init
183# NOSORT-NEXT:     Value: 0x20113D
184# NOSORT:          Name: _init2
185# NOSORT-NEXT:     Value: 0x20113E
186