2 // RUN
: split-file
%s
%t.dir
&& cd
%t.dir
5 // Build
a simple function with an entry thunk.
7 .section .text,"xr",discard,func
14 .section .wowthk$aa,"xr",discard,thunk
21 .section .hybmp$x, "yi"
24 .word 1 // entry thunk
29 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows
%S
/Inputs
/loadconfig-arm64ec.s
-o loadcfg.obj
30 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-simple.s
-o test-simple.obj
31 // RUN
: lld-link
-machine
:arm64ec
-dll
-noentry
-out
:out-simple.dll loadcfg.obj test-simple.obj
32 // RUN
: llvm-objdump
-d out-simple.dll | FileCheck
--check-prefix
=DISASM
%s
34 // DISASM
: Disassembly of section
.text:
36 // DISASM-NEXT
: 0000000180001000 <.text>:
37 // DISASM-NEXT
: 180001000: 00000009 udf
#0x9
38 // DISASM-NEXT
: 180001004: 52800020 mov w0
, #0x1 // =1
39 // DISASM-NEXT
: 180001008: d65f03c0 ret
40 // DISASM-NEXT
: 18000100c
: 52800140 mov w0
, #0xa // =10
41 // DISASM-NEXT
: 180001010: d65f03c0 ret
43 // RUN
: llvm-readobj
--sections out-simple.dll | FileCheck
--check-prefix
=HYBMP
%s
46 // RUN
: lld-link
-machine
:arm64x
-dll
-noentry
-out
:out-simplex.dll loadcfg.obj test-simple.obj
47 // RUN
: llvm-objdump
-d out-simplex.dll | FileCheck
--check-prefix
=DISASM
%s
49 #--- test-split-func.s
50 // Build
a simple function with an entry thunk
, but pass it in multiple files.
52 .section .text,"xr",discard,func
59 #--- test-split-thunk.s
60 .section .wowthk$aa,"xr",discard,thunk
67 #--- test-split-hybmp.s
68 .section .hybmp$x, "yi"
71 .word 1 // entry thunk
73 #--- test-split-data.s
77 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-split-func.s
-o test-split-func.obj
78 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-split-thunk.s
-o test-split-thunk.obj
79 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-split-hybmp.s
-o test-split-hybmp.obj
80 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-split-data.s
-o test-split-data.obj
81 // RUN
: lld-link
-machine
:arm64ec
-dll
-noentry
-out
:out-split.dll loadcfg.obj \
82 // RUN
: test-split-func.obj test-split-thunk.obj test-split-data.obj test-split-hybmp.obj
83 // RUN
: llvm-objdump
-d out-split.dll | FileCheck
--check-prefix
=DISASM
%s
86 // Build multiple functions with thunks
and various alignments
and check that entry thunk offsets
87 // are correctly placed.
89 .section .text,"xr",discard,func
97 .section .text,"xr",discard,func2
104 .section .text,"xr",discard,func3
112 .section .text,"xr",discard,func4
119 .section .text,"xr",discard,func5
126 .section .text,"xr",discard,func6
133 .section .wowthk$aa,"xr",discard,thunk
140 .section .wowthk$aa,"xr",discard,thunk2
147 .section .hybmp$x, "yi"
150 .word 1 // entry thunk
153 .word 1 // entry thunk
156 .word 1 // entry thunk
159 .word 1 // entry thunk
162 .word 1 // entry thunk
165 .word 1 // entry thunk
175 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-align.s
-o test-align.obj
176 // RUN
: lld-link
-machine
:arm64ec
-dll
-noentry
-out
:out-align.dll loadcfg.obj test-align.obj
177 // RUN
: llvm-objdump
-d out-align.dll | FileCheck
--check-prefix
=ALIGN
%s
179 // ALIGN
: Disassembly of section
.text:
181 // ALIGN-NEXT
: 0000000180001000 <.text>:
182 // ALIGN-NEXT
: 180001000: 00000055 udf
#0x55
183 // ALIGN-NEXT
: 180001004: 52800020 mov w0
, #0x1 // =1
184 // ALIGN-NEXT
: 180001008: d503201f
nop
185 // ALIGN-NEXT
: 18000100c
: d65f03c0 ret
186 // ALIGN-NEXT
: 180001010: 0000004d udf
#0x4d
187 // ALIGN-NEXT
: 180001014: 52800040 mov w0
, #0x2 // =2
188 // ALIGN-NEXT
: 180001018: d65f03c0 ret
189 // ALIGN-NEXT
: 18000101c
: 00000039 udf
#0x39
190 // ALIGN-NEXT
: 180001020: 52800060 mov w0
, #0x3 // =3
191 // ALIGN-NEXT
: 180001024: d503201f
nop
192 // ALIGN-NEXT
: 180001028: d65f03c0 ret
193 // ALIGN-NEXT
: 18000102c
: 00000029 udf
#0x29
194 // ALIGN-NEXT
: 180001030: 52800080 mov w0
, #0x4 // =4
195 // ALIGN-NEXT
: 180001034: d65f03c0 ret
196 // ALIGN-NEXT
: 180001038: 00000000 udf
#0x0
197 // ALIGN-NEXT
: 18000103c
: 00000019 udf
#0x19
198 // ALIGN-NEXT
: 180001040: 528000a0 mov w0
, #0x5 // =5
199 // ALIGN-NEXT
: 180001044: d65f03c0 ret
200 // ALIGN-NEXT
: 180001048: 00000000 udf
#0x0
201 // ALIGN-NEXT
: 18000104c
: 00000009 udf
#0x9
202 // ALIGN-NEXT
: 180001050: 528000c0 mov w0
, #0x6 // =6
203 // ALIGN-NEXT
: 180001054: d65f03c0 ret
204 // ALIGN-NEXT
: 180001058: 52800140 mov w0
, #0xa // =10
205 // ALIGN-NEXT
: 18000105c
: d65f03c0 ret
206 // ALIGN-NEXT
: 180001060: 52800280 mov w0
, #0x14 // =20
207 // ALIGN-NEXT
: 180001064: d65f03c0 ret
209 #--- test-icf-thunk.s
210 // Build two functions with identical entry thunks
and check that thunks are merged by ICF.
212 .section .text,"xr",discard,func
219 .section .text,"xr",discard,func2
226 .section .wowthk$aa,"xr",discard,thunk
233 .section .wowthk$aa,"xr",discard,thunk2
240 .section .hybmp$x, "yi"
243 .word 1 // entry thunk
246 .word 1 // entry thunk
252 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-icf-thunk.s
-o test-icf-thunk.obj
253 // RUN
: lld-link
-machine
:arm64ec
-dll
-noentry
-out
:out-icf-thunk.dll loadcfg.obj test-icf-thunk.obj
254 // RUN
: llvm-objdump
-d out-icf-thunk.dll | FileCheck
--check-prefix
=ICF-THUNK
%s
256 // ICF-THUNK
: Disassembly of section
.text:
258 // ICF-THUNK-NEXT
: 0000000180001000 <.text>:
259 // ICF-THUNK-NEXT
: 180001000: 00000015 udf
#0x15
260 // ICF-THUNK-NEXT
: 180001004: 52800020 mov w0
, #0x1 // =1
261 // ICF-THUNK-NEXT
: 180001008: d65f03c0 ret
262 // ICF-THUNK-NEXT
: 18000100c
: 00000009 udf
#0x9
263 // ICF-THUNK-NEXT
: 180001010: 52800040 mov w0
, #0x2 // =2
264 // ICF-THUNK-NEXT
: 180001014: d65f03c0 ret
265 // ICF-THUNK-NEXT
: 180001018: 52800140 mov w0
, #0xa // =10
266 // ICF-THUNK-NEXT
: 18000101c
: d65f03c0 ret
268 #--- test-icf-diff-thunk.s
269 // Build two identical functions with different entry thunks
and check that they are
not merged by ICF.
271 .section .text,"xr",discard,func
278 .section .text,"xr",discard,func2
285 .section .wowthk$aa,"xr",discard,thunk
292 .section .wowthk$aa,"xr",discard,thunk2
299 .section .hybmp$x, "yi"
302 .word 1 // entry thunk
305 .word 1 // entry thunk
311 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-icf-diff-thunk.s
-o test-icf-diff-thunk.obj
312 // RUN
: lld-link
-machine
:arm64ec
-dll
-noentry
-out
:out-icf-diff-thunk.dll loadcfg.obj test-icf-diff-thunk.obj
313 // RUN
: llvm-objdump
-d out-icf-diff-thunk.dll | FileCheck
--check-prefix
=ICF-DIFF-THUNK
%s
315 // ICF-DIFF-THUNK
: Disassembly of section
.text:
316 // ICF-DIFF-THUNK-EMPTY
:
317 // ICF-DIFF-THUNK-NEXT
: 0000000180001000 <.text>:
318 // ICF-DIFF-THUNK-NEXT
: 180001000: 00000015 udf
#0x15
319 // ICF-DIFF-THUNK-NEXT
: 180001004: 52800020 mov w0
, #0x1 // =1
320 // ICF-DIFF-THUNK-NEXT
: 180001008: d65f03c0 ret
321 // ICF-DIFF-THUNK-NEXT
: 18000100c
: 00000011 udf
#0x11
322 // ICF-DIFF-THUNK-NEXT
: 180001010: 52800020 mov w0
, #0x1 // =1
323 // ICF-DIFF-THUNK-NEXT
: 180001014: d65f03c0 ret
324 // ICF-DIFF-THUNK-NEXT
: 180001018: 52800140 mov w0
, #0xa // =10
325 // ICF-DIFF-THUNK-NEXT
: 18000101c
: d65f03c0 ret
326 // ICF-DIFF-THUNK-NEXT
: 180001020: 52800280 mov w0
, #0x14 // =20
327 // ICF-DIFF-THUNK-NEXT
: 180001024: d65f03c0 ret
330 // Build two identical functions with identical entry thunks
and check that they are merged by ICF.
332 .section .text,"xr",discard,func
339 .section .text,"xr",discard,func2
346 .section .wowthk$aa,"xr",discard,thunk
353 .section .wowthk$aa,"xr",discard,thunk2
360 .section .hybmp$x, "yi"
363 .word 1 // entry thunk
366 .word 1 // entry thunk
372 // RUN
: llvm-mc
-filetype
=obj
-triple
=arm64ec-windows test-icf-both.s
-o test-icf-both.obj
373 // RUN
: lld-link
-machine
:arm64ec
-dll
-noentry
-out
:out-icf-both.dll loadcfg.obj test-icf-both.obj
374 // RUN
: llvm-objdump
-d out-icf-both.dll | FileCheck
--check-prefix
=DISASM
%s