; RUN: rm -rf %t ; RUN: split-file %s %t ; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json ; RUN: yaml2obj %t/flags.yaml -o %t/SymbolFlags ; RUN: not clang-installapi -x c++ --target=arm64-apple-macos13 \ ; RUN: -install_name /System/Library/Frameworks/SymbolFlags.framework/Versions/A/SymbolFlags \ ; RUN: -current_version 1 -compatibility_version 1 \ ; RUN: %t/inputs.json -o output.tbd \ ; RUN: --verify-against=%t/SymbolFlags \ ; RUN: --verify-mode=ErrorsOnly 2>&1 | FileCheck %s ; CHECK: project.h:2:21: error: declaration '(tlv) val' is thread local, but symbol is not in dynamic library ; CHECK-NEXT: extern __thread int val; ; CHECK: project.h:3:13: error: dynamic library symbol '(weak-def) __Z12my_weak_funcv' is weak defined, but its declaration is not ; CHECK-NEXT: extern void my_weak_func(); ;--- project.h extern void my_func(); extern __thread int val; extern void my_weak_func(); ;--- inputs.json.in { "headers": [ { "path" : "DSTROOT/project.h", "type" : "project" } ], "version": "3" } ;--- flags.yaml --- !mach-o FileHeader: magic: 0xFEEDFACF cputype: 0x100000C cpusubtype: 0x0 filetype: 0x6 ncmds: 14 sizeofcmds: 912 flags: 0x118085 reserved: 0x0 LoadCommands: - cmd: LC_SEGMENT_64 cmdsize: 232 segname: __TEXT vmaddr: 0 vmsize: 16384 fileoff: 0 filesize: 16384 maxprot: 5 initprot: 5 nsects: 2 flags: 0 Sections: - sectname: __text segname: __TEXT addr: 0xFB0 size: 8 offset: 0xFB0 align: 2 reloff: 0x0 nreloc: 0 flags: 0x80000400 reserved1: 0x0 reserved2: 0x0 reserved3: 0x0 content: C0035FD6C0035FD6 - sectname: __unwind_info segname: __TEXT addr: 0xFB8 size: 4152 offset: 0xFB8 align: 2 reloff: 0x0 nreloc: 0 flags: 0x0 reserved1: 0x0 reserved2: 0x0 reserved3: 0x0 content: 010000001C000000010000002000000000000000200000000200000000000002B00F00003800000038000000B80F00000000000038000000030000000C0001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - cmd: LC_SEGMENT_64 cmdsize: 152 segname: __DATA vmaddr: 16384 vmsize: 16384 fileoff: 16384 filesize: 0 maxprot: 3 initprot: 3 nsects: 1 flags: 0 Sections: - sectname: __common segname: __DATA addr: 0x4000 size: 4 offset: 0x0 align: 2 reloff: 0x0 nreloc: 0 flags: 0x1 reserved1: 0x0 reserved2: 0x0 reserved3: 0x0 - cmd: LC_SEGMENT_64 cmdsize: 72 segname: __LINKEDIT vmaddr: 32768 vmsize: 480 fileoff: 16384 filesize: 480 maxprot: 1 initprot: 1 nsects: 0 flags: 0 - cmd: LC_DYLD_INFO_ONLY cmdsize: 48 rebase_off: 0 rebase_size: 0 bind_off: 0 bind_size: 0 weak_bind_off: 0 weak_bind_size: 0 lazy_bind_off: 0 lazy_bind_size: 0 export_off: 16384 export_size: 64 - cmd: LC_SYMTAB cmdsize: 24 symoff: 16456 nsyms: 4 stroff: 16520 strsize: 56 - cmd: LC_DYSYMTAB cmdsize: 80 ilocalsym: 0 nlocalsym: 0 iextdefsym: 0 nextdefsym: 3 iundefsym: 3 nundefsym: 1 tocoff: 0 ntoc: 0 modtaboff: 0 nmodtab: 0 extrefsymoff: 0 nextrefsyms: 0 indirectsymoff: 0 nindirectsyms: 0 extreloff: 0 nextrel: 0 locreloff: 0 nlocrel: 0 - cmd: LC_ID_DYLIB cmdsize: 96 dylib: name: 24 timestamp: 0 current_version: 65536 compatibility_version: 65536 Content: '/System/Library/Frameworks/SymbolFlags.framework/Versions/A/SymbolFlags' ZeroPadBytes: 1 - cmd: LC_UUID cmdsize: 24 uuid: 4C4C4436-5555-3144-A1AF-5D3063ACFC99 - cmd: LC_BUILD_VERSION cmdsize: 32 platform: 1 minos: 851968 sdk: 983040 ntools: 1 Tools: - tool: 4 version: 1245184 - cmd: LC_LOAD_DYLIB cmdsize: 48 dylib: name: 24 timestamp: 0 current_version: 117985024 compatibility_version: 65536 Content: '/usr/lib/libc++.1.dylib' ZeroPadBytes: 1 - cmd: LC_LOAD_DYLIB cmdsize: 56 dylib: name: 24 timestamp: 0 current_version: 88473600 compatibility_version: 65536 Content: '/usr/lib/libSystem.B.dylib' ZeroPadBytes: 6 - cmd: LC_FUNCTION_STARTS cmdsize: 16 dataoff: 16448 datasize: 8 - cmd: LC_DATA_IN_CODE cmdsize: 16 dataoff: 16456 datasize: 0 - cmd: LC_CODE_SIGNATURE cmdsize: 16 dataoff: 16576 datasize: 288 LinkEditData: ExportTrie: TerminalSize: 0 NodeOffset: 0 Name: '' Flags: 0x0 Address: 0x0 Other: 0x0 ImportName: '' Children: - TerminalSize: 0 NodeOffset: 5 Name: _ Flags: 0x0 Address: 0x0 Other: 0x0 ImportName: '' Children: - TerminalSize: 4 NodeOffset: 16 Name: val Flags: 0x0 Address: 0x4000 Other: 0x0 ImportName: '' - TerminalSize: 0 NodeOffset: 22 Name: _Z Flags: 0x0 Address: 0x0 Other: 0x0 ImportName: '' Children: - TerminalSize: 3 NodeOffset: 52 Name: 7my_funcv Flags: 0x0 Address: 0xFB0 Other: 0x0 ImportName: '' - TerminalSize: 3 NodeOffset: 57 Name: 12my_weak_funcv Flags: 0x4 Address: 0xFB4 Other: 0x0 ImportName: '' NameList: - n_strx: 2 n_type: 0xF n_sect: 1 n_desc: 0 n_value: 4016 - n_strx: 15 n_type: 0xF n_sect: 1 n_desc: 128 n_value: 4020 - n_strx: 34 n_type: 0xF n_sect: 3 n_desc: 0 n_value: 16384 - n_strx: 39 n_type: 0x1 n_sect: 0 n_desc: 512 n_value: 0 StringTable: - ' ' - __Z7my_funcv - __Z12my_weak_funcv - _val - dyld_stub_binder FunctionStarts: [ 0xFB0, 0xFB4 ] ... /// Generated from: // clang++ -mtargetos=macosx13 -arch arm64 flags.cpp // flags.cpp: // __attribute__((visibility("default"))) void my_func() {} // __attribute__((weak)) void my_weak_func() {} // int val = 0;