[Alignment][NFC] Instructions::getLoadStoreAlignment
[llvm-complete.git] / test / ExecutionEngine / RuntimeDyld / ARM / COFF_Thumb.s
blob991e88d01f5cff7efc6e6d2f1648dac4d31a3628
1 // RUN: llvm-mc -triple thumbv7-windows-itanium -filetype obj -o %t.obj %s
2 // RUN: llvm-rtdyld -triple thumbv7-windows -dummy-extern OutputDebugStringW=0x01310061 -dummy-extern OutputDebugStringA=0x78563413 -dummy-extern ExitProcess=0x54769891 -dummy-extern unnamed_addr=0x00001024 -verify -check %s %t.obj
4 .text
5 .syntax unified
7 .def unnamed_addr
8 .scl 2
9 .type 32
10 .endef
11 .global unnamed_addr
13 .def branch24t
14 .scl 2
15 .type 32
16 .endef
17 .global branch24t
18 .p2align 1
19 .code 16
20 .thumb_func
21 branch24t:
22 @ rel1:
23 # b unnamed_addr @ IMAGE_REL_ARM_BRANCH24T
25 .def function
26 .scl 2
27 .type 32
28 .endef
29 .globl function
30 .p2align 1
31 .code 16
32 .thumb_func
33 function:
34 push.w {r11, lr}
35 mov r11, sp
36 rel2: @ IMAGE_REL_ARM_MOV32T
37 movw r0, :lower16:__imp_OutputDebugStringA
38 # rtdyld-check: decode_operand(rel2, 1) = (__imp_OutputDebugStringA&0x0000ffff)
39 movt r0, :upper16:__imp_OutputDebugStringA
40 # TODO rtdyld-check: decode_operand(rel2, 1) = (__imp_OutputDebugStringA&0xffff0000>>16)
41 ldr r1, [r0]
42 rel3: @ IMAGE_REL_ARM_MOV32T
43 movw r0, :lower16:string
44 # rtdyld-check: decode_operand(rel3, 1) = (string&0x0000ffff)
45 movt r0, :upper16:string
46 # TODO rtdyld-check: decode_operand(rel3, 1) = (string&0xffff0000>>16)
47 blx r1
48 rel4: @ IMAGE_REL_ARM_MOV32T
49 movw r0, :lower16:__imp_ExitProcess
50 # rtdyld-check: decode_operand(rel4, 1) = (__imp_ExitProcess&0x0000ffff)
51 movt r0, :upper16:__imp_ExitProcess
52 # TODO rtdyld-check: decode_operand(rel4, 1) = (__imp_ExitProcess&0xffff0000>>16)
53 ldr r1, [r0]
54 movs r0, #0
55 pop.w {r11, lr}
56 bx r1
58 .def main
59 .scl 2
60 .type 32
61 .endef
62 .globl main
63 .p2align 1
64 .code 16
65 .thumb_func
66 main:
67 push.w {r11, lr}
68 mov r11, sp
69 rel5:
70 # bl function @ IMAGE_REL_ARM_BLX23T
71 movs r0, #0
72 pop.w {r11, pc}
74 .section .rdata,"dr"
75 .global string
76 string:
77 .asciz "Hello World\n"
79 .data
81 .p2align 2
82 __imp_OutputDebugStringA:
83 @ rel6:
84 .long OutputDebugStringA @ IMAGE_REL_ARM_ADDR32
85 # rtdyld-check: *{4}__imp_OutputDebugStringA = 0x78563413
87 .p2align 2
88 __imp_ExitProcess:
89 @ rel7:
90 .long ExitProcess @ IMAGE_REL_ARM_ADDR32
91 # rtdyld-check: *{4}__imp_ExitProcess = 0x54769891
93 .global relocations
94 relocations:
95 @ rel8:
96 .long function(imgrel) @ IMAGE_REL_ARM_ADDR32NB
97 # rtdyld-check: *{4}relocations = function - section_addr(COFF_Thumb.s.tmp.obj, .text)
98 rel9:
99 .secidx __imp_OutputDebugStringA @ IMAGE_REL_ARM_SECTION
100 # rtdyld-check: *{2}rel9 = 1
101 rel10:
102 .long relocations(secrel32) @ IMAGE_REL_ARM_SECREL
103 # rtdyld-check: *{4}rel10 = relocations - section_addr(COFF_Thumb.s.tmp.obj, .data)
104 rel11:
105 .secrel32 relocations @ IMAGE_REL_ARM_SECREL
106 # rtdyld-check: *{4}rel11 = relocations - section_addr(COFF_Thumb.s.tmp.obj, .data)
107 rel12: @ IMAGE_REL_ARM_MOV32T
108 movw r0, :lower16:__imp_OutputDebugStringW
109 # rtdyld-check: decode_operand(rel12, 1) = (__imp_OutputDebugStringW&0x0000ffff)
110 movt r0, :upper16:__imp_OutputDebugStringW
111 # TODO rtdyld-check: decode_operand(rel12, 1) = (__imp_OutputDebugStringW&0xffff0000>>16)
112 bx r0
113 trap
115 .data
117 .p2align 2
118 __imp_OutputDebugStringW:
119 @ rel13:
120 .long OutputDebugStringW @ IMAGE_REL_ARM_ADDR32
121 # rtdyld-check: *{4}__imp_OutputDebugStringW = 0x01310061
123 .p2align 2
125 branch_to_thumb_func:
126 @ rel14: @ IMAGE_REL_ARM_MOV32T
127 movw r0, :lower16:function
128 # rtdyld-check: decode_operand(branch_to_thumb_func, 1) = (function&0x0000ffff|1)
129 movt r0, :upper16:function
130 # TODO rtdyld-check: decode_operand(branch_to_thumb_func, 1) = (function&0xffff0000>>16)
131 bx r0
132 trap
134 .data
136 .p2align 2
137 a_data_symbol:
138 .long 1073741822
140 .p2align 2
142 .text
144 ref_to_data_symbol_addr:
145 @ rel15: @ IMAGE_REL_ARM_MOV32T
146 movw r0, :lower16:a_data_symbol
147 # rtdyld-check: decode_operand(ref_to_data_symbol_addr, 1) = (a_data_symbol&0x0000ffff)
148 movt r0, :upper16:a_data_symbol
149 # TODO rtdyld-check: decode_operand(ref_to_data_symbol_addr, 1) = (a_data_symbol&0xffff0000>>16)