[COFF] Minor tweaks to ARM64 relocation code. NFC.

Fix issues found in existing code, while reviewing other changes.

Change the data type of a variable to uint32_t, to avoid potential issues
with signedness in shifts.

Differential revision: https://reviews.llvm.org/D35646

llvm-svn: 308586
This commit is contained in:
Martin Storsjo 2017-07-20 05:49:58 +00:00
parent b3c97b9623
commit dd62dffbcb
1 changed files with 2 additions and 3 deletions

View File

@ -183,11 +183,10 @@ static void applyArm64Imm(uint8_t *Off, uint64_t Imm) {
}
static void applyArm64Ldr(uint8_t *Off, uint64_t Imm) {
int Size = read32le(Off) >> 30;
uint32_t Size = read32le(Off) >> 30;
if ((Imm & ((1 << Size) - 1)) != 0)
fatal("misaligned ldr/str offset");
Imm >>= Size;
applyArm64Imm(Off, Imm);
applyArm64Imm(Off, Imm >> Size);
}
void SectionChunk::applyRelARM64(uint8_t *Off, uint16_t Type, OutputSection *OS,