[PATCH] D24768: [compiler-rt] Fix Asan build on Android
Etienne Bergeron via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 08:56:57 PDT 2016
etienneb updated this revision to Diff 72063.
etienneb added a comment.
fix assert failing
https://reviews.llvm.org/D24768
Files:
lib/asan/asan_mapping.h
lib/asan/asan_rtl.cc
Index: lib/asan/asan_rtl.cc
===================================================================
--- lib/asan/asan_rtl.cc
+++ lib/asan/asan_rtl.cc
@@ -461,9 +461,16 @@
ReplaceSystemMalloc();
- __asan_shadow_memory_dynamic_address = 0;
+ // Set the shadow memory address to uninitialized.
+ __asan_shadow_memory_dynamic_address = kDefaultShadowSentinel;
+
uptr shadow_start = kLowShadowBeg;
- if (shadow_start == 0) {
+ // Detect if a dynamic shadow address must used and find a available location
+ // when necessary.
+ if (shadow_start == kDefaultShadowSentinel) {
+ __asan_shadow_memory_dynamic_address = 0;
+ CHECK_EQ(0, kLowShadowBeg);
+
uptr granularity = GetMmapGranularity();
uptr alignment = 8 * granularity;
uptr left_padding = granularity;
@@ -473,6 +480,7 @@
CHECK_NE((uptr)0, shadow_start);
CHECK(IsAligned(shadow_start, alignment));
}
+ // Update the shadow memory address (potentially) used by instrumentation.
__asan_shadow_memory_dynamic_address = shadow_start;
if (kLowShadowBeg)
Index: lib/asan/asan_mapping.h
===================================================================
--- lib/asan/asan_mapping.h
+++ lib/asan/asan_mapping.h
@@ -125,6 +125,7 @@
// || `[0x00000000, 0x2fffffff]` || LowMem ||
static const u64 kDefaultShadowScale = 3;
+static const u64 kDefaultShadowSentinel = ~(uptr)0;
static const u64 kDefaultShadowOffset32 = 1ULL << 29; // 0x20000000
static const u64 kDefaultShadowOffset64 = 1ULL << 44;
static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24768.72063.patch
Type: text/x-patch
Size: 1578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160921/865582cd/attachment.bin>
More information about the llvm-commits
mailing list