OSDN Git Service

Make asan more closely match clang behavior.
authorDan Albert <danalbert@google.com>
Tue, 28 Apr 2015 20:23:36 +0000 (13:23 -0700)
committerEvgenii Stepanov <eugenis@google.com>
Tue, 12 May 2015 20:40:26 +0000 (13:40 -0700)
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: I3b95c8682c0f63bac6b726f8cd15c638aaa98311

core/config_sanitizers.mk

index 210d442..6e3c0b8 100644 (file)
@@ -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
     my_shared_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_SHARED_LIBRARIES)
     my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)