[lld] r308586 - [COFF] Minor tweaks to ARM64 relocation code. NFC.
Martin Storsjo via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 22:49:58 PDT 2017
Author: mstorsjo
Date: Wed Jul 19 22:49:58 2017
New Revision: 308586
URL: http://llvm.org/viewvc/llvm-project?rev=308586&view=rev
Log:
[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
Modified:
lld/trunk/COFF/Chunks.cpp
Modified: lld/trunk/COFF/Chunks.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Chunks.cpp?rev=308586&r1=308585&r2=308586&view=diff
==============================================================================
--- lld/trunk/COFF/Chunks.cpp (original)
+++ lld/trunk/COFF/Chunks.cpp Wed Jul 19 22:49:58 2017
@@ -183,11 +183,10 @@ static void applyArm64Imm(uint8_t *Off,
}
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,
More information about the llvm-commits
mailing list