[PATCH] D21027: [ARM] Incorrect relocation type for Thumb2 b<cond>.w

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 6 09:15:05 PDT 2016


peter.smith created this revision.
peter.smith added reviewers: llvm-commits, rengolin, t.p.northover.
Herald added subscribers: rengolin, aemerson.

The Thumb2 conditional branch B<cond>.W has a different encoding (T3) to the unconditional branch B.W (T4) as it needs to record <cond>. As the encoding is different the B<cond>.W is given a different relocation type. ELF for the ARM Architecture 4.6.1.6 Static Thumb32 relocations states that R_ARM_THM_JUMP19 should be used for B<cond>.W. At present the MC layer is using the R_ARM_THM_JUMP24 from B.W.
    
This is a simple change to make fixup_t2_condbranch use R_ARM_THM_JUMP19 and update the test which is incorrectly expecting R_ARM_THM_JUMP24.


http://reviews.llvm.org/D21027

Files:
  lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
  test/MC/ARM/thumb1-relax-bcc.s

Index: test/MC/ARM/thumb1-relax-bcc.s
===================================================================
--- test/MC/ARM/thumb1-relax-bcc.s
+++ test/MC/ARM/thumb1-relax-bcc.s
@@ -9,4 +9,4 @@
 @ CHECK-ERROR: unsupported relocation on symbol
 
 @ CHECK-ELF: 7f f4 fe af        bne.w #-4
-@ CHECK-ELF-NEXT: R_ARM_THM_JUMP24 _func2
+@ CHECK-ELF-NEXT: R_ARM_THM_JUMP19 _func2
Index: lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
===================================================================
--- lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
+++ lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
@@ -123,6 +123,8 @@
       Type = ELF::R_ARM_JUMP24;
       break;
     case ARM::fixup_t2_condbranch:
+      Type = ELF::R_ARM_THM_JUMP19;
+      break;
     case ARM::fixup_t2_uncondbranch:
       Type = ELF::R_ARM_THM_JUMP24;
       break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21027.59735.patch
Type: text/x-patch
Size: 851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160606/c4aff080/attachment-0001.bin>


More information about the llvm-commits mailing list