From 5d8029f234669cf1688739437810db11dcdb403d Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Fri, 21 Feb 2014 18:10:53 +0400 Subject: [PATCH] Update ASan configuration. Change runtime library name to keep in sync with upstream. Enable frame pointers in instrumented code for fast stack unwind. Change-Id: I815912bb856c56c399639ea76ad4cb6b97961840 --- core/binary.mk | 2 ++ core/clang/config.mk | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index 7e0ad2dfc1..9fc91fb9ee 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -133,6 +133,8 @@ endif ifeq ($(strip $(LOCAL_ADDRESS_SANITIZER)),true) LOCAL_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) my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES) diff --git a/core/clang/config.mk b/core/clang/config.mk index c471f7ebbd..94dcdb04c4 100644 --- a/core/clang/config.mk +++ b/core/clang/config.mk @@ -67,9 +67,10 @@ CLANG_CONFIG_EXTRA_HOST_C_INCLUDES := $(LLVM_PREBUILTS_HEADER_PATH) CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := $(LLVM_PREBUILTS_HEADER_PATH) $(TARGET_OUT_HEADERS)/clang # Address sanitizer clang config -ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address +ADDRESS_SANITIZER_RUNTIME_LIBRARY := libclang_rt.asan_$(TARGET_ARCH)_android +ADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS := -fsanitize=address -fno-omit-frame-pointer ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS := -Wl,-u,__asan_preinit -ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl libasan_preload +ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES := libdl $(ADDRESS_SANITIZER_RUNTIME_LIBRARY) ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES := libasan # This allows us to use the superset of functionality that compiler-rt