brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.6 KiB · ee35f81 Raw
270 lines · plain
1; RUN: rm -rf %t2; RUN: split-file %s %t3; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json4; RUN: yaml2obj %t/swift-objc-class.yaml -o %t/libswift-objc.dylib5 6// Try out dylib that only has 1 symbol for a ObjCClass, with no declarations in header. 7; RUN: clang-installapi -target arm64-apple-macos14 -dynamiclib \8; RUN: -install_name tmp.dylib --verify-against=%t/libswift-objc.dylib \9; RUN: -I%t/usr/include %t/inputs.json -o %t/missing.tbd \10; RUN: --verify-mode=ErrorsAndWarnings 2>&1 | FileCheck --check-prefix MISSING_DECL %s11; RUN: llvm-readtapi --compare %t/missing.tbd %t/missing-expected.tbd 12 13// Try out a dylib that only has 1 symbol for a ObjCClass, 14// but a complete ObjCClass decl in header.15; RUN: clang-installapi -target arm64-apple-macos14 -dynamiclib \16; RUN: -install_name tmp.dylib --verify-against=%t/libswift-objc.dylib \17; RUN: -I%t/usr/include %t/inputs.json -o %t/mismatching.tbd \18; RUN: --verify-mode=Pedantic -DFULL_DECL 2>&1 | FileCheck --check-prefix MISMATCH_DECL %s19; RUN: llvm-readtapi -compare %t/mismatching.tbd  %t/mismatching-expected.tbd20 21// Try out a dylib that only has 1 symbol for a ObjCClass, but is represented in header. 22; RUN: clang-installapi -target arm64-apple-macos14 -dynamiclib \23; RUN: -install_name tmp.dylib --verify-against=%t/libswift-objc.dylib \24; RUN: -I%t/usr/include %t/inputs.json -o %t/matching.tbd \25; RUN: --verify-mode=Pedantic \26; RUN: -DHAS_META_DECL 2>&1 | FileCheck --allow-empty %s27 28; MISSING_DECL:        violations found for arm6429; MISSING_DECL-NEXT:   warning: no declaration was found for exported symbol 'Metaclass of Suggestion' in dynamic library30 31; MISMATCH_DECL:       violations found for arm64-apple-macos1432; MISMATCH_DECL:       warning: declaration has external linkage, but dynamic library doesn't have symbol 'Class of Suggestion'33 34; CHECK-NOT:           error35; CHECK-NOT:           warning 36 37 38;--- usr/include/mismatch.h39#if HAS_META_DECL40int metaclass __asm("_OBJC_METACLASS_$_Suggestion");41#endif 42 43#if FULL_DECL44@interface Suggestion 45@end46#endif47 48;--- inputs.json.in49{50  "headers": [ {51    "path" : "DSTROOT/usr/include/mismatch.h",52    "type" : "public"53  }54  ],55  "version": "3"56}57 58;--- missing-expected.tbd59--- !tapi-tbd60tbd-version:     461targets:         [ arm64-macos ]62flags:           [ not_app_extension_safe ]63install-name:    tmp.dylib64current-version: 065compatibility-version: 066...67 68;--- mismatching-expected.tbd69--- !tapi-tbd70tbd-version:     471targets:         [ arm64-macos ]72flags:           [ not_app_extension_safe ]73install-name:    tmp.dylib74current-version: 075compatibility-version: 076exports:77  - targets:         [ arm64-macos ]78    objc-classes:    [ Suggestion ]79...80 81;--- swift-objc-class.yaml82--- !mach-o83FileHeader:84  magic:           0xFEEDFACF85  cputype:         0x100000C86  cpusubtype:      0x087  filetype:        0x688  ncmds:           1389  sizeofcmds:      75290  flags:           0x10008591  reserved:        0x092LoadCommands:93  - cmd:             LC_SEGMENT_6494    cmdsize:         23295    segname:         __TEXT96    vmaddr:          097    vmsize:          1638498    fileoff:         099    filesize:        16384100    maxprot:         5101    initprot:        5102    nsects:          2103    flags:           0104    Sections:105      - sectname:        __text106        segname:         __TEXT107        addr:            0x330108        size:            0109        offset:          0x330110        align:           0111        reloff:          0x0112        nreloc:          0113        flags:           0x80000000114        reserved1:       0x0115        reserved2:       0x0116        reserved3:       0x0117        content:         ''118      - sectname:        __const119        segname:         __TEXT120        addr:            0x330121        size:            1122        offset:          0x330123        align:           0124        reloff:          0x0125        nreloc:          0126        flags:           0x0127        reserved1:       0x0128        reserved2:       0x0129        reserved3:       0x0130        content:         '61'131  - cmd:             LC_SEGMENT_64132    cmdsize:         72133    segname:         __LINKEDIT134    vmaddr:          16384135    vmsize:          416136    fileoff:         16384137    filesize:        416138    maxprot:         1139    initprot:        1140    nsects:          0141    flags:           0142  - cmd:             LC_DYLD_INFO_ONLY143    cmdsize:         48144    rebase_off:      0145    rebase_size:     0146    bind_off:        0147    bind_size:       0148    weak_bind_off:   0149    weak_bind_size:  0150    lazy_bind_off:   0151    lazy_bind_size:  0152    export_off:      16384153    export_size:     40154  - cmd:             LC_SYMTAB155    cmdsize:         24156    symoff:          16432157    nsyms:           2158    stroff:          16464159    strsize:         48160  - cmd:             LC_DYSYMTAB161    cmdsize:         80162    ilocalsym:       0163    nlocalsym:       0164    iextdefsym:      0165    nextdefsym:      1166    iundefsym:       1167    nundefsym:       1168    tocoff:          0169    ntoc:            0170    modtaboff:       0171    nmodtab:         0172    extrefsymoff:    0173    nextrefsyms:     0174    indirectsymoff:  0175    nindirectsyms:   0176    extreloff:       0177    nextrel:         0178    locreloff:       0179    nlocrel:         0180  - cmd:             LC_ID_DYLIB181    cmdsize:         40182    dylib:183      name:            24184      timestamp:       0185      current_version: 0186      compatibility_version: 0187    Content:         tmp.dylib188    ZeroPadBytes:    7189  - cmd:             LC_UUID190    cmdsize:         24191    uuid:            4C4C4443-5555-3144-A142-97179769CBE0192  - cmd:             LC_BUILD_VERSION193    cmdsize:         32194    platform:        1195    minos:           917504196    sdk:             983040197    ntools:          1198    Tools:199      - tool:            4200        version:         1245184201  - cmd:             LC_LOAD_DYLIB202    cmdsize:         96203    dylib:204      name:            24205      timestamp:       0206      current_version: 197656576207      compatibility_version: 19660800208    Content:         '/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation'209    ZeroPadBytes:    3210  - cmd:             LC_LOAD_DYLIB211    cmdsize:         56212    dylib:213      name:            24214      timestamp:       0215      current_version: 88473600216      compatibility_version: 65536217    Content:         '/usr/lib/libSystem.B.dylib'218    ZeroPadBytes:    6219  - cmd:             LC_FUNCTION_STARTS220    cmdsize:         16221    dataoff:         16424222    datasize:        8223  - cmd:             LC_DATA_IN_CODE224    cmdsize:         16225    dataoff:         16432226    datasize:        0227  - cmd:             LC_CODE_SIGNATURE228    cmdsize:         16229    dataoff:         16512230    datasize:        288231LinkEditData:232  ExportTrie:233    TerminalSize:    0234    NodeOffset:      0235    Name:            ''236    Flags:           0x0237    Address:         0x0238    Other:           0x0239    ImportName:      ''240    Children:241      - TerminalSize:    3242        NodeOffset:      32243        Name:            '_OBJC_METACLASS_$_Suggestion'244        Flags:           0x0245        Address:         0x330246        Other:           0x0247        ImportName:      ''248  NameList:249    - n_strx:          2250      n_type:          0xF251      n_sect:          2252      n_desc:          0253      n_value:         816254    - n_strx:          31255      n_type:          0x1256      n_sect:          0257      n_desc:          512258      n_value:         0259  StringTable:260    - ' '261    - '_OBJC_METACLASS_$_Suggestion'262    - dyld_stub_binder263  FunctionStarts:  [ 0x330 ]264...265// Generated from: 266// xcrun -sdk macosx clang tmp.c -dynamiclib -install_name tmp.dylib267// tmp.c: 268// __attribute__((visibility("default")))269// const char Meta __asm("_OBJC_METACLASS_$_Suggestion") = 'a';270