Index: lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp =================================================================== --- lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp +++ lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp @@ -719,7 +719,8 @@ Value |= 1; } } - if (IsResolved && (unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_bl) { + if (IsResolved && ((unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_bl || + (unsigned)Fixup.getKind() == ARM::fixup_t2_uncondbranch)) { assert(Sym && "How did we resolve this?"); // If the symbol is external the linker will handle it. Index: test/MC/ARM/thumb2-wide-branch-fixup.s =================================================================== --- /dev/null +++ test/MC/ARM/thumb2-wide-branch-fixup.s @@ -0,0 +1,50 @@ +@ RUN: llvm-mc < %s -triple armv7-linux-gnueabi -filetype=obj -o - \ +@ RUN: | llvm-readobj -r | FileCheck %s + + .code 16 + .thumb_func +thumb_caller: + b.w internal_arm_fn + b.w global_arm_fn + b.w global_thumb_fn + b.w internal_thumb_fn + b.w far_thumb_fn + + .type internal_arm_fn,%function + .code 32 +internal_arm_fn: + bx lr + + .globl global_arm_fn + .type global_arm_fn,%function + .code 32 +global_arm_fn: + bx lr + + .type internal_thumb_fn,%function + .code 16 + .thumb_func +internal_thumb_fn: + bx lr + + .globl global_thumb_fn + .type global_thumb_fn,%function + .code 16 + .thumb_func +global_thumb_fn: + bx lr + .space 0x400004 + + .type far_thumb_fn,%function + .code 16 + .thumb_func +far_thumb_fn: + bx lr + + +@ CHECK: Section (3) .rel.text +@ CHECK-NEXT: 0x0 R_ARM_THM_JUMP24 internal_arm_fn 0x0 +@ CHECK-NEXT: 0x4 R_ARM_THM_JUMP24 global_arm_fn 0x0 +@ CHECK-NEXT: 0x8 R_ARM_THM_JUMP24 global_thumb_fn 0x0 +@ CHECK-NEXT: 0x10 R_ARM_THM_JUMP24 far_thumb_fn 0x0 +@ CHECK-NEXT: }