22
33# # Test that the content of SHT_LLVM_CALL_GRAPH_PROFILE sections
44# # for 32/64-bit little/big endian targets is correct.
5- # RUN: yaml2obj --docnum=1 %s -o %t.le64
6- # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le64 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
7- # RUN: yaml2obj --docnum=2 %s -o %t.be64
8- # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be64 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
9- # RUN: yaml2obj --docnum=3 %s -o %t.le32
10- # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le32 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
11- # RUN: yaml2obj --docnum=4 %s -o %t.be32
12- # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
5+ # RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=LSB %s -o %t.le64
6+ # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le64 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
7+ # RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=MSB %s -o %t.be64
8+ # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be64 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
9+ # RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=LSB %s -o %t.le32
10+ # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.le32 | FileCheck %s --check-prefixes=BASIC,BASIC-LE
11+ # RUN: yaml2obj --docnum=1 -D BITS=32 -D ENCODE=MSB %s -o %t.be32
12+ # RUN: llvm-readobj --elf-cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
1313
1414# BASIC: Name: .llvm.call-graph-profile
1515# BASIC-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
4848# BASIC-NEXT: }
4949# BASIC-NEXT: ]
5050
51- # # TODO: we should really improve yaml2obj somehow to be able to collapse
52- # # the following four YAML descriptions into a single one.
53-
5451--- !ELF
5552FileHeader :
56- Class : ELFCLASS64
57- Data : ELFDATA2LSB
53+ Class : ELFCLASS[[BITS]]
54+ Data : ELFDATA2[[ENCODE]]
5855 Type : ET_DYN
5956 Machine : EM_X86_64
6057Sections :
@@ -71,69 +68,9 @@ Symbols:
7168 - Name : foo
7269 - Name : bar
7370
74- --- !ELF
75- FileHeader :
76- Class : ELFCLASS64
77- Data : ELFDATA2MSB
78- Type : ET_DYN
79- Machine : EM_X86_64
80- Sections :
81- - Name : .llvm.call-graph-profile
82- Type : SHT_LLVM_CALL_GRAPH_PROFILE
83- Entries :
84- - From : 1
85- To : 2
86- Weight : 89
87- - From : 2
88- To : 1
89- Weight : 98
90- Symbols :
91- - Name : foo
92- - Name : bar
93-
94- --- !ELF
95- FileHeader :
96- Class : ELFCLASS32
97- Data : ELFDATA2LSB
98- Type : ET_DYN
99- Machine : EM_386
100- Sections :
101- - Name : .llvm.call-graph-profile
102- Type : SHT_LLVM_CALL_GRAPH_PROFILE
103- Entries :
104- - From : 1
105- To : 2
106- Weight : 89
107- - From : 2
108- To : 1
109- Weight : 98
110- Symbols :
111- - Name : foo
112- - Name : bar
113-
114- --- !ELF
115- FileHeader :
116- Class : ELFCLASS32
117- Data : ELFDATA2MSB
118- Type : ET_DYN
119- Machine : EM_386
120- Sections :
121- - Name : .llvm.call-graph-profile
122- Type : SHT_LLVM_CALL_GRAPH_PROFILE
123- Entries :
124- - From : 1
125- To : 2
126- Weight : 89
127- - From : 2
128- To : 1
129- Weight : 98
130- Symbols :
131- - Name : foo
132- - Name : bar
133-
13471# # Check we can set arbitrary sh_link and sh_entsize values.
13572# # Check we can specify neither "Content" nor "Entries" tags.
136- # RUN: yaml2obj --docnum=5 %s -o %t.link
73+ # RUN: yaml2obj --docnum=2 %s -o %t.link
13774# RUN: llvm-readelf --sections %t.link | FileCheck %s --check-prefix=LINK
13875
13976# LINK: [Nr] Name Type Address Off Size ES Flg Lk
@@ -157,7 +94,7 @@ Sections:
15794 EntSize : 0xFF
15895
15996# # Check we can't specify both "Content" and "Entries" tags.
160- # RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=BOTH
97+ # RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=BOTH
16198# BOTH: error: "Entries" and "Content" can't be used together
16299
163100--- !ELF
@@ -173,7 +110,7 @@ Sections:
173110 Entries : []
174111
175112# # Check we can refer to symbols by name.
176- # RUN: yaml2obj --docnum=7 %s -o %t.sym
113+ # RUN: yaml2obj --docnum=4 %s -o %t.sym
177114# RUN: llvm-readobj --elf-cg-profile %t.sym | FileCheck %s --check-prefix=SYMBOL-NAMES
178115
179116# SYMBOL-NAMES: CGProfile [
@@ -213,7 +150,7 @@ Symbols:
213150 - Name : ' foo [1]'
214151
215152# # Check we can describe SHT_LLVM_CALL_GRAPH_PROFILE sections using the "Content" tag.
216- # RUN: yaml2obj --docnum=8 %s -o %t.content
153+ # RUN: yaml2obj --docnum=5 %s -o %t.content
217154# RUN: llvm-readobj --sections --section-data %t.content | FileCheck %s --check-prefix=CONTENT
218155
219156# CONTENT: Name: .llvm.call-graph-profile
@@ -233,8 +170,8 @@ Sections:
233170 Content : " 11223344"
234171
235172# # Check we can't reference unknown symbols by name.
236- # RUN: not yaml2obj --docnum=9 %s 2>&1 | FileCheck %s --check-prefix=UNKNOWN-NAME
237- # RUN: not yaml2obj --docnum=10 %s 2>&1 | FileCheck %s --check-prefix=UNKNOWN-NAME
173+ # RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=UNKNOWN-NAME
174+ # RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=UNKNOWN-NAME
238175# UNKNOWN-NAME: error: unknown symbol referenced: 'bar' by YAML section '.llvm.call-graph-profile'
239176
240177--- !ELF
@@ -272,7 +209,7 @@ Symbols:
272209 - Name : foo
273210
274211# # Check we can specify arbitrary symbol indexes for an SHT_LLVM_CALL_GRAPH_PROFILE section entry.
275- # RUN: yaml2obj --docnum=11 %s -o %t.unk
212+ # RUN: yaml2obj --docnum=8 %s -o %t.unk
276213# RUN: llvm-readobj --sections --section-data %t.unk | FileCheck %s --check-prefix=UNKNOWN-INDEX
277214
278215# UNKNOWN-INDEX: Name: .llvm.call-graph-profile
0 commit comments