- // Offset by 4, and don't encode the low two bits.
- return ((Value - 4) >> 2) & 0xff;
- case ARM::fixup_t2_pcrel_10:
- case ARM::fixup_arm_pcrel_10: {
- // Offset by 8 just as above.
- Value = Value - 8;
+ // Offset by 4, and don't encode the low two bits. Two bytes of that
+ // 'off by 4' is implicitly handled by the half-word ordering of the
+ // Thumb encoding, so we only need to adjust by 2 here.
+ return ((Value - 2) >> 2) & 0xff;
+ case ARM::fixup_arm_pcrel_10:
+ Value = Value - 6; // ARM fixups offset by an additional word and don't
+ // need to adjust for the half-word ordering.
+ // Fall through.
+ case ARM::fixup_t2_pcrel_10: {
+ // Offset by 4, adjusted by two due to the half-word ordering of thumb.
+ Value = Value - 2;