1# RUN: ld64.lld.darwinold -arch x86_64 %s -o %t -e _main %p/Inputs/x86_64/libSystem.yaml
2# RUN: llvm-objdump --unwind-info %t | FileCheck %s
3
4# CHECK: Contents of __unwind_info section:
5# CHECK:   Version:                                   0x1
6# CHECK:   Common encodings array section offset:     0x1c
7# CHECK:   Number of common encodings in array:       0x0
8# CHECK:   Personality function array section offset: 0x1c
9# CHECK:   Number of personality functions in array:  0x1
10# CHECK:   Index array section offset:                0x20
11# CHECK:   Number of indices in array:                0x2
12# CHECK:   Common encodings: (count = 0)
13# CHECK:   Personality functions: (count = 1)
14# CHECK:     personality[1]: 0x00001000
15# CHECK:   Top level indices: (count = 2)
16# CHECK:     [0]: function offset=0x00000efb, 2nd level page offset=0x00000040, LSDA offset=0x00000038
17# CHECK:     [1]: function offset=0x00000f00, 2nd level page offset=0x00000000, LSDA offset=0x00000040
18# CHECK:   LSDA descriptors:
19# CHECK:     [0]: function offset=0x00000efb, LSDA offset=0x00000f00
20# CHECK:   Second level indices:
21# CHECK:     Second level index[0]: offset in section=0x00000040, base function offset=0x00000efb
22# CHECK:       [0]: function offset=0x00000efb, encoding=0x51000000
23# CHECK:       [1]: function offset=0x00000efc, encoding=0x01000000
24# CHECK:       [2]: function offset=0x00000efd, encoding=0x04000018
25# CHECK:       [3]: function offset=0x00000efe, encoding=0x04000040
26# CHECK:       [4]: function offset=0x00000eff, encoding=0x00000000
27# CHECK-NOT: Contents of __compact_unwind section
28
29--- !native
30path:            '<linker-internal>'
31defined-atoms:
32  - name:            GCC_except_table1
33    type:            unwind-lsda
34    content:         [ FF, 9B, A2, 80, 80, 00, 03, 1A, 08, 00, 00, 00,
35                       05, 00, 00, 00, 1A, 00, 00, 00, 01, 0D, 00, 00,
36                       00, 64, 00, 00, 00, 00, 00, 00, 00, 00, 01, 00,
37                       04, 00, 00, 00 ]
38  - type:            compact-unwind
39    content:         [ 40, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00,
40                       00, 00, 00, 41, 00, 00, 00, 00, 00, 00, 00, 00,
41                       E0, 00, 00, 00, 00, 00, 00, 00 ]
42    references:
43      - kind:            pointer64Anon
44        offset:          0
45        target:          __Z3barv
46      - kind:            pointer64
47        offset:          16
48        target:          ___gxx_personality_v0
49      - kind:            pointer64Anon
50        offset:          24
51        target:          GCC_except_table1
52  - type:            compact-unwind
53    content:         [ C0, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00,
54                       00, 00, 00, 01, 00, 00, 00, 00, 00, 00, 00, 00,
55                       00, 00, 00, 00, 00, 00, 00, 00 ]
56    references:
57      - kind:            pointer64Anon
58        offset:          0
59        target:          _main
60  - type:            compact-unwind
61    content:         [ C1, 00, 00, 00, 00, 00, 00, 00, 01, 00, 00, 00,
62                       00, 00, 00, 04, 00, 00, 00, 00, 00, 00, 00, 00,
63                       00, 00, 00, 00, 00, 00, 00, 00 ]
64    references:
65      - kind:            pointer64Anon
66        offset:          0
67        target:          _needsDwarfButNoCompactUnwind
68
69# Generic x86_64 CIE:
70  - name:            LCIE
71    type:            unwind-cfi
72    content:         [ 14, 00, 00, 00, 00, 00, 00, 00, 01, 7A, 52, 00,
73                       01, 78, 10, 01, 10, 0C, 07, 08, 90, 01, 00, 00 ]
74
75  - type:            unwind-cfi
76    content:         [ 24, 00, 00, 00, 1C, 00, 00, 00, C8, FE, FF, FF,
77                       FF, FF, FF, FF, 01, 00, 00, 00, 00, 00, 00, 00,
78                       00, 41, 0E, 10, 86, 02, 43, 0D, 06, 00, 00, 00,
79                       00, 00, 00, 00 ]
80    references:
81      - kind:            unwindFDEToFunction
82        offset:          8
83        target:          _needsDwarfButNoCompactUnwind
84      - kind:            negDelta32
85        offset:          4
86        target:          LCIE
87
88  - type:            unwind-cfi
89    content:         [ 24, 00, 00, 00, 44, 00, 00, 00, C8, FE, FF, FF,
90                       FF, FF, FF, FF, 01, 00, 00, 00, 00, 00, 00, 00,
91                       00, 41, 0E, 10, 86, 02, 43, 0D, 06, 00, 00, 00,
92                       00, 00, 00, 00 ]
93    references:
94      - kind:            unwindFDEToFunction
95        offset:          8
96        target:          _needsDwarfSaysCompactUnwind
97      - kind:            negDelta32
98        offset:          4
99        target:          LCIE
100
101  - type:            unwind-cfi
102    content:         [ 24, 00, 00, 00, 6C, 00, 00, 00, C8, FE, FF, FF,
103                       FF, FF, FF, FF, 01, 00, 00, 00, 00, 00, 00, 00,
104                       00, 41, 0E, 10, 86, 02, 43, 0D, 06, 00, 00, 00,
105                       00, 00, 00, 00 ]
106    references:
107      - kind:            unwindFDEToFunction
108        offset:          8
109        target:          _main
110      - kind:            negDelta32
111        offset:          4
112        target:          LCIE
113
114  - name:            __Z3barv
115    scope:           global
116    content:         [ C3 ]
117  - name:            _main
118    scope:           global
119    content:         [ C3 ]
120  - name:            _needsDwarfButNoCompactUnwind
121    scope:           global
122    content:         [ C3 ]
123  - name:            _needsDwarfSaysCompactUnwind
124    scope:           global
125    content:         [ C3 ]
126  - name:            _noUnwindData
127    scope:           global
128    content:         [ C3 ]
129
130shared-library-atoms:
131  - name:            ___gxx_personality_v0
132    load-name:       '/usr/lib/libc++abi.dylib'
133    type:            unknown
134