1# RUN: ld64.lld.darwinold -arch x86_64  %s  %p/Inputs/x86_64/libSystem.yaml -o %t1
2# RUN: llvm-nm -m -n %t1 | FileCheck %s
3#
4# RUN: ld64.lld.darwinold -arch x86_64  %s %p/Inputs/x86_64/libSystem.yaml -dead_strip -o %t2
5# RUN: llvm-nm -m -n %t2 | FileCheck %s
6#
7# RUN: ld64.lld.darwinold -arch x86_64  %s %p/Inputs/x86_64/libSystem.yaml -dylib -o %t3
8# RUN: llvm-nm -m -n %t3 | FileCheck %s
9#
10# RUN: ld64.lld.darwinold -arch x86_64  %s %p/Inputs/x86_64/libSystem.yaml -bundle -o %t4
11# RUN: llvm-nm -m -n %t4 | FileCheck %s
12#
13# Test that ___dso_handle symbol is available for executables, bundles, and dylibs
14#
15
16--- !mach-o
17arch:            x86_64
18file-type:       MH_OBJECT
19flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
20sections:
21  - segment:         __TEXT
22    section:         __text
23    type:            S_REGULAR
24    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
25    address:         0x0000000000000000
26    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x31, 0xC0, 0x5D, 0xC3 ]
27  - segment:         __DATA
28    section:         __data
29    type:            S_REGULAR
30    attributes:      [  ]
31    alignment:       8
32    address:         0x0000000000000008
33    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
34    relocations:
35      - offset:          0x00000000
36        type:            X86_64_RELOC_UNSIGNED
37        length:          3
38        pc-rel:          false
39        extern:          true
40        symbol:          2
41global-symbols:
42  - name:            _d
43    type:            N_SECT
44    scope:           [ N_EXT ]
45    sect:            2
46    value:           0x0000000000000008
47  - name:            _main
48    type:            N_SECT
49    scope:           [ N_EXT ]
50    sect:            1
51    value:           0x0000000000000000
52undefined-symbols:
53  - name:            ___dso_handle
54    type:            N_UNDF
55    scope:           [ N_EXT ]
56    value:           0x0000000000000000
57
58
59...
60
61# CHECK_NOT:	___dso_handle
62# CHECK:      _main
63