Skip to content

Commit 1025189

Browse files
[JITLink][AArch32] Don't adjust Thumb bit in fixup code; it doesn't contribute to branch ranges
We don't have to set or clear the Thumb bit in relocation fixup values. It's not part of the branch range and the respective encoding functions like encodeImmBT4BlT1BlxT2() shift out the least significant bit anyway. This was a leftover from the initial patch before we switched to store Thumb state in target-flags with D146641.
1 parent ee643b7 commit 1025189

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

llvm/lib/ExecutionEngine/JITLink/aarch32.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,6 @@ Error applyFixupArm(LinkGraph &G, Block &B, const Edge &E) {
400400
int64_t Addend = E.getAddend();
401401
Symbol &TargetSymbol = E.getTarget();
402402
uint64_t TargetAddress = TargetSymbol.getAddress().getValue();
403-
if (hasTargetFlags(TargetSymbol, ThumbSymbol))
404-
TargetAddress |= 0x01;
405403

406404
switch (Kind) {
407405
case Arm_Jump24: {
@@ -437,11 +435,9 @@ Error applyFixupArm(LinkGraph &G, Block &B, const Edge &E) {
437435
bool InstrIsBlx = (~R.Wd & FixupInfo<Arm_Call>::BitBlx) == 0;
438436
if (TargetIsThumb != InstrIsBlx) {
439437
if (LLVM_LIKELY(TargetIsThumb)) {
440-
// Change opcode BL -> BLX and fix range value
438+
// Change opcode BL -> BLX
441439
R.Wd = R.Wd | FixupInfo<Arm_Call>::BitBlx;
442440
R.Wd = R.Wd & ~FixupInfo<Arm_Call>::BitH;
443-
// Set Thumb bit
444-
Value |= 0x01;
445441
} else {
446442
// Change opcode BLX -> BL
447443
R.Wd = R.Wd & ~FixupInfo<Arm_Call>::BitBlx;
@@ -473,8 +469,6 @@ Error applyFixupThumb(LinkGraph &G, Block &B, const Edge &E,
473469
int64_t Addend = E.getAddend();
474470
Symbol &TargetSymbol = E.getTarget();
475471
uint64_t TargetAddress = TargetSymbol.getAddress().getValue();
476-
if (hasTargetFlags(TargetSymbol, ThumbSymbol))
477-
TargetAddress |= 0x01;
478472

479473
switch (Kind) {
480474
case Thumb_Jump24: {
@@ -511,16 +505,14 @@ Error applyFixupThumb(LinkGraph &G, Block &B, const Edge &E,
511505
bool InstrIsBlx = (R.Lo & FixupInfo<Thumb_Call>::LoBitNoBlx) == 0;
512506
if (TargetIsArm != InstrIsBlx) {
513507
if (LLVM_LIKELY(TargetIsArm)) {
514-
// Change opcode BL -> BLX and fix range value (account for 4-byte
508+
// Change opcode BL -> BLX and fix range value: account for 4-byte
515509
// aligned destination while instruction may only be 2-byte aligned
516-
// and clear Thumb bit).
517510
R.Lo = R.Lo & ~FixupInfo<Thumb_Call>::LoBitNoBlx;
518511
R.Lo = R.Lo & ~FixupInfo<Thumb_Call>::LoBitH;
519512
Value = alignTo(Value, 4);
520513
} else {
521-
// Change opcode BLX -> BL and set Thumb bit
514+
// Change opcode BLX -> BL
522515
R.Lo = R.Lo & ~FixupInfo<Thumb_Call>::LoBitNoBlx;
523-
Value |= 0x01;
524516
}
525517
}
526518

0 commit comments

Comments
 (0)