OSDN Git Service

[Thumb1] Add relocations for fixups fixup_arm_thumb_{br,bcc}
authorJames Molloy <james.molloy@arm.com>
Mon, 5 Sep 2016 08:29:15 +0000 (08:29 +0000)
committerJames Molloy <james.molloy@arm.com>
Mon, 5 Sep 2016 08:29:15 +0000 (08:29 +0000)
These need to be mapped through to R_ARM_THM_JUMP{11,8} respectively.

Fixes PR30279.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280651 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
test/MC/ARM/thumb1-branch-reloc.s [new file with mode: 0644]

index fa468ea..6f19754 100644 (file)
@@ -140,6 +140,12 @@ unsigned ARMELFObjectWriter::GetRelocTypeInner(const MCValue &Target,
     case ARM::fixup_t2_movw_lo16:
       Type = ELF::R_ARM_THM_MOVW_PREL_NC;
       break;
+    case ARM::fixup_arm_thumb_br:
+      Type = ELF::R_ARM_THM_JUMP11;
+      break;
+    case ARM::fixup_arm_thumb_bcc:
+      Type = ELF::R_ARM_THM_JUMP8;
+      break;
     case ARM::fixup_arm_thumb_bl:
     case ARM::fixup_arm_thumb_blx:
       switch (Modifier) {
diff --git a/test/MC/ARM/thumb1-branch-reloc.s b/test/MC/ARM/thumb1-branch-reloc.s
new file mode 100644 (file)
index 0000000..c599389
--- /dev/null
@@ -0,0 +1,21 @@
+@ RUN: llvm-mc -triple thumbv6-eabi -filetype obj -o - %s | llvm-readobj -r - \
+@ RUN:     | FileCheck %s
+
+        .syntax unified
+
+        .extern h
+        .section .text.uncond
+
+        b h
+        
+@CHECK: Section {{.*}} .rel.text.uncond {
+@CHECK:   0x0 R_ARM_THM_JUMP11
+@CHECK: }
+        .section .text.cond
+
+        ble h
+
+@CHECK: Section {{.*}} .rel.text.cond {
+@CHECK:   0x0 R_ARM_THM_JUMP8
+@CHECK: }
+        
\ No newline at end of file