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']: