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