am d400f774: am dcac4582: Merge "Add support for LOCAL_DETECT_INTEGER_OVERFLOWS"

* commit 'd400f7740d1f8105c5d4d5fdb355f08808c729a5':
  Add support for LOCAL_DETECT_INTEGER_OVERFLOWS
This commit is contained in:
Nick Kralevich 2015-06-15 22:17:35 +00:00 committed by Android Git Automerger
commit ad48a4655a
2 changed files with 11 additions and 0 deletions

View File

@ -150,6 +150,7 @@ LOCAL_CTS_TEST_PACKAGE:=
LOCAL_CTS_TEST_RUNNER:=
LOCAL_CLANG:=
LOCAL_ADDRESS_SANITIZER:=
LOCAL_DETECT_INTEGER_OVERFLOWS:=
LOCAL_JAR_EXCLUDE_FILES:=
LOCAL_JAR_PACKAGES:=
LOCAL_JAR_EXCLUDE_PACKAGES:=

View File

@ -105,3 +105,13 @@ ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),)
recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_RECOVER)),
my_cflags += -fsanitize-recover=$(recover_arg)
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