462 lines · plain
1; RUN: rm -rf %t 2; RUN: split-file %s %t3; RUN: sed -e "s|DSTROOT|%/t|g" %t/inputs.json.in > %t/inputs.json4; RUN: yaml2obj %t/AliasList.yaml -o %t/Frameworks/AliasList.framework/AliasList5 6; RUN: clang-installapi --target=x86_64-apple-macos13 \7; RUN: -alias_list %t/aliases.txt \8; RUN: -install_name /System/Library/Frameworks/AliasList.framework/Versions/A/AliasList \9; RUN: -current_version 1 -compatibility_version 1 \10; RUN: -F%t/Frameworks -ObjC %t/inputs.json --verify-mode=Pedantic \ 11; RUN: --verify-against=%t/Frameworks/AliasList.framework/AliasList \12; RUN: -o %t/AliasList.tbd 2>&1 | FileCheck -allow-empty %s \13; RUN: --implicit-check-not=error --implicit-check-not=warning14; RUN: llvm-readtapi -compare %t/expected.tbd %t/AliasList.tbd15 16// Check error handling.17; RUN: not clang-installapi --target=x86_64-apple-macos13 \18; RUN: -alias_list %t/invalid.txt \19; RUN: -install_name /System/Library/Frameworks/AliasList.framework/Versions/A/AliasList \20; RUN: -current_version 1 -compatibility_version 1 \21; RUN: -F%t/Frameworks -ObjC %t/inputs.json --verify-mode=Pedantic \ 22; RUN: --verify-against=%t/Frameworks/AliasList.framework/AliasList \23; RUN: -o %t/AliasList.tbd 2>&1 | FileCheck -allow-empty %s \24; RUN: --check-prefix=INVALID25 26; INVALID: error: could not read symbol alias input list {{.*}}invalid.txt': invalid input format: missing alias for: _hidden27 28;--- Frameworks/AliasList.framework/Headers/AliasList.h29// simple alias from one symbol to another.30extern int simple_symbol;31extern int alias_symbol;32 33// This symbol comes from the alias file.34extern int exported_symbol;35 36// This symbol was moved here and has several special hide symbols in the alias37// file.38extern int moved_here_symbol;39 40// This alias is public, whereas the source is private.41extern int public_symbol;42 43;--- Frameworks/AliasList.framework/PrivateHeaders/AliasList_Private.h44// This is a private symbol that has a public alias.45extern int private_symbol;46 47;--- aliases.txt48# comment49_simple_symbol _alias_symbol50# test multiple space characters separated symbol and alias51_hidden_symbol _exported_symbol # test inline comment with spaces52# test tab character separated symbol and alias53_moved_here_symbol $ld$hide$os10.4$_moved_here_symbol# test inline comment without spaces54# test trailing space character55_moved_here_symbol $ld$hide$os10.5$_moved_here_symbol 56# test trailing tab character57_moved_here_symbol $ld$hide$os10.6$_moved_here_symbol 58_private_symbol _public_symbol59 60;--- invalid.txt61# comment62_simple_symbol _alias_symbol63_hidden # no matching64 65;--- expected.tbd66{67 "main_library": {68 "exported_symbols": [69 {70 "data": {71 "global": [72 "_exported_symbol", "_simple_symbol", "_moved_here_symbol",73 "$ld$hide$os10.6$_moved_here_symbol", "$ld$hide$os10.4$_moved_here_symbol",74 "$ld$hide$os10.5$_moved_here_symbol", "_public_symbol",75 "_private_symbol", "_alias_symbol"76 ]77 }78 }79 ],80 "flags": [81 {82 "attributes": [83 "not_app_extension_safe"84 ]85 }86 ],87 "install_names": [88 {89 "name": "/System/Library/Frameworks/AliasList.framework/Versions/A/AliasList"90 }91 ],92 "target_info": [93 {94 "min_deployment": "13",95 "target": "x86_64-macos"96 }97 ]98 },99 "tapi_tbd_version": 5100}101 102;--- AliasList.yaml103--- !mach-o104FileHeader:105 magic: 0xFEEDFACF106 cputype: 0x1000007107 cpusubtype: 0x3108 filetype: 0x6109 ncmds: 13110 sizeofcmds: 920111 flags: 0x100085112 reserved: 0x0113LoadCommands:114 - cmd: LC_SEGMENT_64115 cmdsize: 152116 segname: __TEXT117 vmaddr: 0118 vmsize: 4096119 fileoff: 0120 filesize: 4096121 maxprot: 5122 initprot: 5123 nsects: 1124 flags: 0125 Sections:126 - sectname: __text127 segname: __TEXT128 addr: 0xBB8129 size: 0130 offset: 0xBB8131 align: 0132 reloff: 0x0133 nreloc: 0134 flags: 0x80000000135 reserved1: 0x0136 reserved2: 0x0137 reserved3: 0x0138 content: ''139 - cmd: LC_SEGMENT_64140 cmdsize: 152141 segname: __DATA_CONST142 vmaddr: 4096143 vmsize: 4096144 fileoff: 4096145 filesize: 4096146 maxprot: 3147 initprot: 3148 nsects: 1149 flags: 16150 Sections:151 - sectname: __objc_imageinfo152 segname: __DATA_CONST153 addr: 0x1000154 size: 8155 offset: 0x1000156 align: 0157 reloff: 0x0158 nreloc: 0159 flags: 0x0160 reserved1: 0x0161 reserved2: 0x0162 reserved3: 0x0163 content: '0000000040000000'164 - cmd: LC_SEGMENT_64165 cmdsize: 152166 segname: __DATA167 vmaddr: 8192168 vmsize: 4096169 fileoff: 8192170 filesize: 0171 maxprot: 3172 initprot: 3173 nsects: 1174 flags: 0175 Sections:176 - sectname: __common177 segname: __DATA178 addr: 0x2000179 size: 40180 offset: 0x0181 align: 2182 reloff: 0x0183 nreloc: 0184 flags: 0x1185 reserved1: 0x0186 reserved2: 0x0187 reserved3: 0x0188 - cmd: LC_SEGMENT_64189 cmdsize: 72190 segname: __LINKEDIT191 vmaddr: 12288192 vmsize: 672193 fileoff: 8192194 filesize: 672195 maxprot: 1196 initprot: 1197 nsects: 0198 flags: 0199 - cmd: LC_DYLD_INFO_ONLY200 cmdsize: 48201 rebase_off: 0202 rebase_size: 0203 bind_off: 0204 bind_size: 0205 weak_bind_off: 0206 weak_bind_size: 0207 lazy_bind_off: 0208 lazy_bind_size: 0209 export_off: 8192210 export_size: 248211 - cmd: LC_SYMTAB212 cmdsize: 24213 symoff: 8448214 nsyms: 11215 stroff: 8624216 strsize: 240217 - cmd: LC_DYSYMTAB218 cmdsize: 80219 ilocalsym: 0220 nlocalsym: 1221 iextdefsym: 1222 nextdefsym: 9223 iundefsym: 10224 nundefsym: 1225 tocoff: 0226 ntoc: 0227 modtaboff: 0228 nmodtab: 0229 extrefsymoff: 0230 nextrefsyms: 0231 indirectsymoff: 0232 nindirectsyms: 0233 extreloff: 0234 nextrel: 0235 locreloff: 0236 nlocrel: 0237 - cmd: LC_ID_DYLIB238 cmdsize: 96239 dylib:240 name: 24241 timestamp: 0242 current_version: 65536243 compatibility_version: 65536244 Content: '/System/Library/Frameworks/AliasList.framework/Versions/A/AliasList'245 ZeroPadBytes: 5246 - cmd: LC_UUID247 cmdsize: 24248 uuid: 4C4C4468-5555-3144-A123-B0FDB87F9813249 - cmd: LC_BUILD_VERSION250 cmdsize: 32251 platform: 1252 minos: 851968253 sdk: 983040254 ntools: 1255 Tools:256 - tool: 4257 version: 1245184258 - cmd: LC_LOAD_DYLIB259 cmdsize: 56260 dylib:261 name: 24262 timestamp: 0263 current_version: 88539136264 compatibility_version: 65536265 Content: '/usr/lib/libSystem.B.dylib'266 ZeroPadBytes: 6267 - cmd: LC_FUNCTION_STARTS268 cmdsize: 16269 dataoff: 8440270 datasize: 8271 - cmd: LC_DATA_IN_CODE272 cmdsize: 16273 dataoff: 8448274 datasize: 0275LinkEditData:276 ExportTrie:277 TerminalSize: 0278 NodeOffset: 0279 Name: ''280 Flags: 0x0281 Address: 0x0282 Other: 0x0283 ImportName: ''284 Children:285 - TerminalSize: 0286 NodeOffset: 21287 Name: '$ld$hide$os10.'288 Flags: 0x0289 Address: 0x0290 Other: 0x0291 ImportName: ''292 Children:293 - TerminalSize: 3294 NodeOffset: 89295 Name: '4$_moved_here_symbol'296 Flags: 0x0297 Address: 0x2000298 Other: 0x0299 ImportName: ''300 - TerminalSize: 3301 NodeOffset: 94302 Name: '6$_moved_here_symbol'303 Flags: 0x0304 Address: 0x2008305 Other: 0x0306 ImportName: ''307 - TerminalSize: 3308 NodeOffset: 99309 Name: '5$_moved_here_symbol'310 Flags: 0x0311 Address: 0x2004312 Other: 0x0313 ImportName: ''314 - TerminalSize: 0315 NodeOffset: 104316 Name: _317 Flags: 0x0318 Address: 0x0319 Other: 0x0320 ImportName: ''321 Children:322 - TerminalSize: 3323 NodeOffset: 179324 Name: alias_symbol325 Flags: 0x0326 Address: 0x2024327 Other: 0x0328 ImportName: ''329 - TerminalSize: 0330 NodeOffset: 184331 Name: p332 Flags: 0x0333 Address: 0x0334 Other: 0x0335 ImportName: ''336 Children:337 - TerminalSize: 3338 NodeOffset: 217339 Name: ublic_symbol340 Flags: 0x0341 Address: 0x2020342 Other: 0x0343 ImportName: ''344 - TerminalSize: 3345 NodeOffset: 222346 Name: rivate_symbol347 Flags: 0x0348 Address: 0x2018349 Other: 0x0350 ImportName: ''351 - TerminalSize: 3352 NodeOffset: 227353 Name: simple_symbol354 Flags: 0x0355 Address: 0x200C356 Other: 0x0357 ImportName: ''358 - TerminalSize: 3359 NodeOffset: 232360 Name: moved_here_symbol361 Flags: 0x0362 Address: 0x2014363 Other: 0x0364 ImportName: ''365 - TerminalSize: 3366 NodeOffset: 237367 Name: exported_symbol368 Flags: 0x0369 Address: 0x201C370 Other: 0x0371 ImportName: ''372 NameList:373 - n_strx: 122374 n_type: 0x1E375 n_sect: 3376 n_desc: 0377 n_value: 8208378 - n_strx: 2379 n_type: 0xF380 n_sect: 3381 n_desc: 0382 n_value: 8192383 - n_strx: 37384 n_type: 0xF385 n_sect: 3386 n_desc: 0387 n_value: 8196388 - n_strx: 72389 n_type: 0xF390 n_sect: 3391 n_desc: 0392 n_value: 8200393 - n_strx: 107394 n_type: 0xF395 n_sect: 3396 n_desc: 0397 n_value: 8204398 - n_strx: 137399 n_type: 0xF400 n_sect: 3401 n_desc: 0402 n_value: 8212403 - n_strx: 156404 n_type: 0xF405 n_sect: 3406 n_desc: 0407 n_value: 8216408 - n_strx: 172409 n_type: 0xF410 n_sect: 3411 n_desc: 0412 n_value: 8220413 - n_strx: 189414 n_type: 0xF415 n_sect: 3416 n_desc: 0417 n_value: 8224418 - n_strx: 204419 n_type: 0xF420 n_sect: 3421 n_desc: 0422 n_value: 8228423 - n_strx: 218424 n_type: 0x1425 n_sect: 0426 n_desc: 256427 n_value: 0428 StringTable:429 - ' '430 - '$ld$hide$os10.4$_moved_here_symbol'431 - '$ld$hide$os10.5$_moved_here_symbol'432 - '$ld$hide$os10.6$_moved_here_symbol'433 - _simple_symbol434 - _hidden_symbol435 - _moved_here_symbol436 - _private_symbol437 - _exported_symbol438 - _public_symbol439 - _alias_symbol440 - dyld_stub_binder441 - ''442 - ''443 - ''444 - ''445 - ''446...447 448;--- inputs.json.in449{450 "headers": [ 451 {452 "path" : "DSTROOT/Frameworks/AliasList.framework/Headers/AliasList.h",453 "type" : "public"454 }, 455 {456 "path" : "DSTROOT/Frameworks/AliasList.framework/PrivateHeaders/AliasList_Private.h",457 "type" : "private"458 }459 ],460 "version": "3"461}462