llvm-6502/test/Object/obj2yaml.test
David Majnemer de6256c938 obj2yaml: Use the correct relocation type for different machine types
The IO normalizer would essentially lump I386 and AMD64 relocations
together.  Relocation types with the same numeric value would then get
mapped in appropriately.

For example:
IMAGE_REL_AMD64_ADDR64 and IMAGE_REL_I386_DIR16 both have a numeric
value of one.  We would see IMAGE_REL_I386_DIR16 in obj2yaml conversions
of object files with a machine type of IMAGE_FILE_MACHINE_AMD64.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205746 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-07 23:12:20 +00:00

186 lines
7.1 KiB
Plaintext

RUN: obj2yaml %p/Inputs/trivial-object-test.coff-i386 | FileCheck %s --check-prefix COFF-I386
RUN: obj2yaml %p/Inputs/trivial-object-test.coff-x86-64 | FileCheck %s --check-prefix COFF-X86-64
COFF-I386: header:
COFF-I386-NEXT: Machine: IMAGE_FILE_MACHINE_I386
COFF-I386: sections:
COFF-I386-NEXT: - Name: .text
COFF-I386-NEXT: Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
COFF-I386-NEXT: Alignment: 16
COFF-I386-NEXT: SectionData: 83EC0CC744240800000000C7042400000000E800000000E8000000008B44240883C40CC3
COFF-I386: Relocations:
COFF-I386-NEXT: - VirtualAddress: 14
COFF-I386-NEXT: SymbolName: L_.str
COFF-I386-NEXT: Type: IMAGE_REL_I386_DIR32
COFF-I386: - VirtualAddress: 19
COFF-I386-NEXT: SymbolName: _puts
COFF-I386-NEXT: Type: IMAGE_REL_I386_REL32
COFF-I386: - VirtualAddress: 24
COFF-I386-NEXT: SymbolName: _SomeOtherFunction
COFF-I386-NEXT: Type: IMAGE_REL_I386_REL32
COFF-I386: - Name: .data
COFF-I386-NEXT: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
COFF-I386-NEXT: Alignment: 1
COFF-I386-NEXT: SectionData: 48656C6C6F20576F726C642100
COFF-I386: symbols:
COFF-I386-NEXT: - Name: .text
COFF-I386-NEXT: Value: 0
COFF-I386-NEXT: SectionNumber: 1
COFF-I386-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-I386-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-I386-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
COFF-I386-NEXT: SectionDefinition:
COFF-I386-NEXT: Length: 36
COFF-I386-NEXT: NumberOfRelocations: 3
COFF-I386-NEXT: NumberOfLinenumbers: 0
COFF-I386-NEXT: CheckSum: 0
COFF-I386-NEXT: Number: 1
COFF-I386: - Name: .data
COFF-I386-NEXT: Value: 0
COFF-I386-NEXT: SectionNumber: 2
COFF-I386-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-I386-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-I386-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
COFF-I386-NEXT: SectionDefinition:
COFF-I386-NEXT: Length: 13
COFF-I386-NEXT: NumberOfRelocations: 0
COFF-I386-NEXT: NumberOfLinenumbers: 0
COFF-I386-NEXT: CheckSum: 0
COFF-I386-NEXT: Number: 2
COFF-I386: - Name: _main
COFF-I386-NEXT: Value: 0
COFF-I386-NEXT: SectionNumber: 1
COFF-I386-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-I386-NEXT: ComplexType: IMAGE_SYM_DTYPE_FUNCTION
COFF-I386-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
COFF-I386: - Name: L_.str
COFF-I386-NEXT: Value: 0
COFF-I386-NEXT: SectionNumber: 2
COFF-I386-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-I386-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-I386-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
COFF-I386: - Name: _puts
COFF-I386-NEXT: Value: 0
COFF-I386-NEXT: SectionNumber: 0
COFF-I386-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-I386-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-I386-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
COFF-I386: - Name: _SomeOtherFunction
COFF-I386-NEXT: Value: 0
COFF-I386-NEXT: SectionNumber: 0
COFF-I386-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-I386-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-I386-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
COFF-X86-64: header:
COFF-X86-64-NEXT: Machine: IMAGE_FILE_MACHINE_AMD64
COFF-X86-64: sections:
COFF-X86-64-NEXT: - Name: .text
COFF-X86-64-NEXT: Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
COFF-X86-64-NEXT: Alignment: 16
COFF-X86-64-NEXT: SectionData: 4883EC28C744242400000000488D0D00000000E800000000E8000000008B4424244883C428C3
COFF-X86-64: Relocations:
COFF-X86-64-NEXT: - VirtualAddress: 15
COFF-X86-64-NEXT: SymbolName: L.str
COFF-X86-64-NEXT: Type: IMAGE_REL_AMD64_REL32
COFF-X86-64: - VirtualAddress: 20
COFF-X86-64-NEXT: SymbolName: puts
COFF-X86-64-NEXT: Type: IMAGE_REL_AMD64_REL32
COFF-X86-64: - VirtualAddress: 25
COFF-X86-64-NEXT: SymbolName: SomeOtherFunction
COFF-X86-64-NEXT: Type: IMAGE_REL_AMD64_REL32
COFF-X86-64: - Name: .data
COFF-X86-64-NEXT: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
COFF-X86-64-NEXT: Alignment: 1
COFF-X86-64-NEXT: SectionData: 48656C6C6F20576F726C642100
COFF-X86-64: - Name: '.CRT$XCU'
COFF-X86-64-NEXT: Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
COFF-X86-64-NEXT: Alignment: 8
COFF-X86-64-NEXT: SectionData: 0000000000000000
COFF-X86-64: Relocations:
COFF-X86-64-NEXT: - VirtualAddress: 0
COFF-X86-64-NEXT: SymbolName: '??__Ex@@YAXXZ'
COFF-X86-64-NEXT: Type: IMAGE_REL_AMD64_ADDR64
COFF-X86-64: symbols:
COFF-X86-64-NEXT: - Name: .text
COFF-X86-64-NEXT: Value: 0
COFF-X86-64-NEXT: SectionNumber: 1
COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
COFF-X86-64-NEXT: SectionDefinition:
COFF-X86-64-NEXT: Length: 38
COFF-X86-64-NEXT: NumberOfRelocations: 3
COFF-X86-64-NEXT: NumberOfLinenumbers: 0
COFF-X86-64-NEXT: CheckSum: 0
COFF-X86-64-NEXT: Number: 1
COFF-X86-64: - Name: .data
COFF-X86-64-NEXT: Value: 0
COFF-X86-64-NEXT: SectionNumber: 2
COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
COFF-X86-64-NEXT: SectionDefinition:
COFF-X86-64-NEXT: Length: 13
COFF-X86-64-NEXT: NumberOfRelocations: 0
COFF-X86-64-NEXT: NumberOfLinenumbers: 0
COFF-X86-64-NEXT: CheckSum: 0
COFF-X86-64-NEXT: Number: 2
COFF-X86-64: - Name: main
COFF-X86-64-NEXT: Value: 0
COFF-X86-64-NEXT: SectionNumber: 1
COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_FUNCTION
COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
COFF-X86-64: - Name: L.str
COFF-X86-64-NEXT: Value: 0
COFF-X86-64-NEXT: SectionNumber: 2
COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC
COFF-X86-64: - Name: puts
COFF-X86-64-NEXT: Value: 0
COFF-X86-64-NEXT: SectionNumber: 0
COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
COFF-X86-64: - Name: SomeOtherFunction
COFF-X86-64-NEXT: Value: 0
COFF-X86-64-NEXT: SectionNumber: 0
COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_NULL
COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_EXTERNAL
COFF-X86-64: - Name: '??__Ex@@YAXXZ'
COFF-X86-64-NEXT: Value: 0
COFF-X86-64-NEXT: SectionNumber: 3
COFF-X86-64-NEXT: SimpleType: IMAGE_SYM_TYPE_NULL
COFF-X86-64-NEXT: ComplexType: IMAGE_SYM_DTYPE_FUNCTION
COFF-X86-64-NEXT: StorageClass: IMAGE_SYM_CLASS_STATIC