## Check how obj2yaml produces YAML .stack_sizes descriptions.
## Check that obj2yaml uses the "Entries" tag to describe a .stack_sizes section
## when it can extract <address, size> pairs.
# RUN: yaml2obj --docnum=1 %s -o %t1
# RUN: obj2yaml %t1 | FileCheck %s --check-prefix=VALID
# VALID: --- !ELF
# VALID-NEXT: FileHeader:
# VALID-NEXT: Class: ELFCLASS64
# VALID-NEXT: Data: ELFDATA2LSB
# VALID-NEXT: Type: ET_EXEC
# VALID-NEXT: Sections:
# VALID-NEXT: - Name: .stack_sizes
# VALID-NEXT: Type: SHT_PROGBITS
# VALID-NEXT: Entries:
# VALID-NEXT: - Address: 0x10
# VALID-NEXT: Size: 0x20
# VALID-NEXT: - Address: 0x30
# VALID-NEXT: Size: 0x40
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
- Name: .stack_sizes
Type: SHT_PROGBITS
Content: "100000000000000020300000000000000040"
## Check that obj2yaml uses the "Content" tag to describe a .stack_sizes section
## when it can't extract the entries, for example, when section data is truncated.
# RUN: yaml2obj --docnum=2 %s -o %t2
# RUN: obj2yaml %t2 | FileCheck %s --check-prefix=INVALID
# INVALID: --- !ELF
# INVALID-NEXT: FileHeader:
# INVALID-NEXT: Class: ELFCLASS64
# INVALID-NEXT: Data: ELFDATA2LSB
# INVALID-NEXT: Type: ET_EXEC
# INVALID-NEXT: Sections:
# INVALID-NEXT: - Name: .stack_sizes
# INVALID-NEXT: Type: SHT_PROGBITS
# INVALID-NEXT: Content: '1000000000000000203000000000000000'
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
- Name: .stack_sizes
Type: SHT_PROGBITS
Content: "1000000000000000203000000000000000"
## Check obj2yaml can dump empty .stack_sizes.
# RUN: yaml2obj --docnum=3 %s -o %t3
# RUN: obj2yaml %t3 | FileCheck %s --check-prefix=EMPTY
# EMPTY: --- !ELF
# EMPTY-NEXT: FileHeader:
# EMPTY-NEXT: Class: ELFCLASS64
# EMPTY-NEXT: Data: ELFDATA2LSB
# EMPTY-NEXT: Type: ET_EXEC
# EMPTY-NEXT: Sections:
# EMPTY-NEXT: - Name: .stack_sizes
# EMPTY-NEXT: Type: SHT_PROGBITS
# EMPTY-NEXT: Content: ''
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
- Name: .stack_sizes
Type: SHT_PROGBITS
Content: ""
## Check obj2yaml can dump multiple .stack_sizes.
# RUN: yaml2obj --docnum=4 %s -o %t4
# RUN: obj2yaml %t4 | FileCheck %s --check-prefix=MULTI
# MULTI: --- !ELF
# MULTI-NEXT: FileHeader:
# MULTI-NEXT: Class: ELFCLASS64
# MULTI-NEXT: Data: ELFDATA2LSB
# MULTI-NEXT: Type: ET_EXEC
# MULTI-NEXT: Sections:
# MULTI-NEXT: - Name: .stack_sizes
# MULTI-NEXT: Type: SHT_PROGBITS
# MULTI-NEXT: Entries:
# MULTI-NEXT: - Address: 0x10
# MULTI-NEXT: Size: 0x20
# MULTI-NEXT: - Address: 0x30
# MULTI-NEXT: Size: 0x40
# MULTI-NEXT: - Name: '.stack_sizes (1)'
# MULTI-NEXT: Type: SHT_PROGBITS
# MULTI-NEXT: Entries:
# MULTI-NEXT: - Address: 0x50
# MULTI-NEXT: Size: 0x1
# MULTI-NEXT: - Address: 0x60
# MULTI-NEXT: Size: 0x2
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Sections:
- Name: .stack_sizes
Type: SHT_PROGBITS
Entries:
- Address: 0x10
Size: 0x20
- Address: 0x30
Size: 0x40
- Name: '.stack_sizes (1)'
Type: SHT_PROGBITS
Entries:
- Address: 0x50
Size: 0x1
- Address: 0x60
Size: 0x2