1 ## Check how yaml2obj produces .llvm_bb_addr_map sections.
3 # RUN: yaml2obj --docnum=1 %s -o %t1
4 # RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s
6 ## Case 1: Specify content.
9 # CHECK-NEXT: Name: .llvm_bb_addr_map (1)
10 # CHECK-NEXT: Type: SHT_LLVM_BB_ADDR_MAP (0x6FFF4C0A)
11 # CHECK-NEXT: Flags [ (0x0)
13 # CHECK-NEXT: Address: 0x0
14 # CHECK-NEXT: Offset: 0x40
15 # CHECK-NEXT: Size: 13
18 # CHECK-NEXT: AddressAlignment: 0
19 # CHECK-NEXT: EntrySize: 0
20 # CHECK-NEXT: SectionData (
21 # CHECK-NEXT: 0000: 00000000 00000000 01010203 04
26 # CHECK: Name: .llvm_bb_addr_map (1)
28 # CHECK-SAME: {{^ 0$}}
30 ## Case 3: Specify Size only.
31 # CHECK: Name: .llvm_bb_addr_map (1)
32 # CHECK: SectionData (
33 # CHECK-NEXT: 0000: 00000000 00000000
36 # Case 4: Specify Entries.
37 # CHECK: Name: .llvm_bb_addr_map (1)
38 # CHECK: SectionData (
39 # CHECK-NEXT: 0000: 02002000 00000000 0000010B 010203
42 # Case 5: Specify Entries and omit the Address field.
43 # CHECK: Name: .llvm_bb_addr_map (1)
45 # CHECK-SAME: {{^ 0x0$}}
46 # CHECK: SectionData (
47 # CHECK-NEXT: 0000: 02000000 00000000 0000010C 010203
50 # Case 6: Override the NumBlocks field.
51 # CHECK: Name: .llvm_bb_addr_map (1)
52 # CHECK: SectionData (
53 # CHECK-NEXT: 0000: 02002000 00000000 0000020D 010203
56 # Case 7: Specify empty BBRanges.
57 # CHECK: Name: .llvm_bb_addr_map (1)
58 # CHECK: SectionData (
59 # CHECK-NEXT: 0000: 020000
62 # Case 8: Specify empty BBRanges with multi-bb-range.
63 # CHECK: Name: .llvm_bb_addr_map (1)
64 # CHECK: SectionData (
65 # CHECK-NEXT: 0000: 020800
78 ## Test the following cases:
80 ## 1) We can produce an .llvm_bb_addr_map section from a description with section
83 - Name: '.llvm_bb_addr_map (1)'
84 Type: SHT_LLVM_BB_ADDR_MAP
85 Content: "00000000000000000101020304"
87 ## 2) We can produce an empty .llvm_bb_addr_map section from a description
88 ## with empty section content.
89 - Name: '.llvm_bb_addr_map (2)'
90 Type: SHT_LLVM_BB_ADDR_MAP
92 ## 3) We can produce a zero .llvm_bb_addr_map section of a specific size when
93 ## we specify the size only.
94 - Name: '.llvm_bb_addr_map (3)'
95 Type: SHT_LLVM_BB_ADDR_MAP
98 ## 4) We can produce an .llvm_bb_addr_map section from a description with
100 - Name: '.llvm_bb_addr_map (4)'
101 Type: SHT_LLVM_BB_ADDR_MAP
105 - BaseAddress: 0x0000000000000020
108 AddressOffset: 0x00000001
112 ## 5) When specifying the description with Entries, the 'Address' field will be
113 ## zero when omitted.
114 - Name: '.llvm_bb_addr_map (5)'
115 Type: SHT_LLVM_BB_ADDR_MAP
121 AddressOffset: 0x00000001
125 ## 6) We can override the NumBlocks field with a value different from the
126 ## actual number of BB Entries.
127 - Name: '.llvm_bb_addr_map (6)'
128 Type: SHT_LLVM_BB_ADDR_MAP
132 - BaseAddress: 0x0000000000000020
136 AddressOffset: 0x00000001
140 ## 7) We can produce a SHT_LLVM_BB_ADDR_MAP section from a description
141 ## with one entry with empty BBRanges.
142 - Name: '.llvm_bb_addr_map (7)'
143 Type: SHT_LLVM_BB_ADDR_MAP
148 ## 8) We can produce a SHT_LLVM_BB_ADDR_MAP section from a multi-bb-range
149 ## description with one entry with empty BBRanges.
150 - Name: '.llvm_bb_addr_map (8)'
151 Type: SHT_LLVM_BB_ADDR_MAP
157 ## Check we can't use Entries at the same time as either Content or Size.
158 # RUN: not yaml2obj --docnum=2 -DCONTENT="00" %s 2>&1 | FileCheck %s --check-prefix=INVALID
159 # RUN: not yaml2obj --docnum=2 -DSIZE="0" %s 2>&1 | FileCheck %s --check-prefix=INVALID
161 # INVALID: error: "Entries" cannot be used with "Content" or "Size"
169 ## Specify Content and Size
170 - Name: '.llvm_bb_addr_map'
171 Type: SHT_LLVM_BB_ADDR_MAP
173 Content: [[CONTENT=<none>]]
174 Size: [[SIZE=<none>]]
176 ## Check that yaml2obj generates a warning when we use unsupported versions.
177 # RUN: yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=INVALID-VERSION
178 # INVALID-VERSION: warning: unsupported SHT_LLVM_BB_ADDR_MAP version: 3; encoding using the most recent version
186 - Name: '.llvm_bb_addr_map'
187 Type: SHT_LLVM_BB_ADDR_MAP
189 ## Specify unsupported version