1 ## Test how we create SHT_LLVM_CALL_GRAPH_PROFILE sections.
3 ## Test that the content of SHT_LLVM_CALL_GRAPH_PROFILE sections
4 ## for 32/64-bit little/big endian targets is correct.
5 # RUN: yaml2obj --docnum=1 -D BITS=64 -D ENCODE=LSB %s -o %t.le64
6 # RUN: llvm-readobj --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 --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 --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 --cg-profile --sections --section-data %t.be32 | FileCheck %s --check-prefixes=BASIC,BASIC-BE
14 # BASIC: Name: .llvm.call-graph-profile
15 # BASIC-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
18 # BASIC-NEXT: Address: 0x0
20 # BASIC-NEXT: Size: 16
21 ## Check that we link SHT_LLVM_CALL_GRAPH_PROFILE section with .symtab by default.
22 # BASIC-NEXT: Link: [[SYMTABNDX:.*]]
24 # BASIC-NEXT: AddressAlignment: 0
25 ## Check that the entry size is set to 16 by default.
26 # BASIC-NEXT: EntrySize: 8
27 # BASIC-NEXT: SectionData (
28 # BASIC-LE-NEXT: 0000: 59000000 00000000 62000000 00000000
29 # BASIC-BE-NEXT: 0000: 00000000 00000059 00000000 00000062
32 # BASIC-NEXT: Section {
33 # BASIC-NEXT: Index: [[SYMTABNDX]]
34 # BASIC-NEXT: Name: .symtab
37 # BASIC-NEXT: CGProfileEntry {
38 # BASIC-NEXT: Weight: 89
40 # BASIC-NEXT: CGProfileEntry {
41 # BASIC-NEXT: Weight: 98
47 Class: ELFCLASS[[BITS]]
48 Data: ELFDATA2[[ENCODE]]
51 - Name: .llvm.call-graph-profile
52 Type: SHT_LLVM_CALL_GRAPH_PROFILE
60 ## Check we can set arbitrary sh_link and sh_entsize values.
61 ## Check we can specify none of "Content", "Entries", and "Size" tags.
62 # RUN: yaml2obj --docnum=2 %s -o %t.link
63 # RUN: llvm-readelf --sections %t.link | FileCheck %s --check-prefix=LINK
65 # LINK: [Nr] Name Type Address Off Size ES Flg Lk
66 # LINK: [ 1] .llvm.foo LLVM_CALL_GRAPH_PROFILE 0000000000000000 000040 000000 00 0
67 # LINK: [ 2] .llvm.bar LLVM_CALL_GRAPH_PROFILE 0000000000000000 000040 000000 ff 255
76 Type: SHT_LLVM_CALL_GRAPH_PROFILE
80 Type: SHT_LLVM_CALL_GRAPH_PROFILE
84 ## Check we can describe SHT_LLVM_CALL_GRAPH_PROFILE sections using the "Content" tag.
85 # RUN: yaml2obj --docnum=3 %s -o %t.content
86 # RUN: llvm-readobj --sections --section-data %t.content | FileCheck %s --check-prefix=CONTENT
88 # CONTENT: Name: .llvm.call-graph-profile
89 # CONTENT: SectionData (
90 # CONTENT-NEXT: 0000: 11223344 |
99 - Name: .llvm.call-graph-profile
100 Type: SHT_LLVM_CALL_GRAPH_PROFILE
103 ## Check we can use the "Content" key with the "Size" key when the size is greater
104 ## than or equal to the content size.
106 # RUN: not yaml2obj --docnum=4 -DSIZE=1 -DCONTENT="'0011'" %s 2>&1 | \
107 # RUN: FileCheck %s --check-prefix=CONTENT-SIZE-ERR
109 # CONTENT-SIZE-ERR: error: Section size must be greater than or equal to the content size
118 Type: SHT_LLVM_CALL_GRAPH_PROFILE
121 Size: [[SIZE=<none>]]
122 Content: [[CONTENT=<none>]]
123 Entries: [[ENTRIES=<none>]]
125 # RUN: yaml2obj --docnum=4 -DSIZE=2 -DCONTENT="'0011'" %s -o %t.cont.size.eq.o
126 # RUN: llvm-readobj --sections --section-data %t.cont.size.eq.o | \
127 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="0011"
129 # RUN: yaml2obj --docnum=4 -DSIZE=3 -DCONTENT="'0011'" %s -o %t.cont.size.gr.o
130 # RUN: llvm-readobj --sections --section-data %t.cont.size.gr.o | \
131 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="001100"
133 # CHECK-CONTENT: Name: .llvm.foo
134 # CHECK-CONTENT-NEXT: Type: SHT_LLVM_CALL_GRAPH_PROFILE
135 # CHECK-CONTENT-NEXT: Flags [
136 # CHECK-CONTENT-NEXT: ]
137 # CHECK-CONTENT-NEXT: Address:
138 # CHECK-CONTENT-NEXT: Offset:
139 # CHECK-CONTENT-NEXT: Size:
140 # CHECK-CONTENT-NEXT: Link: 1
141 # CHECK-CONTENT-NEXT: Info:
142 # CHECK-CONTENT-NEXT: AddressAlignment:
143 # CHECK-CONTENT-NEXT: EntrySize: 2
144 # CHECK-CONTENT-NEXT: SectionData (
145 # CHECK-CONTENT-NEXT: 0000: [[DATA]] |
146 # CHECK-CONTENT-NEXT: )
148 ## Check we can use the "Size" key alone to create the section.
150 # RUN: yaml2obj --docnum=4 -DSIZE=3 %s -o %t.size.o
151 # RUN: llvm-readobj --sections --section-data %t.size.o | \
152 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="000000"
154 ## Check we can use the "Content" key alone to create the section.
156 # RUN: yaml2obj --docnum=4 -DCONTENT="'112233'" %s -o %t.content.o
157 # RUN: llvm-readobj --sections --section-data %t.content.o | \
158 # RUN: FileCheck %s --check-prefix=CHECK-CONTENT -DDATA="112233"
160 ## Check we can't use the "Entries" key together with the "Content" or "Size" keys.
162 # RUN: not yaml2obj --docnum=4 -DSIZE=0 -DENTRIES="[]" %s 2>&1 | \
163 # RUN: FileCheck %s --check-prefix=ENTRIES-ERR
164 # RUN: not yaml2obj --docnum=4 -DCONTENT="'00'" -DENTRIES="[]" %s 2>&1 | \
165 # RUN: FileCheck %s --check-prefix=ENTRIES-ERR
167 # ENTRIES-ERR: error: "Entries" cannot be used with "Content" or "Size"