[lld] r253879 - [ELF/AArch64] Fix overflow checks for R_AARCH64_PREL16 and _PREL32 relocations.
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 23 08:56:10 PST 2015
Author: ikudrin
Date: Mon Nov 23 10:56:10 2015
New Revision: 253879
URL: http://llvm.org/viewvc/llvm-project?rev=253879&view=rev
Log:
[ELF/AArch64] Fix overflow checks for R_AARCH64_PREL16 and _PREL32 relocations.
Modified:
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=253879&r1=253878&r2=253879&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Mon Nov 23 10:56:10 2015
@@ -755,12 +755,12 @@ void AArch64TargetInfo::relocateOne(uint
or32le(Loc, (SA & 0xFFF) << 10);
break;
case R_AARCH64_PREL16:
- if (!isInt<16>(SA))
+ if (!isInt<16>(SA - P))
error("Relocation R_AARCH64_PREL16 out of range");
write16le(Loc, SA - P);
break;
case R_AARCH64_PREL32:
- if (!isInt<32>(SA))
+ if (!isInt<32>(SA - P))
error("Relocation R_AARCH64_PREL32 out of range");
write32le(Loc, SA - P);
break;
More information about the llvm-commits
mailing list