[PATCH] D24768: [compiler-rt] Fix Asan build on Android

Kostya Serebryany via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 20 14:00:40 PDT 2016


kcc added a subscriber: kcc.

================
Comment at: lib/asan/asan_rtl.cc:466
@@ -465,11 +465,3 @@
   uptr shadow_start = kLowShadowBeg;
-  if (shadow_start == 0) {
-    uptr granularity = GetMmapGranularity();
-    uptr alignment = 8 * granularity;
-    uptr left_padding = granularity;
-    uptr space_size = kHighShadowEnd + left_padding;
-
-    shadow_start = FindAvailableMemoryRange(space_size, alignment, granularity);
-    CHECK_NE((uptr)0, shadow_start);
-    CHECK(IsAligned(shadow_start, alignment));
-  }
+#if ASAN_DYNAMIC_SHADOW_ADDRESS
+  CHECK_EQ(0, shadow_start);
----------------
vitalybuka wrote:
> rnk wrote:
> > I think kcc likes regular if over #if, when possible. Also, isn't this macro undefined usually?
> Maybe ~0 instead of 0?
Correct, kcc has very strong opinion on #ifs. 
1. When you can avoid an #if -- avoid it. 
2. When you can't avoid it, check #1 once more
3. If desperate, split the files and put a top-level #if on the entire file. 


https://reviews.llvm.org/D24768





More information about the llvm-commits mailing list