# RUN: yaml2obj %s -o %t # RUN: llvm-objdump --macho --reloc %t | FileCheck %s --check-prefix=OBJDUMP-VERIFY # OBJDUMP-VERIFY: Relocation information (__TEXT,__text) 4 entries # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value # OBJDUMP-VERIFY-NEXT: 00000018 False long True PAGOF12 False _w # OBJDUMP-VERIFY-NEXT: 00000014 True long True PAGE21 False _w # OBJDUMP-VERIFY-NEXT: 0000000c False long True PAGOF12 False _z # OBJDUMP-VERIFY-NEXT: 00000008 True long True PAGE21 False _z # OBJDUMP-VERIFY-NEXT: Relocation information (__TEXT,__StaticInit) 7 entries # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value # OBJDUMP-VERIFY-NEXT: 0000002c True long True BR26 False ___cxx_global_var_init # OBJDUMP-VERIFY-NEXT: 00000018 False long True PAGOF12 False _w # OBJDUMP-VERIFY-NEXT: 00000014 True long True PAGE21 False _w # OBJDUMP-VERIFY-NEXT: 0000000c False long True PAGOF12 False _y # OBJDUMP-VERIFY-NEXT: 00000008 True long True PAGE21 False _y # OBJDUMP-VERIFY-NEXT: 00000004 False long True PAGOF12 False _x # OBJDUMP-VERIFY-NEXT: 00000000 True long True PAGE21 False _x # OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__data) 1 entries # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value # OBJDUMP-VERIFY-NEXT: 00000008 False ?( 3) True UNSIGND False _x # OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__mod_init_func) 1 entries # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value # OBJDUMP-VERIFY-NEXT: 00000000 False ?( 3) True UNSIGND False __GLOBAL__sub_I_main.cpp # OBJDUMP-VERIFY-NEXT: Relocation information (__LD,__compact_unwind) 3 entries # OBJDUMP-VERIFY-NEXT: address pcrel length extern type scattered symbolnum/value # OBJDUMP-VERIFY-NEXT: 00000040 False ?( 3) False UNSIGND False 2 (__TEXT,__StaticInit) # OBJDUMP-VERIFY-NEXT: 00000020 False ?( 3) False UNSIGND False 1 (__TEXT,__text) # OBJDUMP-VERIFY-NEXT: 00000000 False ?( 3) False UNSIGND False 2 (__TEXT,__StaticInit) # RUN: obj2yaml %t | FileCheck %s # CHECK: Sections: # CHECK-NEXT: - sectname: __text # CHECK-NEXT: segname: __TEXT # CHECK-NEXT: addr: 0x0 # CHECK-NEXT: size: 48 # CHECK-NEXT: offset: 0x2C0 # CHECK-NEXT: align: 2 # CHECK-NEXT: reloff: 0x3A0 # CHECK-NEXT: nreloc: 4 # CHECK-NEXT: flags: 0x80000400 # CHECK-NEXT: reserved1: 0x0 # CHECK-NEXT: reserved2: 0x0 # CHECK-NEXT: reserved3: 0x0 # CHECK-NEXT: content: # CHECK-NEXT: relocations: # CHECK-NEXT: - address: 0x18 # CHECK-NEXT: symbolnum: 9 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 4 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x14 # CHECK-NEXT: symbolnum: 9 # CHECK-NEXT: pcrel: true # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 3 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0xC # CHECK-NEXT: symbolnum: 12 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 4 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x8 # CHECK-NEXT: symbolnum: 12 # CHECK-NEXT: pcrel: true # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 3 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - sectname: __StaticInit # CHECK-NEXT: segname: __TEXT # CHECK-NEXT: addr: 0x30 # CHECK-NEXT: size: 56 # CHECK-NEXT: offset: 0x2F0 # CHECK-NEXT: align: 2 # CHECK-NEXT: reloff: 0x3C0 # CHECK-NEXT: nreloc: 7 # CHECK-NEXT: flags: 0x80000400 # CHECK-NEXT: reserved1: 0x0 # CHECK-NEXT: reserved2: 0x0 # CHECK-NEXT: reserved3: 0x0 # CHECK-NEXT: content: # CHECK-NEXT: relocations: # CHECK-NEXT: - address: 0x2C # CHECK-NEXT: symbolnum: 2 # CHECK-NEXT: pcrel: true # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 2 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x18 # CHECK-NEXT: symbolnum: 9 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 4 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x14 # CHECK-NEXT: symbolnum: 9 # CHECK-NEXT: pcrel: true # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 3 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0xC # CHECK-NEXT: symbolnum: 11 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 4 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x8 # CHECK-NEXT: symbolnum: 11 # CHECK-NEXT: pcrel: true # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 3 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x4 # CHECK-NEXT: symbolnum: 10 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 4 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x0 # CHECK-NEXT: symbolnum: 10 # CHECK-NEXT: pcrel: true # CHECK-NEXT: length: 2 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 3 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - sectname: __data # CHECK-NEXT: segname: __DATA # CHECK-NEXT: addr: 0x68 # CHECK-NEXT: size: 16 # CHECK-NEXT: offset: 0x328 # CHECK-NEXT: align: 3 # CHECK-NEXT: reloff: 0x3F8 # CHECK-NEXT: nreloc: 1 # CHECK-NEXT: flags: 0x0 # CHECK-NEXT: reserved1: 0x0 # CHECK-NEXT: reserved2: 0x0 # CHECK-NEXT: reserved3: 0x0 # CHECK-NEXT: content: # CHECK-NEXT: relocations: # CHECK-NEXT: - address: 0x8 # CHECK-NEXT: symbolnum: 10 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 3 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 0 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - sectname: __common # CHECK-NEXT: segname: __DATA # CHECK-NEXT: addr: 0xE0 # CHECK-NEXT: size: 8 # CHECK-NEXT: offset: 0x0 # CHECK-NEXT: align: 3 # CHECK-NEXT: reloff: 0x0 # CHECK-NEXT: nreloc: 0 # CHECK-NEXT: flags: 0x1 # CHECK-NEXT: reserved1: 0x0 # CHECK-NEXT: reserved2: 0x0 # CHECK-NEXT: reserved3: 0x0 # CHECK-NEXT: - sectname: __mod_init_func # CHECK-NEXT: segname: __DATA # CHECK-NEXT: addr: 0x78 # CHECK-NEXT: size: 8 # CHECK-NEXT: offset: 0x338 # CHECK-NEXT: align: 3 # CHECK-NEXT: reloff: 0x400 # CHECK-NEXT: nreloc: 1 # CHECK-NEXT: flags: 0x9 # CHECK-NEXT: reserved1: 0x0 # CHECK-NEXT: reserved2: 0x0 # CHECK-NEXT: reserved3: 0x0 # CHECK-NEXT: content: # CHECK-NEXT: relocations: # CHECK-NEXT: - address: 0x0 # CHECK-NEXT: symbolnum: 3 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 3 # CHECK-NEXT: extern: true # CHECK-NEXT: type: 0 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - sectname: __compact_unwind # CHECK-NEXT: segname: __LD # CHECK-NEXT: addr: 0x80 # CHECK-NEXT: size: 96 # CHECK-NEXT: offset: 0x340 # CHECK-NEXT: align: 3 # CHECK-NEXT: reloff: 0x408 # CHECK-NEXT: nreloc: 3 # CHECK-NEXT: flags: 0x2000000 # CHECK-NEXT: reserved1: 0x0 # CHECK-NEXT: reserved2: 0x0 # CHECK-NEXT: reserved3: 0x0 # CHECK-NEXT: content: # CHECK-NEXT: relocations: # CHECK-NEXT: - address: 0x40 # CHECK-NEXT: symbolnum: 2 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 3 # CHECK-NEXT: extern: false # CHECK-NEXT: type: 0 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x20 # CHECK-NEXT: symbolnum: 1 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 3 # CHECK-NEXT: extern: false # CHECK-NEXT: type: 0 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 # CHECK-NEXT: - address: 0x0 # CHECK-NEXT: symbolnum: 2 # CHECK-NEXT: pcrel: false # CHECK-NEXT: length: 3 # CHECK-NEXT: extern: false # CHECK-NEXT: type: 0 # CHECK-NEXT: scattered: false # CHECK-NEXT: value: 0 --- !mach-o FileHeader: magic: 0xFEEDFACF cputype: 0x0100000C cpusubtype: 0x00000000 filetype: 0x00000001 ncmds: 4 sizeofcmds: 672 flags: 0x00002000 reserved: 0x00000000 LoadCommands: - cmd: LC_SEGMENT_64 cmdsize: 552 segname: '' vmaddr: 0 vmsize: 232 fileoff: 704 filesize: 224 maxprot: 7 initprot: 7 nsects: 6 flags: 0 Sections: - sectname: __text segname: __TEXT addr: 0x0000000000000000 size: 48 offset: 0x000002C0 align: 2 reloff: 0x000003A0 nreloc: 4 flags: 0x80000400 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: FF4300D1FF0F00B90800009008010091080140F90900009029010091290140F90801098BE00308AAFF430091C0035FD6 relocations: - address: 0x00000018 symbolnum: 9 pcrel: false length: 2 extern: true type: 4 scattered: false value: 0 - address: 0x00000014 symbolnum: 9 pcrel: true length: 2 extern: true type: 3 scattered: false value: 0 - address: 0x0000000C symbolnum: 12 pcrel: false length: 2 extern: true type: 4 scattered: false value: 0 - address: 0x00000008 symbolnum: 12 pcrel: true length: 2 extern: true type: 3 scattered: false value: 0 - sectname: __StaticInit segname: __TEXT addr: 0x0000000000000030 size: 56 offset: 0x000002F0 align: 2 reloff: 0x000003C0 nreloc: 7 flags: 0x80000400 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: 08000090080100910900009029010091080109EB0900009029010091280100F9C0035FD6FD7BBFA9FD03009100000094FD7BC1A8C0035FD6 relocations: - address: 0x0000002C symbolnum: 2 pcrel: true length: 2 extern: true type: 2 scattered: false value: 0 - address: 0x00000018 symbolnum: 9 pcrel: false length: 2 extern: true type: 4 scattered: false value: 0 - address: 0x00000014 symbolnum: 9 pcrel: true length: 2 extern: true type: 3 scattered: false value: 0 - address: 0x0000000C symbolnum: 11 pcrel: false length: 2 extern: true type: 4 scattered: false value: 0 - address: 0x00000008 symbolnum: 11 pcrel: true length: 2 extern: true type: 3 scattered: false value: 0 - address: 0x00000004 symbolnum: 10 pcrel: false length: 2 extern: true type: 4 scattered: false value: 0 - address: 0x00000000 symbolnum: 10 pcrel: true length: 2 extern: true type: 3 scattered: false value: 0 - sectname: __data segname: __DATA addr: 0x0000000000000068 size: 16 offset: 0x00000328 align: 3 reloff: 0x000003F8 nreloc: 1 flags: 0x00000000 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: '01000000020000000000000000000000' relocations: - address: 0x00000008 symbolnum: 10 pcrel: false length: 3 extern: true type: 0 scattered: false value: 0 - sectname: __common segname: __DATA addr: 0x00000000000000E0 size: 8 offset: 0x00000000 align: 3 reloff: 0x00000000 nreloc: 0 flags: 0x00000001 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 - sectname: __mod_init_func segname: __DATA addr: 0x0000000000000078 size: 8 offset: 0x00000338 align: 3 reloff: 0x00000400 nreloc: 1 flags: 0x00000009 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: '0000000000000000' relocations: - address: 0x00000000 symbolnum: 3 pcrel: false length: 3 extern: true type: 0 scattered: false value: 0 - sectname: __compact_unwind segname: __LD addr: 0x0000000000000080 size: 96 offset: 0x00000340 align: 3 reloff: 0x00000408 nreloc: 3 flags: 0x02000000 reserved1: 0x00000000 reserved2: 0x00000000 reserved3: 0x00000000 content: '300000000000000024000000000000020000000000000000000000000000000000000000000000003000000000100002000000000000000000000000000000005400000000000000140000000000000400000000000000000000000000000000' relocations: - address: 0x00000040 symbolnum: 2 pcrel: false length: 3 extern: false type: 0 scattered: false value: 0 - address: 0x00000020 symbolnum: 1 pcrel: false length: 3 extern: false type: 0 scattered: false value: 0 - address: 0x00000000 symbolnum: 2 pcrel: false length: 3 extern: false type: 0 scattered: false value: 0 - cmd: LC_VERSION_MIN_IPHONEOS cmdsize: 16 version: 655360 sdk: 0 - cmd: LC_SYMTAB cmdsize: 24 symoff: 1056 nsyms: 13 stroff: 1264 strsize: 104 - cmd: LC_DYSYMTAB cmdsize: 80 ilocalsym: 0 nlocalsym: 8 iextdefsym: 8 nextdefsym: 5 iundefsym: 13 nundefsym: 0 tocoff: 0 ntoc: 0 modtaboff: 0 nmodtab: 0 extrefsymoff: 0 nextrefsyms: 0 indirectsymoff: 0 nindirectsyms: 0 extreloff: 0 nextrel: 0 locreloff: 0 nlocrel: 0 LinkEditData: NameList: - n_strx: 97 n_type: 0x0E n_sect: 1 n_desc: 0 n_value: 0 - n_strx: 91 n_type: 0x0E n_sect: 2 n_desc: 0 n_value: 48 - n_strx: 13 n_type: 0x0E n_sect: 2 n_desc: 0 n_value: 48 - n_strx: 36 n_type: 0x0E n_sect: 2 n_desc: 0 n_value: 84 - n_strx: 85 n_type: 0x0E n_sect: 3 n_desc: 0 n_value: 104 - n_strx: 79 n_type: 0x0E n_sect: 4 n_desc: 0 n_value: 224 - n_strx: 73 n_type: 0x0E n_sect: 5 n_desc: 0 n_value: 120 - n_strx: 67 n_type: 0x0E n_sect: 6 n_desc: 0 n_value: 128 - n_strx: 61 n_type: 0x0F n_sect: 1 n_desc: 0 n_value: 0 - n_strx: 10 n_type: 0x0F n_sect: 4 n_desc: 0 n_value: 224 - n_strx: 7 n_type: 0x0F n_sect: 3 n_desc: 0 n_value: 104 - n_strx: 4 n_type: 0x0F n_sect: 3 n_desc: 0 n_value: 108 - n_strx: 1 n_type: 0x0F n_sect: 3 n_desc: 0 n_value: 112 StringTable: - '' - _z - _y - _x - _w - ___cxx_global_var_init - __GLOBAL__sub_I_main.cpp - _main - ltmp5 - ltmp4 - ltmp3 - ltmp2 - ltmp1 - ltmp0 - '' ...