1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/tools/obj2yaml/elf-stack-sizes.yaml
George Rimar 216513b584 [yaml2obj/obj2yaml] - Add support for .stack_sizes sections.
.stack_sizes is a SHT_PROGBITS section that contains pairs of
<address (4/8 bytes), stack size (uleb128)>.

This patch teach tools to parse and dump it.

Differential revision: https://reviews.llvm.org/D67757

llvm-svn: 372762
2019-09-24 14:22:37 +00:00

89 lines
2.5 KiB
YAML

## 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: Machine: EM_X86_64
# VALID-NEXT: Sections:
# VALID-NEXT: - Name: .stack_sizes
# VALID-NEXT: Type: SHT_PROGBITS
# VALID-NEXT: Entries:
# VALID-NEXT: - Address: 0x0000000000000010
# VALID-NEXT: Size: 0x0000000000000020
# VALID-NEXT: - Address: 0x0000000000000030
# VALID-NEXT: Size: 0x0000000000000040
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
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: Machine: EM_X86_64
# 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
Machine: EM_X86_64
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: Machine: EM_X86_64
# 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
Machine: EM_X86_64
Sections:
- Name: .stack_sizes
Type: SHT_PROGBITS
Content: ""