[llvm] r271997 - [ARM] Incorrect relocation type for Thumb2 B<cond>.w
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 7 03:34:33 PDT 2016
Author: psmith
Date: Tue Jun 7 05:34:33 2016
New Revision: 271997
URL: http://llvm.org/viewvc/llvm-project?rev=271997&view=rev
Log:
[ARM] Incorrect relocation type for Thumb2 B<cond>.w
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 (Table-13) 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 change makes B<cond>.W use R_ARM_THM_JUMP19 and alters the
existing test that checks for R_ARM_THM_JUMP24 to expect
R_ARM_THM_JUMP19.
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
llvm/trunk/test/MC/ARM/thumb1-relax-bcc.s
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp?rev=271997&r1=271996&r2=271997&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp Tue Jun 7 05:34:33 2016
@@ -123,6 +123,8 @@ unsigned ARMELFObjectWriter::GetRelocTyp
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;
Modified: llvm/trunk/test/MC/ARM/thumb1-relax-bcc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/thumb1-relax-bcc.s?rev=271997&r1=271996&r2=271997&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/thumb1-relax-bcc.s (original)
+++ llvm/trunk/test/MC/ARM/thumb1-relax-bcc.s Tue Jun 7 05:34:33 2016
@@ -9,4 +9,4 @@ _func1:
@ 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
More information about the llvm-commits
mailing list