mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-27 08:26:23 +00:00

Some ARM instructions encode 32-bit immediates as a 8-bit integer (0-255) and a 4-bit rotation (0-30, even) in its least significant 12 bits. The original fixup, FK_Data_4, patches the instruction by the value bit-to-bit, regardless of the encoding. For example, assuming the label L1 and L2 are 0x0 and 0x104 respectively, the following instruction: add r0, r0, #(L2 - L1) ; expects 0x104, i.e., 260 would be assembled to the following, which adds 1 to r0, instead of 260: e2800104 add r0, r0, #4, 2 ; equivalently 1 The new fixup kind fixup_arm_mod_imm takes care of the encoding: e2800f41 add r0, r0, #260 Patch by Ting-Yuan Huang! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265122 91177308-0d34-0410-b5e6-96231b3b80d8
15 lines
252 B
ArmAsm
15 lines
252 B
ArmAsm
@ PR24346
|
|
@ RUN: not llvm-mc -triple=arm-linux-gnueabi -filetype=obj < %s 2>&1 | FileCheck %s
|
|
|
|
.data
|
|
.align 8
|
|
L2:
|
|
.word 0
|
|
.align 8
|
|
.byte 0
|
|
L1:
|
|
|
|
.text
|
|
@ CHECK: error: out of range immediate fixup value
|
|
add r0, r0, #(L1 - L2)
|