[InstCombine] Signed saturation patterns
[llvm-core.git] / test / ExecutionEngine / RuntimeDyld / X86 / COFF_i386.s
blob6516eb3d69d17c90936224ebaf801d950232ba53
1 // RUN: llvm-mc -triple i686-windows -filetype obj -o %t.obj %s
2 // RUN: llvm-rtdyld -triple i686-windows -dummy-extern _printf=0x7ffffffd -dummy-extern _OutputDebugStringA@4=0x7ffffffe -dummy-extern _ExitProcess@4=0x7fffffff -verify -check=%s %t.obj
4 .text
6 .def _main
7 .scl 2
8 .type 32
9 .endef
10 .global _main
11 _main:
12 rel1:
13 call _function // IMAGE_REL_I386_REL32
14 # rtdyld-check: decode_operand(rel1, 0) = (_function-_main-4-1)
15 xorl %eax, %eax
16 rel12:
17 jmp _printf
18 # rtdyld-check: decode_operand(rel12, 0)[31:0] = (_printf-_main-4-8)
20 .def _function
21 .scl 2
22 .type 32
23 .endef
24 _function:
25 rel2:
26 pushl string
27 rel3:
28 calll *__imp__OutputDebugStringA // IMAGE_REL_I386_DIR32
29 # rtdyld-check: decode_operand(rel3, 3) = __imp__OutputDebugStringA
30 addl $4, %esp
31 pushl $0
32 rel4:
33 calll *__imp__ExitProcess // IMAGE_REL_I386_DIR32
34 # rtdyld-check: decode_operand(rel4, 3) = __imp__ExitProcess
35 addl $4, %esp
36 retl
38 .data
40 .global __imp__OutputDebugStringA
41 .align 4
42 __imp__OutputDebugStringA:
43 .long "_OutputDebugStringA@4" // IMAGE_REL_I386_DIR32
44 # rtdyld-check: *{4}__imp__OutputDebugStringA = 0x7ffffffe
46 .global __imp__ExitProcess
47 .align 4
48 __imp__ExitProcess:
49 .long "_ExitProcess@4" // IMAGE_REL_I386_DIR32
50 # rtdyld-check: *{4}__imp__ExitProcess = 0x7fffffff
52 .global relocations
53 relocations:
54 rel5:
55 .long _function@imgrel // IMAGE_REL_I386_DIR32NB
56 # rtdyld-check: *{4}rel5 = _function - section_addr(COFF_i386.s.tmp.obj, .text)
57 rel6:
58 # rtdyld-check: *{2}rel6 = 1
59 .secidx __imp__OutputDebugStringA // IMAGE_REL_I386_SECTION
60 rel7:
61 # rtdyld-check: *{4}rel7 = string - section_addr(COFF_i386.s.tmp.obj, .data)
62 .secrel32 string // IMAGE_REL_I386_SECREL
64 # Test that addends work.
65 rel8:
66 # rtdyld-check: *{4}rel8 = string
67 .long string // IMAGE_REL_I386_DIR32
68 rel9:
69 # rtdyld-check: *{4}rel9 = string+1
70 .long string+1 // IMAGE_REL_I386_DIR32
71 rel10:
72 # rtdyld-check: *{4}rel10 = string - section_addr(COFF_i386.s.tmp.obj, .text) + 1
73 .long string@imgrel+1 // IMAGE_REL_I386_DIR32NB
74 rel11:
75 # rtdyld-check: *{4}rel11 = string - section_addr(COFF_i386.s.tmp.obj, .data) + 1
76 .long string@SECREL32+1 // IMAGE_REL_I386_SECREL
78 # We explicitly add padding to put string outside of the 16bit address space
79 # (absolute and as an offset from .data), so that relocations involving
80 # 32bit addresses / offsets are not accidentally truncated to 16 bits.
81 .space 65536
82 .global string
83 .align 1
84 string:
85 .asciz "Hello World!\n"