1; RUN: rm -rf %t 2; RUN: split-file %s %t 3; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json 4 5; RUN: yaml2obj %t/flags.yaml -o %t/SymbolFlags 6 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 %s 13 14; CHECK: project.h:2:21: error: declaration '(tlv) val' is thread local, but symbol is not in dynamic library 15; 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 not 17; CHECK-NEXT: extern void my_weak_func(); 18 19;--- project.h 20extern void my_func(); 21extern __thread int val; 22extern void my_weak_func(); 23 24;--- inputs.json.in 25{ 26 "headers": [ { 27 "path" : "DSTROOT/project.h", 28 "type" : "project" 29 } 30 ], 31 "version": "3" 32} 33 34;--- flags.yaml 35--- !mach-o 36FileHeader: 37 magic: 0xFEEDFACF 38 cputype: 0x100000C 39 cpusubtype: 0x0 40 filetype: 0x6 41 ncmds: 14 42 sizeofcmds: 912 43 flags: 0x118085 44 reserved: 0x0 45LoadCommands: 46 - cmd: LC_SEGMENT_64 47 cmdsize: 232 48 segname: __TEXT 49 vmaddr: 0 50 vmsize: 16384 51 fileoff: 0 52 filesize: 16384 53 maxprot: 5 54 initprot: 5 55 nsects: 2 56 flags: 0 57 Sections: 58 - sectname: __text 59 segname: __TEXT 60 addr: 0xFB0 61 size: 8 62 offset: 0xFB0 63 align: 2 64 reloff: 0x0 65 nreloc: 0 66 flags: 0x80000400 67 reserved1: 0x0 68 reserved2: 0x0 69 reserved3: 0x0 70 content: C0035FD6C0035FD6 71 - sectname: __unwind_info 72 segname: __TEXT 73 addr: 0xFB8 74 size: 4152 75 offset: 0xFB8 76 align: 2 77 reloff: 0x0 78 nreloc: 0 79 flags: 0x0 80 reserved1: 0x0 81 reserved2: 0x0 82 reserved3: 0x0 83 content: 010000001C000000010000002000000000000000200000000200000000000002B00F00003800000038000000B80F00000000000038000000030000000C0001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 84 - cmd: LC_SEGMENT_64 85 cmdsize: 152 86 segname: __DATA 87 vmaddr: 16384 88 vmsize: 16384 89 fileoff: 16384 90 filesize: 0 91 maxprot: 3 92 initprot: 3 93 nsects: 1 94 flags: 0 95 Sections: 96 - sectname: __common 97 segname: __DATA 98 addr: 0x4000 99 size: 4 100 offset: 0x0 101 align: 2 102 reloff: 0x0 103 nreloc: 0 104 flags: 0x1 105 reserved1: 0x0 106 reserved2: 0x0 107 reserved3: 0x0 108 - cmd: LC_SEGMENT_64 109 cmdsize: 72 110 segname: __LINKEDIT 111 vmaddr: 32768 112 vmsize: 480 113 fileoff: 16384 114 filesize: 480 115 maxprot: 1 116 initprot: 1 117 nsects: 0 118 flags: 0 119 - cmd: LC_DYLD_INFO_ONLY 120 cmdsize: 48 121 rebase_off: 0 122 rebase_size: 0 123 bind_off: 0 124 bind_size: 0 125 weak_bind_off: 0 126 weak_bind_size: 0 127 lazy_bind_off: 0 128 lazy_bind_size: 0 129 export_off: 16384 130 export_size: 64 131 - cmd: LC_SYMTAB 132 cmdsize: 24 133 symoff: 16456 134 nsyms: 4 135 stroff: 16520 136 strsize: 56 137 - cmd: LC_DYSYMTAB 138 cmdsize: 80 139 ilocalsym: 0 140 nlocalsym: 0 141 iextdefsym: 0 142 nextdefsym: 3 143 iundefsym: 3 144 nundefsym: 1 145 tocoff: 0 146 ntoc: 0 147 modtaboff: 0 148 nmodtab: 0 149 extrefsymoff: 0 150 nextrefsyms: 0 151 indirectsymoff: 0 152 nindirectsyms: 0 153 extreloff: 0 154 nextrel: 0 155 locreloff: 0 156 nlocrel: 0 157 - cmd: LC_ID_DYLIB 158 cmdsize: 96 159 dylib: 160 name: 24 161 timestamp: 0 162 current_version: 65536 163 compatibility_version: 65536 164 Content: '/System/Library/Frameworks/SymbolFlags.framework/Versions/A/SymbolFlags' 165 ZeroPadBytes: 1 166 - cmd: LC_UUID 167 cmdsize: 24 168 uuid: 4C4C4436-5555-3144-A1AF-5D3063ACFC99 169 - cmd: LC_BUILD_VERSION 170 cmdsize: 32 171 platform: 1 172 minos: 851968 173 sdk: 983040 174 ntools: 1 175 Tools: 176 - tool: 4 177 version: 1245184 178 - cmd: LC_LOAD_DYLIB 179 cmdsize: 48 180 dylib: 181 name: 24 182 timestamp: 0 183 current_version: 117985024 184 compatibility_version: 65536 185 Content: '/usr/lib/libc++.1.dylib' 186 ZeroPadBytes: 1 187 - cmd: LC_LOAD_DYLIB 188 cmdsize: 56 189 dylib: 190 name: 24 191 timestamp: 0 192 current_version: 88473600 193 compatibility_version: 65536 194 Content: '/usr/lib/libSystem.B.dylib' 195 ZeroPadBytes: 6 196 - cmd: LC_FUNCTION_STARTS 197 cmdsize: 16 198 dataoff: 16448 199 datasize: 8 200 - cmd: LC_DATA_IN_CODE 201 cmdsize: 16 202 dataoff: 16456 203 datasize: 0 204 - cmd: LC_CODE_SIGNATURE 205 cmdsize: 16 206 dataoff: 16576 207 datasize: 288 208LinkEditData: 209 ExportTrie: 210 TerminalSize: 0 211 NodeOffset: 0 212 Name: '' 213 Flags: 0x0 214 Address: 0x0 215 Other: 0x0 216 ImportName: '' 217 Children: 218 - TerminalSize: 0 219 NodeOffset: 5 220 Name: _ 221 Flags: 0x0 222 Address: 0x0 223 Other: 0x0 224 ImportName: '' 225 Children: 226 - TerminalSize: 4 227 NodeOffset: 16 228 Name: val 229 Flags: 0x0 230 Address: 0x4000 231 Other: 0x0 232 ImportName: '' 233 - TerminalSize: 0 234 NodeOffset: 22 235 Name: _Z 236 Flags: 0x0 237 Address: 0x0 238 Other: 0x0 239 ImportName: '' 240 Children: 241 - TerminalSize: 3 242 NodeOffset: 52 243 Name: 7my_funcv 244 Flags: 0x0 245 Address: 0xFB0 246 Other: 0x0 247 ImportName: '' 248 - TerminalSize: 3 249 NodeOffset: 57 250 Name: 12my_weak_funcv 251 Flags: 0x4 252 Address: 0xFB4 253 Other: 0x0 254 ImportName: '' 255 NameList: 256 - n_strx: 2 257 n_type: 0xF 258 n_sect: 1 259 n_desc: 0 260 n_value: 4016 261 - n_strx: 15 262 n_type: 0xF 263 n_sect: 1 264 n_desc: 128 265 n_value: 4020 266 - n_strx: 34 267 n_type: 0xF 268 n_sect: 3 269 n_desc: 0 270 n_value: 16384 271 - n_strx: 39 272 n_type: 0x1 273 n_sect: 0 274 n_desc: 512 275 n_value: 0 276 StringTable: 277 - ' ' 278 - __Z7my_funcv 279 - __Z12my_weak_funcv 280 - _val 281 - dyld_stub_binder 282 FunctionStarts: [ 0xFB0, 0xFB4 ] 283... 284 285/// Generated from: 286// clang++ -mtargetos=macosx13 -arch arm64 flags.cpp 287// flags.cpp: 288// __attribute__((visibility("default"))) void my_func() {} 289// __attribute__((weak)) void my_weak_func() {} 290// int val = 0; 291