| 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/MagicSymbols.yaml -o %t/MagicSymbols |
| 6 |
|
| 7 |
; RUN: not clang-installapi -target x86_64-apple-macosx13 \ |
| 8 |
; RUN: -install_name \ |
| 9 |
; RUN: /System/Library/Frameworks/SpecialLinkerSymbols.framework/Versions/A/SpecialLinkerSymbols \ |
| 10 |
; RUN: -current_version 1 -compatibility_version 1 \ |
| 11 |
; RUN: %t/inputs.json -o %t/output.tbd \ |
| 12 |
; RUN: --verify-mode=ErrorsOnly \ |
| 13 |
; RUN: --verify-against=%t/MagicSymbols 2>&1 | FileCheck %s |
| 14 |
|
| 15 |
CHECK: warning: violations found for x86_64 |
| 16 |
CHECK: error: no declaration found for exported symbol '$ld$add$os10.4$_symbol2' in dynamic library |
| 17 |
CHECK: error: no declaration found for exported symbol '$ld$add$os10.5$_symbol2' in dynamic library |
| 18 |
CHECK: error: no declaration found for exported symbol '$ld$hide$os10.6$_symbol1' in dynamic library |
| 19 |
CHECK: error: no declaration found for exported symbol '$ld$hide$os10.7$_symbol1' in dynamic library |
| 20 |
CHECK: error: no declaration found for exported symbol '$ld$weak$os10.5$_symbol3' in dynamic library |
| 21 |
CHECK: error: no declaration found for exported symbol '$ld$weak$os10.4$_symbol3' in dynamic library |
| 22 |
CHECK: error: no declaration found for exported symbol '$ld$install_name$os10.4$/System/Library/Frameworks/A.framework/Versions/A/A' in dynamic library |
| 23 |
CHECK: error: no declaration found for exported symbol '$ld$install_name$os10.5$/System/Library/Frameworks/B.framework/Versions/A/B' in dynamic library |
| 24 |
|
| 25 |
;--- MagicSymbols.h |
| 26 |
#ifndef SPECIAL_LINKER_SYMBOLS_H |
| 27 |
#define SPECIAL_LINKER_SYMBOLS_H |
| 28 |
|
| 29 |
extern const int SpecialLinkerSymbolsVersion; |
| 30 |
|
| 31 |
extern int symbol1; |
| 32 |
extern int symbol3; |
| 33 |
|
| 34 |
#endif // SPECIAL_LINKER_SYMBOLS_H |
| 35 |
|
| 36 |
;--- inputs.json.in |
| 37 |
{ |
| 38 |
"headers": [ { |
| 39 |
"path" : "DSTROOT/MagicSymbols.h", |
| 40 |
"type" : "project" |
| 41 |
} |
| 42 |
], |
| 43 |
"version": "3" |
| 44 |
} |
| 45 |
|
| 46 |
;--- MagicSymbols.yaml |
| 47 |
--- !mach-o |
| 48 |
FileHeader: |
| 49 |
magic: 0xFEEDFACF |
| 50 |
cputype: 0x1000007 |
| 51 |
cpusubtype: 0x3 |
| 52 |
filetype: 0x6 |
| 53 |
ncmds: 12 |
| 54 |
sizeofcmds: 952 |
| 55 |
flags: 0x100085 |
| 56 |
reserved: 0x0 |
| 57 |
LoadCommands: |
| 58 |
- cmd: LC_SEGMENT_64 |
| 59 |
cmdsize: 232 |
| 60 |
segname: __TEXT |
| 61 |
vmaddr: 0 |
| 62 |
vmsize: 4096 |
| 63 |
fileoff: 0 |
| 64 |
filesize: 4096 |
| 65 |
maxprot: 5 |
| 66 |
initprot: 5 |
| 67 |
nsects: 2 |
| 68 |
flags: 0 |
| 69 |
Sections: |
| 70 |
- sectname: __text |
| 71 |
segname: __TEXT |
| 72 |
addr: 0xBD8 |
| 73 |
size: 0 |
| 74 |
offset: 0xBD8 |
| 75 |
align: 0 |
| 76 |
reloff: 0x0 |
| 77 |
nreloc: 0 |
| 78 |
flags: 0x80000000 |
| 79 |
reserved1: 0x0 |
| 80 |
reserved2: 0x0 |
| 81 |
reserved3: 0x0 |
| 82 |
content: '' |
| 83 |
- sectname: __const |
| 84 |
segname: __TEXT |
| 85 |
addr: 0xBD8 |
| 86 |
size: 4 |
| 87 |
offset: 0xBD8 |
| 88 |
align: 2 |
| 89 |
reloff: 0x0 |
| 90 |
nreloc: 0 |
| 91 |
flags: 0x0 |
| 92 |
reserved1: 0x0 |
| 93 |
reserved2: 0x0 |
| 94 |
reserved3: 0x0 |
| 95 |
content: '07000000' |
| 96 |
- cmd: LC_SEGMENT_64 |
| 97 |
cmdsize: 232 |
| 98 |
segname: __DATA |
| 99 |
vmaddr: 4096 |
| 100 |
vmsize: 4096 |
| 101 |
fileoff: 4096 |
| 102 |
filesize: 4096 |
| 103 |
maxprot: 3 |
| 104 |
initprot: 3 |
| 105 |
nsects: 2 |
| 106 |
flags: 0 |
| 107 |
Sections: |
| 108 |
- sectname: __data |
| 109 |
segname: __DATA |
| 110 |
addr: 0x1000 |
| 111 |
size: 8 |
| 112 |
offset: 0x1000 |
| 113 |
align: 2 |
| 114 |
reloff: 0x0 |
| 115 |
nreloc: 0 |
| 116 |
flags: 0x0 |
| 117 |
reserved1: 0x0 |
| 118 |
reserved2: 0x0 |
| 119 |
reserved3: 0x0 |
| 120 |
content: 4D00000009030000 |
| 121 |
- sectname: __common |
| 122 |
segname: __DATA |
| 123 |
addr: 0x1008 |
| 124 |
size: 8 |
| 125 |
offset: 0x0 |
| 126 |
align: 0 |
| 127 |
reloff: 0x0 |
| 128 |
nreloc: 0 |
| 129 |
flags: 0x1 |
| 130 |
reserved1: 0x0 |
| 131 |
reserved2: 0x0 |
| 132 |
reserved3: 0x0 |
| 133 |
- cmd: LC_SEGMENT_64 |
| 134 |
cmdsize: 72 |
| 135 |
segname: __LINKEDIT |
| 136 |
vmaddr: 8192 |
| 137 |
vmsize: 944 |
| 138 |
fileoff: 8192 |
| 139 |
filesize: 944 |
| 140 |
maxprot: 1 |
| 141 |
initprot: 1 |
| 142 |
nsects: 0 |
| 143 |
flags: 0 |
| 144 |
- cmd: LC_DYLD_INFO_ONLY |
| 145 |
cmdsize: 48 |
| 146 |
rebase_off: 0 |
| 147 |
rebase_size: 0 |
| 148 |
bind_off: 0 |
| 149 |
bind_size: 0 |
| 150 |
weak_bind_off: 0 |
| 151 |
weak_bind_size: 0 |
| 152 |
lazy_bind_off: 0 |
| 153 |
lazy_bind_size: 0 |
| 154 |
export_off: 8192 |
| 155 |
export_size: 376 |
| 156 |
- cmd: LC_SYMTAB |
| 157 |
cmdsize: 24 |
| 158 |
symoff: 8576 |
| 159 |
nsyms: 12 |
| 160 |
stroff: 8768 |
| 161 |
strsize: 368 |
| 162 |
- cmd: LC_DYSYMTAB |
| 163 |
cmdsize: 80 |
| 164 |
ilocalsym: 0 |
| 165 |
nlocalsym: 0 |
| 166 |
iextdefsym: 0 |
| 167 |
nextdefsym: 11 |
| 168 |
iundefsym: 11 |
| 169 |
nundefsym: 1 |
| 170 |
tocoff: 0 |
| 171 |
ntoc: 0 |
| 172 |
modtaboff: 0 |
| 173 |
nmodtab: 0 |
| 174 |
extrefsymoff: 0 |
| 175 |
nextrefsyms: 0 |
| 176 |
indirectsymoff: 0 |
| 177 |
nindirectsyms: 0 |
| 178 |
extreloff: 0 |
| 179 |
nextrel: 0 |
| 180 |
locreloff: 0 |
| 181 |
nlocrel: 0 |
| 182 |
- cmd: LC_ID_DYLIB |
| 183 |
cmdsize: 120 |
| 184 |
dylib: |
| 185 |
name: 24 |
| 186 |
timestamp: 0 |
| 187 |
current_version: 65536 |
| 188 |
compatibility_version: 65536 |
| 189 |
Content: '/System/Library/Frameworks/SpecialLinkerSymbols.framework/Versions/A/SpecialLinkerSymbols' |
| 190 |
ZeroPadBytes: 7 |
| 191 |
- cmd: LC_UUID |
| 192 |
cmdsize: 24 |
| 193 |
uuid: 4C4C4478-5555-3144-A106-356C3C9DACA3 |
| 194 |
- cmd: LC_BUILD_VERSION |
| 195 |
cmdsize: 32 |
| 196 |
platform: 1 |
| 197 |
minos: 851968 |
| 198 |
sdk: 983040 |
| 199 |
ntools: 1 |
| 200 |
Tools: |
| 201 |
- tool: 4 |
| 202 |
version: 1245184 |
| 203 |
- cmd: LC_LOAD_DYLIB |
| 204 |
cmdsize: 56 |
| 205 |
dylib: |
| 206 |
name: 24 |
| 207 |
timestamp: 0 |
| 208 |
current_version: 88539136 |
| 209 |
compatibility_version: 65536 |
| 210 |
Content: '/usr/lib/libSystem.B.dylib' |
| 211 |
ZeroPadBytes: 6 |
| 212 |
- cmd: LC_FUNCTION_STARTS |
| 213 |
cmdsize: 16 |
| 214 |
dataoff: 8568 |
| 215 |
datasize: 8 |
| 216 |
- cmd: LC_DATA_IN_CODE |
| 217 |
cmdsize: 16 |
| 218 |
dataoff: 8576 |
| 219 |
datasize: 0 |
| 220 |
LinkEditData: |
| 221 |
ExportTrie: |
| 222 |
TerminalSize: 0 |
| 223 |
NodeOffset: 0 |
| 224 |
Name: '' |
| 225 |
Flags: 0x0 |
| 226 |
Address: 0x0 |
| 227 |
Other: 0x0 |
| 228 |
ImportName: '' |
| 229 |
Children: |
| 230 |
- TerminalSize: 0 |
| 231 |
NodeOffset: 11 |
| 232 |
Name: _ |
| 233 |
Flags: 0x0 |
| 234 |
Address: 0x0 |
| 235 |
Other: 0x0 |
| 236 |
ImportName: '' |
| 237 |
Children: |
| 238 |
- TerminalSize: 3 |
| 239 |
NodeOffset: 50 |
| 240 |
Name: SpecialLinkerSymbolsVersion |
| 241 |
Flags: 0x0 |
| 242 |
Address: 0xBD8 |
| 243 |
Other: 0x0 |
| 244 |
ImportName: '' |
| 245 |
- TerminalSize: 0 |
| 246 |
NodeOffset: 55 |
| 247 |
Name: symbol |
| 248 |
Flags: 0x0 |
| 249 |
Address: 0x0 |
| 250 |
Other: 0x0 |
| 251 |
ImportName: '' |
| 252 |
Children: |
| 253 |
- TerminalSize: 3 |
| 254 |
NodeOffset: 63 |
| 255 |
Name: '3' |
| 256 |
Flags: 0x0 |
| 257 |
Address: 0x1004 |
| 258 |
Other: 0x0 |
| 259 |
ImportName: '' |
| 260 |
- TerminalSize: 3 |
| 261 |
NodeOffset: 68 |
| 262 |
Name: '1' |
| 263 |
Flags: 0x0 |
| 264 |
Address: 0x1000 |
| 265 |
Other: 0x0 |
| 266 |
ImportName: '' |
| 267 |
- TerminalSize: 0 |
| 268 |
NodeOffset: 73 |
| 269 |
Name: '$ld$' |
| 270 |
Flags: 0x0 |
| 271 |
Address: 0x0 |
| 272 |
Other: 0x0 |
| 273 |
ImportName: '' |
| 274 |
Children: |
| 275 |
- TerminalSize: 0 |
| 276 |
NodeOffset: 134 |
| 277 |
Name: 'add$os10.' |
| 278 |
Flags: 0x0 |
| 279 |
Address: 0x0 |
| 280 |
Other: 0x0 |
| 281 |
ImportName: '' |
| 282 |
Children: |
| 283 |
- TerminalSize: 3 |
| 284 |
NodeOffset: 162 |
| 285 |
Name: '4$_symbol2' |
| 286 |
Flags: 0x0 |
| 287 |
Address: 0x1008 |
| 288 |
Other: 0x0 |
| 289 |
ImportName: '' |
| 290 |
- TerminalSize: 3 |
| 291 |
NodeOffset: 167 |
| 292 |
Name: '5$_symbol2' |
| 293 |
Flags: 0x0 |
| 294 |
Address: 0x1009 |
| 295 |
Other: 0x0 |
| 296 |
ImportName: '' |
| 297 |
- TerminalSize: 0 |
| 298 |
NodeOffset: 172 |
| 299 |
Name: 'hide$os10.' |
| 300 |
Flags: 0x0 |
| 301 |
Address: 0x0 |
| 302 |
Other: 0x0 |
| 303 |
ImportName: '' |
| 304 |
Children: |
| 305 |
- TerminalSize: 3 |
| 306 |
NodeOffset: 200 |
| 307 |
Name: '6$_symbol1' |
| 308 |
Flags: 0x0 |
| 309 |
Address: 0x100A |
| 310 |
Other: 0x0 |
| 311 |
ImportName: '' |
| 312 |
- TerminalSize: 3 |
| 313 |
NodeOffset: 205 |
| 314 |
Name: '7$_symbol1' |
| 315 |
Flags: 0x0 |
| 316 |
Address: 0x100B |
| 317 |
Other: 0x0 |
| 318 |
ImportName: '' |
| 319 |
- TerminalSize: 0 |
| 320 |
NodeOffset: 210 |
| 321 |
Name: 'weak$os10.' |
| 322 |
Flags: 0x0 |
| 323 |
Address: 0x0 |
| 324 |
Other: 0x0 |
| 325 |
ImportName: '' |
| 326 |
Children: |
| 327 |
- TerminalSize: 3 |
| 328 |
NodeOffset: 238 |
| 329 |
Name: '5$_symbol3' |
| 330 |
Flags: 0x0 |
| 331 |
Address: 0x100F |
| 332 |
Other: 0x0 |
| 333 |
ImportName: '' |
| 334 |
- TerminalSize: 3 |
| 335 |
NodeOffset: 243 |
| 336 |
Name: '4$_symbol3' |
| 337 |
Flags: 0x0 |
| 338 |
Address: 0x100E |
| 339 |
Other: 0x0 |
| 340 |
ImportName: '' |
| 341 |
- TerminalSize: 0 |
| 342 |
NodeOffset: 248 |
| 343 |
Name: 'install_name$os10.' |
| 344 |
Flags: 0x0 |
| 345 |
Address: 0x0 |
| 346 |
Other: 0x0 |
| 347 |
ImportName: '' |
| 348 |
Children: |
| 349 |
- TerminalSize: 3 |
| 350 |
NodeOffset: 362 |
| 351 |
Name: '4$/System/Library/Frameworks/A.framework/Versions/A/A' |
| 352 |
Flags: 0x0 |
| 353 |
Address: 0x100C |
| 354 |
Other: 0x0 |
| 355 |
ImportName: '' |
| 356 |
- TerminalSize: 3 |
| 357 |
NodeOffset: 367 |
| 358 |
Name: '5$/System/Library/Frameworks/B.framework/Versions/A/B' |
| 359 |
Flags: 0x0 |
| 360 |
Address: 0x100D |
| 361 |
Other: 0x0 |
| 362 |
ImportName: '' |
| 363 |
NameList: |
| 364 |
- n_strx: 2 |
| 365 |
n_type: 0xF |
| 366 |
n_sect: 4 |
| 367 |
n_desc: 0 |
| 368 |
n_value: 4104 |
| 369 |
- n_strx: 26 |
| 370 |
n_type: 0xF |
| 371 |
n_sect: 4 |
| 372 |
n_desc: 0 |
| 373 |
n_value: 4105 |
| 374 |
- n_strx: 50 |
| 375 |
n_type: 0xF |
| 376 |
n_sect: 4 |
| 377 |
n_desc: 0 |
| 378 |
n_value: 4106 |
| 379 |
- n_strx: 75 |
| 380 |
n_type: 0xF |
| 381 |
n_sect: 4 |
| 382 |
n_desc: 0 |
| 383 |
n_value: 4107 |
| 384 |
- n_strx: 100 |
| 385 |
n_type: 0xF |
| 386 |
n_sect: 4 |
| 387 |
n_desc: 0 |
| 388 |
n_value: 4108 |
| 389 |
- n_strx: 176 |
| 390 |
n_type: 0xF |
| 391 |
n_sect: 4 |
| 392 |
n_desc: 0 |
| 393 |
n_value: 4109 |
| 394 |
- n_strx: 252 |
| 395 |
n_type: 0xF |
| 396 |
n_sect: 4 |
| 397 |
n_desc: 0 |
| 398 |
n_value: 4110 |
| 399 |
- n_strx: 277 |
| 400 |
n_type: 0xF |
| 401 |
n_sect: 4 |
| 402 |
n_desc: 0 |
| 403 |
n_value: 4111 |
| 404 |
- n_strx: 302 |
| 405 |
n_type: 0xF |
| 406 |
n_sect: 2 |
| 407 |
n_desc: 0 |
| 408 |
n_value: 3032 |
| 409 |
- n_strx: 331 |
| 410 |
n_type: 0xF |
| 411 |
n_sect: 3 |
| 412 |
n_desc: 0 |
| 413 |
n_value: 4096 |
| 414 |
- n_strx: 340 |
| 415 |
n_type: 0xF |
| 416 |
n_sect: 3 |
| 417 |
n_desc: 0 |
| 418 |
n_value: 4100 |
| 419 |
- n_strx: 349 |
| 420 |
n_type: 0x1 |
| 421 |
n_sect: 0 |
| 422 |
n_desc: 256 |
| 423 |
n_value: 0 |
| 424 |
StringTable: |
| 425 |
- ' ' |
| 426 |
- '$ld$add$os10.4$_symbol2' |
| 427 |
- '$ld$add$os10.5$_symbol2' |
| 428 |
- '$ld$hide$os10.6$_symbol1' |
| 429 |
- '$ld$hide$os10.7$_symbol1' |
| 430 |
- '$ld$install_name$os10.4$/System/Library/Frameworks/A.framework/Versions/A/A' |
| 431 |
- '$ld$install_name$os10.5$/System/Library/Frameworks/B.framework/Versions/A/B' |
| 432 |
- '$ld$weak$os10.4$_symbol3' |
| 433 |
- '$ld$weak$os10.5$_symbol3' |
| 434 |
- _SpecialLinkerSymbolsVersion |
| 435 |
- _symbol1 |
| 436 |
- _symbol3 |
| 437 |
- dyld_stub_binder |
| 438 |
- '' |
| 439 |
- '' |
| 440 |
... |