brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.6 KiB · 9641ac6 Raw
204 lines · yaml
1# Test that obj2yaml + yaml2obj can round-trip mach-o library simple export trie entries.2#3# RUN: rm -rf %t &&  mkdir -p %t4# RUN: yaml2obj %s -o %t/libfoo.dylib | FileCheck %s --allow-empty --implicit-check-not warning: --implicit-check-not error:5# RUN: llvm-nm --dyldinfo-only %t/libfoo.dylib | FileCheck %s --check-prefix=NM6# NM: 3fb0 T _foo7 8# RUN: obj2yaml %t/libfoo.dylib | FileCheck %s --check-prefix=YAML9# YAML: LinkEditData:10# YAML-NEXT:  ExportTrie:11# YAML:    Children:12#YAML-NEXT:      - TerminalSize:    313#YAML-NEXT:        NodeOffset:      814#YAML-NEXT:        Name:            _foo15#YAML-NEXT:        Flags:           0x016#YAML-NEXT:        Address:         0x3FB017#YAML-NEXT:        Other:           0x018#YAML-NEXT:        ImportName:      ''19 20 21 22 23# This file was produced using:24#  int foo() {return 1;} > tmp.c 25#  xcrun clang -Wl,-ld64 -isysroot `xcrun --show-sdk-path -sdk macosx` --target=arm64-apple-macos11.3 -dynamiclib -o libfoo.dylib -install_name @rpath/libfoo.dylib tmp.c26 27--- !mach-o28FileHeader:29  magic:           0xFEEDFACF30  cputype:         0x100000C31  cpusubtype:      0x032  filetype:        0x633  ncmds:           1334  sizeofcmds:      68035  flags:           0x10008536  reserved:        0x037LoadCommands:38  - cmd:             LC_SEGMENT_6439    cmdsize:         23240    segname:         __TEXT41    vmaddr:          042    vmsize:          1638443    fileoff:         044    filesize:        1638445    maxprot:         546    initprot:        547    nsects:          248    flags:           049    Sections:50      - sectname:        __text51        segname:         __TEXT52        addr:            0x3FB053        size:            854        offset:          0x3FB055        align:           256        reloff:          0x057        nreloc:          058        flags:           0x8000040059        reserved1:       0x060        reserved2:       0x061        reserved3:       0x062        content:         20008052C0035FD663      - sectname:        __unwind_info64        segname:         __TEXT65        addr:            0x3FB866        size:            7267        offset:          0x3FB868        align:           269        reloff:          0x070        nreloc:          071        flags:           0x072        reserved1:       0x073        reserved2:       0x074        reserved3:       0x075        content:         010000001C000000000000001C000000000000001C00000002000000B03F00003400000034000000B93F00000000000034000000030000000C00010010000100000000000000000276  - cmd:             LC_SEGMENT_6477    cmdsize:         7278    segname:         __LINKEDIT79    vmaddr:          1638480    vmsize:          1638481    fileoff:         1638482    filesize:        36183    maxprot:         184    initprot:        185    nsects:          086    flags:           087  - cmd:             LC_ID_DYLIB88    cmdsize:         4889    dylib:90      name:            2491      timestamp:       192      current_version: 093      compatibility_version: 094    Content:         '@rpath/libfoo.dylib'95    ZeroPadBytes:    596  - cmd:             LC_DYLD_INFO_ONLY97    cmdsize:         4898    rebase_off:      099    rebase_size:     0100    bind_off:        0101    bind_size:       0102    weak_bind_off:   0103    weak_bind_size:  0104    lazy_bind_off:   0105    lazy_bind_size:  0106    export_off:      16384107    export_size:     16108  - cmd:             LC_SYMTAB109    cmdsize:         24110    symoff:          16408111    nsyms:           2112    stroff:          16440113    strsize:         24114  - cmd:             LC_DYSYMTAB115    cmdsize:         80116    ilocalsym:       0117    nlocalsym:       0118    iextdefsym:      0119    nextdefsym:      1120    iundefsym:       1121    nundefsym:       1122    tocoff:          0123    ntoc:            0124    modtaboff:       0125    nmodtab:         0126    extrefsymoff:    0127    nextrefsyms:     0128    indirectsymoff:  0129    nindirectsyms:   0130    extreloff:       0131    nextrel:         0132    locreloff:       0133    nlocrel:         0134  - cmd:             LC_UUID135    cmdsize:         24136    uuid:            A2CF51D8-828B-3E0F-B8FA-0DF9C5D1C91A137  - cmd:             LC_BUILD_VERSION138    cmdsize:         32139    platform:        1140    minos:           721664141    sdk:             917504142    ntools:          1143    Tools:144      - tool:            3145        version:         59441152146  - cmd:             LC_SOURCE_VERSION147    cmdsize:         16148    version:         0149  - cmd:             LC_LOAD_DYLIB150    cmdsize:         56151    dylib:152      name:            24153      timestamp:       2154      current_version: 87556096155      compatibility_version: 65536156    Content:         '/usr/lib/libSystem.B.dylib'157    ZeroPadBytes:    6158  - cmd:             LC_FUNCTION_STARTS159    cmdsize:         16160    dataoff:         16400161    datasize:        8162  - cmd:             LC_DATA_IN_CODE163    cmdsize:         16164    dataoff:         16408165    datasize:        0166  - cmd:             LC_CODE_SIGNATURE167    cmdsize:         16168    dataoff:         16464169    datasize:        281170LinkEditData:171  ExportTrie:172    TerminalSize:    0173    NodeOffset:      0174    Name:            ''175    Flags:           0x0176    Address:         0x0177    Other:           0x0178    ImportName:      ''179    Children:180      - TerminalSize:    3181        NodeOffset:      8182        Name:            _foo183        Flags:           0x0184        Address:         0x3FB0185        Other:           0x0186        ImportName:      ''187  NameList:188    - n_strx:          2189      n_type:          0xF190      n_sect:          1191      n_desc:          0192      n_value:         16304193    - n_strx:          7194      n_type:          0x1195      n_sect:          0196      n_desc:          256197      n_value:         0198  StringTable:199    - ' '200    - _foo201    - dyld_stub_binder202  FunctionStarts:  [ 0x3FB0 ]203...204