summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/interception/interception_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/lib/interception/interception_win.cc')
-rw-r--r--compiler-rt/lib/interception/interception_win.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler-rt/lib/interception/interception_win.cc b/compiler-rt/lib/interception/interception_win.cc
index 8ffc5ae8f83..91abecf6de5 100644
--- a/compiler-rt/lib/interception/interception_win.cc
+++ b/compiler-rt/lib/interception/interception_win.cc
@@ -148,10 +148,16 @@ static void InterceptionFailed() {
}
static bool DistanceIsWithin2Gig(uptr from, uptr target) {
+#if SANITIZER_WINDOWS64
if (from < target)
return target - from <= (uptr)0x7FFFFFFFU;
else
return from - target <= (uptr)0x80000000U;
+#else
+ // In a 32-bit address space, the address calculation will wrap, so this check
+ // is unnecessary.
+ return true;
+#endif
}
static uptr GetMmapGranularity() {
OpenPOWER on IntegriCloud