ARM: don't diagnose cbz/cbnz to Thumb functions.

A branch-distance to a Thumb function shouldn't be forced to be odd for
CBZ/CBNZ instructions because (assuming it's within range), it's going to be a
valid, even offset.

llvm-svn: 279665
This commit is contained in:
Tim Northover 2016-08-24 21:21:29 +00:00
parent 351c66ab91
commit 67e1ff026d
3 changed files with 17 additions and 1 deletions

View File

@ -710,7 +710,8 @@ void ARMAsmBackend::processFixupValue(const MCAssembler &Asm,
(unsigned)Fixup.getKind() != ARM::fixup_arm_adr_pcrel_12 &&
(unsigned)Fixup.getKind() != ARM::fixup_thumb_adr_pcrel_10 &&
(unsigned)Fixup.getKind() != ARM::fixup_t2_adr_pcrel_12 &&
(unsigned)Fixup.getKind() != ARM::fixup_arm_thumb_cp) {
(unsigned)Fixup.getKind() != ARM::fixup_arm_thumb_cp &&
(unsigned)Fixup.getKind() != ARM::fixup_arm_thumb_cb) {
if (Sym) {
if (Asm.isThumbFunc(Sym))
Value |= 1;

View File

@ -24,6 +24,13 @@ label1:
label2:
nop
@ CHECK: out of range pc-relative fixup value
cbz r0, label4
.space 33
label4:
nop
.align 2
@ CHECK-NOT: label3
cbnz r0, label3
.space 128

View File

@ -0,0 +1,8 @@
@ RUN: llvm-mc -triple thumbv7-apple-macho -filetype=obj -o %t %s
@ RUN: llvm-objdump -d -triple thumbv7 %t | FileCheck %s
@ CHECK: cbnz r0, #0
.thumb_func label4
cbnz r0, label4
.space 2
label4: