[llvm] r306009 - [ARM] Create relocations for beq.w branches to ARM function syms.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 08:32:41 PDT 2017


Author: fhahn
Date: Thu Jun 22 10:32:41 2017
New Revision: 306009

URL: http://llvm.org/viewvc/llvm-project?rev=306009&view=rev
Log:
[ARM] Create relocations for beq.w branches to ARM function syms.

Summary:
The ARM ELF ABI requires the linker to do interworking for wide
conditional branches from Thumb code to ARM code. 

That was pointed out by @peter.smith in the comments for D33436.

Reviewers: rafael, peter.smith, echristo

Reviewed By: peter.smith

Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits, peter.smith

Differential Revision: https://reviews.llvm.org/D34447

Added:
    llvm/trunk/test/MC/ARM/thumb2-beq-fixup.s
Modified:
    llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=306009&r1=306008&r2=306009&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Thu Jun 22 10:32:41 2017
@@ -759,6 +759,7 @@ void ARMAsmBackend::processFixupValue(co
         IsResolved = false;
       if (!Asm.isThumbFunc(Sym) && (FixupKind == ARM::fixup_arm_thumb_br ||
                                     FixupKind == ARM::fixup_arm_thumb_bl ||
+                                    FixupKind == ARM::fixup_t2_condbranch ||
                                     FixupKind == ARM::fixup_t2_uncondbranch))
         IsResolved = false;
     }

Added: llvm/trunk/test/MC/ARM/thumb2-beq-fixup.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb2-beq-fixup.s?rev=306009&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/thumb2-beq-fixup.s (added)
+++ llvm/trunk/test/MC/ARM/thumb2-beq-fixup.s Thu Jun 22 10:32:41 2017
@@ -0,0 +1,39 @@
+@ RUN: llvm-mc < %s -triple armv7-linux-gnueabi -filetype=obj -o - \
+@ RUN:   | llvm-readobj -r | FileCheck %s
+
+  .code  16
+  .thumb_func
+thumb_caller:
+  beq.w internal_arm_fn
+  beq.w global_arm_fn
+  beq.w global_thumb_fn
+  beq.w internal_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
+
+@ CHECK: Section (3) .rel.text
+@ CHECK-NEXT: 0x0 R_ARM_THM_JUMP19 internal_arm_fn 0x0
+@ CHECK-NEXT: 0x4 R_ARM_THM_JUMP19 global_arm_fn 0x0
+@ CHECK-NEXT: }




More information about the llvm-commits mailing list