1# RUN: ld64.lld -arch x86_64 -r -print_atoms %s -o %t  | FileCheck %s
2#
3# Test parsing of __eh_frame (dwarf unwind) section.
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, 0xB8, 0x09, 0x00, 0x00,
19                       0x00, 0x5D, 0xC3, 0x55, 0x48, 0x89, 0xE5, 0xB8,
20                       0x0A, 0x00, 0x00, 0x00, 0x5D, 0xC3 ]
21  - segment:         __TEXT
22    section:         __eh_frame
23    type:            S_COALESCED
24    attributes:      [  ]
25    alignment:       8
26    address:         0x0000000000000058
27    content:         [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28                       0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01,
29                       0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00,
30                       0x24, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
31                       0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
32                       0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33                       0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
34                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35                       0x24, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
36                       0x6B, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
37                       0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38                       0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
39                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
40global-symbols:
41  - name:            __Z3barv
42    type:            N_SECT
43    scope:           [ N_EXT ]
44    sect:            1
45    value:           0x0000000000000000
46  - name:            __Z3foov
47    type:            N_SECT
48    scope:           [ N_EXT ]
49    sect:            1
50    value:           0x000000000000000B
51...
52
53# CHECK: defined-atoms:
54# CHECK:   - ref-name:        [[CIE:L[0-9]+]]
55# CHECK:     type:            unwind-cfi
56# CHECK:     content:         [ 14, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 52, 00,
57# CHECK:                        01, 78, 10, 01, 10, 0C, 07, 08, 90, 01, 00, 00 ]
58# CHECK:   - type:            unwind-cfi
59# CHECK:     content:         [ 24, 00, 00, 00, 1C, 00, 00, 00, 88, FF, FF, FF,
60# CHECK:                        FF, FF, FF, FF, 0B, 00, 00, 00, 00, 00, 00, 00,
61# CHECK:                        00, 41, 0E, 10, 86, 02, 43, 0D, 06, 00, 00, 00,
62# CHECK:                        00, 00, 00, 00 ]
63# CHECK:     references:
64# CHECK:       - kind:            negDelta32
65# CHECK:         offset:          4
66# CHECK:         target:          [[CIE]]
67# CHECK:       - kind:            unwindFDEToFunction
68# CHECK:         offset:          8
69# CHECK:         target:          __Z3barv
70# CHECK:   - type:            unwind-cfi
71# CHECK:     content:         [ 24, 00, 00, 00, 44, 00, 00, 00, 6B, FF, FF, FF,
72# CHECK:                        FF, FF, FF, FF, 0B, 00, 00, 00, 00, 00, 00, 00,
73# CHECK:                        00, 41, 0E, 10, 86, 02, 43, 0D, 06, 00, 00, 00,
74# CHECK:                        00, 00, 00, 00 ]
75# CHECK:     references:
76# CHECK:       - kind:            negDelta32
77# CHECK:         offset:          4
78# CHECK:         target:          [[CIE]]
79# CHECK:       - kind:            unwindFDEToFunction
80# CHECK:         offset:          8
81# CHECK:         target:          __Z3foov
82# CHECK:   - name:            __Z3barv
83# CHECK:     scope:           global
84# CHECK:     content:         [ 55, 48, 89, E5, B8, 09, 00, 00, 00, 5D, C3 ]
85# CHECK:   - name:            __Z3foov
86# CHECK:     scope:           global
87# CHECK:     content:         [ 55, 48, 89, E5, B8, 0A, 00, 00, 00, 5D, C3 ]
88
89