xref: /llvm-project/llvm/test/ExecutionEngine/RuntimeDyld/X86/COFF_x86_64.s (revision 04c27852e47093f7efa18609dbf57b3ce58a3ffa)
1# RUN: rm -rf %t && mkdir -p %t
2# RUN: llvm-mc -triple=x86_64-pc-win32 -filetype=obj -o %t/COFF_x86_64.o %s
3# RUN: llvm-rtdyld -triple=x86_64-pc-win32  -dummy-extern external_func=0x1 \
4# RUN:   -dummy-extern external_data=0x2 -verify -check=%s %t/COFF_x86_64.o
5
6
7	.section section,"rx"
8	.long 0
9Lreloc:
10	.long 0
11# rtdyld-check: *{2}Lreloc = 1
12	.reloc 4, secidx, section+4
13
14
15        .text
16	.def	 F;
17	.scl	2;
18	.type	32;
19	.endef
20	.globl	__real400921f9f01b866e
21	.section	.rdata,"dr",discard,__real400921f9f01b866e
22	.align	8
23__real400921f9f01b866e:
24	.quad	4614256650576692846     # double 3.1415899999999999
25	.text
26	.globl	F
27        .global inst1
28	.align	16, 0x90
29F:                                      # @F
30.Ltmp0:
31.seh_proc F
32# %bb.0:                                # %entry
33.Ltmp1:
34	.seh_endprologue
35# rtdyld-check: decode_operand(inst1, 4) = __real400921f9f01b866e - next_pc(inst1)
36inst1:
37	movsd	__real400921f9f01b866e(%rip), %xmm0 # xmm0 = mem[0],zero
38	retq
39.Leh_func_end0:
40.Ltmp2:
41	.seh_endproc
42
43	.globl	call_to_dllimport
44        .p2align	4, 0x90
45# Check calls to dllimports.
46#
47# (1) Check that callq argument points to synthesized stub addr.
48# rtdyld-check: decode_operand(call_to_dllimport, 3) = \
49# rtdyld-check:   stub_addr(COFF_x86_64.o/.text, __imp_external_func) - \
50# rtdyld-check:     next_pc(call_to_dllimport)
51#
52# (2) Check that synthesized stub entry points to call target.
53# rtdyld-check: *{8}(stub_addr(COFF_x86_64.o/.text, __imp_external_func)) = \
54# rtdyld-check:   external_func
55call_to_dllimport:
56	callq	*__imp_external_func(%rip)
57
58        .globl  load_from_dllimport
59        .p2align        4, 0x90
60# Check loads from dllimports.
61#
62# (1) Check that the movq argument points to synthesized stub addr.
63# rtdyld-check: decode_operand(load_from_dllimport, 4) = \
64# rtdyld-check:   stub_addr(COFF_x86_64.o/.text, __imp_external_data) - \
65# rtdyld-check:     next_pc(load_from_dllimport)
66#
67# (2) Check that synthesized stub entry points to datao target.
68# rtdyld-check: *{8}(stub_addr(COFF_x86_64.o/.text, __imp_external_data)) = \
69# rtdyld-check:   external_data
70load_from_dllimport:
71	movq	__imp_external_data(%rip), %rax
72
73        .data
74	.globl  x                       # @x
75# rtdyld-check: *{8}x = F
76x:
77	.quad	F
78
79# Make sure the JIT doesn't bail out on BSS sections.
80        .bss
81bss_check:
82        .fill 8, 1, 0
83