1# RUN: ld64.lld -arch armv7 -r -print_atoms %s -o %t  | FileCheck %s
2# RUN: ld64.lld -arch armv7 -r -print_atoms %t -o %t2  | FileCheck %s
3# RUN: ld64.lld -arch armv7 -dylib %s -o %t3.dylib %p/Inputs/armv7/libSystem.yaml \
4# RUN:   && llvm-objdump --macho --private-headers %t3.dylib | FileCheck --check-prefix=CHECK2 %s
5#
6# Test parsing LC_DATA_IN_CODE
7#
8#
9
10--- !mach-o
11arch:            armv7
12file-type:       MH_OBJECT
13flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
14sections:
15  - segment:         __TEXT
16    section:         __text
17    type:            S_REGULAR
18    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
19    alignment:       2
20    address:         0x0000000000000000
21    content:         [ 0x00, 0xBF, 0x00, 0xBF, 0x00, 0x00, 0x00, 0x00,
22                       0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
23                       0x03, 0x00, 0x00, 0x00, 0x00, 0xBF, 0x00, 0xBF,
24                       0x00, 0xF0, 0x20, 0xE3, 0x0A, 0x00, 0x00, 0x00,
25                       0x0B, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00,
26                       0x0D, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x20, 0xE3 ]
27local-symbols:
28  - name:            _foo_thumb
29    type:            N_SECT
30    sect:            1
31    desc:            [ N_ARM_THUMB_DEF ]
32    value:           0x0000000000000000
33  - name:            _foo_arm
34    type:            N_SECT
35    sect:            1
36    value:           0x0000000000000018
37dataInCode:
38  - offset:          0x00000004
39    length:          0x0004
40    kind:            DICE_KIND_DATA
41  - offset:          0x00000008
42    length:          0x0004
43    kind:            DICE_KIND_JUMP_TABLE32
44  - offset:          0x0000000C
45    length:          0x0004
46    kind:            DICE_KIND_JUMP_TABLE16
47  - offset:          0x00000010
48    length:          0x0004
49    kind:            DICE_KIND_JUMP_TABLE8
50  - offset:          0x0000001C
51    length:          0x0004
52    kind:            DICE_KIND_DATA
53  - offset:          0x00000020
54    length:          0x0004
55    kind:            DICE_KIND_JUMP_TABLE32
56  - offset:          0x00000024
57    length:          0x0004
58    kind:            DICE_KIND_JUMP_TABLE16
59  - offset:          0x00000028
60    length:          0x0004
61    kind:            DICE_KIND_JUMP_TABLE8
62...
63
64
65
66# CHECK: defined-atoms:
67# CHECK:   - name:            _foo_thumb
68# CHECK:     references:
69# CHECK:       - kind:            modeThumbCode
70# CHECK:         offset:          0
71# CHECK:       - kind:            modeData
72# CHECK:         offset:          4
73# CHECK:         addend:          1
74# CHECK:       - kind:            modeData
75# CHECK:         offset:          8
76# CHECK:         addend:          4
77# CHECK:       - kind:            modeData
78# CHECK:         offset:          12
79# CHECK:         addend:          3
80# CHECK:       - kind:            modeData
81# CHECK:         offset:          16
82# CHECK:         addend:          2
83# CHECK:       - kind:            modeThumbCode
84# CHECK:         offset:          20
85# CHECK:   - name:            _foo_arm
86# CHECK:     references:
87# CHECK:       - kind:            modeData
88# CHECK:         offset:          4
89# CHECK:         addend:          1
90# CHECK:       - kind:            modeData
91# CHECK:         offset:          8
92# CHECK:         addend:          4
93# CHECK:       - kind:            modeData
94# CHECK:         offset:          12
95# CHECK:         addend:          3
96# CHECK:       - kind:            modeData
97# CHECK:         offset:          16
98# CHECK:         addend:          2
99# CHECK:       - kind:            modeArmCode
100# CHECK:         offset:          20
101
102
103# CHECK2:      cmd LC_DATA_IN_CODE
104# CHECK2:  cmdsize 16
105# CHECK2: datasize 64
106
107
108#	.code	16
109#  .thumb_func	_foo_thumb
110#_foo_thumb:
111# nop
112# nop
113#
114#	.data_region
115#  .long 0
116#	.end_data_region
117#
118#	.data_region jt32
119#  .long 1
120#	.end_data_region
121#
122#	.data_region jt16
123#  .long 2
124#	.end_data_region
125#
126#	.data_region jt8
127#  .long 3
128#	.end_data_region
129#
130#  nop
131#  nop
132#
133#
134#
135#	.code	32
136#  .align 2
137#_foo_arm:
138#  nop
139#
140#	.data_region
141#  .long 10
142#	.end_data_region
143#
144#	.data_region jt32
145#  .long 11
146#	.end_data_region
147#
148#	.data_region jt16
149#  .long 12
150#	.end_data_region
151#
152#	.data_region jt8
153#  .long 13
154#	.end_data_region
155#
156#  nop
157#
158