+++ /dev/null
---- !COFF
-header:
- Machine: IMAGE_FILE_MACHINE_AMD64
- Characteristics: [ IMAGE_FILE_RELOCS_STRIPPED, IMAGE_FILE_LINE_NUMS_STRIPPED ]
-sections:
-symbols:
- - Name: .file
- Value: 0
- SectionNumber: 65534
- SimpleType: IMAGE_SYM_TYPE_NULL
- ComplexType: IMAGE_SYM_DTYPE_NULL
- StorageClass: IMAGE_SYM_CLASS_FILE
- File: filename_with_22_chars
-...
+++ /dev/null
-RUN: yaml2obj %p/Inputs/COFF/long-file-symbol.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386
-
-COFF-I386: File: filename_with_22_chars
+++ /dev/null
-RUN: yaml2obj %p/Inputs/COFF/long-section-name.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386
-
-COFF-I386: Name: .long_section_name
+++ /dev/null
-RUN: yaml2obj %p/Inputs/COFF/section-aux-symbol.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386
-
-COFF-I386: sections:
-COFF-I386-NEXT: - Name: .CRT
-COFF-I386: symbols:
-COFF-I386: - Name: '.CRT$XCAA'
-COFF-I386-NEXT: Value: 4
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 1
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XIAA'
-COFF-I386-NEXT: Value: 16
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 1
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XLD'
-COFF-I386-NEXT: Value: 36
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 1
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XLC'
-COFF-I386-NEXT: Value: 32
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 1
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XDZ'
-COFF-I386-NEXT: Value: 48
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XDA'
-COFF-I386-NEXT: Value: 44
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XLZ'
-COFF-I386-NEXT: Value: 40
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XLA'
-COFF-I386-NEXT: Value: 28
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XIC'
-COFF-I386-NEXT: Value: 20
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 1
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XCZ'
-COFF-I386-NEXT: Value: 8
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XCA'
-COFF-I386-NEXT: Value: 0
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XIZ'
-COFF-I386-NEXT: Value: 24
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
-COFF-I386: - Name: '.CRT$XIA'
-COFF-I386-NEXT: Value: 12
-COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
-COFF-I386-NEXT: SectionDefinition:
-COFF-I386-NEXT: Length: 4
-COFF-I386-NEXT: NumberOfRelocations: 0
-COFF-I386-NEXT: NumberOfLinenumbers: 0
+++ /dev/null
-RUN: yaml2obj %p/Inputs/COFF/weak-external.yaml | obj2yaml | FileCheck %s --check-prefix COFF-I386
-
-COFF-I386: Characteristics: 0
+++ /dev/null
-RUN: obj2yaml %p/Inputs/invalid-reloc.elf-x86-64 | FileCheck %s
-
-CHECK: --- !ELF
-CHECK-NEXT: FileHeader:
-CHECK-NEXT: Class: ELFCLASS64
-CHECK-NEXT: Data: ELFDATA2LSB
-CHECK-NEXT: OSABI: ELFOSABI_FREEBSD
-CHECK-NEXT: Type: ET_REL
-CHECK-NEXT: Machine: EM_X86_64
-CHECK-NEXT: Sections:
-CHECK-NEXT: - Name: .text
-CHECK-NEXT: Type: SHT_PROGBITS
-CHECK-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
-CHECK-NEXT: AddressAlign: 0x0000000000000004
-CHECK-NEXT: Content: 4833C0C390
-CHECK-NEXT: - Name: .rela.text
-CHECK-NEXT: Type: SHT_RELA
-CHECK-NEXT: Link: .symtab
-CHECK-NEXT: AddressAlign: 0x0000000000000008
-CHECK-NEXT: EntSize: 0x0000000000000018
-CHECK-NEXT: Info: .text
-CHECK-NEXT: Relocations:
-CHECK-NEXT: - Offset: 0x0000000000000000
-CHECK-NEXT: Symbol: ''
-CHECK-NEXT: Type: R_X86_64_NONE
-CHECK-NEXT: Symbols:
-CHECK-NEXT: - Name: rb_ary_new_capa
-CHECK-NEXT: Type: STT_FUNC
-CHECK-NEXT: Section: .text
-CHECK-NEXT: Size: 0x0000000000000005
-CHECK-NEXT: - Name: __dtraceenabled_ruby___array-create
-CHECK-NEXT: Index: SHN_ABS
-CHECK-NEXT: Binding: STB_GLOBAL
-CHECK-NEXT: - Name: '$dtrace1316529.rb_ary_new_capa'
-CHECK-NEXT: Type: STT_FUNC
-CHECK-NEXT: Section: .text
-CHECK-NEXT: Binding: STB_GLOBAL
-CHECK-NEXT: Size: 0x0000000000000005
-CHECK-NEXT: Visibility: STV_HIDDEN
+++ /dev/null
-# Checks that the tool is able to read section groups with ELF.
-RUN: obj2yaml %p/Inputs/sectionGroup.elf.x86-64 > %t1.sectiongroup.yaml
-RUN: FileCheck %s --check-prefix ELF-GROUP < %t1.sectiongroup.yaml
-RUN: yaml2obj %t1.sectiongroup.yaml -o %t2.o.elf
-RUN: llvm-readobj --sections %t2.o.elf | FileCheck %s -check-prefix=SECTIONS
-#ELF-GROUP: - Name: .group
-#ELF-GROUP: Type: SHT_GROUP
-#ELF-GROUP: Link: .symtab
-#ELF-GROUP: Info: a
-#ELF-GROUP: Members:
-#ELF-GROUP: - SectionOrType: GRP_COMDAT
-#ELF-GROUP: - SectionOrType: .rodata.a
-#SECTIONS: Format: ELF64-x86-64
-#SECTIONS: Arch: x86_64
-#SECTIONS: AddressSize: 64bit
-#SECTIONS: Section {
-#SECTIONS: Index: 1
-#SECTIONS: Name: .group (21)
-#SECTIONS: Type: SHT_GROUP (0x11)
-#SECTIONS: Flags [ (0x0)
-#SECTIONS: ]
-#SECTIONS: Address: 0x0
-#SECTIONS: Size: 8
-#SECTIONS: AddressAlignment: 4
-#SECTIONS: EntrySize: 4
-#SECTIONS: }
--- /dev/null
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s --check-prefix COFF-I386
+
+# COFF-I386: File: filename_with_22_chars
+
+--- !COFF
+header:
+ Machine: IMAGE_FILE_MACHINE_AMD64
+ Characteristics: [ IMAGE_FILE_RELOCS_STRIPPED, IMAGE_FILE_LINE_NUMS_STRIPPED ]
+sections:
+symbols:
+ - Name: .file
+ Value: 0
+ SectionNumber: 65534
+ SimpleType: IMAGE_SYM_TYPE_NULL
+ ComplexType: IMAGE_SYM_DTYPE_NULL
+ StorageClass: IMAGE_SYM_CLASS_FILE
+ File: filename_with_22_chars
+...
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s --check-prefix COFF-I386
+
+# COFF-I386: Name: .long_section_name
+
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_I386
sections:
- Name: .long_section_name
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
- Alignment: 1
- SectionData: ''
symbols:
...
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s --check-prefix COFF-I386
+
+# COFF-I386: sections:
+# COFF-I386-NEXT: - Name: .CRT
+# COFF-I386: symbols:
+# COFF-I386: - Name: '.CRT$XCAA'
+# COFF-I386-NEXT: Value: 4
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 1
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XIAA'
+# COFF-I386-NEXT: Value: 16
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 1
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XLD'
+# COFF-I386-NEXT: Value: 36
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 1
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XLC'
+# COFF-I386-NEXT: Value: 32
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 1
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XDZ'
+# COFF-I386-NEXT: Value: 48
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XDA'
+# COFF-I386-NEXT: Value: 44
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XLZ'
+# COFF-I386-NEXT: Value: 40
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XLA'
+# COFF-I386-NEXT: Value: 28
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XIC'
+# COFF-I386-NEXT: Value: 20
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 1
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XCZ'
+# COFF-I386-NEXT: Value: 8
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XCA'
+# COFF-I386-NEXT: Value: 0
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XIZ'
+# COFF-I386-NEXT: Value: 24
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+# COFF-I386: - Name: '.CRT$XIA'
+# COFF-I386-NEXT: Value: 12
+# COFF-I386: StorageClass: IMAGE_SYM_CLASS_STATIC
+# COFF-I386-NEXT: SectionDefinition:
+# COFF-I386-NEXT: Length: 4
+# COFF-I386-NEXT: NumberOfRelocations: 0
+# COFF-I386-NEXT: NumberOfLinenumbers: 0
+
--- !COFF
-header:
+header:
Machine: IMAGE_FILE_MACHINE_I386
Characteristics: [ IMAGE_FILE_RELOCS_STRIPPED, IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LINE_NUMS_STRIPPED, IMAGE_FILE_32BIT_MACHINE, IMAGE_FILE_DEBUG_STRIPPED ]
-sections:
+sections:
- Name: .CRT
Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
Alignment: 4
SectionData: 0000000030114000000000000000000010104000401640000000000000000000B015400060154000000000000000000000000000
-symbols:
+symbols:
- Name: '.CRT$XCAA'
Value: 4
SectionNumber: 1
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s --check-prefix COFF-I386
+
+# COFF-I386: Characteristics: 0
+
--- !COFF
header:
Machine: IMAGE_FILE_MACHINE_I386
--- /dev/null
+## Check yaml2obj is able to dump relocations
+## that have no or a zero symbol associated.
+
+# RUN: yaml2obj %s -o %t.o
+# RUN: obj2yaml %t.o | FileCheck %s
+
+# CHECK: --- !ELF
+# CHECK-NEXT: FileHeader:
+# CHECK-NEXT: Class: ELFCLASS64
+# CHECK-NEXT: Data: ELFDATA2LSB
+# CHECK-NEXT: Type: ET_REL
+# CHECK-NEXT: Machine: EM_X86_64
+# CHECK-NEXT: Sections:
+# CHECK-NEXT: - Name: .text
+# CHECK-NEXT: Type: SHT_PROGBITS
+# CHECK-NEXT: Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+# CHECK-NEXT: - Name: .rela.text
+# CHECK-NEXT: Type: SHT_RELA
+# CHECK-NEXT: Link: .symtab
+# CHECK-NEXT: EntSize: 0x0000000000000018
+# CHECK-NEXT: Info: .text
+# CHECK-NEXT: Relocations:
+# CHECK-NEXT: - Offset: 0x0000000000000000
+# CHECK-NEXT: Symbol: ''
+# CHECK-NEXT: Type: R_X86_64_NONE
+# CHECK-NEXT: - Offset: 0x0000000000000004
+# CHECK-NEXT: Symbol: ''
+# CHECK-NEXT: Type: R_X86_64_NONE
+# CHECK-NEXT: ...
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ - Name: .rela.text
+ Type: SHT_RELA
+ Info: .text
+ Relocations:
+ - Offset: 0x0
+ Type: R_X86_64_NONE
+ - Offset: 0x4
+ Type: R_X86_64_NONE
+ Symbol: 0
--- /dev/null
+## Checks that the tool is able to read section groups from ELF.
+
+# RUN: yaml2obj %s > %t1.o
+# RUN: llvm-readobj --elf-section-groups %t1.o | FileCheck %s -check-prefix=OBJ
+# RUN: obj2yaml %t1.o | FileCheck %s --check-prefix YAML
+
+# OBJ: Groups {
+# OBJ-NEXT: Group {
+# OBJ-NEXT: Name: .group
+# OBJ-NEXT: Index: 1
+# OBJ-NEXT: Link: 3
+# OBJ-NEXT: Info: 1
+# OBJ-NEXT: Type: COMDAT (0x1)
+# OBJ-NEXT: Signature: signature
+# OBJ-NEXT: Section(s) in group [
+# OBJ-NEXT: .rodata (2)
+# OBJ-NEXT: ]
+# OBJ-NEXT: }
+# OBJ-NEXT: }
+
+# YAML: - Name: .group
+# YAML: Type: SHT_GROUP
+# YAML: Link: .symtab
+# YAML: Info: signature
+# YAML: Members:
+# YAML: - SectionOrType: GRP_COMDAT
+# YAML: - SectionOrType: .rodata
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_X86_64
+Sections:
+ - Name: .group
+ Type: SHT_GROUP
+ Link: .symtab
+ Info: signature
+ Members:
+ - SectionOrType: GRP_COMDAT
+ - SectionOrType: .rodata
+ - Name: .rodata
+ Type: SHT_PROGBITS
+Symbols:
+ - Name: signature
+ Type: STT_OBJECT
+ Section: .rodata