Only add linker_asan as dependency to shared executables

linker_asan is only needed by shared exectuables, prevent adding it as a
dependency of anything else.  Avoids a dependency loop from
linker_asan -> linker -> linker_asan.

Change-Id: Id7744ad8a5901468518fac80741c75e764adb559
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 7882fdf..ac3e4fc 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -157,9 +157,13 @@
       my_ldflags += -Wl,--as-needed
     endif
 
-    my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
-    # Make sure linker_asan get installed.
-    $(LOCAL_INSTALLED_MODULE) : | $(PRODUCT_OUT)$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
+    ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
+      ifneq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
+        my_linker := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
+        # Make sure linker_asan get installed.
+        $(LOCAL_INSTALLED_MODULE) : | $(PRODUCT_OUT)$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_LINKER)
+      endif
+    endif
   endif
 endif