From 2e0f44f809ed252d87a1441f24781ea521117cae Mon Sep 17 00:00:00 2001 From: David Major Date: Thu, 10 Sep 2015 16:55:15 -0400 Subject: [PATCH] Bug 1194834: Don't use static libs on Windows ASan builds. r=glandium --- build/gecko_templates.mozbuild | 2 +- config/config.mk | 6 ++++++ ipc/app/moz.build | 12 ++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/build/gecko_templates.mozbuild b/build/gecko_templates.mozbuild index 905ce038e03..8cadb91f6bb 100644 --- a/build/gecko_templates.mozbuild +++ b/build/gecko_templates.mozbuild @@ -25,7 +25,7 @@ def GeckoBinary(linkage='dependent', msvcrt='dynamic', mozglue=None): 'program' (mozglue linked to an executable program), or 'library' (mozglue linked to a shared library). ''' - if msvcrt == 'dynamic' or CONFIG['OS_ARCH'] != 'WINNT': + if msvcrt == 'dynamic' or CONFIG['OS_ARCH'] != 'WINNT' or CONFIG['MOZ_ASAN']: xpcomglue = 'xpcomglue' elif msvcrt == 'static': USE_STATIC_LIBS = True diff --git a/config/config.mk b/config/config.mk index 9741f053510..b9bc3ae27d2 100644 --- a/config/config.mk +++ b/config/config.mk @@ -381,6 +381,12 @@ ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) #// DLL version of the RTL is used... #// #//------------------------------------------------------------------------ +ifdef MOZ_ASAN +# ASAN-instrumented code tries to link against the dynamic CRT, which can't be +# used in the same link as the static CRT. +USE_STATIC_LIBS= +endif # MOZ_ASAN + ifdef USE_STATIC_LIBS RTL_FLAGS=-MT # Statically linked multithreaded RTL ifdef MOZ_DEBUG diff --git a/ipc/app/moz.build b/ipc/app/moz.build index fb2157ba7da..9337ba4219f 100644 --- a/ipc/app/moz.build +++ b/ipc/app/moz.build @@ -17,7 +17,7 @@ else: kwargs = { 'linkage': None, } - if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT': + if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['MOZ_ASAN']: kwargs['msvcrt'] = 'static' if not CONFIG['GNU_CC']: USE_LIBS += [ @@ -55,9 +55,17 @@ if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT': ] USE_LIBS += [ 'rlz', - 'sandbox_staticruntime_s', ] + if CONFIG['MOZ_ASAN']: + USE_LIBS += [ + 'sandbox_s', + ] + else: + USE_LIBS += [ + 'sandbox_staticruntime_s', + ] + # clang-cl can't deal with this delay-load due to bug 1188045 # (also filed as https://llvm.org/bugs/show_bug.cgi?id=24291) if not CONFIG['CLANG_CL']: