1 ## Check how yaml2obj produces .llvm_bb_addr_map sections.
3 ## Fails on windows (https://github.com/llvm/llvm-project/issues/60013).
4 # UNSUPPORTED: system-windows
6 # RUN: yaml2obj --docnum=1 %s -o %t1
7 # RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s
9 ## Case 1: Specify content.
12 # CHECK-NEXT: Name: .llvm_bb_addr_map (1)
13 # CHECK-NEXT: Type: SHT_LLVM_BB_ADDR_MAP (0x6FFF4C0A)
14 # CHECK-NEXT: Flags [ (0x0)
16 # CHECK-NEXT: Address: 0x0
17 # CHECK-NEXT: Offset: 0x40
18 # CHECK-NEXT: Size: 13
21 # CHECK-NEXT: AddressAlignment: 0
22 # CHECK-NEXT: EntrySize: 0
23 # CHECK-NEXT: SectionData (
24 # CHECK-NEXT: 0000: 00000000 00000000 01010203 04
29 # CHECK: Name: .llvm_bb_addr_map (1)
31 # CHECK-SAME: {{^ 0$}}
33 ## Case 3: Specify Size only.
34 # CHECK: Name: .llvm_bb_addr_map (1)
35 # CHECK: SectionData (
36 # CHECK-NEXT: 0000: 00000000 00000000
39 # Case 4: Specify Entries.
40 # CHECK: Name: .llvm_bb_addr_map (1)
41 # CHECK: SectionData (
42 # CHECK-NEXT: 0000: 02002000 00000000 0000010B 010203
45 # Case 5: Specify Entries and omit the Address field.
46 # CHECK: Name: .llvm_bb_addr_map (1)
48 # CHECK-SAME: {{^ 0x0$}}
49 # CHECK: SectionData (
50 # CHECK-NEXT: 0000: 02000000 00000000 0000010C 010203
53 # Case 6: Override the NumBlocks field.
54 # CHECK: Name: .llvm_bb_addr_map (1)
55 # CHECK: SectionData (
56 # CHECK-NEXT: 0000: 02002000 00000000 0000020D 010203
66 ## Test the following cases:
68 ## 1) We can produce an .llvm_bb_addr_map section from a description with section
71 - Name: '.llvm_bb_addr_map (1)'
72 Type: SHT_LLVM_BB_ADDR_MAP
73 Content: "00000000000000000101020304"
75 ## 2) We can produce an empty .llvm_bb_addr_map section from a description
76 ## with empty section content.
77 - Name: '.llvm_bb_addr_map (2)'
78 Type: SHT_LLVM_BB_ADDR_MAP
80 ## 3) We can produce a zero .llvm_bb_addr_map section of a specific size when
81 ## we specify the size only.
82 - Name: '.llvm_bb_addr_map (3)'
83 Type: SHT_LLVM_BB_ADDR_MAP
86 ## 4) We can produce an .llvm_bb_addr_map section from a description with
88 - Name: '.llvm_bb_addr_map (4)'
89 Type: SHT_LLVM_BB_ADDR_MAP
92 Address: 0x0000000000000020
95 AddressOffset: 0x00000001
99 ## 5) When specifying the description with Entries, the 'Address' field will be
100 ## zero when omitted.
101 - Name: '.llvm_bb_addr_map (5)'
102 Type: SHT_LLVM_BB_ADDR_MAP
107 AddressOffset: 0x00000001
111 ## 6) We can override the NumBlocks field with a value different from the
112 ## actual number of BB Entries.
113 - Name: '.llvm_bb_addr_map (6)'
114 Type: SHT_LLVM_BB_ADDR_MAP
117 Address: 0x0000000000000020
121 AddressOffset: 0x00000001
125 ## Check we can't use Entries at the same time as either Content or Size.
126 # RUN: not yaml2obj --docnum=2 -DCONTENT="00" %s 2>&1 | FileCheck %s --check-prefix=INVALID
127 # RUN: not yaml2obj --docnum=2 -DSIZE="0" %s 2>&1 | FileCheck %s --check-prefix=INVALID
129 # INVALID: error: "Entries" cannot be used with "Content" or "Size"
137 ## Specify Content and Size
138 - Name: '.llvm_bb_addr_map'
139 Type: SHT_LLVM_BB_ADDR_MAP
141 Content: [[CONTENT=<none>]]
142 Size: [[SIZE=<none>]]
144 ## Check that yaml2obj generates a warning when we use unsupported versions.
145 # RUN: yaml2obj --docnum=3 %s 2>&1 | FileCheck %s --check-prefix=INVALID-VERSION
146 # INVALID-VERSION: warning: unsupported SHT_LLVM_BB_ADDR_MAP version: 3; encoding using the most recent version
154 - Name: '.llvm_bb_addr_map'
155 Type: SHT_LLVM_BB_ADDR_MAP
157 ## Specify unsupported version