1# RUN: ld64.lld.darwinold -arch arm64 -r %s -o %t
2# RUN: ld64.lld.darwinold -arch arm64 -r %t -o %t2
3# RUN: llvm-objdump -s --section="__eh_frame" %t | FileCheck %s
4# RUN: llvm-objdump -s --section="__eh_frame" %t2 | FileCheck %s
5
6# The reference from FDE->CIE is implicitly created as a negDelta32.
7# We don't emit these in to the binary as relocations, so we need to
8# make sure that the offset in the FDE to the CIE is the correct value.
9# CHECK: {{[0-9abcdef]*}} 10000000 00000000 017a5200 01781e01
10# CHECK: {{[0-9abcdef]*}} 100c1f00 20000000 18000000 b8ffffff
11# Note, this one that matters               ^~~~~~~~
12# It needs to be 0x18 as that is the offset back to 0 where the CIE is.
13# CHECK: {{[0-9abcdef]*}} ffffffff 20000000 00000000 00480e10
14# CHECK: {{[0-9abcdef]*}} 9e019d02 00000000
15
16---  !mach-o
17arch:            arm64
18file-type:       MH_OBJECT
19flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
20compat-version:  0.0
21current-version: 0.0
22has-UUID:        false
23OS:              unknown
24sections:
25  - segment:         __TEXT
26    section:         __text
27    type:            S_REGULAR
28    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
29    alignment:       4
30    address:         0x0000000000000000
31    content:         [ 0xFD, 0x7B, 0xBF, 0xA9, 0xFD, 0x03, 0x00, 0x91,
32                       0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x91,
33                       0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x80, 0x52,
34                       0xFD, 0x7B, 0xC1, 0xA8, 0xC0, 0x03, 0x5F, 0xD6 ]
35    relocations:
36      - offset:          0x00000010
37        type:            ARM64_RELOC_BRANCH26
38        length:          2
39        pc-rel:          true
40        extern:          true
41        symbol:          6
42      - offset:          0x0000000C
43        type:            ARM64_RELOC_PAGEOFF12
44        length:          2
45        pc-rel:          false
46        extern:          true
47        symbol:          1
48      - offset:          0x00000008
49        type:            ARM64_RELOC_PAGE21
50        length:          2
51        pc-rel:          true
52        extern:          true
53        symbol:          1
54  - segment:         __TEXT
55    section:         __cstring
56    type:            S_CSTRING_LITERALS
57    attributes:      [  ]
58    address:         0x0000000000000020
59    content:         [ 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F,
60                       0x72, 0x6C, 0x64, 0x00 ]
61  - segment:         __LD
62    section:         __compact_unwind
63    type:            S_REGULAR
64    attributes:      [  ]
65    alignment:       8
66    address:         0x0000000000000030
67    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68                       0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
69                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
71    relocations:
72      - offset:          0x00000000
73        type:            ARM64_RELOC_UNSIGNED
74        length:          3
75        pc-rel:          false
76        extern:          false
77        symbol:          1
78  - segment:         __TEXT
79    section:         __eh_frame
80    type:            S_COALESCED
81    attributes:      [  ]
82    alignment:       8
83    address:         0x0000000000000050
84    content:         [ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85                       0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x1E, 0x01,
86                       0x10, 0x0C, 0x1F, 0x00, 0x20, 0x00, 0x00, 0x00,
87                       0x18, 0x00, 0x00, 0x00, 0x94, 0xFF, 0xFF, 0xFF,
88                       0xFF, 0xFF, 0xFF, 0xFF, 0x20, 0x00, 0x00, 0x00,
89                       0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x0E, 0x10,
90                       0x9E, 0x01, 0x9D, 0x02, 0x00, 0x00, 0x00, 0x00 ]
91local-symbols:
92  - name:            ltmp0
93    type:            N_SECT
94    sect:            1
95    value:           0x0000000000000000
96  - name:            L_str
97    type:            N_SECT
98    sect:            2
99    value:           0x0000000000000020
100  - name:            ltmp1
101    type:            N_SECT
102    sect:            2
103    value:           0x0000000000000020
104  - name:            ltmp2
105    type:            N_SECT
106    sect:            3
107    value:           0x0000000000000030
108  - name:            ltmp3
109    type:            N_SECT
110    sect:            4
111    value:           0x0000000000000050
112global-symbols:
113  - name:            __Z3fooi
114    type:            N_SECT
115    scope:           [ N_EXT ]
116    sect:            1
117    value:           0x0000000000000000
118undefined-symbols:
119  - name:            _puts
120    type:            N_UNDF
121    scope:           [ N_EXT ]
122    value:           0x0000000000000000
123page-size:       0x00000000
124...
125