117304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar// RUN: llvm-mc -triple x86_64-apple-darwin10 %s -filetype=obj -o %t.o 2cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// RUN: llvm-readobj -file-headers -s -sd -r -t -macho-segment -macho-dysymtab -macho-indirect-symbols < %t.o > %t.dump 317304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar// RUN: FileCheck < %t.dump %s 417304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar 517304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar_a: 617304b3489b7b8ea06dd4df237f15a381ae181ceDaniel DunbarL0: 717304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar .long 1 817304b3489b7b8ea06dd4df237f15a381ae181ceDaniel DunbarL1: 917304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar .long 2 1017304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar .long _c - _d + 4 1117304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar .long (_c - L0) - (_d - L1) // == (_c - _d) + (L1 - L0) 1217304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar // == (_c - _d + 4) 1317304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar_c: 1417304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar .long 0 1517304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar_d: 1617304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar .long 0 1717304b3489b7b8ea06dd4df237f15a381ae181ceDaniel Dunbar 18cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: File: <stdin> 19cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Format: Mach-O 64-bit x86-64 20cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Arch: x86_64 21cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: AddressSize: 64bit 22cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: MachHeader { 23cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Magic: Magic64 (0xFEEDFACF) 24cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: CpuType: X86-64 (0x1000007) 25cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3) 26cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: FileType: Relocatable (0x1) 27cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: NumOfLoadCommands: 4 28cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: SizeOfLoadCommands: 272 29cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Flags [ (0x0) 30cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 31cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Reserved: 0x0 32cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 33cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Sections [ 34cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Section { 35cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Index: 0 36cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) 37cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 38cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Address: 0x0 39cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Size: 0x18 40cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Offset: 304 41cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Alignment: 0 42cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: RelocationOffset: 0x148 43cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: RelocationCount: 4 44cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Type: 0x0 45cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Attributes [ (0x800000) 46cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: PureInstructions (0x800000) 47cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 48cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Reserved1: 0x0 49cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Reserved2: 0x0 50cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Reserved3: 0x0 51cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: SectionData ( 52cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: 0000: 01000000 02000000 04000000 04000000 |................| 53cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: 0010: 00000000 00000000 |........| 54cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ) 55cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 56cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 57cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Relocations [ 58cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Section __text { 59cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: 0xC 0 2 1 X86_64_RELOC_SUBTRACTOR 0 _d 60cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: 0xC 0 2 1 X86_64_RELOC_UNSIGNED 0 _c 61cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: 0x8 0 2 1 X86_64_RELOC_SUBTRACTOR 0 _d 62cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: 0x8 0 2 1 X86_64_RELOC_UNSIGNED 0 _c 63cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 64cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 65cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Symbols [ 66cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Symbol { 67cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Name: _a (7) 68cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Type: Section (0xE) 69cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Section: __text (0x1) 70cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: RefType: UndefinedNonLazy (0x0) 71cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Flags [ (0x0) 72cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 73cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Value: 0x0 74cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 75cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Symbol { 76cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Name: _c (4) 77cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Type: Section (0xE) 78cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Section: __text (0x1) 79cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: RefType: UndefinedNonLazy (0x0) 80cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Flags [ (0x0) 81cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 82cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Value: 0x10 83cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 84cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Symbol { 85cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Name: _d (1) 86cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Type: Section (0xE) 87cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Section: __text (0x1) 88cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: RefType: UndefinedNonLazy (0x0) 89cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Flags [ (0x0) 90cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 91cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Value: 0x14 92cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 93cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 94cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Indirect Symbols { 95cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Number: 0 96cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Symbols [ 97cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ] 98cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 99cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Segment { 100cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Cmd: LC_SEGMENT_64 101cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Name: 102cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Size: 152 103cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: vmaddr: 0x0 104cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: vmsize: 0x18 105cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: fileoff: 304 106cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: filesize: 24 107cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: maxprot: rwx 108cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: initprot: rwx 109cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nsects: 1 110cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: flags: 0x0 111cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 112cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: Dysymtab { 113cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ilocalsym: 0 114cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nlocalsym: 3 115cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: iextdefsym: 3 116cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nextdefsym: 0 117cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: iundefsym: 3 118cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nundefsym: 0 119cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: tocoff: 0 120cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: ntoc: 0 121cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: modtaboff: 0 122cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nmodtab: 0 123cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: extrefsymoff: 0 124cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nextrefsyms: 0 125cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: indirectsymoff: 0 126cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nindirectsyms: 0 127cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: extreloff: 0 128cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nextrel: 0 129cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: locreloff: 0 130cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: nlocrel: 0 131cddc3e03e4ec99c0268c03a126195173e519ed58Pirama Arumuga Nainar// CHECK: } 132