Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / ExecutionEngine / RuntimeDyld / X86 / COFF_i386.s
blob0f4c4dd7fdb666f39d5dc2bc422b74afa35b2940
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
7 .text
9 .def _main
10 .scl 2
11 .type 32
12 .endef
13 .global _main
14 _main:
15 rel1:
16 call _function // IMAGE_REL_I386_REL32
17 # rtdyld-check: decode_operand(rel1, 0) = (_function-_main-4-1)
18 xorl %eax, %eax
19 rel12:
20 jmp _printf
21 # rtdyld-check: decode_operand(rel12, 0)[31:0] = (_printf-_main-4-8)
23 .def _function
24 .scl 2
25 .type 32
26 .endef
27 _function:
28 rel2:
29 pushl string
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
34 rel3:
35 calll *__imp__ExitProcess // IMAGE_REL_I386_DIR32
37 .data
39 .global relocations
40 relocations:
41 rel5:
42 .long _function@imgrel // IMAGE_REL_I386_DIR32NB
43 # rtdyld-check: *{4}rel5 = _function - section_addr(COFF_i386.o, .text)
44 rel6:
45 # rtdyld-check: *{2}rel6 = 1
46 .secidx rel5 // IMAGE_REL_I386_SECTION
47 rel7:
48 # rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.o, .data)
49 .secrel32 string // IMAGE_REL_I386_SECREL
51 # Test that addends work.
52 rel8:
53 # rtdyld-check: *{4}rel8 = string
54 .long string // IMAGE_REL_I386_DIR32
55 rel9:
56 # rtdyld-check: *{4}rel9 = string+1
57 .long string+1 // IMAGE_REL_I386_DIR32
58 rel10:
59 # rtdyld-check: *{4}rel10 = string - section_addr(COFF_i386.o, .text) + 1
60 .long string@imgrel+1 // IMAGE_REL_I386_DIR32NB
61 rel11:
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.
68 .space 65536
69 .global string
70 .align 1
71 string:
72 .asciz "Hello World!\n"