Skip to content

Commit

Permalink
Simplify mask computation.
Browse files Browse the repository at this point in the history
llvm-svn: 271525
  • Loading branch information
espindola committed Jun 2, 2016
1 parent 1016f19 commit 1c0eb97
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lld/ELF/Target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1203,8 +1203,8 @@ void AArch64TargetInfo::writePlt(uint8_t *Buf, uint64_t GotEntryAddr,

static void updateAArch64Addr(uint8_t *L, uint64_t Imm) {
uint32_t ImmLo = (Imm & 0x3) << 29;
uint32_t ImmHi = ((Imm & 0x1FFFFC) >> 2) << 5;
uint64_t Mask = (0x3 << 29) | (0x7FFFF << 5);
uint32_t ImmHi = (Imm & 0x1FFFFC) << 3;
uint64_t Mask = (0x3 << 29) | (0x1FFFFC << 3);
write32le(L, (read32le(L) & ~Mask) | ImmLo | ImmHi);
}

Expand Down Expand Up @@ -1240,11 +1240,11 @@ void AArch64TargetInfo::relocateOne(uint8_t *Loc, uint32_t Type,
case R_AARCH64_ADR_PREL_PG_HI21:
case R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
checkInt<33>(Val, Type);
updateAArch64Addr(Loc, (Val >> 12) & 0x1FFFFF); // X[32:12]
updateAArch64Addr(Loc, Val >> 12);
break;
case R_AARCH64_ADR_PREL_LO21:
checkInt<21>(Val, Type);
updateAArch64Addr(Loc, Val & 0x1FFFFF);
updateAArch64Addr(Loc, Val);
break;
case R_AARCH64_CALL26:
case R_AARCH64_JUMP26:
Expand Down

0 comments on commit 1c0eb97

Please sign in to comment.