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        .text
8	.def	 F;
9	.scl	2;
10	.type	32;
11	.endef
12	.globl	__real400921f9f01b866e
13	.section	.rdata,"dr",discard,__real400921f9f01b866e
14	.align	8
15__real400921f9f01b866e:
16	.quad	4614256650576692846     # double 3.1415899999999999
17	.text
18	.globl	F
19        .global inst1
20	.align	16, 0x90
21F:                                      # @F
22.Ltmp0:
23.seh_proc F
24# %bb.0:                                # %entry
25.Ltmp1:
26	.seh_endprologue
27# rtdyld-check: decode_operand(inst1, 4) = __real400921f9f01b866e - next_pc(inst1)
28inst1:
29	movsd	__real400921f9f01b866e(%rip), %xmm0 # xmm0 = mem[0],zero
30	retq
31.Leh_func_end0:
32.Ltmp2:
33	.seh_endproc
34
35	.globl	call_to_dllimport
36        .p2align	4, 0x90
37# Check calls to dllimports.
38#
39# (1) Check that callq argument points to synthesized stub addr.
40# rtdyld-check: decode_operand(call_to_dllimport, 3) = \
41# rtdyld-check:   stub_addr(COFF_x86_64.o/.text, __imp_external_func) - \
42# rtdyld-check:     next_pc(call_to_dllimport)
43#
44# (2) Check that synthesized stub entry points to call target.
45# rtdyld-check: *{8}(stub_addr(COFF_x86_64.o/.text, __imp_external_func)) = \
46# rtdyld-check:   external_func
47call_to_dllimport:
48	callq	*__imp_external_func(%rip)
49
50        .globl  load_from_dllimport
51        .p2align        4, 0x90
52# Check loads from dllimports.
53#
54# (1) Check that the movq argument points to synthesized stub addr.
55# rtdyld-check: decode_operand(load_from_dllimport, 4) = \
56# rtdyld-check:   stub_addr(COFF_x86_64.o/.text, __imp_external_data) - \
57# rtdyld-check:     next_pc(load_from_dllimport)
58#
59# (2) Check that synthesized stub entry points to datao target.
60# rtdyld-check: *{8}(stub_addr(COFF_x86_64.o/.text, __imp_external_data)) = \
61# rtdyld-check:   external_data
62load_from_dllimport:
63	movq	__imp_external_data(%rip), %rax
64
65        .data
66	.globl  x                       # @x
67# rtdyld-check: *{8}x = F
68x:
69	.quad	F
70
71# Make sure the JIT doesn't bail out on BSS sections.
72        .bss
73bss_check:
74        .fill 8, 1, 0
75