summaryrefslogtreecommitdiffstats
path: root/core/config_sanitizers.mk
diff options
context:
space:
mode:
Diffstat (limited to 'core/config_sanitizers.mk')
-rw-r--r--core/config_sanitizers.mk9
1 files changed, 7 insertions, 2 deletions
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 210d442..7eb1c89 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -78,10 +78,15 @@ 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 += -Wl,--no-as-needed
else
- my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
+ # ASan runtime library must be the first in the link order.
+ my_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RUNTIME_LIBRARY) \
+ $(my_shared_libraries) \
+ $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
+ my_ldflags += -Wl,-rpath,$($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RPATH)
endif
endif