This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Incorrect relocation type for Thumb2 b<cond>.w
ClosedPublic

Authored by peter.smith on Jun 6 2016, 9:15 AM.

Details

Summary

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.

Diff Detail

Event Timeline

peter.smith updated this revision to Diff 59735.Jun 6 2016, 9:15 AM
peter.smith retitled this revision from to [ARM] Incorrect relocation type for Thumb2 b<cond>.w.
peter.smith updated this object.
rengolin accepted this revision.Jun 7 2016, 3:21 AM
rengolin edited edge metadata.

Good catch Peter! LGTM. Thanks!

PS: ARM ELF ABI 4.6.1.6 (Table 4-13).

This revision is now accepted and ready to land.Jun 7 2016, 3:21 AM

Thanks, committed in revision r271997

peter.smith closed this revision.Jun 10 2016, 4:16 AM

Thanks, apologies forgot to close this out on committing (revision r271997 earlier in the week).