From 8a31153ae01ef5238f45acd660294d360a2292f3 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Tue, 28 Apr 2015 13:23:36 -0700 Subject: [PATCH] Make asan more closely match clang behavior. Always link libm with asan. Hasn't been a problem before because ASAN was only ever used when libc++ was as well, which already links libm. Pass --no-as-needed for host modules. These aren't needed for the target builds because the target uses the shared RTL. Change-Id: I5d6a3c2dd557b5231be2b7711df6438693753a88 --- core/config_sanitizers.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index dcaab20a4..b8d95a53f 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -78,7 +78,8 @@ ifneq ($(filter address,$(my_sanitize)),) ifdef LOCAL_IS_HOST_MODULE # -nodefaultlibs (provided with libc++) prevents the driver from linking # libraries needed with -fsanitize=address. http://b/18650275 (WAI) - my_ldlibs += -ldl -lpthread + my_ldlibs += -lm -ldl -lpthread + my_ldflags += --no-as-needed else # ASan runtime library must be the first in the link order. my_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RUNTIME_LIBRARY) \