Closed Quuxplusone closed 8 years ago
Bugzilla Link | PR24346 |
Status | RESOLVED FIXED |
Importance | P normal |
Reported by | Han Shen (shenhan@google.com) |
Reported on | 2015-08-03 18:54:14 -0700 |
Last modified on | 2016-04-01 05:07:36 -0700 |
Version | trunk |
Hardware | PC Linux |
CC | kristof.beyls@gmail.com, laszio@google.com, llozano@chromium.org, llvm-bugs@lists.llvm.org, rengolin@gmail.com |
Fixed by commit(s) | |
Attachments | |
Blocks | PR18926, PR24345 |
Blocked by | |
See also |
Looks like a problem with instruction format:
352 = 0x160 = (2 >> 1) << 8 | 96 = encoding of arm operand 2 #96, 2
llvm-mc -show-inst seems to have a similar problem:
3606 = 0xe16 = (28 >> 1) << 8 | 22 = encoding of arm operand 2 #22, 28 (which
is 352)
sub r5, r5, #352 @ <MCInst #468 SUBri
@ <MCOperand Reg:71>
@ <MCOperand Reg:71>
@ <MCOperand Imm:3606>
@ <MCOperand Imm:14>
@ <MCOperand Reg:0>
@ <MCOperand Reg:0>>
sub r5, r5, #96, #2 @ <MCInst #468 SUBri
@ <MCOperand Reg:71>
@ <MCOperand Reg:71>
@ <MCOperand Imm:352>
@ <MCOperand Imm:14>
@ <MCOperand Reg:0>
@ <MCOperand Reg:0>>
The labels or expressions in the last operand of subs are matched by ModImm, which gets an FK_Data_4 fixup that patches the 12 LSBs of the instruction directly after the offsets of the labels or the value of the expressions are decided.
getModImmOpValue() emits FK_Data_4 which patches the lowest 12 bits of instructions by the value bit-to-bit. This is incompatible with the modified-immediate encoding. The proposed solution is to make a new fixup kind: fixup_arm_mod_imm which takes care of the encoding.
Verified patch in comment 3), with the patch, we are now finally able to bring up ARM ChromeOS built with clang.