Enable SANITIZE_TARGET.

The same as SANITIZE_HOST, but for the target.
Also, skip all LOCAL_FORCE_STATIC_EXECUTABLE targets, as ASan does not
support static linking.

Bug: 21785137
Change-Id: Ief53ff8de1fee18f230d6c7dd31845db5bbd415c
This commit is contained in:
Evgenii Stepanov 2015-06-11 13:57:10 -07:00
parent c567234484
commit 3632cc3241
2 changed files with 28 additions and 13 deletions

View File

@ -9,22 +9,24 @@ ifdef LOCAL_SDK_VERSION
my_sanitize := never
endif
# Configure SANITIZE_HOST.
ifdef LOCAL_IS_HOST_MODULE
ifeq ($(my_sanitize),)
# Configure SANITIZE_HOST / SANITIZE_TARGET.
ifeq ($(my_sanitize),)
ifdef LOCAL_IS_HOST_MODULE
my_sanitize := $(strip $(SANITIZE_HOST))
else
my_sanitize := $(strip $(SANITIZE_TARGET))
endif
# SANTIZIZE_HOST=true is a deprecated way to say SANITIZE_HOST=address.
ifeq ($(my_sanitize),true)
my_sanitize := address
endif
# SANITIZE_HOST=true is a deprecated way to say SANITIZE_HOST=address.
ifeq ($(my_sanitize),true)
my_sanitize := address
endif
# SANITIZE_HOST is only in effect if the module is already using clang (host
# modules that haven't set `LOCAL_CLANG := false` and device modules that
# have set `LOCAL_CLANG := true`.
ifneq ($(my_clang),true)
my_sanitize :=
endif
# SANITIZE_HOST is only in effect if the module is already using clang (host
# modules that haven't set `LOCAL_CLANG := false` and device modules that
# have set `LOCAL_CLANG := true`.
ifneq ($(my_clang),true)
my_sanitize :=
endif
endif

View File

@ -6,6 +6,17 @@
# LOCAL_MODULE_PATH_32 and LOCAL_MODULE_PATH_64 or LOCAL_MODULE_STEM_32 and
# LOCAL_MODULE_STEM_64
my_skip_this_target :=
ifeq (address,$(strip $(SANITIZE_TARGET)))
ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
my_skip_this_target := true
else ifeq (false, $(LOCAL_CLANG))
my_skip_this_target := true
endif
endif
ifneq (true,$(my_skip_this_target))
my_prefix := TARGET_
include $(BUILD_SYSTEM)/multilib.mk
@ -71,3 +82,5 @@ LOCAL_2ND_ARCH_VAR_PREFIX :=
LOCAL_NO_2ND_ARCH_MODULE_SUFFIX :=
my_module_arch_supported :=
endif