465 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/Mismatch.yaml -o %t/System/Library/Frameworks/MismatchCpp.framework/MismatchCpp6 7// RUN: not clang-installapi --target=arm64-apple-macos13 -x objective-c++ \8// RUN: -F %t/System/Library/Frameworks \9// RUN: -install_name /System/Library/Frameworks/MismatchCpp.framework/Versions/A/MismatchCpp \10// RUN: -current_version 1 -compatibility_version 1 %t/inputs.json \11// RUN: --verify-against=%t/System/Library/Frameworks/MismatchCpp.framework/MismatchCpp \12// RUN: --verify-mode=Pedantic -o %t/output.tbd --demangle 2> %t/errors.log13// RUN: FileCheck -input-file %t/errors.log %s 14 15CHECK: warning: violations found for arm64-apple-macos1316CHECK: CPP.h:5:7: error: declaration has external linkage, but symbol has internal linkage in dynamic library 'vtable for Bar'17CHECK-NEXT: class Bar : Foo {18CHECK-NEXT: ^19CHECK-NEXT: CPP.h:5:7: error: declaration has external linkage, but symbol has internal linkage in dynamic library 'typeinfo for Bar'20CHECK-NEXT: CPP.h:5:7: error: declaration has external linkage, but symbol has internal linkage in dynamic library 'typeinfo name for Bar'21CHECK-NEXT: CPP.h:6:7: error: dynamic library symbol '(weak-def) Bar::init()' is weak defined, but its declaration is not22CHECK-NEXT: int init();23CHECK-NEXT: ^24CHECK-NEXT: warning: violations found for arm6425CHECK-NEXT: error: no declaration found for exported symbol 'int foo<unsigned int>(unsigned int)' in dynamic library26 27//--- inputs.json.in28{29 "headers": [ {30 "path" : "DSTROOT/System/Library/Frameworks/MismatchCpp.framework/Headers/CPP.h",31 "type" : "public"32 }33 ],34 "version": "3"35}36 37//--- System/Library/Frameworks/MismatchCpp.framework/Headers/CPP.h38class Foo {39 virtual int init() = 0;40};41 42class Bar : Foo { 43 int init();44};45 46/// Created from: 47// With LD flags: -exported_symbol,"__ZN3Bar4initEv" -exported_symbol,"__Z3fooIjEiT_"48// class Foo { virtual int init() = 0;};49// 50// class Bar : Foo {int init() { return 1;}};51// Bar bar;52// 53// template <typename T> int foo(T val) { return 1; }54// template <> int foo(unsigned val) { return 1; }55 56//--- Mismatch.yaml57--- !mach-o58FileHeader:59 magic: 0xFEEDFACF60 cputype: 0x100000C61 cpusubtype: 0x062 filetype: 0x663 ncmds: 1564 sizeofcmds: 122465 flags: 0x11808566 reserved: 0x067LoadCommands:68 - cmd: LC_SEGMENT_6469 cmdsize: 31270 segname: __TEXT71 vmaddr: 072 vmsize: 1638473 fileoff: 074 filesize: 1638475 maxprot: 576 initprot: 577 nsects: 378 flags: 079 Sections:80 - sectname: __text81 segname: __TEXT82 addr: 0x10E883 size: 1684 offset: 0x10E885 align: 286 reloff: 0x087 nreloc: 088 flags: 0x8000040089 reserved1: 0x090 reserved2: 0x091 reserved3: 0x092 content: 20008052C0035FD620008052C0035FD693 - sectname: __const94 segname: __TEXT95 addr: 0x10F896 size: 1097 offset: 0x10F898 align: 099 reloff: 0x0100 nreloc: 0101 flags: 0x0102 reserved1: 0x0103 reserved2: 0x0104 reserved3: 0x0105 content: 334261720033466F6F00106 - sectname: __unwind_info107 segname: __TEXT108 addr: 0x1104109 size: 4152110 offset: 0x1104111 align: 2112 reloff: 0x0113 nreloc: 0114 flags: 0x0115 reserved1: 0x0116 reserved2: 0x0117 reserved3: 0x0118 content: 010000001C000000010000002000000000000000200000000200000000000002E81000003800000038000000F81000000000000038000000030000000C0001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000119 - cmd: LC_SEGMENT_64120 cmdsize: 232121 segname: __DATA_CONST122 vmaddr: 16384123 vmsize: 16384124 fileoff: 16384125 filesize: 16384126 maxprot: 3127 initprot: 3128 nsects: 2129 flags: 16130 Sections:131 - sectname: __const132 segname: __DATA_CONST133 addr: 0x4000134 size: 80135 offset: 0x4000136 align: 3137 reloff: 0x0138 nreloc: 0139 flags: 0x0140 reserved1: 0x0141 reserved2: 0x0142 reserved3: 0x0143 content: 00000000000000002840000000000000F0100000000000001000000000000000FD100000000000801000000000000000F810000000000080000000000100000018400000000000000000000000000000144 - sectname: __objc_imageinfo145 segname: __DATA_CONST146 addr: 0x4050147 size: 8148 offset: 0x4050149 align: 0150 reloff: 0x0151 nreloc: 0152 flags: 0x0153 reserved1: 0x0154 reserved2: 0x0155 reserved3: 0x0156 content: '0000000040000000'157 - cmd: LC_SEGMENT_64158 cmdsize: 152159 segname: __DATA160 vmaddr: 32768161 vmsize: 16384162 fileoff: 32768163 filesize: 16384164 maxprot: 3165 initprot: 3166 nsects: 1167 flags: 0168 Sections:169 - sectname: __data170 segname: __DATA171 addr: 0x8000172 size: 8173 offset: 0x8000174 align: 3175 reloff: 0x0176 nreloc: 0177 flags: 0x0178 reserved1: 0x0179 reserved2: 0x0180 reserved3: 0x0181 content: '1040000000000000'182 - cmd: LC_SEGMENT_64183 cmdsize: 72184 segname: __LINKEDIT185 vmaddr: 49152186 vmsize: 1104187 fileoff: 49152188 filesize: 1104189 maxprot: 1190 initprot: 1191 nsects: 0192 flags: 0193 - cmd: LC_DYLD_INFO_ONLY194 cmdsize: 48195 rebase_off: 49152196 rebase_size: 16197 bind_off: 49168198 bind_size: 96199 weak_bind_off: 49264200 weak_bind_size: 24201 lazy_bind_off: 0202 lazy_bind_size: 0203 export_off: 49288204 export_size: 48205 - cmd: LC_SYMTAB206 cmdsize: 24207 symoff: 49344208 nsyms: 11209 stroff: 49520210 strsize: 192211 - cmd: LC_DYSYMTAB212 cmdsize: 80213 ilocalsym: 0214 nlocalsym: 6215 iextdefsym: 6216 nextdefsym: 2217 iundefsym: 8218 nundefsym: 3219 tocoff: 0220 ntoc: 0221 modtaboff: 0222 nmodtab: 0223 extrefsymoff: 0224 nextrefsyms: 0225 indirectsymoff: 0226 nindirectsyms: 0227 extreloff: 0228 nextrel: 0229 locreloff: 0230 nlocrel: 0231 - cmd: LC_ID_DYLIB232 cmdsize: 96233 dylib:234 name: 24235 timestamp: 0236 current_version: 65536237 compatibility_version: 65536238 Content: '/System/Library/Frameworks/MismatchCpp.framework/Versions/A/MismatchCpp'239 ZeroPadBytes: 1240 - cmd: LC_UUID241 cmdsize: 24242 uuid: 4C4C44F3-5555-3144-A13F-B3FE15787197243 - cmd: LC_BUILD_VERSION244 cmdsize: 32245 platform: 1246 minos: 851968247 sdk: 983040248 ntools: 1249 Tools:250 - tool: 4251 version: 1245184252 - cmd: LC_LOAD_DYLIB253 cmdsize: 48254 dylib:255 name: 24256 timestamp: 0257 current_version: 117985024258 compatibility_version: 65536259 Content: '/usr/lib/libc++.1.dylib'260 ZeroPadBytes: 1261 - cmd: LC_LOAD_DYLIB262 cmdsize: 56263 dylib:264 name: 24265 timestamp: 0266 current_version: 88473600267 compatibility_version: 65536268 Content: '/usr/lib/libSystem.B.dylib'269 ZeroPadBytes: 6270 - cmd: LC_FUNCTION_STARTS271 cmdsize: 16272 dataoff: 49336273 datasize: 8274 - cmd: LC_DATA_IN_CODE275 cmdsize: 16276 dataoff: 49344277 datasize: 0278 - cmd: LC_CODE_SIGNATURE279 cmdsize: 16280 dataoff: 49712281 datasize: 544282LinkEditData:283 RebaseOpcodes:284 - Opcode: REBASE_OPCODE_SET_TYPE_IMM285 Imm: 1286 - Opcode: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB287 Imm: 1288 ExtraData: [ 0x8 ]289 - Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES290 Imm: 2291 - Opcode: REBASE_OPCODE_ADD_ADDR_IMM_SCALED292 Imm: 1293 - Opcode: REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB294 Imm: 0295 ExtraData: [ 0x3, 0x8 ]296 - Opcode: REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB297 Imm: 2298 ExtraData: [ 0x0 ]299 - Opcode: REBASE_OPCODE_DO_REBASE_IMM_TIMES300 Imm: 1301 - Opcode: REBASE_OPCODE_DONE302 Imm: 0303 BindOpcodes:304 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM305 Imm: 0306 Symbol: __ZTVN10__cxxabiv117__class_type_infoE307 - Opcode: BIND_OPCODE_SET_TYPE_IMM308 Imm: 1309 Symbol: ''310 - Opcode: BIND_OPCODE_SET_DYLIB_ORDINAL_IMM311 Imm: 1312 Symbol: ''313 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB314 Imm: 1315 ULEBExtraData: [ 0x18 ]316 Symbol: ''317 - Opcode: BIND_OPCODE_SET_ADDEND_SLEB318 Imm: 0319 SLEBExtraData: [ 16 ]320 Symbol: ''321 - Opcode: BIND_OPCODE_DO_BIND322 Imm: 0323 Symbol: ''324 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM325 Imm: 0326 Symbol: __ZTVN10__cxxabiv121__vmi_class_type_infoE327 - Opcode: BIND_OPCODE_SET_TYPE_IMM328 Imm: 1329 Symbol: ''330 - Opcode: BIND_OPCODE_ADD_ADDR_ULEB331 Imm: 0332 ULEBExtraData: [ 0x8 ]333 Symbol: ''334 - Opcode: BIND_OPCODE_DO_BIND335 Imm: 0336 Symbol: ''337 - Opcode: BIND_OPCODE_DONE338 Imm: 0339 Symbol: ''340 WeakBindOpcodes:341 - Opcode: BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM342 Imm: 0343 Symbol: __ZN3Bar4initEv344 - Opcode: BIND_OPCODE_SET_TYPE_IMM345 Imm: 1346 Symbol: ''347 - Opcode: BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB348 Imm: 1349 ULEBExtraData: [ 0x10 ]350 Symbol: ''351 - Opcode: BIND_OPCODE_DO_BIND352 Imm: 0353 Symbol: ''354 - Opcode: BIND_OPCODE_DONE355 Imm: 0356 Symbol: ''357 ExportTrie:358 TerminalSize: 0359 NodeOffset: 0360 Name: ''361 Flags: 0x0362 Address: 0x0363 Other: 0x0364 ImportName: ''365 Children:366 - TerminalSize: 0367 NodeOffset: 7368 Name: __Z369 Flags: 0x0370 Address: 0x0371 Other: 0x0372 ImportName: ''373 Children:374 - TerminalSize: 3375 NodeOffset: 35376 Name: 3fooIjEiT_377 Flags: 0x0378 Address: 0x10E8379 Other: 0x0380 ImportName: ''381 - TerminalSize: 3382 NodeOffset: 40383 Name: N3Bar4initEv384 Flags: 0x4385 Address: 0x10F0386 Other: 0x0387 ImportName: ''388 NameList:389 - n_strx: 32390 n_type: 0x1E391 n_sect: 4392 n_desc: 0393 n_value: 16384394 - n_strx: 42395 n_type: 0x1E396 n_sect: 4397 n_desc: 0398 n_value: 16408399 - n_strx: 52400 n_type: 0x1E401 n_sect: 4402 n_desc: 0403 n_value: 16424404 - n_strx: 62405 n_type: 0x1E406 n_sect: 6407 n_desc: 0408 n_value: 32768409 - n_strx: 67410 n_type: 0x1E411 n_sect: 2412 n_desc: 0413 n_value: 4344414 - n_strx: 77415 n_type: 0x1E416 n_sect: 2417 n_desc: 0418 n_value: 4349419 - n_strx: 2420 n_type: 0xF421 n_sect: 1422 n_desc: 0423 n_value: 4328424 - n_strx: 16425 n_type: 0xF426 n_sect: 1427 n_desc: 128428 n_value: 4336429 - n_strx: 87430 n_type: 0x1431 n_sect: 0432 n_desc: 256433 n_value: 0434 - n_strx: 126435 n_type: 0x1436 n_sect: 0437 n_desc: 256438 n_value: 0439 - n_strx: 169440 n_type: 0x1441 n_sect: 0442 n_desc: 512443 n_value: 0444 StringTable:445 - ' '446 - __Z3fooIjEiT_447 - __ZN3Bar4initEv448 - __ZTV3Bar449 - __ZTI3Foo450 - __ZTI3Bar451 - _bar452 - __ZTS3Bar453 - __ZTS3Foo454 - __ZTVN10__cxxabiv117__class_type_infoE455 - __ZTVN10__cxxabiv121__vmi_class_type_infoE456 - dyld_stub_binder457 - ''458 - ''459 - ''460 - ''461 - ''462 - ''463 FunctionStarts: [ 0x10E8, 0x10F0 ]464...465