Merge "Fix clang compiled memset recursive call problem." am: e57b56c7b6 am: 3c32c3009e
am: a6588b4831

Change-Id: Ib99df518f130828cc9d3402156834dd630814bb8
diff --git a/Android.build_host.mk b/Android.build_host.mk
index 77d11ba..ee07d2d 100644
--- a/Android.build_host.mk
+++ b/Android.build_host.mk
@@ -23,10 +23,8 @@
   vg_local_arch := amd64
 endif
 
-# TODO: This workaround is to avoid calling memset from VG(memset)
-# wrapper because of invalid clang optimization; This seems to be
-# limited to amd64/x86 codegen(?);
-LOCAL_CLANG := false
+# Do not call (builtin) memset from VG(memset).
+LOCAL_CLANG_CFLAGS += -fno-builtin-memset
 
 LOCAL_MODULE := $(vg_local_module)-$(vg_local_arch)-linux
 
diff --git a/Android.build_one.mk b/Android.build_one.mk
index cb5de07..16ea662 100644
--- a/Android.build_one.mk
+++ b/Android.build_one.mk
@@ -23,13 +23,15 @@
 vg_local_arch  := $(vg_arch)
 endif
 
-# TODO: This workaround is to avoid calling memset from VG(memset)
-# wrapper because of invalid clang optimization; This seems to be
-# limited to amd64/x86 codegen(?);
+# For arm and arm64 targets, clang compiled module has other
+# undefined errors, see bug 28454823.
 ifeq ($(filter $TARGET_ARCH,x86 x86_64),)
   LOCAL_CLANG := false
 endif
 
+# Do not call (builtin) memset from VG(memset).
+LOCAL_CLANG_CFLAGS += -fno-builtin-memset
+
 LOCAL_MODULE := $(vg_local_module)-$(vg_local_arch)-linux
 
 LOCAL_MODULE_TARGET_ARCH := $(vg_local_arch)