1 ## Check how yaml2obj produces .stack_sizes sections.
3 ## Test the following cases when the .stack_sizes Content field is specified:
4 ## 1) We can produce a .stack_sizes section from a description with
5 ## a valid section content.
6 ## 2) We can produce an incorrect .stack_sizes section from a description with
7 ## a broken (truncated) section content.
8 ## 3) We can produce an empty .stack_sizes section from a description with
9 ## empty section content.
11 # RUN: yaml2obj --docnum=1 %s -o %t1
12 # RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s
14 ## Case 1: valid content.
17 # CHECK-NEXT: Name: .stack_sizes (1)
18 # CHECK-NEXT: Type: SHT_PROGBITS (0x1)
19 # CHECK-NEXT: Flags [ (0x0)
21 # CHECK-NEXT: Address: 0x0
22 # CHECK-NEXT: Offset: 0x40
26 # CHECK-NEXT: AddressAlignment: 0
27 # CHECK-NEXT: EntrySize: 0
28 # CHECK-NEXT: SectionData (
29 # CHECK-NEXT: 0000: 10000000 00000000 20
33 ## Case 2: truncated content.
34 # CHECK: Name: .stack_sizes
37 # CHECK: SectionData (
38 # CHECK-NEXT: 0000: 10000000 00000000
40 ## Case 3: empty content.
41 # CHECK: Name: .stack_sizes
53 - Name: '.stack_sizes [1]'
55 Content: "100000000000000020"
57 - Name: '.stack_sizes [2]'
59 Content: "1000000000000000"
61 - Name: '.stack_sizes [3]'
65 ## Check we can describe .stack_sizes section using <address, size> pairs.
67 # RUN: yaml2obj --docnum=2 %s -o %t2
68 # RUN: llvm-readobj --sections --section-data %t2 | FileCheck %s --check-prefix=ENTRIES-LE64-BOTH
69 # RUN: yaml2obj --docnum=3 %s -o %t3
70 # RUN: llvm-readobj --sections --section-data %t3 | FileCheck %s --check-prefix=ENTRIES-BE64-BOTH
71 # RUN: yaml2obj --docnum=4 %s -o %t4
72 # RUN: llvm-readobj --sections --section-data %t4 | FileCheck %s --check-prefix=ENTRIES-LE32-BOTH
73 # RUN: yaml2obj --docnum=5 %s -o %t5
74 # RUN: llvm-readobj --sections --section-data %t5 | FileCheck %s --check-prefix=ENTRIES-BE32-BOTH
76 # ENTRIES-LE64-BOTH: Name: .stack_sizes
77 # ENTRIES-LE64-BOTH: SectionData (
78 # ENTRIES-LE64-BOTH-NEXT: 0000: 10000000 00000000 20300000 00000000 |
79 # ENTRIES-LE64-BOTH-NEXT: 0010: 0040 |
81 # ENTRIES-BE64-BOTH: Name: .stack_sizes
82 # ENTRIES-BE64-BOTH: SectionData (
83 # ENTRIES-BE64-BOTH-NEXT: 0000: 00000000 00000010 20000000 00000000 |
84 # ENTRIES-BE64-BOTH-NEXT: 0010: 3040
86 # ENTRIES-LE32-BOTH: Name: .stack_sizes
87 # ENTRIES-LE32-BOTH: SectionData (
88 # ENTRIES-LE32-BOTH-NEXT: 0000: 10000000 20300000 0040 |
90 # ENTRIES-BE32-BOTH: Name: .stack_sizes
91 # ENTRIES-BE32-BOTH: SectionData (
92 # ENTRIES-BE32-BOTH-NEXT: 0000: 00000010 20000000 3040 |
154 ## Check we can omit the "Address" tag. In this case the address will be zero.
156 # RUN: yaml2obj --docnum=6 %s -o %t6
157 # RUN: llvm-readobj --sections --section-data %t6 | FileCheck %s --check-prefix=ENTRIES-NOADDR
159 # ENTRIES-NOADDR: Name: .stack_sizes
160 # ENTRIES-NOADDR: SectionData (
161 # ENTRIES-NOADDR-NEXT: 0000: 00000000 00000000 10000000 00000000 |
162 # ENTRIES-NOADDR-NEXT: 0010: 0020 |
177 ## Check that "Size" tag is mandatory when we describe .stack_sizes using "Entries".
179 # RUN: not yaml2obj --docnum=7 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-NOSIZE
181 # ENTRIES-NOSIZE: error: missing required key 'Size'
195 ## Check we can't use both "Content" and "Entries" tags at the same time.
197 # RUN: not yaml2obj --docnum=8 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-AND-CONTENT
199 # ENTRIES-AND-CONTENT: error: .stack_sizes: Content and Entries cannot be used together
215 ## Check we must specify either "Content", "Entries" or "Size" tag when describing .stack_sizes.
217 # RUN: not yaml2obj --docnum=9 %s 2>&1 | FileCheck %s --check-prefix=NO-TAGS
219 # NO-TAGS: .stack_sizes: one of Content, Entries and Size must be specified
231 ## Check we can't use both "Size" and "Entries" tags at the same time.
233 # RUN: not yaml2obj --docnum=10 %s 2>&1 | FileCheck %s --check-prefix=ENTRIES-AND-SIZE
235 # ENTRIES-AND-SIZE: .stack_sizes: Size and Entries cannot be used together
251 ## Check we can use only "Size" to create .stack_sizes section.
253 # RUN: yaml2obj --docnum=11 %s -o %t11
254 # RUN: llvm-readobj --sections --section-data %t11 | FileCheck %s --check-prefix=SIZE
256 # SIZE: Name: .stack_sizes
259 # SIZE: SectionData (
260 # SIZE-NEXT: 0000: 00000000 00000000 00000000 00000000 |
261 # SIZE-NEXT: 0010: 00 |
275 ## Check we can use "Size" and "Content" together to create .stack_sizes section.
277 # RUN: yaml2obj --docnum=12 %s -o %t12
278 # RUN: llvm-readobj --sections --section-data %t12 | FileCheck %s --check-prefix=SIZE-CONTENT
280 # SIZE-CONTENT: Name: .stack_sizes
281 # SIZE-CONTENT: Size:
282 # SIZE-CONTENT-SAME: 5
283 # SIZE-CONTENT: SectionData (
284 # SIZE-CONTENT-NEXT: 0000: 11223300 00 |
285 # SIZE-CONTENT-NEXT: )
299 # RUN: not yaml2obj --docnum=13 %s 2>&1 | FileCheck %s --check-prefix=SIZE-CONTENT-ERR
301 # SIZE-CONTENT-ERR: error: .stack_sizes: Size must be greater than or equal to the content size
315 ## Check we can describe multiple .stack_sizes sections using unique suffixes.
317 # RUN: yaml2obj --docnum=14 %s -o %t11
318 # RUN: llvm-readobj --sections --section-data %t11 | FileCheck %s --check-prefix=UNIQUE
320 # UNIQUE: Name: .stack_sizes
321 # UNIQUE: SectionData (
322 # UNIQUE-NEXT: 0000: 10000000 00000000 20 |
324 # UNIQUE: Name: .stack_sizes
325 # UNIQUE: SectionData (
326 # UNIQUE-NEXT: 0000: 30000000 00000000 40 |
335 - Name: '.stack_sizes [1]'
340 - Name: '.stack_sizes [2]'