1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
## This is a basic test to check if we can parse the XCOFF object file correctly.
# RUN: yaml2obj %s -DMAGIC=0x01DF -o %t-32
# RUN: obj2yaml %t-32 | FileCheck %s --check-prefix=CHECK32
# RUN: yaml2obj %s -DMAGIC=0x01F7 -o %t-64
# RUN: obj2yaml %t-64 -o %t-64.yaml 2>&1 | count 0
# RUN: FileCheck --input-file %t-64.yaml %s --check-prefix=CHECK64
# CHECK32: --- !XCOFF
# CHECK32-NEXT: FileHeader:
# CHECK32-NEXT: MagicNumber: 0x1DF
# CHECK32-NEXT: NumberOfSections: 2
# CHECK32-NEXT: CreationTime: 0
# CHECK32-NEXT: OffsetToSymbolTable: 0x80
# CHECK32-NEXT: EntriesInSymbolTable: 4
# CHECK32-NEXT: AuxiliaryHeaderSize: 0
# CHECK32-NEXT: Flags: 0x0
# CHECK32-NEXT: Sections:
# CHECK32-NEXT: - Name: .text
# CHECK32-NEXT: Address: 0x0
# CHECK32-NEXT: Size: 0x4
# CHECK32-NEXT: FileOffsetToData: 0x64
# CHECK32-NEXT: FileOffsetToRelocations: 0x6C
# CHECK32-NEXT: FileOffsetToLineNumbers: 0x0
# CHECK32-NEXT: NumberOfRelocations: 0x1
# CHECK32-NEXT: NumberOfLineNumbers: 0x0
# CHECK32-NEXT: Flags: [ STYP_TEXT ]
# CHECK32-NEXT: SectionData: '00007400'
# CHECK32-NEXT: Relocations:
# CHECK32-NEXT: - Address: 0xE
# CHECK32-NEXT: Symbol: 0x12
# CHECK32-NEXT: Info: 0xF
# CHECK32-NEXT: Type: 0x3
# CHECK32-NEXT: - Name: .data
# CHECK32-NEXT: Address: 0x4
# CHECK32-NEXT: Size: 0x4
# CHECK32-NEXT: FileOffsetToData: 0x68
# CHECK32-NEXT: FileOffsetToRelocations: 0x76
# CHECK32-NEXT: FileOffsetToLineNumbers: 0x0
# CHECK32-NEXT: NumberOfRelocations: 0x1
# CHECK32-NEXT: NumberOfLineNumbers: 0x0
# CHECK32-NEXT: Flags: [ STYP_DATA ]
# CHECK32-NEXT: SectionData: '00007700'
# CHECK32-NEXT: Relocations:
# CHECK32-NEXT: - Address: 0x60
# CHECK32-NEXT: Symbol: 0x8
# CHECK32-NEXT: Info: 0x1F
# CHECK32-NEXT: Type: 0x0
# CHECK32-NEXT: Symbols:
# CHECK32-NEXT: - Name: TestforXcoff
# CHECK32-NEXT: Value: 0x0
# CHECK32-NEXT: Section: N_UNDEF
# CHECK32-NEXT: Type: 0x0
# CHECK32-NEXT: StorageClass: C_EXT
# CHECK32-NEXT: NumberOfAuxEntries: 1
# CHECK32-NEXT: - Name: .data
# CHECK32-NEXT: Value: 0x70
# CHECK32-NEXT: Section: .data
# CHECK32-NEXT: Type: 0x0
# CHECK32-NEXT: StorageClass: C_HIDEXT
# CHECK32-NEXT: NumberOfAuxEntries: 1
# CHECK64: --- !XCOFF
# CHECK64-NEXT: FileHeader:
# CHECK64-NEXT: MagicNumber: 0x1F7
# CHECK64-NEXT: NumberOfSections: 2
# CHECK64-NEXT: CreationTime: 0
# CHECK64-NEXT: OffsetToSymbolTable: 0xCC
# CHECK64-NEXT: EntriesInSymbolTable: 4
# CHECK64-NEXT: AuxiliaryHeaderSize: 0
# CHECK64-NEXT: Flags: 0x0
# CHECK64-NEXT: Sections:
# CHECK64-NEXT: - Name: .text
# CHECK64-NEXT: Address: 0x0
# CHECK64-NEXT: Size: 0x4
# CHECK64-NEXT: FileOffsetToData: 0xA8
# CHECK64-NEXT: FileOffsetToRelocations: 0xB0
# CHECK64-NEXT: FileOffsetToLineNumbers: 0x0
# CHECK64-NEXT: NumberOfRelocations: 0x1
# CHECK64-NEXT: NumberOfLineNumbers: 0x0
# CHECK64-NEXT: Flags: [ STYP_TEXT ]
# CHECK64-NEXT: SectionData: '00007400'
# CHECK64-NEXT: Relocations:
# CHECK64-NEXT: - Address: 0xE
# CHECK64-NEXT: Symbol: 0x12
# CHECK64-NEXT: Info: 0xF
# CHECK64-NEXT: Type: 0x3
# CHECK64-NEXT: - Name: .data
# CHECK64-NEXT: Address: 0x4
# CHECK64-NEXT: Size: 0x4
# CHECK64-NEXT: FileOffsetToData: 0xAC
# CHECK64-NEXT: FileOffsetToRelocations: 0xBE
# CHECK64-NEXT: FileOffsetToLineNumbers: 0x0
# CHECK64-NEXT: NumberOfRelocations: 0x1
# CHECK64-NEXT: NumberOfLineNumbers: 0x0
# CHECK64-NEXT: Flags: [ STYP_DATA ]
# CHECK64-NEXT: SectionData: '00007700'
# CHECK64-NEXT: Relocations:
# CHECK64-NEXT: - Address: 0x60
# CHECK64-NEXT: Symbol: 0x8
# CHECK64-NEXT: Info: 0x1F
# CHECK64-NEXT: Type: 0x0
# CHECK64-NEXT: Symbols:
# CHECK64-NEXT: - Name: TestforXcoff
# CHECK64-NEXT: Value: 0x0
# CHECK64-NEXT: Section: N_UNDEF
# CHECK64-NEXT: Type: 0x0
# CHECK64-NEXT: StorageClass: C_EXT
# CHECK64-NEXT: NumberOfAuxEntries: 1
# CHECK64-NEXT: - Name: .data
# CHECK64-NEXT: Value: 0x70
# CHECK64-NEXT: Section: .data
# CHECK64-NEXT: Type: 0x0
# CHECK64-NEXT: StorageClass: C_HIDEXT
# CHECK64-NEXT: NumberOfAuxEntries: 1
--- !XCOFF
FileHeader:
MagicNumber: [[MAGIC]]
Sections:
- Name: .text
Flags: [ STYP_TEXT ]
SectionData: '00007400'
Relocations:
- Address: 0xE
Symbol: 0x12
Info: 0xF
Type: 0x3
- Name: .data
Flags: [ STYP_DATA ]
SectionData: '00007700'
Relocations:
- Address: 0x60
Symbol: 0x8
Info: 0x1F
Type: 0x0
Symbols:
- Name: TestforXcoff
Value: 0x0
Section: N_UNDEF
Type: 0x0
StorageClass: C_EXT
NumberOfAuxEntries: 1
- Name: .data
Value: 0x70
Section: .data
Type: 0x0
StorageClass: C_HIDEXT
NumberOfAuxEntries: 1
|