Make linking with libcompiler_rt conditional

introduce LOCAL_NO_LIBCOMPILER_RT
embedded targets do not necessarily want to have it

Bug: 29635686
Change-Id: Ieb04f7ea7237ae01a067dedfa2fb13571e9a789c
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
diff --git a/core/binary.mk b/core/binary.mk
index 439235b..45f7277 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -343,10 +343,12 @@
 
 include $(BUILD_SYSTEM)/config_sanitizers.mk
 
+ifneq ($(LOCAL_NO_LIBCOMPILER_RT),true)
 # Add in libcompiler_rt for all regular device builds
 ifeq (,$(LOCAL_SDK_VERSION)$(WITHOUT_LIBCOMPILER_RT))
   my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
 endif
+endif
 
 ####################################################
 ## Add FDO flags if FDO is turned on and supported
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 6f5633c..2c64d2e 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -142,6 +142,7 @@
 LOCAL_PROTOC_FLAGS:=
 LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
 LOCAL_NO_CRT:=
+LOCAL_NO_LIBCOMPILER_RT:=
 LOCAL_NO_LIBGCC:=
 LOCAL_NO_PIC:=
 LOCAL_PROPRIETARY_MODULE:=