1 // RUN: llvm-objdump -p %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s 2 // RUN: llvm-objdump -p %p/Inputs/hello.exe.macho-x86_64 \ 3 // RUN: | FileCheck %s -check-prefix=EXE 4 // RUN: llvm-objdump -p %p/Inputs/dylibLoadKinds.macho-x86_64 \ 5 // RUN: | FileCheck %s -check-prefix=LOAD 6 // RUN: llvm-objdump -p %p/Inputs/linkerOption.macho-x86_64 \ 7 // RUN: | FileCheck %s -check-prefix=LD_OPT 8 // RUN: llvm-objdump -p %p/Inputs/dylibSubFramework.macho-x86_64 \ 9 // RUN: | FileCheck %s -check-prefix=SUB_FRAME 10 // RUN: llvm-objdump -p %p/Inputs/dylibSubUmbrella.macho-x86_64 \ 11 // RUN: | FileCheck %s -check-prefix=SUB_UMB 12 // RUN: llvm-objdump -p %p/Inputs/dylibSubLibrary.macho-x86_64 \ 13 // RUN: | FileCheck %s -check-prefix=SUB_LIB 14 // RUN: llvm-objdump -p %p/Inputs/dylibSubClient.macho-x86_64 \ 15 // RUN: | FileCheck %s -check-prefix=SUB_CLI 16 // RUN: llvm-objdump -p %p/Inputs/dylibRoutines.macho-x86_64 \ 17 // RUN: | FileCheck %s -check-prefix=ROUTINE 18 // RUN: llvm-objdump -p %p/Inputs/exeThread.macho-x86_64 \ 19 // RUN: | FileCheck %s -check-prefix=THREAD 20 // RUN: llvm-objdump -macho -p -arch i386 %p/Inputs/macho-universal.x86_64.i386 \ 21 // RUN: | FileCheck %s -check-prefix=FATi386 22 // RUN: llvm-objdump -p -non-verbose %p/Inputs/hello.obj.macho-x86_64 \ 23 // RUN: | FileCheck %s -check-prefix=NON_VERBOSE 24 // RUN: llvm-objdump -p %p/Inputs/codesig.macho-x86_64 \ 25 // RUN: | FileCheck %s -check-prefix=CODESIG 26 27 CHECK: Mach header 28 CHECK: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags 29 CHECK: MH_MAGIC_64 X86_64 ALL 0x00 OBJECT 3 496 SUBSECTIONS_VIA_SYMBOLS 30 CHECK: Load command 0 31 CHECK: cmd LC_SEGMENT_64 32 CHECK: cmdsize 392 33 CHECK: segname 34 CHECK: vmaddr 0x0000000000000000 35 CHECK: vmsize 0x00000000000000a8 36 CHECK: fileoff 528 37 CHECK: filesize 168 38 CHECK: maxprot rwx 39 CHECK: initprot rwx 40 CHECK: nsects 4 41 CHECK: flags (none) 42 CHECK: Section 43 CHECK: sectname __text 44 CHECK: segname __TEXT 45 CHECK: addr 0x0000000000000000 46 CHECK: size 0x000000000000003b 47 CHECK: offset 528 48 CHECK: align 2^4 (16) 49 CHECK: reloff 696 50 CHECK: nreloc 2 51 CHECK: type S_REGULAR 52 CHECK: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS 53 CHECK: reserved1 0 54 CHECK: reserved2 0 55 CHECK: Section 56 CHECK: sectname __cstring 57 CHECK: segname __TEXT 58 CHECK: addr 0x000000000000003b 59 CHECK: size 0x000000000000000d 60 CHECK: offset 587 61 CHECK: align 2^0 (1) 62 CHECK: reloff 0 63 CHECK: nreloc 0 64 CHECK: type S_CSTRING_LITERALS 65 CHECK: attributes (none) 66 CHECK: reserved1 0 67 CHECK: reserved2 0 68 CHECK: Section 69 CHECK: sectname __compact_unwind 70 CHECK: segname __LD 71 CHECK: addr 0x0000000000000048 72 CHECK: size 0x0000000000000020 73 CHECK: offset 600 74 CHECK: align 2^3 (8) 75 CHECK: reloff 712 76 CHECK: nreloc 1 77 CHECK: type S_REGULAR 78 CHECK: attributes DEBUG 79 CHECK: reserved1 0 80 CHECK: reserved2 0 81 CHECK: Section 82 CHECK: sectname __eh_frame 83 CHECK: segname __TEXT 84 CHECK: addr 0x0000000000000068 85 CHECK: size 0x0000000000000040 86 CHECK: offset 632 87 CHECK: align 2^3 (8) 88 CHECK: reloff 0 89 CHECK: nreloc 0 90 CHECK: type S_COALESCED 91 CHECK: attributes NO_TOC STRIP_STATIC_SYMS LIVE_SUPPORT 92 CHECK: reserved1 0 93 CHECK: reserved2 0 94 CHECK: Load command 1 95 CHECK: cmd LC_SYMTAB 96 CHECK: cmdsize 24 97 CHECK: symoff 720 98 CHECK: nsyms 5 99 CHECK: stroff 800 100 CHECK: strsize 44 101 CHECK: Load command 2 102 CHECK: cmd LC_DYSYMTAB 103 CHECK: cmdsize 80 104 CHECK: ilocalsym 0 105 CHECK: nlocalsym 2 106 CHECK: iextdefsym 2 107 CHECK: nextdefsym 2 108 CHECK: iundefsym 4 109 CHECK: nundefsym 1 110 CHECK: tocoff 0 111 CHECK: ntoc 0 112 CHECK: modtaboff 0 113 CHECK: nmodtab 0 114 CHECK: extrefsymoff 0 115 CHECK: nextrefsyms 0 116 CHECK: indirectsymoff 0 117 CHECK: nindirectsyms 0 118 CHECK: extreloff 0 119 CHECK: nextrel 0 120 CHECK: locreloff 0 121 CHECK: nlocrel 0 122 123 EXE: Mach header 124 EXE: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags 125 EXE: MH_MAGIC_64 X86_64 ALL LIB64 EXECUTE 16 1296 NOUNDEFS DYLDLINK TWOLEVEL PIE 126 EXE: Load command 0 127 EXE: cmd LC_SEGMENT_64 128 EXE: cmdsize 72 129 EXE: segname __PAGEZERO 130 EXE: vmaddr 0x0000000000000000 131 EXE: vmsize 0x0000000100000000 132 EXE: fileoff 0 133 EXE: filesize 0 134 EXE: maxprot --- 135 EXE: initprot --- 136 EXE: nsects 0 137 EXE: flags (none) 138 EXE: Load command 1 139 EXE: cmd LC_SEGMENT_64 140 EXE: cmdsize 552 141 EXE: segname __TEXT 142 EXE: vmaddr 0x0000000100000000 143 EXE: vmsize 0x0000000000001000 144 EXE: fileoff 0 145 EXE: filesize 4096 146 EXE: maxprot rwx 147 EXE: initprot r-x 148 EXE: nsects 6 149 EXE: flags (none) 150 EXE: Section 151 EXE: sectname __text 152 EXE: segname __TEXT 153 EXE: addr 0x0000000100000f30 154 EXE: size 0x000000000000003b 155 EXE: offset 3888 156 EXE: align 2^4 (16) 157 EXE: reloff 0 158 EXE: nreloc 0 159 EXE: type S_REGULAR 160 EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS 161 EXE: reserved1 0 162 EXE: reserved2 0 163 EXE: Section 164 EXE: sectname __stubs 165 EXE: segname __TEXT 166 EXE: addr 0x0000000100000f6c 167 EXE: size 0x0000000000000006 168 EXE: offset 3948 169 EXE: align 2^1 (2) 170 EXE: reloff 0 171 EXE: nreloc 0 172 EXE: type S_SYMBOL_STUBS 173 EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS 174 EXE: reserved1 0 (index into indirect symbol table) 175 EXE: reserved2 6 (size of stubs) 176 EXE: Section 177 EXE: sectname __stub_helper 178 EXE: segname __TEXT 179 EXE: addr 0x0000000100000f74 180 EXE: size 0x000000000000001a 181 EXE: offset 3956 182 EXE: align 2^2 (4) 183 EXE: reloff 0 184 EXE: nreloc 0 185 EXE: type S_REGULAR 186 EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS 187 EXE: reserved1 0 188 EXE: reserved2 0 189 EXE: Section 190 EXE: sectname __cstring 191 EXE: segname __TEXT 192 EXE: addr 0x0000000100000f8e 193 EXE: size 0x000000000000000d 194 EXE: offset 3982 195 EXE: align 2^0 (1) 196 EXE: reloff 0 197 EXE: nreloc 0 198 EXE: type S_CSTRING_LITERALS 199 EXE: attributes (none) 200 EXE: reserved1 0 201 EXE: reserved2 0 202 EXE: Section 203 EXE: sectname __unwind_info 204 EXE: segname __TEXT 205 EXE: addr 0x0000000100000f9b 206 EXE: size 0x0000000000000048 207 EXE: offset 3995 208 EXE: align 2^0 (1) 209 EXE: reloff 0 210 EXE: nreloc 0 211 EXE: type S_REGULAR 212 EXE: attributes (none) 213 EXE: reserved1 0 214 EXE: reserved2 0 215 EXE: Section 216 EXE: sectname __eh_frame 217 EXE: segname __TEXT 218 EXE: addr 0x0000000100000fe8 219 EXE: size 0x0000000000000018 220 EXE: offset 4072 221 EXE: align 2^3 (8) 222 EXE: reloff 0 223 EXE: nreloc 0 224 EXE: type S_REGULAR 225 EXE: attributes (none) 226 EXE: reserved1 0 227 EXE: reserved2 0 228 EXE: Load command 2 229 EXE: cmd LC_SEGMENT_64 230 EXE: cmdsize 232 231 EXE: segname __DATA 232 EXE: vmaddr 0x0000000100001000 233 EXE: vmsize 0x0000000000001000 234 EXE: fileoff 4096 235 EXE: filesize 4096 236 EXE: maxprot rwx 237 EXE: initprot rw- 238 EXE: nsects 2 239 EXE: flags (none) 240 EXE: Section 241 EXE: sectname __nl_symbol_ptr 242 EXE: segname __DATA 243 EXE: addr 0x0000000100001000 244 EXE: size 0x0000000000000010 245 EXE: offset 4096 246 EXE: align 2^3 (8) 247 EXE: reloff 0 248 EXE: nreloc 0 249 EXE: type S_NON_LAZY_SYMBOL_POINTERS 250 EXE: attributes (none) 251 EXE: reserved1 1 (index into indirect symbol table) 252 EXE: reserved2 0 253 EXE: Section 254 EXE: sectname __la_symbol_ptr 255 EXE: segname __DATA 256 EXE: addr 0x0000000100001010 257 EXE: size 0x0000000000000008 258 EXE: offset 4112 259 EXE: align 2^3 (8) 260 EXE: reloff 0 261 EXE: nreloc 0 262 EXE: type S_LAZY_SYMBOL_POINTERS 263 EXE: attributes (none) 264 EXE: reserved1 3 (index into indirect symbol table) 265 EXE: reserved2 0 266 EXE: Load command 3 267 EXE: cmd LC_SEGMENT_64 268 EXE: cmdsize 72 269 EXE: segname __LINKEDIT 270 EXE: vmaddr 0x0000000100002000 271 EXE: vmsize 0x0000000000001000 272 EXE: fileoff 8192 273 EXE: filesize 304 274 EXE: maxprot rwx 275 EXE: initprot r-- 276 EXE: nsects 0 277 EXE: flags (none) 278 EXE: Load command 4 279 EXE: cmd LC_DYLD_INFO_ONLY 280 EXE: cmdsize 48 281 EXE: rebase_off 8192 282 EXE: rebase_size 8 283 EXE: bind_off 8200 284 EXE: bind_size 24 285 EXE: weak_bind_off 0 286 EXE: weak_bind_size 0 287 EXE: lazy_bind_off 8224 288 EXE: lazy_bind_size 16 289 EXE: export_off 8240 290 EXE: export_size 48 291 EXE: Load command 5 292 EXE: cmd LC_SYMTAB 293 EXE: cmdsize 24 294 EXE: symoff 8360 295 EXE: nsyms 4 296 EXE: stroff 8440 297 EXE: strsize 56 298 EXE: Load command 6 299 EXE: cmd LC_DYSYMTAB 300 EXE: cmdsize 80 301 EXE: ilocalsym 0 302 EXE: nlocalsym 0 303 EXE: iextdefsym 0 304 EXE: nextdefsym 2 305 EXE: iundefsym 2 306 EXE: nundefsym 2 307 EXE: tocoff 0 308 EXE: ntoc 0 309 EXE: modtaboff 0 310 EXE: nmodtab 0 311 EXE: extrefsymoff 0 312 EXE: nextrefsyms 0 313 EXE: indirectsymoff 8424 314 EXE: nindirectsyms 4 315 EXE: extreloff 0 316 EXE: nextrel 0 317 EXE: locreloff 0 318 EXE: nlocrel 0 319 EXE: Load command 7 320 EXE: cmd LC_LOAD_DYLINKER 321 EXE: cmdsize 32 322 EXE: name /usr/lib/dyld (offset 12) 323 EXE: Load command 8 324 EXE: cmd LC_UUID 325 EXE: cmdsize 24 326 EXE: uuid 65C2DD41-79B0-3B34-871B-8CB3446AB762 327 EXE: Load command 9 328 EXE: cmd LC_VERSION_MIN_MACOSX 329 EXE: cmdsize 16 330 EXE: version 10.9 331 EXE: sdk 10.9 332 EXE: Load command 10 333 EXE: cmd LC_SOURCE_VERSION 334 EXE: cmdsize 16 335 EXE: version 0.0 336 EXE: Load command 11 337 EXE: cmd LC_MAIN 338 EXE: cmdsize 24 339 EXE: entryoff 3888 340 EXE: stacksize 0 341 EXE: Load command 12 342 EXE: cmd LC_LOAD_DYLIB 343 EXE: cmdsize 56 344 EXE: name /usr/lib/libSystem.B.dylib (offset 24) 345 EXE: current version 1197.1.1 346 EXE: compatibility version 1.0.0 347 EXE: Load command 13 348 EXE: cmd LC_FUNCTION_STARTS 349 EXE: cmdsize 16 350 EXE: dataoff 8288 351 EXE: datasize 8 352 EXE: Load command 14 353 EXE: cmd LC_DATA_IN_CODE 354 EXE: cmdsize 16 355 EXE: dataoff 8296 356 EXE: datasize 0 357 EXE: Load command 15 358 EXE: cmd LC_DYLIB_CODE_SIGN_DRS 359 EXE: cmdsize 16 360 EXE: dataoff 8296 361 EXE: datasize 64 362 363 364 LOAD: Load command 10 365 LOAD: cmd LC_LOAD_DYLIB 366 LOAD: cmdsize 48 367 LOAD: name /usr/lib/foo1.dylib (offset 24) 368 LOAD: current version 0.0.0 369 LOAD: compatibility version 0.0.0 370 LOAD: Load command 11 371 LOAD: cmd LC_LOAD_WEAK_DYLIB 372 LOAD: cmdsize 48 373 LOAD: name /usr/lib/foo2.dylib (offset 24) 374 LOAD: current version 0.0.0 375 LOAD: compatibility version 0.0.0 376 LOAD: Load command 12 377 LOAD: cmd LC_REEXPORT_DYLIB 378 LOAD: cmdsize 48 379 LOAD: name /usr/lib/foo3.dylib (offset 24) 380 LOAD: current version 0.0.0 381 LOAD: compatibility version 0.0.0 382 LOAD: Load command 13 383 LOAD: cmd LC_LAZY_LOAD_DYLIB 384 LOAD: cmdsize 48 385 LOAD: name /usr/lib/foo4.dylib (offset 24) 386 LOAD: current version 0.0.0 387 LOAD: compatibility version 0.0.0 388 389 LD_OPT: Load command 4 390 LD_OPT: cmd LC_LINKER_OPTION 391 LD_OPT: cmdsize 24 392 LD_OPT: count 1 393 LD_OPT: string #1 -lc++ 394 LD_OPT: Load command 5 395 LD_OPT: cmd LC_LINKER_OPTION 396 LD_OPT: cmdsize 40 397 LD_OPT: count 2 398 LD_OPT: string #1 -framework 399 LD_OPT: string #2 Foundation 400 401 SUB_FRAME: Load command 10 402 SUB_FRAME: cmd LC_SUB_FRAMEWORK 403 SUB_FRAME: cmdsize 16 404 SUB_FRAME: umbrella Bar (offset 12) 405 406 SUB_UMB: Load command 5 407 SUB_UMB: cmd LC_SUB_UMBRELLA 408 SUB_UMB: cmdsize 16 409 SUB_UMB: sub_umbrella Foo (offset 12) 410 411 SUB_LIB: Load command 5 412 SUB_LIB: cmd LC_SUB_LIBRARY 413 SUB_LIB: cmdsize 20 414 SUB_LIB: sub_library libfoo (offset 12) 415 416 SUB_CLI: Load command 10 417 SUB_CLI: cmd LC_SUB_CLIENT 418 SUB_CLI: cmdsize 16 419 SUB_CLI: client bar (offset 12) 420 421 ROUTINE: Load command 6 422 ROUTINE: cmd LC_ROUTINES_64 423 ROUTINE: cmdsize 72 424 ROUTINE: init_address 0x0000000000000f80 425 ROUTINE: init_module 0 426 ROUTINE: reserved1 0 427 ROUTINE: reserved2 0 428 ROUTINE: reserved3 0 429 ROUTINE: reserved4 0 430 ROUTINE: reserved5 0 431 ROUTINE: reserved6 0 432 433 THREAD: Load command 10 434 THREAD: cmd LC_UNIXTHREAD 435 THREAD: cmdsize 184 436 THREAD: flavor x86_THREAD_STATE64 437 THREAD: count x86_THREAD_STATE64_COUNT 438 THREAD: rax 0x0000000000000000 rbx 0x0000000000000000 rcx 0x0000000000000000 439 THREAD: rdx 0x0000000000000000 rdi 0x0000000000000000 rsi 0x0000000000000000 440 THREAD: rbp 0x0000000000000000 rsp 0x0000000000000000 r8 0x0000000000000000 441 THREAD: r9 0x0000000000000000 r10 0x0000000000000000 r11 0x0000000000000000 442 THREAD: r12 0x0000000000000000 r13 0x0000000000000000 r14 0x0000000000000000 443 THREAD: r15 0x0000000000000000 rip 0x0000000100000d00 444 THREAD: rflags 0x0000000000000000 cs 0x0000000000000000 fs 0x0000000000000000 445 THREAD: gs 0x0000000000000000 446 447 FATi386: Mach header 448 FATi386: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags 449 FATi386: MH_MAGIC I386 ALL 0x00 EXECUTE 16 716 NOUNDEFS DYLDLINK TWOLEVEL PIE MH_NO_HEAP_EXECUTION 450 451 NON_VERBOSE: Mach header 452 NON_VERBOSE: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags 453 NON_VERBOSE: 0xfeedfacf 16777223 3 0x00 1 3 496 0x00002000 454 NON_VERBOSE: Load command 0 455 NON_VERBOSE: cmd LC_SEGMENT_64 456 NON_VERBOSE: cmdsize 392 457 NON_VERBOSE: segname 458 NON_VERBOSE: vmaddr 0x0000000000000000 459 NON_VERBOSE: vmsize 0x00000000000000a8 460 NON_VERBOSE: fileoff 528 461 NON_VERBOSE: filesize 168 462 NON_VERBOSE: maxprot 0x00000007 463 NON_VERBOSE: initprot 0x00000007 464 NON_VERBOSE: nsects 4 465 NON_VERBOSE: flags 0x0 466 NON_VERBOSE: Section 467 NON_VERBOSE: sectname __text 468 NON_VERBOSE: segname __TEXT 469 NON_VERBOSE: addr 0x0000000000000000 470 NON_VERBOSE: size 0x000000000000003b 471 NON_VERBOSE: offset 528 472 NON_VERBOSE: align 2^4 (16) 473 NON_VERBOSE: reloff 696 474 NON_VERBOSE: nreloc 2 475 NON_VERBOSE: flags 0x80000400 476 NON_VERBOSE: reserved1 0 477 NON_VERBOSE: reserved2 0 478 NON_VERBOSE: Section 479 NON_VERBOSE: sectname __cstring 480 NON_VERBOSE: segname __TEXT 481 NON_VERBOSE: addr 0x000000000000003b 482 NON_VERBOSE: size 0x000000000000000d 483 NON_VERBOSE: offset 587 484 NON_VERBOSE: align 2^0 (1) 485 NON_VERBOSE: reloff 0 486 NON_VERBOSE: nreloc 0 487 NON_VERBOSE: flags 0x00000002 488 NON_VERBOSE: reserved1 0 489 NON_VERBOSE: reserved2 0 490 NON_VERBOSE: Section 491 NON_VERBOSE: sectname __compact_unwind 492 NON_VERBOSE: segname __LD 493 NON_VERBOSE: addr 0x0000000000000048 494 NON_VERBOSE: size 0x0000000000000020 495 NON_VERBOSE: offset 600 496 NON_VERBOSE: align 2^3 (8) 497 NON_VERBOSE: reloff 712 498 NON_VERBOSE: nreloc 1 499 NON_VERBOSE: flags 0x02000000 500 NON_VERBOSE: reserved1 0 501 NON_VERBOSE: reserved2 0 502 NON_VERBOSE: Section 503 NON_VERBOSE: sectname __eh_frame 504 NON_VERBOSE: segname __TEXT 505 NON_VERBOSE: addr 0x0000000000000068 506 NON_VERBOSE: size 0x0000000000000040 507 NON_VERBOSE: offset 632 508 NON_VERBOSE: align 2^3 (8) 509 NON_VERBOSE: reloff 0 510 NON_VERBOSE: nreloc 0 511 NON_VERBOSE: flags 0x6800000b 512 NON_VERBOSE: reserved1 0 513 NON_VERBOSE: reserved2 0 514 NON_VERBOSE: Load command 1 515 NON_VERBOSE: cmd LC_SYMTAB 516 NON_VERBOSE: cmdsize 24 517 NON_VERBOSE: symoff 720 518 NON_VERBOSE: nsyms 5 519 NON_VERBOSE: stroff 800 520 NON_VERBOSE: strsize 44 521 NON_VERBOSE: Load command 2 522 NON_VERBOSE: cmd LC_DYSYMTAB 523 NON_VERBOSE: cmdsize 80 524 NON_VERBOSE: ilocalsym 0 525 NON_VERBOSE: nlocalsym 2 526 NON_VERBOSE: iextdefsym 2 527 NON_VERBOSE: nextdefsym 2 528 NON_VERBOSE: iundefsym 4 529 NON_VERBOSE: nundefsym 1 530 NON_VERBOSE: tocoff 0 531 NON_VERBOSE: ntoc 0 532 NON_VERBOSE: modtaboff 0 533 NON_VERBOSE: nmodtab 0 534 NON_VERBOSE: extrefsymoff 0 535 NON_VERBOSE: nextrefsyms 0 536 NON_VERBOSE: indirectsymoff 0 537 NON_VERBOSE: nindirectsyms 0 538 NON_VERBOSE: extreloff 0 539 NON_VERBOSE: nextrel 0 540 NON_VERBOSE: locreloff 0 541 NON_VERBOSE: nlocrel 0 542 543 CODESIG: cmd LC_CODE_SIGNATURE 544 CODESIG: cmdsize 16 545 CODESIG: dataoff 8496 546 CODESIG: datasize 64 547