brintos

brintos / llvm-project-archived public Read only

0
0
Text · 19.8 KiB · 55c890b Raw
632 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 5; RUN: yaml2obj %t/Availability.yaml -o %t/System/Library/Frameworks/Availability.framework/Availability6 7; RUN: clang-installapi \8; RUN: --target=x86_64-apple-macos13 \9; RUN: -install_name /System/Library/Frameworks/Availability.framework/Versions/A/Availability \10; RUN: -current_version 1 -compatibility_version 1 \11; RUN: -F %t/System/Library/Frameworks \12; RUN: %t/inputs.json -o %t/output.tbd \13; RUN: --verify-against=%t/System/Library/Frameworks/Availability.framework/Availability \14; RUN: --verify-mode=ErrorsOnly --filetype=tbd-v5 2> %t/errors.log15; RUN: FileCheck -allow-empty -check-prefix=ERRORSONLY -input-file %t/errors.log %s16 17; RUN: clang-installapi \18; RUN: --target=x86_64-apple-macos13 \19; RUN: -install_name /System/Library/Frameworks/Availability.framework/Versions/A/Availability \20; RUN: -current_version 1 -compatibility_version 1 \21; RUN: -F %t/System/Library/Frameworks \22; RUN: %t/inputs.json -o %t/output-warnings.tbd \23; RUN: --verify-against=%t/System/Library/Frameworks/Availability.framework/Availability \24; RUN: --verify-mode=ErrorsAndWarnings 2> %t/errors.log25; RUN: FileCheck -check-prefixes=VIOLATIONS,ERRORSANDWARNINGS -input-file %t/errors.log %s26 27; RUN: not clang-installapi \28; RUN: --target=x86_64-apple-macos13 \29; RUN: -install_name /System/Library/Frameworks/Availability.framework/Versions/A/Availability \30; RUN: -current_version 1 -compatibility_version 1 \31; RUN: -F %t/System/Library/Frameworks \32; RUN: %t/inputs.json -o %t/output-pedantic.tbd \33; RUN: --verify-against=%t/System/Library/Frameworks/Availability.framework/Availability \34; RUN: --verify-mode=Pedantic 2> %t/errors.log35; RUN: FileCheck -check-prefixes=VIOLATIONS,PEDANTIC -input-file %t/errors.log %s36 37; ERRORSONLY-NOT:        error38; ERRORSONLY-NOT:        warning39 40; ERRORSANDWARNINGS-NOT: error41; VIOLATIONS:            warning: violations found for x86_64-apple-macos42; VIOLATIONS:            declaration 'publicGlobalVariable' is marked unavailable, but symbol is exported in dynamic library43; VIOLATIONS-NEXT:       extern int publicGlobalVariable NS_AVAILABLE44; VIOLATIONS:            declaration 'Foo' is marked unavailable, but symbol is exported in dynamic library45; VIOLATIONS-NEXT:       @interface Foo : NSObject46; VIOLATIONS:            declaration 'publicGlobalVariable3' is marked unavailable, but symbol is exported in dynamic library47; VIOLATIONS-NEXT:       extern int publicGlobalVariable3 __attribute__((unavailable))48; VIOLATIONS:            declaration 'privateGlobalVariable' is marked unavailable, but symbol is exported in dynamic library49; VIOLATIONS-NEXT:       extern int privateGlobalVariable;50 51; ERRORSANDWARNINGS-NOT: warning 52; PEDANTIC-NOT:          error53 54;--- inputs.json.in55{56  "headers": [ {57    "path" : "DSTROOT/System/Library/Frameworks/Availability.framework/Headers/Availability.h",58    "type" : "public"59  }, 60  {61    "path" : "DSTROOT/System/Library/Frameworks/Availability.framework/PrivateHeaders/AvailabilityPrivate.h",62    "type" : "private"63  }64  ],65  "version": "3"66}67 68;--- System/Library/Frameworks/Availability.framework/Headers/AV_Defines.h69#ifndef AV_DEFINES70#define AV_DEFINES 71 72#define NS_AVAILABLE __attribute__((availability(macosx,introduced=NA)))73 74@interface NSObject 75@end76 77#endif //AV_DEFINES78 79;--- System/Library/Frameworks/Availability.framework/PrivateHeaders/AvailabilityPrivate.h80#import <Availability/AV_Defines.h>81// Test private global variable.82NS_AVAILABLE 83extern int privateGlobalVariable;84 85;--- System/Library/Frameworks/Availability.framework/Headers/Availability.h86#import <Availability/AV_Defines.h>87extern int publicGlobalVariable NS_AVAILABLE;88 89// Test public ObjC class90NS_AVAILABLE91@interface Foo : NSObject92@end93 94// Test unavailable attribute.95#ifdef __i386__96#define UNAVAILABLE_I386 __attribute__((unavailable))97#else98#define UNAVAILABLE_I38699#endif100extern int publicGlobalVariable2 UNAVAILABLE_I386;101 102extern int publicGlobalVariable3 __attribute__((unavailable))103__attribute__((availability(macosx, introduced = 10.9)));104 105// Test obsoleted with exported variable.106extern int publicGlobalVariable4 __attribute__((availability(107    macosx, introduced = 10.9, deprecated = 10.10, obsoleted = 10.11)));108// Test obsoleted with non-existent variable.109extern int publicGlobalVariable5 __attribute__((availability(110    macosx, introduced = 10.9, deprecated = 10.10, obsoleted = 10.11)));111 112#ifdef __i386__113#define OBSOLETE_I386 __attribute__((availability(macosx, obsoleted = 10.11)))114#else115#define OBSOLETE_I386116#endif117extern int publicGlobalVariable6 OBSOLETE_I386;118 119 120/// Created from: 121// int publicGlobalVariable; int privateGlobalVariable;122// 123// @implementation Foo124// @end125// 126// #ifndef __i386__127// int publicGlobalVariable2;128// #endif129// 130// int publicGlobalVariable3;131// int publicGlobalVariable4;132// 133// #ifndef __i386__134// int publicGlobalVariable6;135// #endif136;--- Availability.yaml137--- !mach-o138FileHeader:139  magic:           0xFEEDFACF140  cputype:         0x1000007141  cpusubtype:      0x3142  filetype:        0x6143  ncmds:           14144  sizeofcmds:      1312145  flags:           0x100085146  reserved:        0x0147LoadCommands:148  - cmd:             LC_SEGMENT_64149    cmdsize:         232150    segname:         __TEXT151    vmaddr:          0152    vmsize:          8192153    fileoff:         0154    filesize:        8192155    maxprot:         5156    initprot:        5157    nsects:          2158    flags:           0159    Sections:160      - sectname:        __text161        segname:         __TEXT162        addr:            0x1140163        size:            0164        offset:          0x1140165        align:           0166        reloff:          0x0167        nreloc:          0168        flags:           0x80000000169        reserved1:       0x0170        reserved2:       0x0171        reserved3:       0x0172        content:         ''173      - sectname:        __cstring174        segname:         __TEXT175        addr:            0x1140176        size:            4177        offset:          0x1140178        align:           0179        reloff:          0x0180        nreloc:          0181        flags:           0x2182        reserved1:       0x0183        reserved2:       0x0184        reserved3:       0x0185        content:         466F6F00186  - cmd:             LC_SEGMENT_64187    cmdsize:         232188    segname:         __DATA_CONST189    vmaddr:          8192190    vmsize:          4096191    fileoff:         8192192    filesize:        4096193    maxprot:         3194    initprot:        3195    nsects:          2196    flags:           16197    Sections:198      - sectname:        __objc_classlist199        segname:         __DATA_CONST200        addr:            0x2000201        size:            8202        offset:          0x2000203        align:           3204        reloff:          0x0205        nreloc:          0206        flags:           0x10000000207        reserved1:       0x0208        reserved2:       0x0209        reserved3:       0x0210        content:         B830000000000000211      - sectname:        __objc_imageinfo212        segname:         __DATA_CONST213        addr:            0x2008214        size:            8215        offset:          0x2008216        align:           0217        reloff:          0x0218        nreloc:          0219        flags:           0x0220        reserved1:       0x0221        reserved2:       0x0222        reserved3:       0x0223        content:         '0000000040000000'224  - cmd:             LC_SEGMENT_64225    cmdsize:         312226    segname:         __DATA227    vmaddr:          12288228    vmsize:          4096229    fileoff:         12288230    filesize:        4096231    maxprot:         3232    initprot:        3233    nsects:          3234    flags:           0235    Sections:236      - sectname:        __objc_const237        segname:         __DATA238        addr:            0x3000239        size:            144240        offset:          0x3000241        align:           3242        reloff:          0x0243        nreloc:          0244        flags:           0x0245        reserved1:       0x0246        reserved2:       0x0247        reserved3:       0x0248        content:         '010000002800000028000000000000000000000000000000401100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000008000000000000000000000000000000401100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'249      - sectname:        __objc_data250        segname:         __DATA251        addr:            0x3090252        size:            80253        offset:          0x3090254        align:           3255        reloff:          0x0256        nreloc:          0257        flags:           0x0258        reserved1:       0x0259        reserved2:       0x0260        reserved3:       0x0261        content:         '0000000000000000000000000000000000000000000000000000000000000000003000000000000090300000000000000000000000000000000000000000000000000000000000004830000000000000'262      - sectname:        __common263        segname:         __DATA264        addr:            0x30E0265        size:            24266        offset:          0x0267        align:           2268        reloff:          0x0269        nreloc:          0270        flags:           0x1271        reserved1:       0x0272        reserved2:       0x0273        reserved3:       0x0274  - cmd:             LC_SEGMENT_64275    cmdsize:         72276    segname:         __LINKEDIT277    vmaddr:          16384278    vmsize:          824279    fileoff:         16384280    filesize:        824281    maxprot:         1282    initprot:        1283    nsects:          0284    flags:           0285  - cmd:             LC_DYLD_INFO_ONLY286    cmdsize:         48287    rebase_off:      16384288    rebase_size:     16289    bind_off:        16400290    bind_size:       104291    weak_bind_off:   0292    weak_bind_size:  0293    lazy_bind_off:   0294    lazy_bind_size:  0295    export_off:      16504296    export_size:     152297  - cmd:             LC_SYMTAB298    cmdsize:         24299    symoff:          16664300    nsyms:           14301    stroff:          16888302    strsize:         320303  - cmd:             LC_DYSYMTAB304    cmdsize:         80305    ilocalsym:       0306    nlocalsym:       2307    iextdefsym:      2308    nextdefsym:      8309    iundefsym:       10310    nundefsym:       4311    tocoff:          0312    ntoc:            0313    modtaboff:       0314    nmodtab:         0315    extrefsymoff:    0316    nextrefsyms:     0317    indirectsymoff:  0318    nindirectsyms:   0319    extreloff:       0320    nextrel:         0321    locreloff:       0322    nlocrel:         0323  - cmd:             LC_ID_DYLIB324    cmdsize:         112325    dylib:326      name:            24327      timestamp:       0328      current_version: 65536329      compatibility_version: 65536330    Content:         '/System/Library/Frameworks/Availability.framework/Versions/A/Availability'331    ZeroPadBytes:    7332  - cmd:             LC_UUID333    cmdsize:         24334    uuid:            4C4C4470-5555-3144-A142-4EE44DA08D2F335  - cmd:             LC_BUILD_VERSION336    cmdsize:         32337    platform:        1338    minos:           851968339    sdk:             983040340    ntools:          1341    Tools:342      - tool:            4343        version:         1245184344  - cmd:             LC_LOAD_DYLIB345    cmdsize:         56346    dylib:347      name:            24348      timestamp:       0349      current_version: 14942208350      compatibility_version: 65536351    Content:         '/usr/lib/libobjc.A.dylib'352    ZeroPadBytes:    8353  - cmd:             LC_LOAD_DYLIB354    cmdsize:         56355    dylib:356      name:            24357      timestamp:       0358      current_version: 88473600359      compatibility_version: 65536360    Content:         '/usr/lib/libSystem.B.dylib'361    ZeroPadBytes:    6362  - cmd:             LC_FUNCTION_STARTS363    cmdsize:         16364    dataoff:         16656365    datasize:        8366  - cmd:             LC_DATA_IN_CODE367    cmdsize:         16368    dataoff:         16664369    datasize:        0370LinkEditData:371  RebaseOpcodes:372    - Opcode:          REBASE_OPCODE_SET_TYPE_IMM373      Imm:             1374    - Opcode:          REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB375      Imm:             1376      ExtraData:       [ 0x0 ]377    - Opcode:          REBASE_OPCODE_DO_REBASE_IMM_TIMES378      Imm:             1379    - Opcode:          REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB380      Imm:             2381      ExtraData:       [ 0x18 ]382    - Opcode:          REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB383      Imm:             0384      ExtraData:       [ 0x2, 0x40 ]385    - Opcode:          REBASE_OPCODE_ADD_ADDR_IMM_SCALED386      Imm:             1387    - Opcode:          REBASE_OPCODE_DO_REBASE_IMM_TIMES388      Imm:             2389    - Opcode:          REBASE_OPCODE_ADD_ADDR_IMM_SCALED390      Imm:             3391    - Opcode:          REBASE_OPCODE_DO_REBASE_IMM_TIMES392      Imm:             1393    - Opcode:          REBASE_OPCODE_DONE394      Imm:             0395  BindOpcodes:396    - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM397      Imm:             0398      Symbol:          '_OBJC_METACLASS_$_NSObject'399    - Opcode:          BIND_OPCODE_SET_TYPE_IMM400      Imm:             1401      Symbol:          ''402    - Opcode:          BIND_OPCODE_SET_DYLIB_ORDINAL_IMM403      Imm:             1404      Symbol:          ''405    - Opcode:          BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB406      Imm:             2407      ULEBExtraData:   [ 0x90 ]408      Symbol:          ''409    - Opcode:          BIND_OPCODE_DO_BIND410      Imm:             0411      Symbol:          ''412    - Opcode:          BIND_OPCODE_DO_BIND413      Imm:             0414      Symbol:          ''415    - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM416      Imm:             0417      Symbol:          __objc_empty_cache418    - Opcode:          BIND_OPCODE_SET_TYPE_IMM419      Imm:             1420      Symbol:          ''421    - Opcode:          BIND_OPCODE_DO_BIND422      Imm:             0423      Symbol:          ''424    - Opcode:          BIND_OPCODE_ADD_ADDR_ULEB425      Imm:             0426      ULEBExtraData:   [ 0x20 ]427      Symbol:          ''428    - Opcode:          BIND_OPCODE_DO_BIND429      Imm:             0430      Symbol:          ''431    - Opcode:          BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM432      Imm:             0433      Symbol:          '_OBJC_CLASS_$_NSObject'434    - Opcode:          BIND_OPCODE_SET_TYPE_IMM435      Imm:             1436      Symbol:          ''437    - Opcode:          BIND_OPCODE_ADD_ADDR_ULEB438      Imm:             0439      ULEBExtraData:   [ 0xFFFFFFFFFFFFFFF0 ]440      Symbol:          ''441    - Opcode:          BIND_OPCODE_DO_BIND442      Imm:             0443      Symbol:          ''444    - Opcode:          BIND_OPCODE_DONE445      Imm:             0446      Symbol:          ''447  ExportTrie:448    TerminalSize:    0449    NodeOffset:      0450    Name:            ''451    Flags:           0x0452    Address:         0x0453    Other:           0x0454    ImportName:      ''455    Children:456      - TerminalSize:    0457        NodeOffset:      5458        Name:            _459        Flags:           0x0460        Address:         0x0461        Other:           0x0462        ImportName:      ''463        Children:464          - TerminalSize:    0465            NodeOffset:      17466            Name:            OBJC_467            Flags:           0x0468            Address:         0x0469            Other:           0x0470            ImportName:      ''471            Children:472              - TerminalSize:    3473                NodeOffset:      49474                Name:            'METACLASS_$_Foo'475                Flags:           0x0476                Address:         0x3090477                Other:           0x0478                ImportName:      ''479              - TerminalSize:    3480                NodeOffset:      54481                Name:            'CLASS_$_Foo'482                Flags:           0x0483                Address:         0x30B8484                Other:           0x0485                ImportName:      ''486          - TerminalSize:    0487            NodeOffset:      59488            Name:            p489            Flags:           0x0490            Address:         0x0491            Other:           0x0492            ImportName:      ''493            Children:494              - TerminalSize:    3495                NodeOffset:      104496                Name:            rivateGlobalVariable497                Flags:           0x0498                Address:         0x30E0499                Other:           0x0500                ImportName:      ''501              - TerminalSize:    3502                NodeOffset:      109503                Name:            ublicGlobalVariable504                Flags:           0x0505                Address:         0x30E4506                Other:           0x0507                ImportName:      ''508                Children:509                  - TerminalSize:    3510                    NodeOffset:      130511                    Name:            '4'512                    Flags:           0x0513                    Address:         0x30F0514                    Other:           0x0515                    ImportName:      ''516                  - TerminalSize:    3517                    NodeOffset:      135518                    Name:            '3'519                    Flags:           0x0520                    Address:         0x30EC521                    Other:           0x0522                    ImportName:      ''523                  - TerminalSize:    3524                    NodeOffset:      140525                    Name:            '2'526                    Flags:           0x0527                    Address:         0x30E8528                    Other:           0x0529                    ImportName:      ''530                  - TerminalSize:    3531                    NodeOffset:      145532                    Name:            '6'533                    Flags:           0x0534                    Address:         0x30F4535                    Other:           0x0536                    ImportName:      ''537  NameList:538    - n_strx:          2539      n_type:          0xE540      n_sect:          5541      n_desc:          0542      n_value:         12288543    - n_strx:          28544      n_type:          0xE545      n_sect:          5546      n_desc:          0547      n_value:         12360548    - n_strx:          50549      n_type:          0xF550      n_sect:          7551      n_desc:          0552      n_value:         12512553    - n_strx:          73554      n_type:          0xF555      n_sect:          7556      n_desc:          0557      n_value:         12516558    - n_strx:          95559      n_type:          0xF560      n_sect:          7561      n_desc:          0562      n_value:         12520563    - n_strx:          118564      n_type:          0xF565      n_sect:          7566      n_desc:          0567      n_value:         12524568    - n_strx:          141569      n_type:          0xF570      n_sect:          7571      n_desc:          0572      n_value:         12528573    - n_strx:          164574      n_type:          0xF575      n_sect:          7576      n_desc:          0577      n_value:         12532578    - n_strx:          187579      n_type:          0xF580      n_sect:          6581      n_desc:          0582      n_value:         12432583    - n_strx:          209584      n_type:          0xF585      n_sect:          6586      n_desc:          0587      n_value:         12472588    - n_strx:          227589      n_type:          0x1590      n_sect:          0591      n_desc:          256592      n_value:         0593    - n_strx:          250594      n_type:          0x1595      n_sect:          0596      n_desc:          256597      n_value:         0598    - n_strx:          277599      n_type:          0x1600      n_sect:          0601      n_desc:          256602      n_value:         0603    - n_strx:          296604      n_type:          0x1605      n_sect:          0606      n_desc:          512607      n_value:         0608  StringTable:609    - ' '610    - '__OBJC_METACLASS_RO_$_Foo'611    - '__OBJC_CLASS_RO_$_Foo'612    - _privateGlobalVariable613    - _publicGlobalVariable614    - _publicGlobalVariable2615    - _publicGlobalVariable3616    - _publicGlobalVariable4617    - _publicGlobalVariable6618    - '_OBJC_METACLASS_$_Foo'619    - '_OBJC_CLASS_$_Foo'620    - '_OBJC_CLASS_$_NSObject'621    - '_OBJC_METACLASS_$_NSObject'622    - __objc_empty_cache623    - dyld_stub_binder624    - ''625    - ''626    - ''627    - ''628    - ''629    - ''630    - ''631...632