1# RUN: ld64.lld.darwinold -arch i386 -r -print_atoms %s -o %t  | FileCheck %s
2#
3# Test parsing of mach-o functions.
4#
5
6--- !mach-o
7arch:            x86
8file-type:       MH_OBJECT
9flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
10has-UUID:        false
11OS:              unknown
12sections:
13  - segment:         __TEXT
14    section:         __cstring
15    type:            S_CSTRING_LITERALS
16    attributes:      [  ]
17    address:         0x0000000000000000
18    content:         [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x00, 0x74, 0x68,
19                       0x65, 0x72, 0x65, 0x00 ]
20  - segment:         __DATA
21    section:         __cfstring
22    type:            S_REGULAR
23    attributes:      [  ]
24    alignment:       8
25    address:         0x0000000000000010
26    content:         [ 0x00, 0x00, 0x00, 0x00, 0xC8, 0x07, 0x00, 0x00,
27                       0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
28                       0x00, 0x00, 0x00, 0x00, 0xC8, 0x07, 0x00, 0x00,
29                       0x06, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 ]
30    relocations:
31      - offset:          0x00000018
32        type:            GENERIC_RELOC_VANILLA
33        length:          2
34        pc-rel:          false
35        extern:          false
36        symbol:          1
37      - offset:          0x00000010
38        type:            GENERIC_RELOC_VANILLA
39        length:          2
40        pc-rel:          false
41        extern:          true
42        symbol:          0
43      - offset:          0x00000008
44        type:            GENERIC_RELOC_VANILLA
45        length:          2
46        pc-rel:          false
47        extern:          false
48        symbol:          1
49      - offset:          0x00000000
50        type:            GENERIC_RELOC_VANILLA
51        length:          2
52        pc-rel:          false
53        extern:          true
54        symbol:          0
55undefined-symbols:
56  - name:            ___CFConstantStringClassReference
57    type:            N_UNDF
58    scope:           [ N_EXT ]
59    value:           0x0000000000000000
60...
61
62# CHECK: defined-atoms:
63# CHECK:  - ref-name:        [[STR1:L[L0-9]+]]
64# CHECK:    scope:           hidden
65# CHECK:    type:            c-string
66# CHECK:    content:         [ 68, 65, 6C, 6C, 6F, 00 ]
67# CHECK:    merge:           by-content
68# CHECK:  - ref-name:        [[STR2:L[L0-9]+]]
69# CHECK:    scope:           hidden
70# CHECK:    type:            c-string
71# CHECK:    content:         [ 74, 68, 65, 72, 65, 00 ]
72# CHECK:    merge:           by-content
73# CHECK:  - scope:           hidden
74# CHECK:    type:            cfstring
75# CHECK:    merge:           by-content
76# CHECK:    references:
77# CHECK:        - kind:            pointer32
78# CHECK:          offset:          0
79# CHECK:          target:          ___CFConstantStringClassReference
80# CHECK:        - kind:            pointer32
81# CHECK:          offset:          8
82# CHECK:          target:          [[STR1]]
83# CHECK:  - scope:           hidden
84# CHECK:    type:            cfstring
85# CHECK:    merge:           by-content
86# CHECK:    references:
87# CHECK:        - kind:            pointer32
88# CHECK:          offset:          0
89# CHECK:          target:          ___CFConstantStringClassReference
90# CHECK:        - kind:            pointer32
91# CHECK:          offset:          8
92# CHECK:          target:          [[STR2]]
93# CHECK:undefined-atoms:
94# CHECK:  - name:            ___CFConstantStringClassReference
95