From 948354abb9573b95fbc6f6197f9000d7d81dbbe7 Mon Sep 17 00:00:00 2001
From: Dan Willemsen <dwillemsen@google.com>
Date: Fri, 1 Sep 2017 14:08:46 -0700
Subject: [PATCH] Fix libsepolwrap with SANITIZE_HOST=address

Test: SANITIZE_HOST=true m treble_sepolicy_tests
Change-Id: I9190dc06715bbbac8a267a143801f99f911decf3
---
 tests/Android.bp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/Android.bp b/tests/Android.bp
index 2c70f363f..de8600200 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -1,9 +1,18 @@
 cc_library_host_shared {
     name: "libsepolwrap",
     srcs: ["sepol_wrap.cpp"],
-    shared_libs: ["libbase", "libsepol"],
+    shared_libs: ["libsepol"],
     cflags: ["-Wall", "-Werror",],
     export_include_dirs: ["include"],
+
+    // libsepolwrap gets loaded from the system python, which does not have the
+    // ASAN runtime. So turn off sanitization for ourself, and  use static
+    // libraries, since the shared libraries will use ASAN.
+    static_libs: ["libbase"],
+    stl: "libc++_static",
+    sanitize: {
+        never: true,
+    },
 }
 
 cc_prebuilt_binary {
-- 
GitLab