2013-04-04 02:31:38 +08:00
|
|
|
RUN: llvm-readobj -s -st -sr -sd %p/Inputs/trivial.obj.coff-i386 \
|
|
|
|
RUN: | FileCheck %s -check-prefix COFF
|
|
|
|
RUN: llvm-readobj -s -st -sr -sd %p/Inputs/trivial.obj.elf-i386 \
|
|
|
|
RUN: | FileCheck %s -check-prefix ELF
|
|
|
|
RUN: llvm-readobj -s -st -sr -sd %p/Inputs/trivial.obj.macho-i386 \
|
2013-04-11 10:52:29 +08:00
|
|
|
RUN: | FileCheck %s -check-prefix MACHO-I386
|
|
|
|
RUN: llvm-readobj -s -st -sr -sd %p/Inputs/trivial.obj.macho-x86-64 \
|
|
|
|
RUN: | FileCheck %s -check-prefix MACHO-X86-64
|
2013-04-04 02:31:38 +08:00
|
|
|
|
|
|
|
COFF: Sections [
|
|
|
|
COFF-NEXT: Section {
|
|
|
|
COFF-NEXT: Number: 1
|
|
|
|
COFF-NEXT: Name: .text (2E 74 65 78 74 00 00 00)
|
|
|
|
COFF-NEXT: VirtualSize: 0x0
|
|
|
|
COFF-NEXT: VirtualAddress: 0x0
|
|
|
|
COFF-NEXT: RawDataSize: 22
|
|
|
|
COFF-NEXT: PointerToRawData: 0x64
|
|
|
|
COFF-NEXT: PointerToRelocations: 0x7A
|
|
|
|
COFF-NEXT: PointerToLineNumbers: 0x0
|
|
|
|
COFF-NEXT: RelocationCount: 3
|
|
|
|
COFF-NEXT: LineNumberCount: 0
|
|
|
|
COFF-NEXT: Characteristics [ (0x60500020)
|
|
|
|
COFF-NEXT: IMAGE_SCN_ALIGN_16BYTES (0x500000)
|
|
|
|
COFF-NEXT: IMAGE_SCN_CNT_CODE (0x20)
|
|
|
|
COFF-NEXT: IMAGE_SCN_MEM_EXECUTE (0x20000000)
|
|
|
|
COFF-NEXT: IMAGE_SCN_MEM_READ (0x40000000)
|
|
|
|
COFF-NEXT: ]
|
|
|
|
COFF-NEXT: Relocations [
|
|
|
|
COFF-NEXT: 0x4 IMAGE_REL_I386_DIR32 .data
|
|
|
|
COFF-NEXT: 0x9 IMAGE_REL_I386_REL32 _puts
|
|
|
|
COFF-NEXT: 0xE IMAGE_REL_I386_REL32 _SomeOtherFunction
|
|
|
|
COFF-NEXT: ]
|
|
|
|
COFF-NEXT: Symbols [
|
|
|
|
COFF-NEXT: Symbol {
|
|
|
|
COFF-NEXT: Name: .text
|
|
|
|
COFF-NEXT: Value: 0
|
|
|
|
COFF-NEXT: Section: .text (1)
|
|
|
|
COFF-NEXT: BaseType: Null (0x0)
|
|
|
|
COFF-NEXT: ComplexType: Null (0x0)
|
|
|
|
COFF-NEXT: StorageClass: Static (0x3)
|
|
|
|
COFF-NEXT: AuxSymbolCount: 1
|
|
|
|
COFF-NEXT: AuxSectionDef {
|
|
|
|
COFF-NEXT: Length: 22
|
|
|
|
COFF-NEXT: RelocationCount: 3
|
|
|
|
COFF-NEXT: LineNumberCount: 0
|
|
|
|
COFF-NEXT: Checksum: 0x0
|
|
|
|
COFF-NEXT: Number: 1
|
|
|
|
COFF-NEXT: Selection: 0x0
|
|
|
|
COFF-NEXT: Unused: (00 00 00)
|
|
|
|
COFF-NEXT: }
|
|
|
|
COFF-NEXT: }
|
|
|
|
COFF-NEXT: Symbol {
|
|
|
|
COFF-NEXT: Name: _main
|
|
|
|
COFF-NEXT: Value: 0
|
|
|
|
COFF-NEXT: Section: .text (1)
|
|
|
|
COFF-NEXT: BaseType: Null (0x0)
|
|
|
|
COFF-NEXT: ComplexType: Function (0x2)
|
|
|
|
COFF-NEXT: StorageClass: External (0x2)
|
|
|
|
COFF-NEXT: AuxSymbolCount: 0
|
|
|
|
COFF-NEXT: }
|
|
|
|
COFF-NEXT: ]
|
|
|
|
COFF-NEXT: SectionData (
|
|
|
|
COFF-NEXT: 0000: 50C70424 00000000 E8000000 00E80000 |P..$............|
|
|
|
|
COFF-NEXT: 0010: 000031C0 5AC3 |..1.Z.|
|
|
|
|
COFF-NEXT: )
|
|
|
|
COFF-NEXT: }
|
|
|
|
|
|
|
|
ELF: Sections [
|
|
|
|
ELF-NEXT: Section {
|
|
|
|
ELF-NEXT: Index: 0
|
|
|
|
ELF-NEXT: Name: (0)
|
|
|
|
ELF-NEXT: Type: SHT_NULL (0x0)
|
|
|
|
ELF-NEXT: Flags [ (0x0)
|
|
|
|
ELF-NEXT: ]
|
|
|
|
ELF-NEXT: Address: 0x0
|
|
|
|
ELF-NEXT: Offset: 0x0
|
|
|
|
ELF-NEXT: Size: 0
|
|
|
|
ELF-NEXT: Link: 0
|
|
|
|
ELF-NEXT: Info: 0
|
|
|
|
ELF-NEXT: AddressAlignment: 0
|
|
|
|
ELF-NEXT: EntrySize: 0
|
|
|
|
ELF-NEXT: Relocations [
|
|
|
|
ELF-NEXT: ]
|
|
|
|
ELF-NEXT: Symbols [
|
|
|
|
ELF-NEXT: ]
|
|
|
|
ELF-NEXT: SectionData (
|
|
|
|
ELF-NEXT: )
|
|
|
|
ELF-NEXT: }
|
|
|
|
ELF-NEXT: Section {
|
|
|
|
ELF-NEXT: Index: 1
|
|
|
|
ELF-NEXT: Name: .text (5)
|
|
|
|
ELF-NEXT: Type: SHT_PROGBITS (0x1)
|
|
|
|
ELF-NEXT: Flags [ (0x6)
|
|
|
|
ELF-NEXT: SHF_ALLOC (0x2)
|
|
|
|
ELF-NEXT: SHF_EXECINSTR (0x4)
|
|
|
|
ELF-NEXT: ]
|
|
|
|
ELF-NEXT: Address: 0x0
|
|
|
|
ELF-NEXT: Offset: 0x40
|
|
|
|
ELF-NEXT: Size: 42
|
|
|
|
ELF-NEXT: Link: 0
|
|
|
|
ELF-NEXT: Info: 0
|
|
|
|
ELF-NEXT: AddressAlignment: 16
|
|
|
|
ELF-NEXT: EntrySize: 0
|
|
|
|
ELF-NEXT: Relocations [
|
|
|
|
ELF-NEXT: 0xC R_386_GOTPC _GLOBAL_OFFSET_TABLE_ 0x0
|
|
|
|
ELF-NEXT: 0x12 R_386_GOTOFF .L.str 0x0
|
|
|
|
ELF-NEXT: 0x1A R_386_PLT32 puts 0x0
|
|
|
|
ELF-NEXT: 0x1F R_386_PLT32 SomeOtherFunction 0x0
|
|
|
|
ELF-NEXT: ]
|
|
|
|
ELF-NEXT: Symbols [
|
|
|
|
ELF-NEXT: Symbol {
|
|
|
|
ELF-NEXT: Name: .text (0)
|
|
|
|
ELF-NEXT: Value: 0x0
|
|
|
|
ELF-NEXT: Size: 0
|
|
|
|
ELF-NEXT: Binding: Local (0x0)
|
|
|
|
ELF-NEXT: Type: Section (0x3)
|
|
|
|
ELF-NEXT: Other: 0
|
|
|
|
ELF-NEXT: Section: .text (0x1)
|
|
|
|
ELF-NEXT: }
|
|
|
|
ELF-NEXT: Symbol {
|
|
|
|
ELF-NEXT: Name: main (12)
|
|
|
|
ELF-NEXT: Value: 0x0
|
|
|
|
ELF-NEXT: Size: 42
|
|
|
|
ELF-NEXT: Binding: Global (0x1)
|
|
|
|
ELF-NEXT: Type: Function (0x2)
|
|
|
|
ELF-NEXT: Other: 0
|
|
|
|
ELF-NEXT: Section: .text (0x1)
|
|
|
|
ELF-NEXT: }
|
|
|
|
ELF-NEXT: ]
|
|
|
|
ELF-NEXT: SectionData (
|
|
|
|
ELF-NEXT: 0000: 5383EC08 E8000000 005B81C3 03000000 |S........[......|
|
|
|
|
ELF-NEXT: 0010: 8D830000 00008904 24E8FCFF FFFFE8FC |........$.......|
|
|
|
|
ELF-NEXT: 0020: FFFFFF31 C083C408 5BC3 |...1....[.|
|
|
|
|
ELF-NEXT: )
|
|
|
|
ELF-NEXT: }
|
|
|
|
|
2013-04-11 10:52:29 +08:00
|
|
|
MACHO-I386: Sections [
|
|
|
|
MACHO-I386-NEXT: Section {
|
|
|
|
MACHO-I386-NEXT: Index: 0
|
|
|
|
MACHO-I386-NEXT: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
|
|
|
|
MACHO-I386-NEXT: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
|
|
|
|
MACHO-I386-NEXT: Address: 0x0
|
|
|
|
MACHO-I386-NEXT: Size: 0x22
|
|
|
|
MACHO-I386-NEXT: Offset: 324
|
|
|
|
MACHO-I386-NEXT: Alignment: 4
|
|
|
|
MACHO-I386-NEXT: RelocationOffset: 0x174
|
|
|
|
MACHO-I386-NEXT: RelocationCount: 4
|
|
|
|
MACHO-I386-NEXT: Type: 0x0
|
|
|
|
MACHO-I386-NEXT: Attributes [ (0x800004)
|
|
|
|
MACHO-I386-NEXT: PureInstructions (0x800000)
|
|
|
|
MACHO-I386-NEXT: SomeInstructions (0x4)
|
|
|
|
MACHO-I386-NEXT: ]
|
|
|
|
MACHO-I386-NEXT: Reserved1: 0x0
|
|
|
|
MACHO-I386-NEXT: Reserved2: 0x0
|
|
|
|
MACHO-I386-NEXT: Relocations [
|
2013-04-12 01:46:10 +08:00
|
|
|
MACHO-I386-NEXT: 0x18 GENERIC_RELOC_VANILLA _SomeOtherFunction 0x0
|
|
|
|
MACHO-I386-NEXT: 0x13 GENERIC_RELOC_VANILLA _puts 0x0
|
|
|
|
MACHO-I386-NEXT: 0xB GENERIC_RELOC_LOCAL_SECTDIFF _main 0x{{[0-9A-F]+}}
|
|
|
|
MACHO-I386-NEXT: 0x0 GENERIC_RELOC_PAIR _main 0x{{[0-9A-F]+}}
|
2013-04-11 10:52:29 +08:00
|
|
|
MACHO-I386-NEXT: ]
|
|
|
|
MACHO-I386-NEXT: Symbols [
|
|
|
|
MACHO-I386-NEXT: Symbol {
|
|
|
|
MACHO-I386-NEXT: Name: _main (1)
|
|
|
|
MACHO-I386-NEXT: Type: 0xF
|
|
|
|
MACHO-I386-NEXT: Section: __text (0x1)
|
|
|
|
MACHO-I386-NEXT: RefType: UndefinedNonLazy (0x0)
|
|
|
|
MACHO-I386-NEXT: Flags [ (0x0)
|
|
|
|
MACHO-I386-NEXT: ]
|
|
|
|
MACHO-I386-NEXT: Value: 0x0
|
|
|
|
MACHO-I386-NEXT: }
|
|
|
|
MACHO-I386-NEXT: ]
|
|
|
|
MACHO-I386-NEXT: SectionData (
|
|
|
|
MACHO-I386-NEXT: 0000: 83EC0CE8 00000000 588D801A 00000089 |........X.......|
|
|
|
|
MACHO-I386-NEXT: 0010: 0424E8E9 FFFFFFE8 E4FFFFFF 31C083C4 |.$..........1...|
|
|
|
|
MACHO-I386-NEXT: 0020: 0CC3 |..|
|
|
|
|
MACHO-I386-NEXT: )
|
|
|
|
MACHO-I386-NEXT: }
|
|
|
|
|
|
|
|
|
|
|
|
MACHO-X86-64: Sections [
|
|
|
|
MACHO-X86-64-NEXT: Section {
|
|
|
|
MACHO-X86-64-NEXT: Index: 0
|
|
|
|
MACHO-X86-64-NEXT: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
|
|
|
|
MACHO-X86-64-NEXT: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
|
|
|
|
MACHO-X86-64-NEXT: Address: 0x0
|
|
|
|
MACHO-X86-64-NEXT: Size: 0x16
|
|
|
|
MACHO-X86-64-NEXT: Offset: 368
|
|
|
|
MACHO-X86-64-NEXT: Alignment: 4
|
|
|
|
MACHO-X86-64-NEXT: RelocationOffset: 0x194
|
|
|
|
MACHO-X86-64-NEXT: RelocationCount: 3
|
|
|
|
MACHO-X86-64-NEXT: Type: 0x0
|
|
|
|
MACHO-X86-64-NEXT: Attributes [ (0x800004)
|
|
|
|
MACHO-X86-64-NEXT: PureInstructions (0x800000)
|
|
|
|
MACHO-X86-64-NEXT: SomeInstructions (0x4)
|
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: Reserved1: 0x0
|
|
|
|
MACHO-X86-64-NEXT: Reserved2: 0x0
|
|
|
|
MACHO-X86-64-NEXT: Relocations [
|
2013-04-12 01:46:10 +08:00
|
|
|
MACHO-X86-64-NEXT: 0xE X86_64_RELOC_BRANCH _SomeOtherFunction 0x0
|
|
|
|
MACHO-X86-64-NEXT: 0x9 X86_64_RELOC_BRANCH _puts 0x0
|
|
|
|
MACHO-X86-64-NEXT: 0x4 X86_64_RELOC_SIGNED L_.str 0x0
|
2013-04-11 10:52:29 +08:00
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: Symbols [
|
|
|
|
MACHO-X86-64-NEXT: Symbol {
|
|
|
|
MACHO-X86-64-NEXT: Name: _main (1)
|
|
|
|
MACHO-X86-64-NEXT: Type: 0xF
|
|
|
|
MACHO-X86-64-NEXT: Section: __text (0x1)
|
|
|
|
MACHO-X86-64-NEXT: RefType: UndefinedNonLazy (0x0)
|
|
|
|
MACHO-X86-64-NEXT: Flags [ (0x0)
|
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: Value: 0x0
|
|
|
|
MACHO-X86-64-NEXT: }
|
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: SectionData (
|
|
|
|
MACHO-X86-64-NEXT: 0000: 50488D3D 00000000 E8000000 00E80000 |PH.=............|
|
|
|
|
MACHO-X86-64-NEXT: 0010: 000031C0 5AC3 |..1.Z.|
|
|
|
|
MACHO-X86-64-NEXT: )
|
|
|
|
MACHO-X86-64-NEXT: }
|
|
|
|
MACHO-X86-64-NEXT: Section {
|
|
|
|
MACHO-X86-64-NEXT: Index: 1
|
|
|
|
MACHO-X86-64-NEXT: Name: __cstring (5F 5F 63 73 74 72 69 6E 67 00 00 00 00 00 00 00)
|
|
|
|
MACHO-X86-64-NEXT: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
|
|
|
|
MACHO-X86-64-NEXT: Address: 0x16
|
|
|
|
MACHO-X86-64-NEXT: Size: 0xD
|
|
|
|
MACHO-X86-64-NEXT: Offset: 390
|
|
|
|
MACHO-X86-64-NEXT: Alignment: 0
|
|
|
|
MACHO-X86-64-NEXT: RelocationOffset: 0x0
|
|
|
|
MACHO-X86-64-NEXT: RelocationCount: 0
|
|
|
|
MACHO-X86-64-NEXT: Type: ExtReloc (0x2)
|
|
|
|
MACHO-X86-64-NEXT: Attributes [ (0x0)
|
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: Reserved1: 0x0
|
|
|
|
MACHO-X86-64-NEXT: Reserved2: 0x0
|
|
|
|
MACHO-X86-64-NEXT: Relocations [
|
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: Symbols [
|
|
|
|
MACHO-X86-64-NEXT: Symbol {
|
|
|
|
MACHO-X86-64-NEXT: Name: L_.str (32)
|
|
|
|
MACHO-X86-64-NEXT: Type: Section (0xE)
|
|
|
|
MACHO-X86-64-NEXT: Section: __cstring (0x2)
|
|
|
|
MACHO-X86-64-NEXT: RefType: UndefinedNonLazy (0x0)
|
|
|
|
MACHO-X86-64-NEXT: Flags [ (0x0)
|
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: Value: 0x16
|
|
|
|
MACHO-X86-64-NEXT: }
|
|
|
|
MACHO-X86-64-NEXT: ]
|
|
|
|
MACHO-X86-64-NEXT: SectionData (
|
|
|
|
MACHO-X86-64-NEXT: 0000: 48656C6C 6F20576F 726C640A 00 |Hello World..|
|
|
|
|
MACHO-X86-64-NEXT: )
|
|
|
|
MACHO-X86-64-NEXT: }
|
|
|
|
MACHO-X86-64-NEXT:]
|