[PATCH] D34447: [ARM] Create relocations for beq.w branches to ARM function syms.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 21 06:24:58 PDT 2017
fhahn created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.
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 https://reviews.llvm.org/D33436.
https://reviews.llvm.org/D34447
Files:
lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
test/MC/ARM/thumb2-beq-fixup.s
Index: test/MC/ARM/thumb2-beq-fixup.s
===================================================================
--- /dev/null
+++ test/MC/ARM/thumb2-beq-fixup.s
@@ -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: }
Index: lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
===================================================================
--- lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
+++ lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
@@ -759,6 +759,7 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34447.103367.patch
Type: text/x-patch
Size: 1606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170621/b52d37e9/attachment.bin>
More information about the llvm-commits
mailing list