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