1 // RUN
: rm
-rf
%t && mkdir
-p
%t
2 // RUN
: llvm-mc
-triple i686-windows
-filetype obj
-o
%t/COFF_i386.o
%s
3 // RUN
: llvm-rtdyld
-triple i686-windows
-dummy-extern _printf
=0x7ffffffd \
4 // RUN
: -dummy-extern _ExitProcess
=0x7fffffff \
5 // RUN
: -verify
-check
=%s
%t/COFF_i386.o
16 call _function
// IMAGE_REL_I386_REL32
17 # rtdyld-check: decode_operand(rel1, 0) = (_function-_main-4-1)
21 # rtdyld-check: decode_operand(rel12, 0)[31:0] = (_printf-_main-4-8)
30 # rtdyld-check: decode_operand(rel3, 3) = \
31 # rtdyld-check: stub_addr(COFF_i386.o/.text, __imp__ExitProcess)
32 # rtdyld-check: *{4}(stub_addr(COFF_i386.o/.text, __imp__ExitProcess)) = \
33 # rtdyld-check: _ExitProcess
35 calll
*__imp__ExitProcess
// IMAGE_REL_I386_DIR32
42 .long _function@imgrel // IMAGE_REL_I386_DIR32NB
43 # rtdyld-check: *{4}rel5 = _function - section_addr(COFF_i386.o, .text)
45 # rtdyld-check: *{2}rel6 = 1
46 .secidx rel5 // IMAGE_REL_I386_SECTION
48 # rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.o, .data)
49 .secrel32 string // IMAGE_REL_I386_SECREL
51 # Test that addends work.
53 # rtdyld-check: *{4}rel8 = string
54 .long string // IMAGE_REL_I386_DIR32
56 # rtdyld-check: *{4}rel9 = string+1
57 .long string+1 // IMAGE_REL_I386_DIR32
59 # rtdyld-check: *{4}rel10 = string - section_addr(COFF_i386.o, .text) + 1
60 .long string@imgrel+1 // IMAGE_REL_I386_DIR32NB
62 # rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.o, .data) + 1
63 .long string@SECREL32+1 // IMAGE_REL_I386_SECREL
65 # We explicitly add padding to put string outside of the 16bit address space
66 # (absolute and as an offset from .data), so that relocations involving
67 # 32bit addresses / offsets are not accidentally truncated to 16 bits.
72 .asciz "Hello World!\n"