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