1# RUN: ld64.lld -arch x86_64 %s -o %t -r -macosx_version_min 10.8 && llvm-objdump --private-headers %t | FileCheck %s
2# RUN: ld64.lld -arch x86_64 %s -o %t -r && llvm-objdump --private-headers %t | FileCheck %s
3# RUN: ld64.lld -arch x86_64 %s -o %t -r %p/Inputs/no-version-min-load-command-object.yaml && llvm-objdump --private-headers %t | FileCheck %s --check-prefix=NO_VERSION_MIN
4
5# If we are emitting an object file, then we only emit a min version load command if the source object file(s) all have
6# version(s) and either known platforms or contain min version load commands themselves.
7
8--- !mach-o
9arch:            x86_64
10file-type:       MH_OBJECT
11flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
12min-os-version-kind: LC_VERSION_MIN_MACOSX
13min-os-version: 10.8
14sections:
15  - segment:         __TEXT
16    section:         __text
17    type:            S_REGULAR
18    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
19    address:         0x0000000000000000
20    content:         [ 0x00, 0x00, 0x00, 0x00 ]
21global-symbols:
22  - name:            _main
23    type:            N_SECT
24    scope:           [ N_EXT ]
25    sect:            1
26    value:           0x0000000000000000
27...
28
29# CHECK: Load command {{[0-9]*}}
30# CHECK:   cmd LC_VERSION_MIN_MACOSX
31# CHECK:   cmdsize 16
32# CHECK:   version 10.8
33# CHECK:   sdk n/a
34
35# NO_VERSION_MIN-NOT: LC_VERSION_MIN_MACOSX