# REQUIRES: x86
# RUN: rm -rf %t; mkdir %t
# RUN: yaml2obj %s > %t/test.dylib
# RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-macos10.15 -o %t/test_macos.o
# RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-ios13.15.0-macabi -o %t/test_maccatalyst.o
# RUN: echo "" | llvm-mc -filetype=obj -triple=x86_64-apple-ios13.15.0 -o %t/test_ios.o

# RUN: %lld -lSystem -dylib %t/test.dylib %t/test_macos.o -o /dev/null
# RUN: %lld -lSystem -dylib -platform_version mac-catalyst 13.15.0 14.0 %t/test.dylib %t/test_maccatalyst.o -o /dev/null

# RUN: not %lld -lSystem -dylib -platform_version ios 13.15.0 14.0 %t/test.dylib %t/test_ios.o -o /dev/null 2>&1 | FileCheck %s
# CHECK: test.dylib has platform macOS/macCatalyst, which is different from target platform iOS

--- !mach-o
FileHeader:
  magic:           0xFEEDFACF
  cputype:         0x1000007
  cpusubtype:      0x3
  filetype:        0x6
  ncmds:           4
  sizeofcmds:      600
  flags:           0x100085
  reserved:        0x0
LoadCommands:
  - cmd:             LC_ID_DYLIB
    cmdsize:         32
    dylib:
      name:            24
      timestamp:       1
      current_version: 0
      compatibility_version: 0
    Content:         test
    ZeroPadBytes:    4
  - 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:      0
    export_size:     0
  - cmd:             LC_BUILD_VERSION
    cmdsize:         32
    platform:        1
    minos:           659200
    sdk:             720896
    ntools:          1
    Tools:
      - tool:            3
        version:         39913472
  - cmd:             LC_BUILD_VERSION
    cmdsize:         32
    platform:        6
    minos:           855808
    sdk:             917504
    ntools:          1
    Tools:
      - tool:            3
        version:         39913472
...
