1# RUN: ld64.lld -arch x86_64 -r -print_atoms %s -o %t  | FileCheck %s
2#
3# Test parsing of literal sections.
4#
5
6--- !mach-o
7arch:            x86_64
8file-type:       MH_OBJECT
9flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
10has-UUID:        false
11OS:              unknown
12sections:
13  - segment:         __TEXT
14    section:         __text
15    type:            S_REGULAR
16    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
17    address:         0x0000000000000000
18    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3, 0x55, 0x48,
19                       0x89, 0xE5, 0x5D, 0xC3, 0x55, 0x48, 0x89, 0xE5,
20                       0x5D, 0xC3 ]
21  - segment:         __DATA
22    section:         __mod_init_func
23    type:            S_MOD_INIT_FUNC_POINTERS
24    attributes:      [  ]
25    alignment:       1
26    address:         0x0000000000000100
27    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
29    relocations:
30      - offset:          0x00000000
31        type:            X86_64_RELOC_UNSIGNED
32        length:          3
33        pc-rel:          false
34        extern:          true
35        symbol:          0
36      - offset:          0x00000008
37        type:            X86_64_RELOC_UNSIGNED
38        length:          3
39        pc-rel:          false
40        extern:          true
41        symbol:          1
42  - segment:         __DATA
43    section:         __mod_term_func
44    type:            S_MOD_TERM_FUNC_POINTERS
45    attributes:      [  ]
46    alignment:       8
47    address:         0x0000000000000108
48    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
49    relocations:
50      - offset:          0x00000000
51        type:            X86_64_RELOC_UNSIGNED
52        length:          3
53        pc-rel:          false
54        extern:          true
55        symbol:          2
56global-symbols:
57  - name:            _init
58    type:            N_SECT
59    scope:           [ N_EXT ]
60    sect:            1
61    value:           0x0000000000000000
62  - name:            _init2
63    type:            N_SECT
64    scope:           [ N_EXT ]
65    sect:            1
66    value:           0x0000000000000006
67  - name:            _term
68    type:            N_SECT
69    scope:           [ N_EXT ]
70    sect:            1
71    value:           0x000000000000000C
72...
73
74
75# CHECK:defined-atoms:
76# CHECK:  - type:            initializer-pointer
77# CHECK:    content:         [ 00, 00, 00, 00, 00, 00, 00, 00 ]
78# CHECK:    dead-strip:      never
79# CHECK:     references:
80# CHECK:       - kind:        pointer64
81# CHECK:         offset:      0
82# CHECK:         target:      _init
83# CHECK:  - type:            initializer-pointer
84# CHECK:    content:         [ 00, 00, 00, 00, 00, 00, 00, 00 ]
85# CHECK:    dead-strip:      never
86# CHECK:     references:
87# CHECK:       - kind:        pointer64
88# CHECK:         offset:      0
89# CHECK:         target:      _init2
90# CHECK:  - type:            terminator-pointer
91# CHECK:    content:         [ 00, 00, 00, 00, 00, 00, 00, 00 ]
92# CHECK:    dead-strip:      never
93# CHECK:     references:
94# CHECK:       - kind:        pointer64
95# CHECK:         offset:      0
96# CHECK:         target:      _term
97# CHECK:  - name:            _init
98# CHECK:    scope:           global
99# CHECK:    content:         [ 55, 48, 89, E5, 5D, C3 ]
100# CHECK:  - name:            _init2
101# CHECK:    scope:           global
102# CHECK:    content:         [ 55, 48, 89, E5, 5D, C3 ]
103# CHECK:  - name:            _term
104# CHECK:    scope:           global
105# CHECK:    content:         [ 55, 48, 89, E5, 5D, C3 ]
106