2 RUN: split-file %s %t.dir && cd %t.dir
4 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows test-arm64ec.s -o test-arm64ec.obj
5 RUN: llvm-mc -filetype=obj -triple=x86_64-windows test-x86_64.s -o test-x86_64.obj
6 RUN: llvm-mc -filetype=obj -triple=arm64ec-windows %S/Inputs/loadconfig-arm64ec.s -o loadconfig-arm64ec.obj
7 RUN: llvm-lib -out:test.lib -def:test.def -machine:arm64ec
9 RUN: lld-link -out:out.dll -debug -machine:arm64ec -dll -noentry test-arm64ec.obj test-x86_64.obj loadconfig-arm64ec.obj test.lib
10 RUN: llvm-pdbutil dump out.pdb -all | FileCheck %s
13 CHECK-NEXT: ============================================================
14 CHECK: Stream 10 ( 104 bytes): [Module "Import:test.dll"]
15 CHECK-NEXT: Blocks: [9]
16 CHECK-NEXT: Stream 11 ({{[ 0-9]+}} bytes): [Module "* Linker *"]
17 CHECK-NEXT: Blocks: [10]
20 CHECK-NEXT: ============================================================
21 CHECK-NEXT: Mod 0000 | `{{.*}}test-arm64ec.obj`:
22 CHECK-NEXT: Mod 0 (debug info not present): [{{.*}}test-arm64ec.obj]
23 CHECK-NEXT: Mod 0001 | `{{.*}}test-x86_64.obj`:
24 CHECK-NEXT: Mod 1 (debug info not present): [{{.*}}test-x86_64.obj]
25 CHECK-NEXT: Mod 0002 | `{{.*}}loadconfig-arm64ec.obj`:
26 CHECK-NEXT: Mod 2 (debug info not present): [{{.*}}loadconfig-arm64ec.obj]
27 CHECK-NEXT: Mod 0003 | `test.dll`:
28 CHECK-NEXT: Mod 3 (debug info not present): [test.dll]
29 CHECK-NEXT: Mod 0004 | `Import:test.dll`:
30 CHECK-NEXT: Stream 10, 104 bytes
33 CHECK-NEXT: ============================================================
34 CHECK-NEXT: Mod 0000 | `{{.*}}test-arm64ec.obj`:
35 CHECK-NEXT: SC[.text] | mod = 0, 0001:0000, size = 8, data crc = 2063330902, reloc crc = 0
36 CHECK-NEXT: IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_EXECUTE |
37 CHECK-NEXT: IMAGE_SCN_MEM_READ
38 CHECK-NEXT: Obj: `{{.*}}test-arm64ec.obj`:
39 CHECK-NEXT: debug stream: 65535, # files: 0, has ec info: false
40 CHECK-NEXT: pdb file ni: 0 ``, src file ni: 0 ``
41 CHECK-NEXT: Mod 0001 | `{{.*}}test-x86_64.obj`:
42 CHECK-NEXT: SC[.text] | mod = 1, 0001:4096, size = 0, data crc = 0, reloc crc = 0
43 CHECK-NEXT: IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_EXECUTE |
44 CHECK-NEXT: IMAGE_SCN_MEM_READ
45 CHECK-NEXT: Obj: `{{.*}}test-x86_64.obj`:
46 CHECK-NEXT: debug stream: 65535, # files: 0, has ec info: false
47 CHECK-NEXT: pdb file ni: 0 ``, src file ni: 0 ``
48 CHECK-NEXT: Mod 0002 | `{{.*}}loadconfig-arm64ec.obj`:
49 CHECK-NEXT: SC[.text] | mod = 2, 0001:0008, size = 0, data crc = 0, reloc crc = 0
50 CHECK-NEXT: IMAGE_SCN_CNT_CODE | IMAGE_SCN_ALIGN_4BYTES | IMAGE_SCN_MEM_EXECUTE |
51 CHECK-NEXT: IMAGE_SCN_MEM_READ
52 CHECK-NEXT: Obj: `{{.*}}loadconfig-arm64ec.obj`:
53 CHECK-NEXT: debug stream: 65535, # files: 0, has ec info: false
54 CHECK-NEXT: pdb file ni: 0 ``, src file ni: 0 ``
55 CHECK-NEXT: Mod 0003 | `test.dll`:
56 CHECK-NEXT: SC[???] | mod = 65535, 65535:0000, size = -1, data crc = 0, reloc crc = 0
58 CHECK-NEXT: Obj: `{{.*}}test.lib`:
59 CHECK-NEXT: debug stream: 65535, # files: 0, has ec info: false
60 CHECK-NEXT: pdb file ni: 0 ``, src file ni: 0 ``
61 CHECK-NEXT: Mod 0004 | `Import:test.dll`:
62 CHECK-NEXT: SC[.text] | mod = 4, 0001:4096, size = 6, data crc = 0, reloc crc = 0
63 CHECK-NEXT: IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ
64 CHECK-NEXT: Obj: `{{.*}}test.lib`:
65 CHECK-NEXT: debug stream: 10, # files: 0, has ec info: false
66 CHECK-NEXT: pdb file ni: 0 ``, src file ni: 0 ``
67 CHECK-NEXT: Mod 0005 | `* Linker *`:
68 CHECK-NEXT: SC[???] | mod = 65535, 65535:0000, size = -1, data crc = 0, reloc crc = 0
71 CHECK-NEXT: debug stream: 11, # files: 0, has ec info: false
72 CHECK-NEXT: pdb file ni: 1 `{{.*}}out.pdb`, src file ni: 0 ``
75 CHECK-NEXT: ============================================================
77 CHECK-NEXT: 584 | S_PUB32 [size = 28] `x86_64_sym`
78 CHECK-NEXT: flags = none, addr = 0005:0008
79 CHECK-NEXT: 536 | S_PUB32 [size = 28] `arm64ec_sym`
80 CHECK-NEXT: flags = none, addr = 0005:0000
81 CHECK-NEXT: 168 | S_PUB32 [size = 44] `__hybrid_auxiliary_iat_copy`
82 CHECK-NEXT: flags = none, addr = 0002:
83 CHECK-NEXT: 96 | S_PUB32 [size = 32] `__chpe_metadata`
84 CHECK-NEXT: flags = none, addr = 0003:0000
85 CHECK-NEXT: 456 | S_PUB32 [size = 48] `__x64_code_ranges_to_entry_points`
86 CHECK-NEXT: flags = none, addr = 0002:
87 CHECK-NEXT: 0 | S_PUB32 [size = 20] `#func`
88 CHECK-NEXT: flags = function, addr = 0001:0008
89 CHECK-NEXT: 244 | S_PUB32 [size = 40] `__icall_helper_arm64ec`
90 CHECK-NEXT: flags = none, addr = 0001:0000
91 CHECK-NEXT: 64 | S_PUB32 [size = 32] `__auximpcopy_func`
92 CHECK-NEXT: flags = none, addr = 0002:
93 CHECK-NEXT: 504 | S_PUB32 [size = 32] `_load_config_used`
94 CHECK-NEXT: flags = none, addr = 0002:
95 CHECK-NEXT: 564 | S_PUB32 [size = 20] `func`
96 CHECK-NEXT: flags = function, addr = 0001:4096
97 CHECK-NEXT: 128 | S_PUB32 [size = 40] `__hybrid_auxiliary_iat`
98 CHECK-NEXT: flags = none, addr = 0002:8192
99 CHECK-NEXT: 284 | S_PUB32 [size = 32] `__imp_aux_func`
100 CHECK-NEXT: flags = none, addr = 0002:0000
101 CHECK-NEXT: 344 | S_PUB32 [size = 28] `__impchk_func`
102 CHECK-NEXT: flags = function, addr = 0001:0020
103 CHECK-NEXT: 372 | S_PUB32 [size = 44] `__os_arm64x_dispatch_icall`
104 CHECK-NEXT: flags = none, addr = 0002:
105 CHECK-NEXT: 212 | S_PUB32 [size = 32] `__hybrid_code_map`
106 CHECK-NEXT: flags = none, addr = 0002:
107 CHECK-NEXT: 20 | S_PUB32 [size = 44] `__arm64x_redirection_metadata`
108 CHECK-NEXT: flags = none, addr = 0004:0000
109 CHECK-NEXT: 416 | S_PUB32 [size = 40] `__os_arm64x_dispatch_ret`
110 CHECK-NEXT: flags = none, addr = 0002:
111 CHECK-NEXT: 316 | S_PUB32 [size = 28] `__imp_func`
112 CHECK-NEXT: flags = none, addr = 0002:8192
115 CHECK-NEXT: ============================================================
116 CHECK-NEXT: Mod 0000 | `{{.*}}test-arm64ec.obj`:
117 CHECK-NEXT: Error loading module stream 0. The specified stream could not be loaded. Module stream not present
118 CHECK-NEXT: Mod 0001 | `{{.*}}test-x86_64.obj`:
119 CHECK-NEXT: Error loading module stream 1. The specified stream could not be loaded. Module stream not present
120 CHECK-NEXT: Mod 0002 | `{{.*}}loadconfig-arm64ec.obj`:
121 CHECK-NEXT: Error loading module stream 2. The specified stream could not be loaded. Module stream not present
122 CHECK-NEXT: Mod 0003 | `test.dll`:
123 CHECK-NEXT: Error loading module stream 3. The specified stream could not be loaded. Module stream not present
124 CHECK-NEXT: Mod 0004 | `Import:test.dll`:
125 CHECK-NEXT: 4 | S_OBJNAME [size = 20] sig=0, `test.dll`
126 CHECK-NEXT: 24 | S_COMPILE3 [size = 40]
127 CHECK-NEXT: machine = arm64ec, Ver = LLVM Linker, language = link
128 CHECK-NEXT: frontend = 0.0.0.0, backend = 14.10.25019.0
129 CHECK-NEXT: flags = none
130 CHECK-NEXT: 64 | S_THUNK32 [size = 32] `func`
131 CHECK-NEXT: parent = 0, end = 96, next = 0
132 CHECK-NEXT: kind = thunk, size = 6, addr = 0001:4096
133 CHECK-NEXT: 96 | S_END [size = 4]
134 CHECK-NEXT: Mod 0005 | `* Linker *`:
135 CHECK-NEXT: 4 | S_OBJNAME [size = 20] sig=0, `* Linker *`
136 CHECK-NEXT: 24 | S_COMPILE3 [size = 40]
137 CHECK-NEXT: machine = arm64x, Ver = LLVM Linker, language = link
138 CHECK-NEXT: frontend = 0.0.0.0, backend = 14.10.25019.0
139 CHECK-NEXT: flags = none
140 CHECK-NEXT: 64 | S_ENVBLOCK [size = {{[0-9]+}}]
141 CHECK: {{[0-9]+}} | S_SECTION [size = 28] `.text`
142 CHECK-NEXT: length = 4102, alignment = 12, rva = 4096, section # = 1
143 CHECK-NEXT: characteristics =
145 CHECK-NEXT: execute permissions
146 CHECK-NEXT: read permissions
147 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 24] `.text`
148 CHECK-NEXT: length = 8, addr = 0001:0000
149 CHECK-NEXT: characteristics =
151 CHECK-NEXT: execute permissions
152 CHECK-NEXT: read permissions
153 CHECK-NEXT: {{[0-9]+}} | S_SECTION [size = 28] `.rdata`
154 CHECK-NEXT: length = 8208, alignment = 12, rva = 12288, section # = 2
155 CHECK-NEXT: characteristics =
156 CHECK-NEXT: initialized data
157 CHECK-NEXT: read permissions
158 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$5`
159 CHECK-NEXT: length = 16, addr = 0002:0000
160 CHECK-NEXT: characteristics =
161 CHECK-NEXT: initialized data
162 CHECK-NEXT: read permissions
163 CHECK-NEXT: write permissions
164 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.00cfg`
165 CHECK-NEXT: length = 456, addr = 0002:
166 CHECK-NEXT: characteristics =
167 CHECK-NEXT: initialized data
168 CHECK-NEXT: read permissions
169 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$2`
170 CHECK-NEXT: length = 40, addr = 0002:
171 CHECK-NEXT: characteristics =
172 CHECK-NEXT: initialized data
173 CHECK-NEXT: read permissions
174 CHECK-NEXT: write permissions
175 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$4`
176 CHECK-NEXT: length = 16, addr = 0002:
177 CHECK-NEXT: characteristics =
178 CHECK-NEXT: initialized data
179 CHECK-NEXT: read permissions
180 CHECK-NEXT: write permissions
181 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$6`
182 CHECK-NEXT: length = 8, addr = 0002:
183 CHECK-NEXT: characteristics =
184 CHECK-NEXT: initialized data
185 CHECK-NEXT: read permissions
186 CHECK-NEXT: write permissions
187 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$7`
188 CHECK-NEXT: length = 9, addr = 0002:
189 CHECK-NEXT: characteristics =
190 CHECK-NEXT: initialized data
191 CHECK-NEXT: read permissions
192 CHECK-NEXT: write permissions
193 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$a`
194 CHECK-NEXT: length = 16, addr = 0002:
195 CHECK-NEXT: characteristics =
196 CHECK-NEXT: initialized data
197 CHECK-NEXT: read permissions
198 CHECK-NEXT: write permissions
199 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 28] `.idata$9`
200 CHECK-NEXT: length = 16, addr = 0002:8192
201 CHECK-NEXT: characteristics =
202 CHECK-NEXT: initialized data
203 CHECK-NEXT: read permissions
204 CHECK-NEXT: write permissions
205 CHECK-NEXT: {{[0-9]+}} | S_SECTION [size = 28] `.data`
206 CHECK-NEXT: length = 124, alignment = 12, rva = 24576, section # = 3
207 CHECK-NEXT: characteristics =
208 CHECK-NEXT: initialized data
209 CHECK-NEXT: read permissions
210 CHECK-NEXT: write permissions
211 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 24] `.data`
212 CHECK-NEXT: length = 124, addr = 0003:0000
213 CHECK-NEXT: characteristics =
214 CHECK-NEXT: initialized data
215 CHECK-NEXT: read permissions
216 CHECK-NEXT: write permissions
217 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 24] `.bss`
218 CHECK-NEXT: length = 0, addr = 0003:0124
219 CHECK-NEXT: characteristics =
220 CHECK-NEXT: uninitialized data
221 CHECK-NEXT: read permissions
222 CHECK-NEXT: write permissions
223 CHECK-NEXT: {{[0-9]+}} | S_SECTION [size = 28] `.a64xrm`
224 CHECK-NEXT: length = 8, alignment = 12, rva = 28672, section # = 4
225 CHECK-NEXT: characteristics =
226 CHECK-NEXT: initialized data
227 CHECK-NEXT: read permissions
228 CHECK-NEXT: {{[0-9]+}} | S_SECTION [size = 28] `.test`
229 CHECK-NEXT: length = 16, alignment = 12, rva = 32768, section # = 5
230 CHECK-NEXT: characteristics =
231 CHECK-NEXT: initialized data
232 CHECK-NEXT: read permissions
233 CHECK-NEXT: {{[0-9]+}} | S_COFFGROUP [size = 24] `.test`
234 CHECK-NEXT: length = 16, addr = 0005:0000
235 CHECK-NEXT: characteristics =
236 CHECK-NEXT: initialized data
237 CHECK-NEXT: read permissions
238 CHECK-NEXT: {{[0-9]+}} | S_SECTION [size = 28] `.reloc`
239 CHECK-NEXT: length = 32, alignment = 12, rva = 36864, section # = 6
240 CHECK-NEXT: characteristics =
241 CHECK-NEXT: initialized data
242 CHECK-NEXT: discardable
243 CHECK-NEXT: read permissions
247 .globl __icall_helper_arm64ec
249 __icall_helper_arm64ec: