291 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/flags.yaml -o %t/SymbolFlags6 7; RUN: not clang-installapi -x c++ --target=arm64-apple-macos13 \8; RUN: -install_name /System/Library/Frameworks/SymbolFlags.framework/Versions/A/SymbolFlags \9; RUN: -current_version 1 -compatibility_version 1 \10; RUN: %t/inputs.json -o output.tbd \11; RUN: --verify-against=%t/SymbolFlags \12; RUN: --verify-mode=ErrorsOnly 2>&1 | FileCheck %s13 14; CHECK: project.h:2:21: error: declaration '(tlv) val' is thread local, but symbol is not in dynamic library15; CHECK-NEXT: extern __thread int val;16; CHECK: project.h:3:13: error: dynamic library symbol '(weak-def) __Z12my_weak_funcv' is weak defined, but its declaration is not17; CHECK-NEXT: extern void my_weak_func();18 19;--- project.h20extern void my_func();21extern __thread int val;22extern void my_weak_func();23 24;--- inputs.json.in25{26 "headers": [ {27 "path" : "DSTROOT/project.h",28 "type" : "project"29 }30 ],31 "version": "3"32}33 34;--- flags.yaml35--- !mach-o36FileHeader:37 magic: 0xFEEDFACF38 cputype: 0x100000C39 cpusubtype: 0x040 filetype: 0x641 ncmds: 1442 sizeofcmds: 91243 flags: 0x11808544 reserved: 0x045LoadCommands:46 - cmd: LC_SEGMENT_6447 cmdsize: 23248 segname: __TEXT49 vmaddr: 050 vmsize: 1638451 fileoff: 052 filesize: 1638453 maxprot: 554 initprot: 555 nsects: 256 flags: 057 Sections:58 - sectname: __text59 segname: __TEXT60 addr: 0xFB061 size: 862 offset: 0xFB063 align: 264 reloff: 0x065 nreloc: 066 flags: 0x8000040067 reserved1: 0x068 reserved2: 0x069 reserved3: 0x070 content: C0035FD6C0035FD671 - sectname: __unwind_info72 segname: __TEXT73 addr: 0xFB874 size: 415275 offset: 0xFB876 align: 277 reloff: 0x078 nreloc: 079 flags: 0x080 reserved1: 0x081 reserved2: 0x082 reserved3: 0x083 content: 010000001C000000010000002000000000000000200000000200000000000002B00F00003800000038000000B80F00000000000038000000030000000C000100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000084 - cmd: LC_SEGMENT_6485 cmdsize: 15286 segname: __DATA87 vmaddr: 1638488 vmsize: 1638489 fileoff: 1638490 filesize: 091 maxprot: 392 initprot: 393 nsects: 194 flags: 095 Sections:96 - sectname: __common97 segname: __DATA98 addr: 0x400099 size: 4100 offset: 0x0101 align: 2102 reloff: 0x0103 nreloc: 0104 flags: 0x1105 reserved1: 0x0106 reserved2: 0x0107 reserved3: 0x0108 - cmd: LC_SEGMENT_64109 cmdsize: 72110 segname: __LINKEDIT111 vmaddr: 32768112 vmsize: 480113 fileoff: 16384114 filesize: 480115 maxprot: 1116 initprot: 1117 nsects: 0118 flags: 0119 - cmd: LC_DYLD_INFO_ONLY120 cmdsize: 48121 rebase_off: 0122 rebase_size: 0123 bind_off: 0124 bind_size: 0125 weak_bind_off: 0126 weak_bind_size: 0127 lazy_bind_off: 0128 lazy_bind_size: 0129 export_off: 16384130 export_size: 64131 - cmd: LC_SYMTAB132 cmdsize: 24133 symoff: 16456134 nsyms: 4135 stroff: 16520136 strsize: 56137 - cmd: LC_DYSYMTAB138 cmdsize: 80139 ilocalsym: 0140 nlocalsym: 0141 iextdefsym: 0142 nextdefsym: 3143 iundefsym: 3144 nundefsym: 1145 tocoff: 0146 ntoc: 0147 modtaboff: 0148 nmodtab: 0149 extrefsymoff: 0150 nextrefsyms: 0151 indirectsymoff: 0152 nindirectsyms: 0153 extreloff: 0154 nextrel: 0155 locreloff: 0156 nlocrel: 0157 - cmd: LC_ID_DYLIB158 cmdsize: 96159 dylib:160 name: 24161 timestamp: 0162 current_version: 65536163 compatibility_version: 65536164 Content: '/System/Library/Frameworks/SymbolFlags.framework/Versions/A/SymbolFlags'165 ZeroPadBytes: 1166 - cmd: LC_UUID167 cmdsize: 24168 uuid: 4C4C4436-5555-3144-A1AF-5D3063ACFC99169 - cmd: LC_BUILD_VERSION170 cmdsize: 32171 platform: 1172 minos: 851968173 sdk: 983040174 ntools: 1175 Tools:176 - tool: 4177 version: 1245184178 - cmd: LC_LOAD_DYLIB179 cmdsize: 48180 dylib:181 name: 24182 timestamp: 0183 current_version: 117985024184 compatibility_version: 65536185 Content: '/usr/lib/libc++.1.dylib'186 ZeroPadBytes: 1187 - cmd: LC_LOAD_DYLIB188 cmdsize: 56189 dylib:190 name: 24191 timestamp: 0192 current_version: 88473600193 compatibility_version: 65536194 Content: '/usr/lib/libSystem.B.dylib'195 ZeroPadBytes: 6196 - cmd: LC_FUNCTION_STARTS197 cmdsize: 16198 dataoff: 16448199 datasize: 8200 - cmd: LC_DATA_IN_CODE201 cmdsize: 16202 dataoff: 16456203 datasize: 0204 - cmd: LC_CODE_SIGNATURE205 cmdsize: 16206 dataoff: 16576207 datasize: 288208LinkEditData:209 ExportTrie:210 TerminalSize: 0211 NodeOffset: 0212 Name: ''213 Flags: 0x0214 Address: 0x0215 Other: 0x0216 ImportName: ''217 Children:218 - TerminalSize: 0219 NodeOffset: 5220 Name: _221 Flags: 0x0222 Address: 0x0223 Other: 0x0224 ImportName: ''225 Children:226 - TerminalSize: 4227 NodeOffset: 16228 Name: val229 Flags: 0x0230 Address: 0x4000231 Other: 0x0232 ImportName: ''233 - TerminalSize: 0234 NodeOffset: 22235 Name: _Z236 Flags: 0x0237 Address: 0x0238 Other: 0x0239 ImportName: ''240 Children:241 - TerminalSize: 3242 NodeOffset: 52243 Name: 7my_funcv244 Flags: 0x0245 Address: 0xFB0246 Other: 0x0247 ImportName: ''248 - TerminalSize: 3249 NodeOffset: 57250 Name: 12my_weak_funcv251 Flags: 0x4252 Address: 0xFB4253 Other: 0x0254 ImportName: ''255 NameList:256 - n_strx: 2257 n_type: 0xF258 n_sect: 1259 n_desc: 0260 n_value: 4016261 - n_strx: 15262 n_type: 0xF263 n_sect: 1264 n_desc: 128265 n_value: 4020266 - n_strx: 34267 n_type: 0xF268 n_sect: 3269 n_desc: 0270 n_value: 16384271 - n_strx: 39272 n_type: 0x1273 n_sect: 0274 n_desc: 512275 n_value: 0276 StringTable:277 - ' '278 - __Z7my_funcv279 - __Z12my_weak_funcv280 - _val281 - dyld_stub_binder282 FunctionStarts: [ 0xFB0, 0xFB4 ]283...284 285/// Generated from: 286// clang++ -mtargetos=macosx13 -arch arm64 flags.cpp287// flags.cpp: 288// __attribute__((visibility("default"))) void my_func() {}289// __attribute__((weak)) void my_weak_func() {}290// int val = 0;291