1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/Object/yaml2obj-elf-section-basic.yaml
Chris Bieneman 1f183c5130 [yaml2obj] Remove --format option in favor of YAML tags
Summary:
Our YAML library's handling of tags isn't perfect, but it is good enough to get rid of the need for the --format argument to yaml2obj. This patch does exactly that.

Instead of requiring --format, it infers the format based on the tags found in the object file. The supported tags are:

!ELF
!COFF
!mach-o
!fat-mach-o

I have a corresponding patch that is quite large that fixes up all the in-tree test cases.

Reviewers: rafael, Bigcheese, compnerd, silvas

Subscribers: compnerd, llvm-commits

Differential Revision: http://reviews.llvm.org/D21711

llvm-svn: 273915
2016-06-27 19:53:53 +00:00

80 lines
2.2 KiB
YAML

# RUN: yaml2obj %s | llvm-readobj -sections -section-data - | FileCheck %s
# RUN: yaml2obj -o %t %s
# RUN: llvm-readobj -sections -section-data %t | FileCheck %s
!ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
Address: 0xCAFEBABE
Link: .text # Doesn't make sense for SHT_PROGBITS, but good enough for test.
Content: EBFE
AddressAlign: 2
- Name: .data
Type: SHT_PROGBITS
Flags: [ SHF_ALLOC ]
Address: 0xCAFECAFE
Content: FEBF
Size: 8
AddressAlign: 2
# CHECK: Section {
# CHECK: Index: 0
# CHECK: Type: SHT_NULL (0x0)
#
# CHECK: Section {
# CHECK: Name: .text
# CHECK: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x6)
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: SHF_EXECINSTR (0x4)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0xCAFEBABE
# CHECK: Size: 2
# Check that Link != 0.
# CHECK: Link: {{[1-9][0-9]*}}
# CHECK: AddressAlignment: 2
# CHECK: SectionData (
# CHECK-NEXT: 0000: EBFE
# CHECK-NEXT: )
#
# CHECK: Section {
# CHECK: Name: .data
# CHECK-NEXT: Type: SHT_PROGBITS (0x1)
# CHECK-NEXT: Flags [ (0x2)
# CHECK-NEXT: SHF_ALLOC (0x2)
# CHECK-NEXT: ]
# CHECK-NEXT: Address: 0xCAFECAFE
# CHECK-NEXT: Offset: 0x{{[0-9A-F]+}}
# CHECK-NEXT: Size: 8
# CHECK-NEXT: Link: 0
# CHECK-NEXT: Info: 0
# CHECK-NEXT: AddressAlignment: 2
# CHECK-NEXT: EntrySize: 0
# CHECK-NEXT: SectionData (
# CHECK-NEXT: 0000: FEBF0000 00000000 |........|
# CHECK-NEXT: )
#
# CHECK: Section {
# CHECK: Name: .symtab (25)
# CHECK: Type: SHT_SYMTAB (0x2)
# CHECK: AddressAlignment: 8
# CHECK: }
# CHECK: Section {
# CHECK: Name: .strtab (17)
# CHECK: Type: SHT_STRTAB (0x3)
# CHECK: AddressAlignment: 1
# CHECK: }
# CHECK: Section {
# CHECK: Name: .shstrtab (7)
# CHECK: Type: SHT_STRTAB (0x3)
# CHECK: AddressAlignment: 1
# CHECK: }