1# RUN: yaml2obj %s -o %t 2# RUN: llvm-objdump --macho --reloc %t | FileCheck %s --check-prefix=OBJDUMP-VERIFY 3 4# OBJDUMP-VERIFY: Relocation information (__TEXT,__text) 4 entries 5# OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value 6# OBJDUMP-VERIFY-NEXT: 00000018 False long True PAGOF12 False _w 7# OBJDUMP-VERIFY-NEXT: 00000014 True long True PAGE21 False _w 8# OBJDUMP-VERIFY-NEXT: 0000000c False long True PAGOF12 False _z 9# OBJDUMP-VERIFY-NEXT: 00000008 True long True PAGE21 False _z 10# OBJDUMP-VERIFY-NEXT: Relocation information (__TEXT,__StaticInit) 7 entries 11# OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value 12# OBJDUMP-VERIFY-NEXT: 0000002c True long True BR26 False ___cxx_global_var_init 13# OBJDUMP-VERIFY-NEXT: 00000018 False long True PAGOF12 False _w 14# OBJDUMP-VERIFY-NEXT: 00000014 True long True PAGE21 False _w 15# OBJDUMP-VERIFY-NEXT: 0000000c False long True PAGOF12 False _y 16# OBJDUMP-VERIFY-NEXT: 00000008 True long True PAGE21 False _y 17# OBJDUMP-VERIFY-NEXT: 00000004 False long True PAGOF12 False _x 18# OBJDUMP-VERIFY-NEXT: 00000000 True long True PAGE21 False _x 19# OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__data) 1 entries 20# OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value 21# OBJDUMP-VERIFY-NEXT: 00000008 False ?( 3) True UNSIGND False _x 22# OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__mod_init_func) 1 entries 23# OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value 24# OBJDUMP-VERIFY-NEXT: 00000000 False ?( 3) True UNSIGND False __GLOBAL__sub_I_main.cpp 25# OBJDUMP-VERIFY-NEXT: Relocation information (__LD,__compact_unwind) 3 entries 26# OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value 27# OBJDUMP-VERIFY-NEXT: 00000040 False ?( 3) False UNSIGND False 2 (__TEXT,__StaticInit) 28# OBJDUMP-VERIFY-NEXT: 00000020 False ?( 3) False UNSIGND False 1 (__TEXT,__text) 29# OBJDUMP-VERIFY-NEXT: 00000000 False ?( 3) False UNSIGND False 2 (__TEXT,__StaticInit) 30 31# RUN: obj2yaml %t | FileCheck %s 32# CHECK: Sections: 33# CHECK-NEXT: - sectname: __text 34# CHECK-NEXT: segname: __TEXT 35# CHECK-NEXT: addr: 0x0 36# CHECK-NEXT: size: 48 37# CHECK-NEXT: offset: 0x2C0 38# CHECK-NEXT: align: 2 39# CHECK-NEXT: reloff: 0x3A0 40# CHECK-NEXT: nreloc: 4 41# CHECK-NEXT: flags: 0x80000400 42# CHECK-NEXT: reserved1: 0x0 43# CHECK-NEXT: reserved2: 0x0 44# CHECK-NEXT: reserved3: 0x0 45# CHECK-NEXT: content: 46# CHECK-NEXT: relocations: 47# CHECK-NEXT: - address: 0x18 48# CHECK-NEXT: symbolnum: 9 49# CHECK-NEXT: pcrel: false 50# CHECK-NEXT: length: 2 51# CHECK-NEXT: extern: true 52# CHECK-NEXT: type: 4 53# CHECK-NEXT: scattered: false 54# CHECK-NEXT: value: 0 55# CHECK-NEXT: - address: 0x14 56# CHECK-NEXT: symbolnum: 9 57# CHECK-NEXT: pcrel: true 58# CHECK-NEXT: length: 2 59# CHECK-NEXT: extern: true 60# CHECK-NEXT: type: 3 61# CHECK-NEXT: scattered: false 62# CHECK-NEXT: value: 0 63# CHECK-NEXT: - address: 0xC 64# CHECK-NEXT: symbolnum: 12 65# CHECK-NEXT: pcrel: false 66# CHECK-NEXT: length: 2 67# CHECK-NEXT: extern: true 68# CHECK-NEXT: type: 4 69# CHECK-NEXT: scattered: false 70# CHECK-NEXT: value: 0 71# CHECK-NEXT: - address: 0x8 72# CHECK-NEXT: symbolnum: 12 73# CHECK-NEXT: pcrel: true 74# CHECK-NEXT: length: 2 75# CHECK-NEXT: extern: true 76# CHECK-NEXT: type: 3 77# CHECK-NEXT: scattered: false 78# CHECK-NEXT: value: 0 79# CHECK-NEXT: - sectname: __StaticInit 80# CHECK-NEXT: segname: __TEXT 81# CHECK-NEXT: addr: 0x30 82# CHECK-NEXT: size: 56 83# CHECK-NEXT: offset: 0x2F0 84# CHECK-NEXT: align: 2 85# CHECK-NEXT: reloff: 0x3C0 86# CHECK-NEXT: nreloc: 7 87# CHECK-NEXT: flags: 0x80000400 88# CHECK-NEXT: reserved1: 0x0 89# CHECK-NEXT: reserved2: 0x0 90# CHECK-NEXT: reserved3: 0x0 91# CHECK-NEXT: content: 92# CHECK-NEXT: relocations: 93# CHECK-NEXT: - address: 0x2C 94# CHECK-NEXT: symbolnum: 2 95# CHECK-NEXT: pcrel: true 96# CHECK-NEXT: length: 2 97# CHECK-NEXT: extern: true 98# CHECK-NEXT: type: 2 99# CHECK-NEXT: scattered: false 100# CHECK-NEXT: value: 0 101# CHECK-NEXT: - address: 0x18 102# CHECK-NEXT: symbolnum: 9 103# CHECK-NEXT: pcrel: false 104# CHECK-NEXT: length: 2 105# CHECK-NEXT: extern: true 106# CHECK-NEXT: type: 4 107# CHECK-NEXT: scattered: false 108# CHECK-NEXT: value: 0 109# CHECK-NEXT: - address: 0x14 110# CHECK-NEXT: symbolnum: 9 111# CHECK-NEXT: pcrel: true 112# CHECK-NEXT: length: 2 113# CHECK-NEXT: extern: true 114# CHECK-NEXT: type: 3 115# CHECK-NEXT: scattered: false 116# CHECK-NEXT: value: 0 117# CHECK-NEXT: - address: 0xC 118# CHECK-NEXT: symbolnum: 11 119# CHECK-NEXT: pcrel: false 120# CHECK-NEXT: length: 2 121# CHECK-NEXT: extern: true 122# CHECK-NEXT: type: 4 123# CHECK-NEXT: scattered: false 124# CHECK-NEXT: value: 0 125# CHECK-NEXT: - address: 0x8 126# CHECK-NEXT: symbolnum: 11 127# CHECK-NEXT: pcrel: true 128# CHECK-NEXT: length: 2 129# CHECK-NEXT: extern: true 130# CHECK-NEXT: type: 3 131# CHECK-NEXT: scattered: false 132# CHECK-NEXT: value: 0 133# CHECK-NEXT: - address: 0x4 134# CHECK-NEXT: symbolnum: 10 135# CHECK-NEXT: pcrel: false 136# CHECK-NEXT: length: 2 137# CHECK-NEXT: extern: true 138# CHECK-NEXT: type: 4 139# CHECK-NEXT: scattered: false 140# CHECK-NEXT: value: 0 141# CHECK-NEXT: - address: 0x0 142# CHECK-NEXT: symbolnum: 10 143# CHECK-NEXT: pcrel: true 144# CHECK-NEXT: length: 2 145# CHECK-NEXT: extern: true 146# CHECK-NEXT: type: 3 147# CHECK-NEXT: scattered: false 148# CHECK-NEXT: value: 0 149# CHECK-NEXT: - sectname: __data 150# CHECK-NEXT: segname: __DATA 151# CHECK-NEXT: addr: 0x68 152# CHECK-NEXT: size: 16 153# CHECK-NEXT: offset: 0x328 154# CHECK-NEXT: align: 3 155# CHECK-NEXT: reloff: 0x3F8 156# CHECK-NEXT: nreloc: 1 157# CHECK-NEXT: flags: 0x0 158# CHECK-NEXT: reserved1: 0x0 159# CHECK-NEXT: reserved2: 0x0 160# CHECK-NEXT: reserved3: 0x0 161# CHECK-NEXT: content: 162# CHECK-NEXT: relocations: 163# CHECK-NEXT: - address: 0x8 164# CHECK-NEXT: symbolnum: 10 165# CHECK-NEXT: pcrel: false 166# CHECK-NEXT: length: 3 167# CHECK-NEXT: extern: true 168# CHECK-NEXT: type: 0 169# CHECK-NEXT: scattered: false 170# CHECK-NEXT: value: 0 171# CHECK-NEXT: - sectname: __common 172# CHECK-NEXT: segname: __DATA 173# CHECK-NEXT: addr: 0xE0 174# CHECK-NEXT: size: 8 175# CHECK-NEXT: offset: 0x0 176# CHECK-NEXT: align: 3 177# CHECK-NEXT: reloff: 0x0 178# CHECK-NEXT: nreloc: 0 179# CHECK-NEXT: flags: 0x1 180# CHECK-NEXT: reserved1: 0x0 181# CHECK-NEXT: reserved2: 0x0 182# CHECK-NEXT: reserved3: 0x0 183# CHECK-NEXT: - sectname: __mod_init_func 184# CHECK-NEXT: segname: __DATA 185# CHECK-NEXT: addr: 0x78 186# CHECK-NEXT: size: 8 187# CHECK-NEXT: offset: 0x338 188# CHECK-NEXT: align: 3 189# CHECK-NEXT: reloff: 0x400 190# CHECK-NEXT: nreloc: 1 191# CHECK-NEXT: flags: 0x9 192# CHECK-NEXT: reserved1: 0x0 193# CHECK-NEXT: reserved2: 0x0 194# CHECK-NEXT: reserved3: 0x0 195# CHECK-NEXT: content: 196# CHECK-NEXT: relocations: 197# CHECK-NEXT: - address: 0x0 198# CHECK-NEXT: symbolnum: 3 199# CHECK-NEXT: pcrel: false 200# CHECK-NEXT: length: 3 201# CHECK-NEXT: extern: true 202# CHECK-NEXT: type: 0 203# CHECK-NEXT: scattered: false 204# CHECK-NEXT: value: 0 205# CHECK-NEXT: - sectname: __compact_unwind 206# CHECK-NEXT: segname: __LD 207# CHECK-NEXT: addr: 0x80 208# CHECK-NEXT: size: 96 209# CHECK-NEXT: offset: 0x340 210# CHECK-NEXT: align: 3 211# CHECK-NEXT: reloff: 0x408 212# CHECK-NEXT: nreloc: 3 213# CHECK-NEXT: flags: 0x2000000 214# CHECK-NEXT: reserved1: 0x0 215# CHECK-NEXT: reserved2: 0x0 216# CHECK-NEXT: reserved3: 0x0 217# CHECK-NEXT: content: 218# CHECK-NEXT: relocations: 219# CHECK-NEXT: - address: 0x40 220# CHECK-NEXT: symbolnum: 2 221# CHECK-NEXT: pcrel: false 222# CHECK-NEXT: length: 3 223# CHECK-NEXT: extern: false 224# CHECK-NEXT: type: 0 225# CHECK-NEXT: scattered: false 226# CHECK-NEXT: value: 0 227# CHECK-NEXT: - address: 0x20 228# CHECK-NEXT: symbolnum: 1 229# CHECK-NEXT: pcrel: false 230# CHECK-NEXT: length: 3 231# CHECK-NEXT: extern: false 232# CHECK-NEXT: type: 0 233# CHECK-NEXT: scattered: false 234# CHECK-NEXT: value: 0 235# CHECK-NEXT: - address: 0x0 236# CHECK-NEXT: symbolnum: 2 237# CHECK-NEXT: pcrel: false 238# CHECK-NEXT: length: 3 239# CHECK-NEXT: extern: false 240# CHECK-NEXT: type: 0 241# CHECK-NEXT: scattered: false 242# CHECK-NEXT: value: 0 243 244--- !mach-o 245FileHeader: 246 magic: 0xFEEDFACF 247 cputype: 0x0100000C 248 cpusubtype: 0x00000000 249 filetype: 0x00000001 250 ncmds: 4 251 sizeofcmds: 672 252 flags: 0x00002000 253 reserved: 0x00000000 254LoadCommands: 255 - cmd: LC_SEGMENT_64 256 cmdsize: 552 257 segname: '' 258 vmaddr: 0 259 vmsize: 232 260 fileoff: 704 261 filesize: 224 262 maxprot: 7 263 initprot: 7 264 nsects: 6 265 flags: 0 266 Sections: 267 - sectname: __text 268 segname: __TEXT 269 addr: 0x0000000000000000 270 size: 48 271 offset: 0x000002C0 272 align: 2 273 reloff: 0x000003A0 274 nreloc: 4 275 flags: 0x80000400 276 reserved1: 0x00000000 277 reserved2: 0x00000000 278 reserved3: 0x00000000 279 content: FF4300D1FF0F00B90800009008010091080140F90900009029010091290140F90801098BE00308AAFF430091C0035FD6 280 relocations: 281 - address: 0x00000018 282 symbolnum: 9 283 pcrel: false 284 length: 2 285 extern: true 286 type: 4 287 scattered: false 288 value: 0 289 - address: 0x00000014 290 symbolnum: 9 291 pcrel: true 292 length: 2 293 extern: true 294 type: 3 295 scattered: false 296 value: 0 297 - address: 0x0000000C 298 symbolnum: 12 299 pcrel: false 300 length: 2 301 extern: true 302 type: 4 303 scattered: false 304 value: 0 305 - address: 0x00000008 306 symbolnum: 12 307 pcrel: true 308 length: 2 309 extern: true 310 type: 3 311 scattered: false 312 value: 0 313 - sectname: __StaticInit 314 segname: __TEXT 315 addr: 0x0000000000000030 316 size: 56 317 offset: 0x000002F0 318 align: 2 319 reloff: 0x000003C0 320 nreloc: 7 321 flags: 0x80000400 322 reserved1: 0x00000000 323 reserved2: 0x00000000 324 reserved3: 0x00000000 325 content: 08000090080100910900009029010091080109EB0900009029010091280100F9C0035FD6FD7BBFA9FD03009100000094FD7BC1A8C0035FD6 326 relocations: 327 - address: 0x0000002C 328 symbolnum: 2 329 pcrel: true 330 length: 2 331 extern: true 332 type: 2 333 scattered: false 334 value: 0 335 - address: 0x00000018 336 symbolnum: 9 337 pcrel: false 338 length: 2 339 extern: true 340 type: 4 341 scattered: false 342 value: 0 343 - address: 0x00000014 344 symbolnum: 9 345 pcrel: true 346 length: 2 347 extern: true 348 type: 3 349 scattered: false 350 value: 0 351 - address: 0x0000000C 352 symbolnum: 11 353 pcrel: false 354 length: 2 355 extern: true 356 type: 4 357 scattered: false 358 value: 0 359 - address: 0x00000008 360 symbolnum: 11 361 pcrel: true 362 length: 2 363 extern: true 364 type: 3 365 scattered: false 366 value: 0 367 - address: 0x00000004 368 symbolnum: 10 369 pcrel: false 370 length: 2 371 extern: true 372 type: 4 373 scattered: false 374 value: 0 375 - address: 0x00000000 376 symbolnum: 10 377 pcrel: true 378 length: 2 379 extern: true 380 type: 3 381 scattered: false 382 value: 0 383 - sectname: __data 384 segname: __DATA 385 addr: 0x0000000000000068 386 size: 16 387 offset: 0x00000328 388 align: 3 389 reloff: 0x000003F8 390 nreloc: 1 391 flags: 0x00000000 392 reserved1: 0x00000000 393 reserved2: 0x00000000 394 reserved3: 0x00000000 395 content: '01000000020000000000000000000000' 396 relocations: 397 - address: 0x00000008 398 symbolnum: 10 399 pcrel: false 400 length: 3 401 extern: true 402 type: 0 403 scattered: false 404 value: 0 405 - sectname: __common 406 segname: __DATA 407 addr: 0x00000000000000E0 408 size: 8 409 offset: 0x00000000 410 align: 3 411 reloff: 0x00000000 412 nreloc: 0 413 flags: 0x00000001 414 reserved1: 0x00000000 415 reserved2: 0x00000000 416 reserved3: 0x00000000 417 - sectname: __mod_init_func 418 segname: __DATA 419 addr: 0x0000000000000078 420 size: 8 421 offset: 0x00000338 422 align: 3 423 reloff: 0x00000400 424 nreloc: 1 425 flags: 0x00000009 426 reserved1: 0x00000000 427 reserved2: 0x00000000 428 reserved3: 0x00000000 429 content: '0000000000000000' 430 relocations: 431 - address: 0x00000000 432 symbolnum: 3 433 pcrel: false 434 length: 3 435 extern: true 436 type: 0 437 scattered: false 438 value: 0 439 - sectname: __compact_unwind 440 segname: __LD 441 addr: 0x0000000000000080 442 size: 96 443 offset: 0x00000340 444 align: 3 445 reloff: 0x00000408 446 nreloc: 3 447 flags: 0x02000000 448 reserved1: 0x00000000 449 reserved2: 0x00000000 450 reserved3: 0x00000000 451 content: '300000000000000024000000000000020000000000000000000000000000000000000000000000003000000000100002000000000000000000000000000000005400000000000000140000000000000400000000000000000000000000000000' 452 relocations: 453 - address: 0x00000040 454 symbolnum: 2 455 pcrel: false 456 length: 3 457 extern: false 458 type: 0 459 scattered: false 460 value: 0 461 - address: 0x00000020 462 symbolnum: 1 463 pcrel: false 464 length: 3 465 extern: false 466 type: 0 467 scattered: false 468 value: 0 469 - address: 0x00000000 470 symbolnum: 2 471 pcrel: false 472 length: 3 473 extern: false 474 type: 0 475 scattered: false 476 value: 0 477 - cmd: LC_VERSION_MIN_IPHONEOS 478 cmdsize: 16 479 version: 655360 480 sdk: 0 481 - cmd: LC_SYMTAB 482 cmdsize: 24 483 symoff: 1056 484 nsyms: 13 485 stroff: 1264 486 strsize: 104 487 - cmd: LC_DYSYMTAB 488 cmdsize: 80 489 ilocalsym: 0 490 nlocalsym: 8 491 iextdefsym: 8 492 nextdefsym: 5 493 iundefsym: 13 494 nundefsym: 0 495 tocoff: 0 496 ntoc: 0 497 modtaboff: 0 498 nmodtab: 0 499 extrefsymoff: 0 500 nextrefsyms: 0 501 indirectsymoff: 0 502 nindirectsyms: 0 503 extreloff: 0 504 nextrel: 0 505 locreloff: 0 506 nlocrel: 0 507LinkEditData: 508 NameList: 509 - n_strx: 97 510 n_type: 0x0E 511 n_sect: 1 512 n_desc: 0 513 n_value: 0 514 - n_strx: 91 515 n_type: 0x0E 516 n_sect: 2 517 n_desc: 0 518 n_value: 48 519 - n_strx: 13 520 n_type: 0x0E 521 n_sect: 2 522 n_desc: 0 523 n_value: 48 524 - n_strx: 36 525 n_type: 0x0E 526 n_sect: 2 527 n_desc: 0 528 n_value: 84 529 - n_strx: 85 530 n_type: 0x0E 531 n_sect: 3 532 n_desc: 0 533 n_value: 104 534 - n_strx: 79 535 n_type: 0x0E 536 n_sect: 4 537 n_desc: 0 538 n_value: 224 539 - n_strx: 73 540 n_type: 0x0E 541 n_sect: 5 542 n_desc: 0 543 n_value: 120 544 - n_strx: 67 545 n_type: 0x0E 546 n_sect: 6 547 n_desc: 0 548 n_value: 128 549 - n_strx: 61 550 n_type: 0x0F 551 n_sect: 1 552 n_desc: 0 553 n_value: 0 554 - n_strx: 10 555 n_type: 0x0F 556 n_sect: 4 557 n_desc: 0 558 n_value: 224 559 - n_strx: 7 560 n_type: 0x0F 561 n_sect: 3 562 n_desc: 0 563 n_value: 104 564 - n_strx: 4 565 n_type: 0x0F 566 n_sect: 3 567 n_desc: 0 568 n_value: 108 569 - n_strx: 1 570 n_type: 0x0F 571 n_sect: 3 572 n_desc: 0 573 n_value: 112 574 StringTable: 575 - '' 576 - _z 577 - _y 578 - _x 579 - _w 580 - ___cxx_global_var_init 581 - __GLOBAL__sub_I_main.cpp 582 - _main 583 - ltmp5 584 - ltmp4 585 - ltmp3 586 - ltmp2 587 - ltmp1 588 - ltmp0 589 - '' 590... 591