1# RUN: ld64.lld -arch x86_64 -r -print_atoms %s -o %t  | FileCheck %s
2#
3# Test parsing of __LD/__compact_unwind (compact 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    alignment:       4
18    address:         0x0000000000000000
19    content:         [ 0x55, 0x48, 0x89, 0xE5, 0xB8, 0x0A, 0x00, 0x00,
20                       0x00, 0x5D, 0xC3, 0x55, 0x48, 0x89, 0xE5, 0xB8,
21                       0x0A, 0x00, 0x00, 0x00, 0x5D, 0xC3 ]
22  - segment:         __LD
23    section:         __compact_unwind
24    type:            S_REGULAR
25    attributes:      [  ]
26    alignment:       8
27    address:         0x0000000000000020
28    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29                       0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
30                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32                       0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33                       0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
34                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
36    relocations:
37      - offset:          0x00000020
38        type:            X86_64_RELOC_UNSIGNED
39        length:          3
40        pc-rel:          false
41        extern:          false
42        symbol:          1
43      - offset:          0x00000000
44        type:            X86_64_RELOC_UNSIGNED
45        length:          3
46        pc-rel:          false
47        extern:          false
48        symbol:          1
49global-symbols:
50  - name:            __Z3barv
51    type:            N_SECT
52    scope:           [ N_EXT ]
53    sect:            1
54    value:           0x0000000000000000
55  - name:            __Z3foov
56    type:            N_SECT
57    scope:           [ N_EXT ]
58    sect:            1
59    value:           0x000000000000000B
60...
61
62# CHECK: defined-atoms:
63# CHECK:   - type:            compact-unwind
64# CHECK:     content:         [ 00, 00, 00, 00, 00, 00, 00, 00, 0B, 00, 00, 00,
65# CHECK:                        00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00,
66# CHECK:                        00, 00, 00, 00, 00, 00, 00, 00 ]
67# CHECK:   - type:            compact-unwind
68# CHECK:     content:         [ 10, 00, 00, 00, 00, 00, 00, 00, 0B, 00, 00, 00,
69# CHECK:                        00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00,
70# CHECK:                        00, 00, 00, 00, 00, 00, 00, 00 ]
71# CHECK:   - name:            __Z3barv
72# CHECK:     scope:           global
73# CHECK:     content:         [ 55, 48, 89, E5, B8, 0A, 00, 00, 00, 5D, C3 ]
74# CHECK:   - name:            __Z3foov
75# CHECK:     scope:           global
76# CHECK:     content:         [ 55, 48, 89, E5, B8, 0A, 00, 00, 00, 5D, C3 ]
77