1# RUN: ld64.lld -arch i386 -r -print_atoms %s -o %t  | FileCheck %s
2#
3# Test parsing of new __eh_frame (dwarf unwind) section that has no .eh labels
4# and no relocations.
5#
6
7--- !mach-o
8arch:            x86
9file-type:       MH_OBJECT
10flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
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, 0x89, 0xE5, 0x56, 0x83, 0xEC, 0x14, 0xE8,
19                       0x00, 0x00, 0x00, 0x00, 0x5E, 0xC7, 0x04, 0x24,
20                       0x04, 0x00, 0x00, 0x00, 0xE8, 0xE7, 0xFF, 0xFF,
21                       0xFF, 0xC7, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x8B,
22                       0x8E, 0x38, 0x00, 0x00, 0x00, 0x89, 0x4C, 0x24,
23                       0x04, 0x89, 0x04, 0x24, 0xC7, 0x44, 0x24, 0x08,
24                       0x00, 0x00, 0x00, 0x00, 0xE8, 0xC7, 0xFF, 0xFF,
25                       0xFF, 0x55, 0x89, 0xE5, 0x83, 0xEC, 0x08, 0xE8,
26                       0xBC, 0xFF, 0xFF, 0xFF ]
27    relocations:
28      - offset:          0x00000040
29        type:            GENERIC_RELOC_VANILLA
30        length:          2
31        pc-rel:          true
32        extern:          false
33        symbol:          1
34      - offset:          0x00000035
35        type:            GENERIC_RELOC_VANILLA
36        length:          2
37        pc-rel:          true
38        extern:          true
39        symbol:          4
40      - offset:          0x00000021
41        scattered:       true
42        type:            GENERIC_RELOC_LOCAL_SECTDIFF
43        length:          2
44        pc-rel:          false
45        value:           0x00000044
46      - offset:          0x00000000
47        scattered:       true
48        type:            GENERIC_RELOC_PAIR
49        length:          2
50        pc-rel:          false
51        value:           0x0000000C
52      - offset:          0x00000015
53        type:            GENERIC_RELOC_VANILLA
54        length:          2
55        pc-rel:          true
56        extern:          true
57        symbol:          3
58  - segment:         __IMPORT
59    section:         __pointers
60    type:            S_NON_LAZY_SYMBOL_POINTERS
61    attributes:      [  ]
62    address:         0x0000000000000044
63    content:         [ 0x00, 0x00, 0x00, 0x00 ]
64    indirect-syms:   [ 5 ]
65  - segment:         __TEXT
66    section:         __eh_frame
67    type:            S_REGULAR
68    attributes:      [  ]
69    alignment:       2
70    address:         0x0000000000000048
71    content:         [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72                       0x01, 0x7A, 0x52, 0x00, 0x01, 0x7C, 0x08, 0x01,
73                       0x10, 0x0C, 0x05, 0x04, 0x88, 0x01, 0x00, 0x00,
74                       0x18, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
75                       0x98, 0xFF, 0xFF, 0xFF, 0x39, 0x00, 0x00, 0x00,
76                       0x00, 0x41, 0x0E, 0x08, 0x84, 0x02, 0x42, 0x0D,
77                       0x04, 0x44, 0x86, 0x03, 0x18, 0x00, 0x00, 0x00,
78                       0x38, 0x00, 0x00, 0x00, 0xB5, 0xFF, 0xFF, 0xFF,
79                       0x0B, 0x00, 0x00, 0x00, 0x00, 0x41, 0x0E, 0x08,
80                       0x84, 0x02, 0x42, 0x0D, 0x04, 0x00, 0x00, 0x00 ]
81global-symbols:
82  - name:            __Z3barv
83    type:            N_SECT
84    scope:           [ N_EXT ]
85    sect:            1
86    value:           0x0000000000000039
87  - name:            __Z3foov
88    type:            N_SECT
89    scope:           [ N_EXT ]
90    sect:            1
91    value:           0x0000000000000000
92undefined-symbols:
93  - name:            __ZTIi
94    type:            N_UNDF
95    scope:           [ N_EXT ]
96    value:           0x0000000000000000
97  - name:            ___cxa_allocate_exception
98    type:            N_UNDF
99    scope:           [ N_EXT ]
100    value:           0x0000000000000000
101  - name:            ___cxa_throw
102    type:            N_UNDF
103    scope:           [ N_EXT ]
104    value:           0x0000000000000000
105...
106
107# CHECK: defined-atoms:
108# CHECK:   - ref-name:        [[CIE:L[L0-9]+]]
109# CHECK:     type:            unwind-cfi
110# CHECK:     content:
111# CHECK:   - type:            unwind-cfi
112# CHECK:     content:
113# CHECK:     references:
114# CHECK:       - kind:            negDelta32
115# CHECK:         offset:          4
116# CHECK:         target:          [[CIE]]
117# CHECK:       - kind:            delta32
118# CHECK:         offset:          8
119# CHECK:         target:          __Z3foov
120# CHECK:   - type:            unwind-cfi
121# CHECK:     content:
122# CHECK:     references:
123# CHECK:       - kind:            negDelta32
124# CHECK:         offset:          4
125# CHECK:         target:          [[CIE]]
126# CHECK:       - kind:            delta32
127# CHECK:         offset:          8
128# CHECK:         target:          __Z3barv
129
130