Rename CODE_OWNERS -> Maintainers (#114544)
[llvm-project.git] / lld / test / COFF / arm64-relocs-imports.test
blobda2fd1f941d8af2b0b89a30de990a28225231e62
1 # REQUIRES: aarch64
3 # RUN: yaml2obj %s -o %t.obj
4 # RUN: llvm-objdump --no-print-imm-hex -d %t.obj | FileCheck %s --check-prefix BEFORE
5 # RUN: lld-link /entry:main /subsystem:console /out:%t.exe %t.obj %p/Inputs/library-arm64.lib
6 # RUN: llvm-objdump --no-print-imm-hex -d %t.exe | FileCheck %s --check-prefix AFTER
8 # BEFORE: Disassembly of section .text:
9 # BEFORE-EMPTY:
10 # BEFORE:        0:       f81f0ffe        str     x30, [sp, #-16]!
11 # BEFORE:        4:       90000000        adrp    x0, 0x0
12 # BEFORE:        8:       91000800        add     x0, x0, #2
13 # BEFORE:        c:       94000000        bl      0xc
14 # BEFORE:       10:       39400100        ldrb    w0, [x8]
15 # BEFORE:       14:       79400100        ldrh    w0, [x8]
16 # BEFORE:       18:       b9400100        ldr     w0, [x8]
17 # BEFORE:       1c:       f9400100        ldr     x0, [x8]
18 # BEFORE:       20:       39000100        strb    w0, [x8]
19 # BEFORE:       24:       79000100        strh    w0, [x8]
20 # BEFORE:       28:       b9000100        str     w0, [x8]
21 # BEFORE:       2c:       f9000100        str     x0, [x8]
22 # BEFORE:       30:       3d400100        ldr     b0, [x8]
23 # BEFORE:       34:       7d400100        ldr     h0, [x8]
24 # BEFORE:       38:       bd400100        ldr     s0, [x8]
25 # BEFORE:       3c:       fd400100        ldr     d0, [x8]
26 # BEFORE:       40:       3dc00100        ldr     q0, [x8]
27 # BEFORE:       44:       3d000100        str     b0, [x8]
28 # BEFORE:       48:       7d000100        str     h0, [x8]
29 # BEFORE:       4c:       bd000100        str     s0, [x8]
30 # BEFORE:       50:       fd000100        str     d0, [x8]
31 # BEFORE:       54:       3d800100        str     q0, [x8]
32 # BEFORE:       58:       f9400500        ldr     x0, [x8, #8]
33 # BEFORE:       5c:       b0011a20        adrp    x0, 0x2345000
34 # BEFORE:       60:       f94ffc00        ldr     x0, [x0, #8184]
35 # BEFORE:       64:       2a1f03e0        mov      w0, wzr
36 # BEFORE:       68:       f84107fe        ldr     x30, [sp], #16
37 # BEFORE:       6c:       d65f03c0        ret
38 # BEFORE:       70:       00000008        udf #8
39 # BEFORE:       74:       00000000        udf #0
40 # BEFORE:       78:       00000001        udf #1
41 # BEFORE:       7c:       00000001        udf #1
42 # BEFORE:       80:       91000000        add     x0, x0, #0
43 # BEFORE:       84:       91400000        add     x0, x0, #0, lsl #12
44 # BEFORE:       88:       f9400000        ldr     x0, [x0]
45 # BEFORE:       8c:       00000001        udf #1
46 # BEFORE:       90:       30091a20        adr x0, 0x123d5
47 # BEFORE:       94:       54000001        b.ne    0x94
48 # BEFORE:       98:       36000000        tbz     w0, #0, 0x98
49 # BEFORE:       9c:       00000001        udf #1
50 # BEFORE:       a0:       90800002        adrp    x2, 0xffffffff00000000
52 # AFTER: Disassembly of section .text:
53 # AFTER-EMPTY:
54 # AFTER:  140001000:      f81f0ffe        str     x30, [sp, #-16]!
55 # AFTER:  140001004:      b0000000        adrp    x0, 0x140002000
56 # AFTER:  140001008:      91001800        add     x0, x0, #6
57 # AFTER:  14000100c:      94000026        bl      0x1400010a4
58 # AFTER:  140001010:      39402100        ldrb    w0, [x8, #8]
59 # AFTER:  140001014:      79401100        ldrh    w0, [x8, #8]
60 # AFTER:  140001018:      b9400900        ldr     w0, [x8, #8]
61 # AFTER:  14000101c:      f9400500        ldr     x0, [x8, #8]
62 # AFTER:  140001020:      39002100        strb    w0, [x8, #8]
63 # AFTER:  140001024:      79001100        strh    w0, [x8, #8]
64 # AFTER:  140001028:      b9000900        str     w0, [x8, #8]
65 # AFTER:  14000102c:      f9000500        str     x0, [x8, #8]
66 # AFTER:  140001030:      3d404100        ldr     b0, [x8, #16]
67 # AFTER:  140001034:      7d402100        ldr     h0, [x8, #16]
68 # AFTER:  140001038:      bd401100        ldr     s0, [x8, #16]
69 # AFTER:  14000103c:      fd400900        ldr     d0, [x8, #16]
70 # AFTER:  140001040:      3dc00500        ldr     q0, [x8, #16]
71 # AFTER:  140001044:      3d004100        str     b0, [x8, #16]
72 # AFTER:  140001048:      7d002100        str     h0, [x8, #16]
73 # AFTER:  14000104c:      bd001100        str     s0, [x8, #16]
74 # AFTER:  140001050:      fd000900        str     d0, [x8, #16]
75 # AFTER:  140001054:      3d800500        str     q0, [x8, #16]
76 # AFTER:  140001058:      f9400900        ldr     x0, [x8, #16]
77 # AFTER:  14000105c:      f0000000        adrp    x0, 0x140004000
78 # AFTER:  140001060:      f947fc00        ldr     x0, [x0, #4088]
79 # AFTER:  140001064:      2a1f03e0        mov      w0, wzr
80 # AFTER:  140001068:      f84107fe        ldr     x30, [sp], #16
81 # AFTER:  14000106c:      d65f03c0        ret
82 # AFTER:  140001070:      40002010        <unknown>
83 # AFTER:  140001074:      00000001        udf #1
84 # AFTER:  140001078:      00002009        udf #8201
85 # AFTER:  14000107c:      00000009        udf #9
86 # AFTER:  140001080:      910e2000        add     x0, x0, #904
87 # AFTER:  140001084:      91400400        add     x0, x0, #1, lsl #12
88 # AFTER:  140001088:      f941c400        ldr     x0, [x0, #904]
89 # AFTER:  14000108c:      00000003        udf #3
90 # AFTER:  140001090:      300995e0        adr     x0, 0x14001434d
91 # AFTER:  140001094:      54000081        b.ne    0x1400010a4
92 # AFTER:  140001098:      36000060        tbz     w0, #0, 0x1400010a4
93 # AFTER:  14000109c:      ffffff61        <unknown>
94 # AFTER:  1400010a0:      b0fff802        adrp    x2,  0x13ff02000
95 # AFTER:  1400010a4:      b0000010        adrp    x16, 0x140002000
96 # AFTER:  1400010a8:      f9402a10        ldr     x16, [x16, #80]
97 # AFTER:  1400010ac:      d61f0200        br      x16
99 --- !COFF
100 header:
101   Machine:         IMAGE_FILE_MACHINE_ARM64
102   Characteristics: [  ]
103 sections:
104   - Name:            .text
105     Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
106     Alignment:       4
107     SectionData:     FE0F1FF80000009000080091000000940001403900014079000140B9000140F90001003900010079000100B9000100F90001403D0001407D000140BD000140FD0001C03D0001003D0001007D000100BD000100FD0001803D000540F9201A01B000FC4FF9E0031F2AFE0741F8C0035FD6080000000000000001000000010000000000009100004091000040f901000000201a093001000054000000360100000002008090
108     Relocations:
109       - VirtualAddress:  4
110         SymbolName:      .Lstr
111         Type:            IMAGE_REL_ARM64_PAGEBASE_REL21
112       - VirtualAddress:  8
113         SymbolName:      .Lstr
114         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12A
115       - VirtualAddress:  12
116         SymbolName:      function
117         Type:            IMAGE_REL_ARM64_BRANCH26
118       - VirtualAddress:  16
119         SymbolName:      .Lglobal
120         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
121       - VirtualAddress:  20
122         SymbolName:      .Lglobal
123         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
124       - VirtualAddress:  24
125         SymbolName:      .Lglobal
126         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
127       - VirtualAddress:  28
128         SymbolName:      .Lglobal
129         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
130       - VirtualAddress:  32
131         SymbolName:      .Lglobal
132         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
133       - VirtualAddress:  36
134         SymbolName:      .Lglobal
135         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
136       - VirtualAddress:  40
137         SymbolName:      .Lglobal
138         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
139       - VirtualAddress:  44
140         SymbolName:      .Lglobal
141         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
142       - VirtualAddress:  48
143         SymbolName:      .Lglobal16
144         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
145       - VirtualAddress:  52
146         SymbolName:      .Lglobal16
147         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
148       - VirtualAddress:  56
149         SymbolName:      .Lglobal16
150         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
151       - VirtualAddress:  60
152         SymbolName:      .Lglobal16
153         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
154       - VirtualAddress:  64
155         SymbolName:      .Lglobal16
156         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
157       - VirtualAddress:  68
158         SymbolName:      .Lglobal16
159         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
160       - VirtualAddress:  72
161         SymbolName:      .Lglobal16
162         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
163       - VirtualAddress:  76
164         SymbolName:      .Lglobal16
165         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
166       - VirtualAddress:  80
167         SymbolName:      .Lglobal16
168         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
169       - VirtualAddress:  84
170         SymbolName:      .Lglobal16
171         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
172       - VirtualAddress:  88
173         SymbolName:      .Lglobal
174         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
175       - VirtualAddress:  92
176         SymbolName:      .Lglobal16
177         Type:            IMAGE_REL_ARM64_PAGEBASE_REL21
178       - VirtualAddress:  96
179         SymbolName:      .Lglobal0
180         Type:            IMAGE_REL_ARM64_PAGEOFFSET_12L
181       - VirtualAddress:  112
182         SymbolName:      .Lglobal
183         Type:            IMAGE_REL_ARM64_ADDR64
184       - VirtualAddress:  120
185         SymbolName:      .Lglobal
186         Type:            IMAGE_REL_ARM64_ADDR32NB
187       - VirtualAddress:  124
188         SymbolName:      .Lglobal
189         Type:            IMAGE_REL_ARM64_SECREL
190       - VirtualAddress:  128
191         SymbolName:      .Lglobal5000
192         Type:            IMAGE_REL_ARM64_SECREL_LOW12A
193       - VirtualAddress:  132
194         SymbolName:      .Lglobal5000
195         Type:            IMAGE_REL_ARM64_SECREL_HIGH12A
196       - VirtualAddress:  136
197         SymbolName:      .Lglobal5000
198         Type:            IMAGE_REL_ARM64_SECREL_LOW12L
199       - VirtualAddress:  140
200         SymbolName:      .Lglobal
201         Type:            IMAGE_REL_ARM64_SECTION
202       - VirtualAddress:  144
203         SymbolName:      .Lglobal
204         Type:            IMAGE_REL_ARM64_REL21
205       - VirtualAddress:  148
206         SymbolName:      function
207         Type:            IMAGE_REL_ARM64_BRANCH19
208       - VirtualAddress:  152
209         SymbolName:      function
210         Type:            IMAGE_REL_ARM64_BRANCH14
211       - VirtualAddress:  156
212         SymbolName:      main
213         Type:            IMAGE_REL_ARM64_REL32
214       - VirtualAddress:  160
215         SymbolName:      .Lstr
216         Type:            IMAGE_REL_ARM64_PAGEBASE_REL21
217   - Name:            .data
218     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
219     Alignment:       4
220     SectionData:     ''
221   - Name:            .bss
222     Characteristics: [ IMAGE_SCN_CNT_UNINITIALIZED_DATA, IMAGE_SCN_MEM_READ, IMAGE_SCN_MEM_WRITE ]
223     Alignment:       4
224     SectionData:     ''
225   - Name:            .rdata
226     Characteristics: [ IMAGE_SCN_CNT_INITIALIZED_DATA, IMAGE_SCN_MEM_READ ]
227     Alignment:       1
228     SectionData:     00000000202068656C6C6F20776F726C6400
229 symbols:
230   - Name:            .text
231     Value:           0
232     SectionNumber:   1
233     SimpleType:      IMAGE_SYM_TYPE_NULL
234     ComplexType:     IMAGE_SYM_DTYPE_NULL
235     StorageClass:    IMAGE_SYM_CLASS_STATIC
236     SectionDefinition:
237       Length:          28
238       NumberOfRelocations: 3
239       NumberOfLinenumbers: 0
240       CheckSum:        1438860354
241       Number:          1
242   - Name:            .rdata
243     Value:           0
244     SectionNumber:   4
245     SimpleType:      IMAGE_SYM_TYPE_NULL
246     ComplexType:     IMAGE_SYM_DTYPE_NULL
247     StorageClass:    IMAGE_SYM_CLASS_STATIC
248     SectionDefinition:
249       Length:          12
250       NumberOfRelocations: 0
251       NumberOfLinenumbers: 0
252       CheckSum:        872944732
253       Number:          4
254   - Name:            main
255     Value:           0
256     SectionNumber:   1
257     SimpleType:      IMAGE_SYM_TYPE_NULL
258     ComplexType:     IMAGE_SYM_DTYPE_NULL
259     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
260   - Name:            .Lstr
261     Value:           4
262     SectionNumber:   4
263     SimpleType:      IMAGE_SYM_TYPE_NULL
264     ComplexType:     IMAGE_SYM_DTYPE_NULL
265     StorageClass:    IMAGE_SYM_CLASS_STATIC
266   - Name:            .Lglobal
267     Value:           8
268     SectionNumber:   4
269     SimpleType:      IMAGE_SYM_TYPE_NULL
270     ComplexType:     IMAGE_SYM_DTYPE_NULL
271     StorageClass:    IMAGE_SYM_CLASS_STATIC
272   - Name:            .Lglobal16
273     Value:           16
274     SectionNumber:   4
275     SimpleType:      IMAGE_SYM_TYPE_NULL
276     ComplexType:     IMAGE_SYM_DTYPE_NULL
277     StorageClass:    IMAGE_SYM_CLASS_STATIC
278   - Name:            .Lglobal0
279     Value:           0
280     SectionNumber:   4
281     SimpleType:      IMAGE_SYM_TYPE_NULL
282     ComplexType:     IMAGE_SYM_DTYPE_NULL
283     StorageClass:    IMAGE_SYM_CLASS_STATIC
284   - Name:            function
285     Value:           0
286     SectionNumber:   0
287     SimpleType:      IMAGE_SYM_TYPE_NULL
288     ComplexType:     IMAGE_SYM_DTYPE_NULL
289     StorageClass:    IMAGE_SYM_CLASS_EXTERNAL
290   - Name:            .Lglobal5000
291     Value:           5000
292     SectionNumber:   4
293     SimpleType:      IMAGE_SYM_TYPE_NULL
294     ComplexType:     IMAGE_SYM_DTYPE_NULL
295     StorageClass:    IMAGE_SYM_CLASS_STATIC