Bug 1194834: Don't use static libs on Windows ASan builds. r=glandium
authorDavid Major <dmajor@mozilla.com>
Thu, 10 Sep 2015 16:55:15 -0400
changeset 261793 6feccf342e7ca5120c7ae5b1ebfd8161709040b8
parent 261792 ba1fb46745fba671a113888120d88ed9bd6e7ab7
child 261794 bb14c6b7a30bece1da3b66bbaf5b42dbcf23c064
push id64855
push userdmajor@mozilla.com
push dateThu, 10 Sep 2015 20:56:06 +0000
treeherdermozilla-inbound@6feccf342e7c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1194834
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1194834: Don't use static libs on Windows ASan builds. r=glandium
build/gecko_templates.mozbuild
config/config.mk
ipc/app/moz.build
--- a/build/gecko_templates.mozbuild
+++ b/build/gecko_templates.mozbuild
@@ -20,17 +20,17 @@ def GeckoBinary(linkage='dependent', msv
     `msvcrt` indicates which Microsoft Visual Studio CRT, for Windows build,
     ought to be linked: 'static' or 'dynamic'.
 
     `mozglue` indicates whether to link against the mozglue library, and if
     so, what linkage to apply. Valid values are None (mozglue not linked),
     '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
         xpcomglue = 'xpcomglue_staticruntime'
         if not CONFIG['GNU_CC']:
             mozglue = None
             if linkage == 'dependent':
                 USE_LIBS += [
--- a/config/config.mk
+++ b/config/config.mk
@@ -376,16 +376,22 @@ CXXFLAGS += $(WARNINGS_AS_ERRORS)
 CFLAGS   += $(WARNINGS_AS_ERRORS)
 endif # ALLOW_COMPILER_WARNINGS
 
 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
 #// Currently, unless USE_STATIC_LIBS is defined, the multithreaded
 #// 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
 ifndef MOZ_NO_DEBUG_RTL
 RTL_FLAGS=-MTd         # Statically linked multithreaded MSVC4.0 debug RTL
 endif
 endif # MOZ_DEBUG
 
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -12,17 +12,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr
         'MozillaRuntimeMainAndroid.cpp',
     ]
 
     DIRS += ['pie']
 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 += [
                 'mozalloc_staticruntime',
             ]
     GeckoProgram(CONFIG['MOZ_CHILD_PROCESS_NAME'], **kwargs)
 
     SOURCES += [
@@ -50,19 +50,27 @@ if CONFIG['OS_TARGET'] != 'Android':
 if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
     # For sandbox includes and the include dependencies those have
     LOCAL_INCLUDES += [
         '/security/sandbox/chromium',
         '/security/sandbox/chromium-shim',
     ]
     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']:
         DELAYLOAD_DLLS += [
             'nss3.dll',
             'xul.dll'
         ]