am cf66a791: am 4fbb83dd: Merge "Add support for LOCAL_SANITIZE := integer."

* commit 'cf66a79130a7382a583f20197f42436a5c1d4095':
  Add support for `LOCAL_SANITIZE := integer`.
This commit is contained in:
Dan Albert 2015-06-19 18:16:24 +00:00 committed by Android Git Automerger
commit 6f3527fe60
3 changed files with 9 additions and 27 deletions

View file

@ -152,7 +152,7 @@ endif
ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fno-omit-frame-pointer ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fno-omit-frame-pointer
ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit
ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES :=
ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan
# This allows us to use the superset of functionality that compiler-rt # This allows us to use the superset of functionality that compiler-rt

View file

@ -149,7 +149,6 @@ LOCAL_MODULE_OWNER:=
LOCAL_CTS_TEST_PACKAGE:= LOCAL_CTS_TEST_PACKAGE:=
LOCAL_CTS_TEST_RUNNER:= LOCAL_CTS_TEST_RUNNER:=
LOCAL_CLANG:= LOCAL_CLANG:=
LOCAL_DETECT_INTEGER_OVERFLOWS:=
LOCAL_JAR_EXCLUDE_FILES:= LOCAL_JAR_EXCLUDE_FILES:=
LOCAL_JAR_PACKAGES:= LOCAL_JAR_PACKAGES:=
LOCAL_JAR_EXCLUDE_PACKAGES:= LOCAL_JAR_EXCLUDE_PACKAGES:=

View file

@ -41,14 +41,6 @@ endif
ifneq ($(filter default-ub,$(my_sanitize)),) ifneq ($(filter default-ub,$(my_sanitize)),)
my_sanitize := $(CLANG_DEFAULT_UB_CHECKS) my_sanitize := $(CLANG_DEFAULT_UB_CHECKS)
ifdef LOCAL_IS_HOST_MODULE
my_cflags += -fno-sanitize-recover=all
my_ldlibs += -ldl
else
my_cflags += -fsanitize-undefined-trap-on-error
my_shared_libraries += libdl
endif
endif endif
ifneq ($(my_sanitize),) ifneq ($(my_sanitize),)
@ -56,7 +48,13 @@ ifneq ($(my_sanitize),)
my_cflags += -fsanitize=$(fsanitize_arg) my_cflags += -fsanitize=$(fsanitize_arg)
ifdef LOCAL_IS_HOST_MODULE ifdef LOCAL_IS_HOST_MODULE
my_cflags += -fno-sanitize-recover=all
my_ldflags += -fsanitize=$(fsanitize_arg) my_ldflags += -fsanitize=$(fsanitize_arg)
my_ldlibs += -ldl
else
my_cflags += -fsanitize-undefined-trap-on-error
my_cflags += -ftrap-function=abort
my_shared_libraries += libdl
endif endif
endif endif
@ -68,7 +66,7 @@ ifneq ($(filter address,$(my_sanitize)),)
ifdef LOCAL_IS_HOST_MODULE ifdef LOCAL_IS_HOST_MODULE
# -nodefaultlibs (provided with libc++) prevents the driver from linking # -nodefaultlibs (provided with libc++) prevents the driver from linking
# libraries needed with -fsanitize=address. http://b/18650275 (WAI) # libraries needed with -fsanitize=address. http://b/18650275 (WAI)
my_ldlibs += -lm -ldl -lpthread my_ldlibs += -lm -lpthread
my_ldflags += -Wl,--no-as-needed my_ldflags += -Wl,--no-as-needed
else else
# ASan runtime library must be the first in the link order. # ASan runtime library must be the first in the link order.
@ -81,27 +79,12 @@ ifneq ($(filter address,$(my_sanitize)),)
endif endif
ifneq ($(filter undefined,$(my_sanitize)),) ifneq ($(filter undefined,$(my_sanitize)),)
my_cflags += -fno-sanitize-recover=all ifndef LOCAL_IS_HOST_MODULE
ifdef LOCAL_IS_HOST_MODULE
my_ldlibs += -ldl
else
$(error ubsan is not yet supported on the target) $(error ubsan is not yet supported on the target)
endif endif
endif endif
ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),) ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),)
recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_RECOVER)), recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_RECOVER)),
my_cflags += -fsanitize-recover=$(recover_arg) my_cflags += -fsanitize-recover=$(recover_arg)
endif endif
ifeq ($(strip $(LOCAL_DETECT_INTEGER_OVERFLOWS)),true)
ifeq ($(my_clang),true)
my_cflags += -fsanitize=signed-integer-overflow,unsigned-integer-overflow
my_cflags += -ftrap-function=abort
my_cflags += -fsanitize-undefined-trap-on-error
else
$(error $(LOCAL_MODULE): You must enable LOCAL_CLANG:=true to use LOCAL_DETECT_INTEGER_OVERFLOWS)
endif
endif