llvm.org GIT mirror llvm / 2946185
ExecutionEngine: fix a bug in the movt/movw relocator According to the arm arm specifications, 4 bytes are needed for a shift instead of 8, this was causing the movt instruction to write to a different register sometimes. Patch by Walter Erquinigo! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280005 91177308-0d34-0410-b5e6-96231b3b80d8 Saleem Abdulrasool 3 years ago
2 changed file(s) with 18 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
224224 Bytes[0] |= ((Immediate & 0xf000) >> 12);
225225 Bytes[1] |= ((Immediate & 0x0800) >> 11);
226226 Bytes[2] |= ((Immediate & 0x00ff) >> 0);
227 Bytes[3] |= ((Immediate & 0x0700) >> 8);
227 Bytes[3] |= (((Immediate & 0x0700) >> 8) << 4);
228228 };
229229
230230 EncodeImmediate(&Target[0], static_cast(Result) >> 00);
0 // RUN: llvm-mc -triple thumbv7-windows-itanium -filetype obj -o %t.obj %s
1 // RUN: llvm-rtdyld -triple thumbv7-windows -dummy-extern OutputDebugStringA=0x78563412 -dummy-extern ExitProcess=0x54769890 -dummy-extern unnamed_addr=0x00001024 -verify -check %s %t.obj
1 // RUN: llvm-rtdyld -triple thumbv7-windows -dummy-extern OutputDebugStringW=0x01310060 -dummy-extern OutputDebugStringA=0x78563412 -dummy-extern ExitProcess=0x54769890 -dummy-extern unnamed_addr=0x00001024 -verify -check %s %t.obj
22
33 .text
44 .syntax unified
103103 rel11:
104104 .secrel32 relocations @ IMAGE_REL_ARM_SECREL
105105 # rtdyld-check: *{4}rel11 = relocations - section_addr(COFF_Thumb.s.tmp.obj, .data)
106 rel12: @ IMAGE_REL_ARM_MOV32T
107 movw r0, :lower16:__imp_OutputDebugStringW
108 # rtdyld-check: decode_operand(rel12, 1) = (__imp_OutputDebugStringW&0x0000ffff)
109 movt r0, :upper16:__imp_OutputDebugStringW
110 # TODO rtdyld-check: decode_operand(rel12, 1) = (__imp_OutputDebugStringW&0xffff0000>>16)
111 bx r0
112 trap
106113
114 .data
115
116 .p2align 2
117 __imp_OutputDebugStringW:
118 @ rel13:
119 .long OutputDebugStringW @ IMAGE_REL_ARM_ADDR32
120 # rtdyld-check: *{4}__imp_OutputDebugStringW = 0x01310060
121
122 .p2align 2