1 RUN: llvm-readobj -h %p/Inputs/macho-universal.x86_64.i386 \ 2 RUN: | FileCheck %s -check-prefix MULTIHEADER 3 4 RUN: llvm-readobj -sections %p/Inputs/macho-universal.x86_64.i386 \ 5 RUN: | FileCheck %s -check-prefix MULTISECTIONS 6 7 RUN: llvm-readobj -h %p/Inputs/macho-universal-archive.x86_64.i386 \ 8 RUN: | FileCheck %s -check-prefix MULTIHEADER-ARCHIVE 9 10 RUN: llvm-readobj -sections %p/Inputs/macho-universal-archive.x86_64.i386 \ 11 RUN: | FileCheck %s -check-prefix MULTISECTIONS-ARCHIVE 12 13 MULTIHEADER: Format: Mach-O 64-bit x86-64 14 MULTIHEADER: Arch: x86_64 15 MULTIHEADER: AddressSize: 64bit 16 MULTIHEADER: MachHeader { 17 MULTIHEADER: Magic: Magic64 (0xFEEDFACF) 18 MULTIHEADER: CpuType: X86-64 (0x1000007) 19 MULTIHEADER: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3) 20 MULTIHEADER: FileType: Executable (0x2) 21 MULTIHEADER: NumOfLoadCommands: 16 22 MULTIHEADER: SizeOfLoadCommands: 880 23 MULTIHEADER: Flags [ (0x200085) 24 MULTIHEADER: MH_DYLDLINK (0x4) 25 MULTIHEADER: MH_NOUNDEFS (0x1) 26 MULTIHEADER: MH_PIE (0x200000) 27 MULTIHEADER: MH_TWOLEVEL (0x80) 28 MULTIHEADER: ] 29 MULTIHEADER: Reserved: 0x0 30 MULTIHEADER: } 31 32 MULTIHEADER: Format: Mach-O 32-bit i386 33 MULTIHEADER: Arch: i386 34 MULTIHEADER: AddressSize: 32bit 35 MULTIHEADER: MachHeader { 36 MULTIHEADER: Magic: Magic (0xFEEDFACE) 37 MULTIHEADER: CpuType: X86 (0x7) 38 MULTIHEADER: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3) 39 MULTIHEADER: FileType: Executable (0x2) 40 MULTIHEADER: NumOfLoadCommands: 16 41 MULTIHEADER: SizeOfLoadCommands: 716 42 MULTIHEADER: Flags [ (0x1200085) 43 MULTIHEADER: MH_DYLDLINK (0x4) 44 MULTIHEADER: MH_NOUNDEFS (0x1) 45 MULTIHEADER: MH_NO_HEAP_EXECUTION (0x1000000) 46 MULTIHEADER: MH_PIE (0x200000) 47 MULTIHEADER: MH_TWOLEVEL (0x80) 48 MULTIHEADER: ] 49 MULTIHEADER: } 50 51 52 53 MULTISECTIONS: Format: Mach-O 64-bit x86-64 54 MULTISECTIONS: Arch: x86_64 55 MULTISECTIONS: AddressSize: 64bit 56 MULTISECTIONS: Sections [ 57 MULTISECTIONS: Section { 58 MULTISECTIONS: Index: 0 59 MULTISECTIONS: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) 60 MULTISECTIONS: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 61 MULTISECTIONS: Address: 0x100000F60 62 MULTISECTIONS: Size: 0x12 63 MULTISECTIONS: Offset: 3936 64 MULTISECTIONS: Alignment: 4 65 MULTISECTIONS: RelocationOffset: 0x0 66 MULTISECTIONS: RelocationCount: 0 67 MULTISECTIONS: Type: 0x0 68 MULTISECTIONS: Attributes [ (0x800004) 69 MULTISECTIONS: PureInstructions (0x800000) 70 MULTISECTIONS: SomeInstructions (0x4) 71 MULTISECTIONS: ] 72 MULTISECTIONS: Reserved1: 0x0 73 MULTISECTIONS: Reserved2: 0x0 74 MULTISECTIONS: } 75 MULTISECTIONS: Section { 76 MULTISECTIONS: Index: 1 77 MULTISECTIONS: Name: __unwind_info (5F 5F 75 6E 77 69 6E 64 5F 69 6E 66 6F 00 00 00) 78 MULTISECTIONS: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 79 MULTISECTIONS: Address: 0x100000F72 80 MULTISECTIONS: Size: 0x48 81 MULTISECTIONS: Offset: 3954 82 MULTISECTIONS: Alignment: 0 83 MULTISECTIONS: RelocationOffset: 0x0 84 MULTISECTIONS: RelocationCount: 0 85 MULTISECTIONS: Type: 0x0 86 MULTISECTIONS: Attributes [ (0x0) 87 MULTISECTIONS: ] 88 MULTISECTIONS: Reserved1: 0x0 89 MULTISECTIONS: Reserved2: 0x0 90 MULTISECTIONS: } 91 MULTISECTIONS: Section { 92 MULTISECTIONS: Index: 2 93 MULTISECTIONS: Name: __eh_frame (5F 5F 65 68 5F 66 72 61 6D 65 00 00 00 00 00 00) 94 MULTISECTIONS: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 95 MULTISECTIONS: Address: 0x100000FC0 96 MULTISECTIONS: Size: 0x40 97 MULTISECTIONS: Offset: 4032 98 MULTISECTIONS: Alignment: 3 99 MULTISECTIONS: RelocationOffset: 0x0 100 MULTISECTIONS: RelocationCount: 0 101 MULTISECTIONS: Type: 0x0 102 MULTISECTIONS: Attributes [ (0x0) 103 MULTISECTIONS: ] 104 MULTISECTIONS: Reserved1: 0x0 105 MULTISECTIONS: Reserved2: 0x0 106 MULTISECTIONS: } 107 MULTISECTIONS: ] 108 109 MULTISECTIONS: Format: Mach-O 32-bit i386 110 MULTISECTIONS: Arch: i386 111 MULTISECTIONS: AddressSize: 32bit 112 MULTISECTIONS: Sections [ 113 MULTISECTIONS: Section { 114 MULTISECTIONS: Index: 0 115 MULTISECTIONS: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) 116 MULTISECTIONS: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 117 MULTISECTIONS: Address: 0x1FA0 118 MULTISECTIONS: Size: 0x15 119 MULTISECTIONS: Offset: 4000 120 MULTISECTIONS: Alignment: 4 121 MULTISECTIONS: RelocationOffset: 0x0 122 MULTISECTIONS: RelocationCount: 0 123 MULTISECTIONS: Type: 0x0 124 MULTISECTIONS: Attributes [ (0x800004) 125 MULTISECTIONS: PureInstructions (0x800000) 126 MULTISECTIONS: SomeInstructions (0x4) 127 MULTISECTIONS: ] 128 MULTISECTIONS: Reserved1: 0x0 129 MULTISECTIONS: Reserved2: 0x0 130 MULTISECTIONS: } 131 MULTISECTIONS: Section { 132 MULTISECTIONS: Index: 1 133 MULTISECTIONS: Name: __unwind_info (5F 5F 75 6E 77 69 6E 64 5F 69 6E 66 6F 00 00 00) 134 MULTISECTIONS: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 135 MULTISECTIONS: Address: 0x1FB5 136 MULTISECTIONS: Size: 0x48 137 MULTISECTIONS: Offset: 4021 138 MULTISECTIONS: Alignment: 0 139 MULTISECTIONS: RelocationOffset: 0x0 140 MULTISECTIONS: RelocationCount: 0 141 MULTISECTIONS: Type: 0x0 142 MULTISECTIONS: Attributes [ (0x0) 143 MULTISECTIONS: ] 144 MULTISECTIONS: Reserved1: 0x0 145 MULTISECTIONS: Reserved2: 0x0 146 MULTISECTIONS: } 147 MULTISECTIONS: ] 148 149 MULTIHEADER-ARCHIVE: File: hello.o 150 MULTIHEADER-ARCHIVE: Format: Mach-O 64-bit x86-64 151 MULTIHEADER-ARCHIVE: Arch: x86_64 152 MULTIHEADER-ARCHIVE: AddressSize: 64bit 153 MULTIHEADER-ARCHIVE: MachHeader { 154 MULTIHEADER-ARCHIVE: Magic: Magic64 (0xFEEDFACF) 155 MULTIHEADER-ARCHIVE: CpuType: X86-64 (0x1000007) 156 MULTIHEADER-ARCHIVE: CpuSubType: CPU_SUBTYPE_X86_64_ALL (0x3) 157 MULTIHEADER-ARCHIVE: FileType: Relocatable (0x1) 158 MULTIHEADER-ARCHIVE: NumOfLoadCommands: 3 159 MULTIHEADER-ARCHIVE: SizeOfLoadCommands: 496 160 MULTIHEADER-ARCHIVE: Flags [ (0x2000) 161 MULTIHEADER-ARCHIVE: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000) 162 MULTIHEADER-ARCHIVE: ] 163 MULTIHEADER-ARCHIVE: Reserved: 0x0 164 MULTIHEADER-ARCHIVE: } 165 MULTIHEADER-ARCHIVE: File: foo.o 166 MULTIHEADER-ARCHIVE: Format: Mach-O 32-bit i386 167 MULTIHEADER-ARCHIVE: Arch: i386 168 MULTIHEADER-ARCHIVE: AddressSize: 32bit 169 MULTIHEADER-ARCHIVE: MachHeader { 170 MULTIHEADER-ARCHIVE: Magic: Magic (0xFEEDFACE) 171 MULTIHEADER-ARCHIVE: CpuType: X86 (0x7) 172 MULTIHEADER-ARCHIVE: CpuSubType: CPU_SUBTYPE_I386_ALL (0x3) 173 MULTIHEADER-ARCHIVE: FileType: Relocatable (0x1) 174 MULTIHEADER-ARCHIVE: NumOfLoadCommands: 3 175 MULTIHEADER-ARCHIVE: SizeOfLoadCommands: 296 176 MULTIHEADER-ARCHIVE: Flags [ (0x2000) 177 MULTIHEADER-ARCHIVE: MH_SUBSECTIONS_VIA_SYMBOLS (0x2000) 178 MULTIHEADER-ARCHIVE: ] 179 MULTIHEADER-ARCHIVE: } 180 181 MULTISECTIONS-ARCHIVE: File: hello.o 182 MULTISECTIONS-ARCHIVE: Format: Mach-O 64-bit x86-64 183 MULTISECTIONS-ARCHIVE: Arch: x86_64 184 MULTISECTIONS-ARCHIVE: AddressSize: 64bit 185 MULTISECTIONS-ARCHIVE: Sections [ 186 MULTISECTIONS-ARCHIVE: Section { 187 MULTISECTIONS-ARCHIVE: Index: 0 188 MULTISECTIONS-ARCHIVE: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) 189 MULTISECTIONS-ARCHIVE: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 190 MULTISECTIONS-ARCHIVE: Address: 0x0 191 MULTISECTIONS-ARCHIVE: Size: 0x3B 192 MULTISECTIONS-ARCHIVE: Offset: 528 193 MULTISECTIONS-ARCHIVE: Alignment: 4 194 MULTISECTIONS-ARCHIVE: RelocationOffset: 0x2B8 195 MULTISECTIONS-ARCHIVE: RelocationCount: 2 196 MULTISECTIONS-ARCHIVE: Type: 0x0 197 MULTISECTIONS-ARCHIVE: Attributes [ (0x800004) 198 MULTISECTIONS-ARCHIVE: PureInstructions (0x800000) 199 MULTISECTIONS-ARCHIVE: SomeInstructions (0x4) 200 MULTISECTIONS-ARCHIVE: ] 201 MULTISECTIONS-ARCHIVE: Reserved1: 0x0 202 MULTISECTIONS-ARCHIVE: Reserved2: 0x0 203 MULTISECTIONS-ARCHIVE: } 204 MULTISECTIONS-ARCHIVE: Section { 205 MULTISECTIONS-ARCHIVE: Index: 1 206 MULTISECTIONS-ARCHIVE: Name: __cstring (5F 5F 63 73 74 72 69 6E 67 00 00 00 00 00 00 00) 207 MULTISECTIONS-ARCHIVE: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 208 MULTISECTIONS-ARCHIVE: Address: 0x3B 209 MULTISECTIONS-ARCHIVE: Size: 0xD 210 MULTISECTIONS-ARCHIVE: Offset: 587 211 MULTISECTIONS-ARCHIVE: Alignment: 0 212 MULTISECTIONS-ARCHIVE: RelocationOffset: 0x0 213 MULTISECTIONS-ARCHIVE: RelocationCount: 0 214 MULTISECTIONS-ARCHIVE: Type: ExtReloc (0x2) 215 MULTISECTIONS-ARCHIVE: Attributes [ (0x0) 216 MULTISECTIONS-ARCHIVE: ] 217 MULTISECTIONS-ARCHIVE: Reserved1: 0x0 218 MULTISECTIONS-ARCHIVE: Reserved2: 0x0 219 MULTISECTIONS-ARCHIVE: } 220 MULTISECTIONS-ARCHIVE: Section { 221 MULTISECTIONS-ARCHIVE: Index: 2 222 MULTISECTIONS-ARCHIVE: Name: __compact_unwind (5F 5F 63 6F 6D 70 61 63 74 5F 75 6E 77 69 6E 64) 223 MULTISECTIONS-ARCHIVE: Segment: __LD (5F 5F 4C 44 00 00 00 00 00 00 00 00 00 00 00 00) 224 MULTISECTIONS-ARCHIVE: Address: 0x48 225 MULTISECTIONS-ARCHIVE: Size: 0x20 226 MULTISECTIONS-ARCHIVE: Offset: 600 227 MULTISECTIONS-ARCHIVE: Alignment: 3 228 MULTISECTIONS-ARCHIVE: RelocationOffset: 0x2C8 229 MULTISECTIONS-ARCHIVE: RelocationCount: 1 230 MULTISECTIONS-ARCHIVE: Type: 0x0 231 MULTISECTIONS-ARCHIVE: Attributes [ (0x20000) 232 MULTISECTIONS-ARCHIVE: Debug (0x20000) 233 MULTISECTIONS-ARCHIVE: ] 234 MULTISECTIONS-ARCHIVE: Reserved1: 0x0 235 MULTISECTIONS-ARCHIVE: Reserved2: 0x0 236 MULTISECTIONS-ARCHIVE: } 237 MULTISECTIONS-ARCHIVE: Section { 238 MULTISECTIONS-ARCHIVE: Index: 3 239 MULTISECTIONS-ARCHIVE: Name: __eh_frame (5F 5F 65 68 5F 66 72 61 6D 65 00 00 00 00 00 00) 240 MULTISECTIONS-ARCHIVE: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 241 MULTISECTIONS-ARCHIVE: Address: 0x68 242 MULTISECTIONS-ARCHIVE: Size: 0x40 243 MULTISECTIONS-ARCHIVE: Offset: 632 244 MULTISECTIONS-ARCHIVE: Alignment: 3 245 MULTISECTIONS-ARCHIVE: RelocationOffset: 0x0 246 MULTISECTIONS-ARCHIVE: RelocationCount: 0 247 MULTISECTIONS-ARCHIVE: Type: 0xB 248 MULTISECTIONS-ARCHIVE: Attributes [ (0x680000) 249 MULTISECTIONS-ARCHIVE: LiveSupport (0x80000) 250 MULTISECTIONS-ARCHIVE: NoTOC (0x400000) 251 MULTISECTIONS-ARCHIVE: StripStaticSyms (0x200000) 252 MULTISECTIONS-ARCHIVE: ] 253 MULTISECTIONS-ARCHIVE: Reserved1: 0x0 254 MULTISECTIONS-ARCHIVE: Reserved2: 0x0 255 MULTISECTIONS-ARCHIVE: } 256 MULTISECTIONS-ARCHIVE: ] 257 MULTISECTIONS-ARCHIVE: File: foo.o 258 MULTISECTIONS-ARCHIVE: Format: Mach-O 32-bit i386 259 MULTISECTIONS-ARCHIVE: Arch: i386 260 MULTISECTIONS-ARCHIVE: AddressSize: 32bit 261 MULTISECTIONS-ARCHIVE: Sections [ 262 MULTISECTIONS-ARCHIVE: Section { 263 MULTISECTIONS-ARCHIVE: Index: 0 264 MULTISECTIONS-ARCHIVE: Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00) 265 MULTISECTIONS-ARCHIVE: Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00) 266 MULTISECTIONS-ARCHIVE: Address: 0x0 267 MULTISECTIONS-ARCHIVE: Size: 0x5 268 MULTISECTIONS-ARCHIVE: Offset: 324 269 MULTISECTIONS-ARCHIVE: Alignment: 4 270 MULTISECTIONS-ARCHIVE: RelocationOffset: 0x0 271 MULTISECTIONS-ARCHIVE: RelocationCount: 0 272 MULTISECTIONS-ARCHIVE: Type: 0x0 273 MULTISECTIONS-ARCHIVE: Attributes [ (0x800004) 274 MULTISECTIONS-ARCHIVE: PureInstructions (0x800000) 275 MULTISECTIONS-ARCHIVE: SomeInstructions (0x4) 276 MULTISECTIONS-ARCHIVE: ] 277 MULTISECTIONS-ARCHIVE: Reserved1: 0x0 278 MULTISECTIONS-ARCHIVE: Reserved2: 0x0 279 MULTISECTIONS-ARCHIVE: } 280 MULTISECTIONS-ARCHIVE: Section { 281 MULTISECTIONS-ARCHIVE: Index: 1 282 MULTISECTIONS-ARCHIVE: Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00) 283 MULTISECTIONS-ARCHIVE: Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00) 284 MULTISECTIONS-ARCHIVE: Address: 0x8 285 MULTISECTIONS-ARCHIVE: Size: 0x4 286 MULTISECTIONS-ARCHIVE: Offset: 332 287 MULTISECTIONS-ARCHIVE: Alignment: 2 288 MULTISECTIONS-ARCHIVE: RelocationOffset: 0x0 289 MULTISECTIONS-ARCHIVE: RelocationCount: 0 290 MULTISECTIONS-ARCHIVE: Type: 0x0 291 MULTISECTIONS-ARCHIVE: Attributes [ (0x0) 292 MULTISECTIONS-ARCHIVE: ] 293 MULTISECTIONS-ARCHIVE: Reserved1: 0x0 294 MULTISECTIONS-ARCHIVE: Reserved2: 0x0 295 MULTISECTIONS-ARCHIVE: } 296 MULTISECTIONS-ARCHIVE: ] 297 298