From 5adfcb166e23bbb38053a8d9c8c05b9867a4dfe0 Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Thu, 25 Jun 2015 16:38:25 -0700 Subject: [PATCH] SANITIZE_TARGET: allow undef symbols in non-sanitized shared libraries. These symbols are defined in the ASan runtime library, which is always present at runtime. Bug:21785137 Change-Id: Ib8418c66323fd4cdfdc05548048f32380cb84ee5 --- core/config_sanitizers.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index e8ffc1b00d..b43b1cc5cb 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -34,6 +34,20 @@ ifeq ($(my_sanitize),never) my_sanitize := endif +# Undefined symbols can occur if a non-sanitized library links +# sanitized static libraries. That's OK, because the executable +# always depends on the ASan runtime library, which defines these +# symbols. +ifneq ($(strip $(SANITIZE_TARGET)),) + ifndef LOCAL_IS_HOST_MODULE + ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES) + ifeq ($(my_sanitize),) + my_allow_undefined_symbols := true + endif + endif + endif +endif + # Sanitizers can only be used with clang. ifneq ($(my_clang),true) ifneq ($(my_sanitize),)