Merge "Add a SANITIZE_HOST flag."
This commit is contained in:
@@ -191,19 +191,7 @@ $(foreach lib, $(LOCAL_HAL_STATIC_LIBRARIES), \
|
|||||||
b_lib :=
|
b_lib :=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
|
include $(BUILD_SYSTEM)/config_sanitizers.mk
|
||||||
my_clang := true
|
|
||||||
# Frame pointer based unwinder in ASan requires ARM frame setup.
|
|
||||||
LOCAL_ARM_MODE := arm
|
|
||||||
my_cflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
|
|
||||||
my_ldflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
|
|
||||||
ifdef LOCAL_IS_HOST_MODULE
|
|
||||||
my_ldflags += -fsanitize=address
|
|
||||||
else
|
|
||||||
my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
|
|
||||||
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_$(my_prefix)CLANG)),true)
|
ifeq ($(strip $($(LOCAL_2ND_ARCH_VAR_PREFIX)WITHOUT_$(my_prefix)CLANG)),true)
|
||||||
my_clang :=
|
my_clang :=
|
||||||
|
32
core/config_sanitizers.mk
Normal file
32
core/config_sanitizers.mk
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
##############################################
|
||||||
|
## Perform configuration steps for sanitizers.
|
||||||
|
##############################################
|
||||||
|
|
||||||
|
# Configure SANITIZE_HOST.
|
||||||
|
ifdef LOCAL_IS_HOST_MODULE
|
||||||
|
ifeq ($(SANITIZE_HOST),true)
|
||||||
|
ifneq ($(strip $(LOCAL_CLANG)),false)
|
||||||
|
ifneq ($(strip $(LOCAL_ADDRESS_SANITIZER)),false)
|
||||||
|
LOCAL_ADDRESS_SANITIZER := true
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Configure address sanitizer.
|
||||||
|
ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true)
|
||||||
|
my_clang := true
|
||||||
|
# Frame pointer based unwinder in ASan requires ARM frame setup.
|
||||||
|
LOCAL_ARM_MODE := arm
|
||||||
|
my_cflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
|
||||||
|
my_ldflags += $(ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS)
|
||||||
|
ifdef LOCAL_IS_HOST_MODULE
|
||||||
|
my_ldflags += -fsanitize=address
|
||||||
|
# -nodefaultlibs (provided with libc++) prevents the driver from linking
|
||||||
|
# libraries needed with -fsanitize=address. http://b/18650275
|
||||||
|
my_ldlibs += -ldl -lpthread
|
||||||
|
else
|
||||||
|
my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
|
||||||
|
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
|
||||||
|
endif
|
||||||
|
endif
|
@@ -17,6 +17,11 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
|
|||||||
- sgrep: Greps on all local source files.
|
- sgrep: Greps on all local source files.
|
||||||
- godir: Go to the directory containing a file.
|
- godir: Go to the directory containing a file.
|
||||||
|
|
||||||
|
Environemnt options:
|
||||||
|
- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
|
||||||
|
ASAN_OPTIONS=detect_leaks=0 will be set by default until the
|
||||||
|
build is leak-check clean.
|
||||||
|
|
||||||
Look at the source to view more functions. The complete list is:
|
Look at the source to view more functions. The complete list is:
|
||||||
EOF
|
EOF
|
||||||
T=$(gettop)
|
T=$(gettop)
|
||||||
@@ -231,6 +236,7 @@ function set_stuff_for_environment()
|
|||||||
export ANDROID_BUILD_TOP=$(gettop)
|
export ANDROID_BUILD_TOP=$(gettop)
|
||||||
# With this environment variable new GCC can apply colors to warnings/errors
|
# With this environment variable new GCC can apply colors to warnings/errors
|
||||||
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
||||||
|
export ASAN_OPTIONS=detect_leaks=0
|
||||||
}
|
}
|
||||||
|
|
||||||
function set_sequence_number()
|
function set_sequence_number()
|
||||||
|
Reference in New Issue
Block a user