Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / ExecutionEngine / RuntimeDyld / ARM / COFF_Thumb.s
blobb4946880ff1552373acd0eee1d45de30c5239419
1 # RUN: rm -rf %t && mkdir -p %t
2 # RUN: llvm-mc -triple thumbv7-windows-itanium -filetype obj -o %t/COFF_Thumb.o %s
3 # RUN: llvm-rtdyld -triple thumbv7-windows \
4 # RUN: -dummy-extern ExitProcess=0x54769891 \
5 # RUN: -dummy-extern unnamed_addr=0x00001024 -verify -check %s %t/COFF_Thumb.o
7 .text
8 .syntax unified
10 .def unnamed_addr
11 .scl 2
12 .type 32
13 .endef
14 .global unnamed_addr
16 .def branch24t
17 .scl 2
18 .type 32
19 .endef
20 .global branch24t
21 .p2align 1
22 .code 16
23 .thumb_func
24 branch24t:
25 @ rel1:
26 # b unnamed_addr @ IMAGE_REL_ARM_BRANCH24T
28 .def function
29 .scl 2
30 .type 32
31 .endef
32 .globl function
33 .p2align 1
34 .code 16
35 .thumb_func
36 function:
37 push.w {r11, lr}
38 mov r11, sp
39 rel3: @ IMAGE_REL_ARM_MOV32T
40 movw r0, :lower16:string
41 # rtdyld-check: decode_operand(rel3, 1) = (string&0x0000ffff)
42 movt r0, :upper16:string
43 # TODO rtdyld-check: decode_operand(rel3, 1) = (string&0xffff0000>>16)
44 blx r1
45 load_from_dllimport_lo: @ IMAGE_REL_ARM_MOV32T
46 movw r0, :lower16:__imp_ExitProcess
47 # (1) Check stub content.
48 # rtdyld-check: *{4}(stub_addr(COFF_Thumb.o/.text, __imp_ExitProcess)) = \
49 # rtdyld-check: ExitProcess
51 # (2) Check lo bits of stub address.
52 # rtdyld-check: decode_operand(load_from_dllimport_lo, 1) = \
53 # rtdyld-check: stub_addr(COFF_Thumb.o/.text, __imp_ExitProcess)[15:0]
54 load_from_dllimport_hi:
55 movt r0, :upper16:__imp_ExitProcess
56 # (3) Check hi bits of stub address.
57 # rtdyld-check: decode_operand(load_from_dllimport_hi, 2) = \
58 # rtdyld-check: stub_addr(COFF_Thumb.o/.text, __imp_ExitProcess)[31:16]
59 ldr r1, [r0]
60 movs r0, #0
61 pop.w {r11, lr}
62 bx r1
64 .def main
65 .scl 2
66 .type 32
67 .endef
68 .globl main
69 .p2align 1
70 .code 16
71 .thumb_func
72 main:
73 push.w {r11, lr}
74 mov r11, sp
75 rel5:
76 # bl function @ IMAGE_REL_ARM_BLX23T
77 movs r0, #0
78 pop.w {r11, pc}
80 .section .rdata,"dr"
81 .global string
82 string:
83 .asciz "Hello World\n"
85 .data
87 .global relocations
88 relocations:
89 @ rel8:
90 .long function(imgrel) @ IMAGE_REL_ARM_ADDR32NB
91 # rtdyld-check: *{4}relocations = function - section_addr(COFF_Thumb.o, .text)
92 rel9:
93 .secidx __imp_ExitProcess @ IMAGE_REL_ARM_SECTION
94 # rtdyld-check: *{2}rel9 = 2
95 rel10:
96 .long relocations(secrel32) @ IMAGE_REL_ARM_SECREL
97 # rtdyld-check: *{4}rel10 = relocations - section_addr(COFF_Thumb.o, .data)
98 rel11:
99 .secrel32 relocations @ IMAGE_REL_ARM_SECREL
100 # rtdyld-check: *{4}rel11 = relocations - section_addr(COFF_Thumb.o, .data)
101 bx r0
102 trap
104 .text
106 .p2align 2
108 branch_to_thumb_func:
109 @ rel14: @ IMAGE_REL_ARM_MOV32T
110 movw r0, :lower16:function
111 # rtdyld-check: decode_operand(branch_to_thumb_func, 1) = (function&0x0000ffff|1)
112 movt r0, :upper16:function
113 # TODO rtdyld-check: decode_operand(branch_to_thumb_func, 1) = (function&0xffff0000>>16)
114 bx r0
115 trap
117 .data
119 .p2align 2
120 a_data_symbol:
121 .long 1073741822
123 .p2align 2
125 .text
127 ref_to_data_symbol_addr:
128 @ rel15: @ IMAGE_REL_ARM_MOV32T
129 movw r0, :lower16:a_data_symbol
130 # rtdyld-check: decode_operand(ref_to_data_symbol_addr, 1) = (a_data_symbol&0x0000ffff)
131 movt r0, :upper16:a_data_symbol
132 # TODO rtdyld-check: decode_operand(ref_to_data_symbol_addr, 1) = (a_data_symbol&0xffff0000>>16)