1 ## Check how yaml2obj produces SHT_HASH sections.
3 ## Check we can describe a SHT_HASH section using the "Content" tag.
4 ## Check default values of section fields.
6 # RUN: yaml2obj --docnum=1 %s -o %t1
7 # RUN: llvm-readobj --sections --section-data %t1 | \
8 # RUN: FileCheck %s -DENTSIZE=4 --check-prefix=CONTENT
10 # CONTENT: Name: .hash
11 # CONTENT-NEXT: Type: SHT_HASH
12 # CONTENT-NEXT: Flags [
14 # CONTENT-NEXT: Address: 0x0
15 # CONTENT-NEXT: Offset: 0x44
16 # CONTENT-NEXT: Size: 20
17 # CONTENT-NEXT: Link: 1
18 # CONTENT-NEXT: Info: 0
19 # CONTENT-NEXT: AddressAlignment: 0
20 # CONTENT-NEXT: EntrySize: [[ENTSIZE]]{{$}}
21 # CONTENT-NEXT: SectionData (
22 # CONTENT-NEXT: 0000: 01000000 02000000 03000000 04000000
23 # CONTENT-NEXT: 0010: 05000000
32 ## SHT_HASH is linked to dynamic symbol table by default.
37 Content: '0100000002000000030000000400000005000000'
38 EntSize: [[ENTSIZE=<none>]]
40 ## Check we can set an arbitrary entry size for the SHT_HASH section.
42 # RUN: yaml2obj --docnum=1 -DENTSIZE=0xFF %s -o %t1.entsize
43 # RUN: llvm-readobj --sections --section-data %t1.entsize | \
44 # RUN: FileCheck %s -DENTSIZE=255 --check-prefix=CONTENT
46 ## Check we can describe a SHT_HASH section using "Bucket" and "Chain" tags.
48 # RUN: yaml2obj --docnum=2 %s -o %t2
49 # RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s --check-prefix=BUCKET-CHAIN
51 # BUCKET-CHAIN: Name: .hash
53 # BUCKET-CHAIN-SAME: 28
55 # BUCKET-CHAIN-SAME: 0
56 # BUCKET-CHAIN: SectionData (
57 # BUCKET-CHAIN-NEXT: 0000: 02000000 03000000 01000000 02000000 |
58 # BUCKET-CHAIN-NEXT: 0010: 03000000 04000000 05000000 |
59 # BUCKET-CHAIN-NEXT: )
72 ## Check we can't use "Content" and "Bucket" tags together.
74 # RUN: not yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-BUCKET
76 # CONTENT-BUCKET: "Bucket" and "Chain" cannot be used with "Content" or "Size"
89 ## Check we can't use "Content" and "Chain" tags together.
91 # RUN: not yaml2obj --docnum=4 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-CHAIN
93 # CONTENT-CHAIN: "Chain" cannot be used with "Content" or "Size"
106 ## Check we can't use "Bucket" without "Chain".
108 # RUN: not yaml2obj --docnum=5 %s 2>&1 | FileCheck %s --check-prefix=NO-BUCKET-OR-CHAIN
110 # NO-BUCKET-OR-CHAIN: error: "Bucket" and "Chain" must be used together
122 ## Check we can't use "Chain" without "Bucket".
124 # RUN: not yaml2obj --docnum=6 %s 2>&1 | FileCheck %s --check-prefix=NO-BUCKET-OR-CHAIN
136 ## Check we emit an empty section if neither "Bucket", "Chain",
137 ## "Content" nor "Size" were set.
139 # RUN: yaml2obj --docnum=7 %s -o %t7
140 # RUN: llvm-readelf --sections %t7 | FileCheck %s --check-prefix=NO-TAGS
142 # NO-TAGS: [Nr] Name Type Address Off Size
143 # NO-TAGS: [ 1] .hash HASH 00000000 000034 000000
154 ## Check we can set any sh_link value with use of the "Link" tag.
156 # RUN: yaml2obj --docnum=8 %s -o %t8
157 # RUN: llvm-readobj --sections %t8 | FileCheck %s --check-prefix=LINK
181 ## SHT_HASH is linked to dynamic symbol table by default if it exists.
185 ## Check we can use only "Size" to create a SHT_HASH section.
187 # RUN: yaml2obj --docnum=9 %s -o %t9
188 # RUN: llvm-readobj --sections --section-data %t9 | FileCheck %s --check-prefix=SIZE
193 # SIZE: SectionData (
194 # SIZE-NEXT: 0000: 00000000 00000000 00000000 00000000 |
195 # SIZE-NEXT: 0010: 00 |
208 ## Check we can use "Size" and "Content" together to create a SHT_HASH section.
210 # RUN: yaml2obj --docnum=10 %s -o %t10
211 # RUN: llvm-readobj --sections --section-data %t10 | FileCheck %s --check-prefix=SIZE-CONTENT
213 # SIZE-CONTENT: Name: .hash
214 # SIZE-CONTENT: Size:
215 # SIZE-CONTENT-SAME: 5
216 # SIZE-CONTENT: SectionData (
217 # SIZE-CONTENT-NEXT: 0000: 11223300 00 |
218 # SIZE-CONTENT-NEXT: )
231 ## Check that when "Size" and "Content" are used together, the size
232 ## must be greater than or equal to the content size.
234 # RUN: not yaml2obj --docnum=11 %s 2>&1 | FileCheck %s --check-prefix=SIZE-CONTENT-ERR
236 # SIZE-CONTENT-ERR: error: Section size must be greater than or equal to the content size
249 ## Check we can't use "Size" and "Bucket" tags together.
251 # RUN: not yaml2obj --docnum=12 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-BUCKET
264 ## Check we can't use "Size" and "Chain" tags together.
266 # RUN: not yaml2obj --docnum=13 %s 2>&1 | FileCheck %s --check-prefix=CONTENT-CHAIN
279 ## Check we can override "nbucket" and "nchain" values of a SHT_HASH section using "NBucket"
280 ## and "NChain" tags. Check that the section size is unaffected when we do this.
282 # RUN: yaml2obj --docnum=14 %s -o %t14
283 # RUN: llvm-readobj --sections --section-data %t14 | FileCheck %s --check-prefix=OVERRIDE
285 # OVERRIDE: Name: .hash
286 # OVERRIDE-NEXT: Type: SHT_HASH
287 # OVERRIDE-NEXT: Flags [
289 # OVERRIDE-NEXT: Address: 0x0
290 # OVERRIDE-NEXT: Offset: 0x34
291 # OVERRIDE-NEXT: Size: 28
292 # OVERRIDE-NEXT: Link: 0
293 # OVERRIDE-NEXT: Info: 0
294 # OVERRIDE-NEXT: AddressAlignment: 0
295 # OVERRIDE-NEXT: EntrySize: 4
296 # OVERRIDE-NEXT: SectionData (
297 # OVERRIDE-NEXT: 0000: AA000000 BB000000 01000000 02000000
298 # OVERRIDE-NEXT: 0010: 03000000 04000000 05000000