llvm-for-llvmta/test/tools/yaml2obj/ELF/bb-addr-map.yaml

117 lines
3.3 KiB
YAML
Raw Permalink Normal View History

2022-04-25 10:02:23 +02:00
## Check how yaml2obj produces .llvm_bb_addr_map sections.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: llvm-readobj --sections --section-data %t1 | FileCheck %s
## Case 1: Specify content.
# CHECK: Section {
# CHECK: Index: 1
# CHECK-NEXT: Name: .llvm_bb_addr_map (1)
# CHECK-NEXT: Type: SHT_LLVM_BB_ADDR_MAP (0x6FFF4C08)
# CHECK-NEXT: Flags [ (0x0)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0x0
# CHECK-NEXT: Offset: 0x40
# CHECK-NEXT: Size: 12
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 0
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: SectionData (
# CHECK-NEXT: 0000: 00000000 00000000 01010203
# CHECK-NEXT: )
# CHECK-NEXT: }
## Case 2: Empty.
# CHECK: Name: .llvm_bb_addr_map (1)
# CHECK: Size:
# CHECK-SAME: {{^ 0$}}
## Case 3: Specify Size only.
# CHECK: Name: .llvm_bb_addr_map (1)
# CHECK: SectionData (
# CHECK-NEXT: 0000: 00000000 00000000
# CHECK-NEXT: )
# Case 4: Specify Entries.
# CHECK: Name: .llvm_bb_addr_map (1)
# CHECK: SectionData (
# CHECK-NEXT: 0000: 20000000 00000000 01010203
# CHECK-NEXT: )
# Case 5: Specify Entries and omit the Address field.
# CHECK: Name: .llvm_bb_addr_map (1)
# CHECK: Address:
# CHECK-SAME: {{^ 0x0$}}
# CHECK: SectionData (
# CHECK-NEXT: 0000: 00000000 00000000 01010203
# CHECK-NEXT: )
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
## Test the following cases:
## 1) We can produce an .llvm_bb_addr_map section from a description with section
## content.
## Specify Content.
- Name: '.llvm_bb_addr_map (1)'
Type: SHT_LLVM_BB_ADDR_MAP
Content: "000000000000000001010203"
## 2) We can produce an empty .llvm_bb_addr_map section from a description
## with empty section content.
- Name: '.llvm_bb_addr_map (2)'
Type: SHT_LLVM_BB_ADDR_MAP
## 3) We can produce a zero .llvm_bb_addr_map section of a specific size when
## we specify the size only.
- Name: '.llvm_bb_addr_map (3)'
Type: SHT_LLVM_BB_ADDR_MAP
Size: 8
## 4) We can produce an .llvm_bb_addr_map section from a description with
## Entries.
- Name: '.llvm_bb_addr_map (4)'
Type: SHT_LLVM_BB_ADDR_MAP
Entries:
- Address: 0x0000000000000020
BBEntries:
- AddressOffset: 0x00000001
Size: 0x00000002
Metadata: 0x00000003
## 5) When specifying the description with Entries, the 'Address' field will be
## zero when omitted.
- Name: '.llvm_bb_addr_map (5)'
Type: SHT_LLVM_BB_ADDR_MAP
Entries:
- BBEntries:
- AddressOffset: 0x00000001
Size: 0x00000002
Metadata: 0x00000003
## Check we can't use Entries at the same time as either Content or Size.
# RUN: not yaml2obj --docnum=2 -DCONTENT="00" %s 2>&1 | FileCheck %s --check-prefix=INVALID
# RUN: not yaml2obj --docnum=2 -DSIZE="0" %s 2>&1 | FileCheck %s --check-prefix=INVALID
# INVALID: error: "Entries" cannot be used with "Content" or "Size"
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
## Specify Content and Size
- Name: '.llvm_bb_addr_map'
Type: SHT_LLVM_BB_ADDR_MAP
Entries: []
Content: [[CONTENT=<none>]]
Size: [[SIZE=<none>]]