Bug 1414287 - Use a 64-bits clang-cl for 32-bits static analysis builds r=dmajor
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 10 Oct 2018 17:53:06 +0000
changeset 496372 ce3b1b7b826fa336d1e8ead8520f55d6fa710dde
parent 496371 ba07c543cc935aed4a56a495a031dc8cd970290b
child 496373 0a7a9e17c1ea59f36f3669f07aeadd452acecbb4
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor
bugs1414287
milestone64.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 1414287 - Use a 64-bits clang-cl for 32-bits static analysis builds r=dmajor This also requires the 64-bits rust compiler and some build system tweaks. And since we make the 32-bits builds cross-compiles on CI, we also need to adjust the MSVC build mozconfigs such that the host compiler points to the right MSVC cl. Likewise, the DIA SDK is used for host things, so use the 64-bits version or it. Differential Revision: https://phabricator.services.mozilla.com/D7845
browser/config/mozconfigs/win32/clang
browser/config/mozconfigs/win32/clang-debug
browser/config/mozconfigs/win32/debug-msvc
browser/config/mozconfigs/win32/opt-msvc
build/win32/mozconfig.vs2017
config/config.mk
taskcluster/ci/static-analysis/kind.yml
--- a/browser/config/mozconfigs/win32/clang
+++ b/browser/config/mozconfigs/win32/clang
@@ -5,14 +5,16 @@ MOZ_AUTOMATION_L10N_CHECK=0
 . "$topsrcdir/build/mozconfig.win-common"
 . "$topsrcdir/browser/config/mozconfigs/common"
 
 ac_add_options --enable-optimize
 
 ac_add_options --enable-clang-plugin
 
 . $topsrcdir/build/win32/mozconfig.vs-latest
-# Regardless of what mozconfig.vs-latest sets, clang-plugin builds need to use
-# the Microsoft linker until at least bugs 1414287 and 1427808 are resolved.
+
+# Regardless of what mozconfig.vs-latest sets, lld-link that comes with the old
+# clang version used for static analysis fails to link multiple things. So
+# until bug 1427808 is resolved, use the Microsoft linker.
 export LINKER=link
 
 . "$topsrcdir/build/mozconfig.common.override"
 . "$topsrcdir/build/mozconfig.clang-cl"
--- a/browser/config/mozconfigs/win32/clang-debug
+++ b/browser/config/mozconfigs/win32/clang-debug
@@ -6,14 +6,16 @@ MOZ_AUTOMATION_L10N_CHECK=0
 . "$topsrcdir/browser/config/mozconfigs/common"
 
 ac_add_options --enable-optimize
 ac_add_options --enable-debug
 
 ac_add_options --enable-clang-plugin
 
 . $topsrcdir/build/win32/mozconfig.vs-latest
-# Regardless of what mozconfig.vs-latest sets, clang-plugin builds need to use
-# the Microsoft linker until at least bugs 1414287 and 1427808 are resolved.
+
+# Regardless of what mozconfig.vs-latest sets, lld-link that comes with the old
+# clang version used for static analysis fails to link multiple things. So
+# until bug 1427808 is resolved, use the Microsoft linker.
 export LINKER=link
 
 . "$topsrcdir/build/mozconfig.common.override"
 . "$topsrcdir/build/mozconfig.clang-cl"
--- a/browser/config/mozconfigs/win32/debug-msvc
+++ b/browser/config/mozconfigs/win32/debug-msvc
@@ -1,5 +1,8 @@
 . "$topsrcdir/browser/config/mozconfigs/win32/debug"
 
 export CC="cl.exe"
 export CXX="cl.exe"
 export LINKER="link.exe"
+
+export HOST_CC=${VSPATH}/VC/bin/Hostx64/x64/cl.exe
+export HOST_CXX=${VSPATH}/VC/bin/Hostx64/x64/cl.exe
--- a/browser/config/mozconfigs/win32/opt-msvc
+++ b/browser/config/mozconfigs/win32/opt-msvc
@@ -1,5 +1,8 @@
 . "$topsrcdir/browser/config/mozconfigs/win32/nightly"
 
 export CC="cl.exe"
 export CXX="cl.exe"
 export LINKER="link.exe"
+
+export HOST_CC=${VSPATH}/VC/bin/Hostx64/x64/cl.exe
+export HOST_CXX=${VSPATH}/VC/bin/Hostx64/x64/cl.exe
--- a/build/win32/mozconfig.vs2017
+++ b/build/win32/mozconfig.vs2017
@@ -4,28 +4,31 @@ if [ -z "${VSPATH}" ]; then
 fi
 
 if [ -d "${VSPATH}" ]; then
     VSWINPATH="$(cd ${VSPATH} && pwd -W)"
 
     export WINDOWSSDKDIR="${VSWINPATH}/SDK"
     export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT"
     export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x86"
-    export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin"
+    export WIN_DIA_SDK_BIN_DIR="${VSPATH}/DIA SDK/bin/amd64"
 
     export PATH="${VSPATH}/VC/bin/Hostx86/x86:${VSPATH}/VC/bin/Hostx64/x86:${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/SDK/bin/10.0.17134.0/x64:${WIN_DIA_SDK_BIN_DIR}:${PATH}"
     export PATH="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x86:${PATH}"
 
     export INCLUDE="${VSPATH}/VC/include:${VSPATH}/VC/atlmfc/include:${VSPATH}/SDK/Include/10.0.17134.0/ucrt:${VSPATH}/SDK/Include/10.0.17134.0/shared:${VSPATH}/SDK/Include/10.0.17134.0/um:${VSPATH}/SDK/Include/10.0.17134.0/winrt:${VSPATH}/DIA SDK/include"
     export LIB="${VSPATH}/VC/lib/x86:${VSPATH}/VC/atlmfc/lib/x86:${VSPATH}/SDK/Lib/10.0.17134.0/ucrt/x86:${VSPATH}/SDK/Lib/10.0.17134.0/um/x86:${VSPATH}/DIA SDK/lib"
 
     export WIN64_LINK="${VSPATH}/VC/bin/Hostx64/x64/link.exe"
     export WIN64_LIB="${VSPATH}/VC/lib/x64:${VSPATH}/VC/atlmfc/lib/x64:${VSPATH}/SDK/Lib/10.0.17134.0/ucrt/x64:${VSPATH}/SDK/Lib/10.0.17134.0/um/x64:${VSPATH}/DIA SDK/lib/amd64"
 fi
 
+ac_add_options --target=i686-pc-mingw32
+ac_add_options --host=x86_64-pc-mingw32
+
 . $topsrcdir/build/mozconfig.vs-common
 
 mk_export_correct_style WINDOWSSDKDIR
 mk_export_correct_style WIN32_REDIST_DIR
 mk_export_correct_style WIN_UCRT_REDIST_DIR
 mk_export_correct_style WIN_DIA_SDK_BIN_DIR
 mk_export_correct_style PATH
 mk_export_correct_style INCLUDE
--- a/config/config.mk
+++ b/config/config.mk
@@ -196,16 +196,23 @@ COMPILE_CMFLAGS = $(MOZ_LTO_CFLAGS) $(OS
 COMPILE_CMMFLAGS = $(MOZ_LTO_CFLAGS) $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
 ASFLAGS = $(COMPUTED_ASFLAGS)
 SFLAGS = $(COMPUTED_SFLAGS)
 
 HOST_CFLAGS = $(COMPUTED_HOST_CFLAGS) $(_DEPEND_CFLAGS)
 HOST_CXXFLAGS = $(COMPUTED_HOST_CXXFLAGS) $(_DEPEND_CFLAGS)
 HOST_C_LDFLAGS = $(COMPUTED_HOST_C_LDFLAGS)
 HOST_CXX_LDFLAGS = $(COMPUTED_HOST_CXX_LDFLAGS)
+# Win32 Cross-builds on win64 need to override LIB when invoking the linker,
+# which we do for rust through cargo-linker.bat, so we abuse it here.
+# Ideally, we'd empty LIB and pass -LIBPATH options to the linker somehow but
+# we don't have this in place for rust, so...
+ifdef WIN64_CARGO_LINKER
+HOST_LINKER = $(topobjdir)/build/win64/cargo-linker.bat
+endif
 
 ifdef MOZ_LTO
 ifeq (Darwin,$(OS_TARGET))
 # When linking on macOS, debug info is not linked along with the final binary,
 # and the dwarf data stays in object files until they are "linked" with the
 # dsymutil tool.
 # With LTO, object files are temporary, and are not kept around, which
 # means there's no object file for dsymutil to do its job. Consequently,
--- a/taskcluster/ci/static-analysis/kind.yml
+++ b/taskcluster/ci/static-analysis/kind.yml
@@ -43,18 +43,18 @@ jobs:
             options: [append-env-variables-from-configs]
             script: mozharness/scripts/fx_desktop_build.py
             config:
                 - builds/releng_base_firefox.py
                 - builds/taskcluster_base_windows.py
                 - builds/taskcluster_base_win32.py
                 - builds/taskcluster_sub_win32/clang_debug.py
         toolchains:
-            - win32-clang-cl-st-an
-            - win32-rust
+            - win64-clang-cl-st-an
+            - win64-rust
             - win64-cbindgen
             - win64-sccache
             - win64-node
 
     win32-st-an/opt:
         description: "Win32 Static Analysis Opt (clang-cl)"
         index:
             product: firefox
@@ -74,18 +74,18 @@ jobs:
             options: [append-env-variables-from-configs]
             script: mozharness/scripts/fx_desktop_build.py
             config:
                 - builds/releng_base_firefox.py
                 - builds/taskcluster_base_windows.py
                 - builds/taskcluster_base_win32.py
                 - builds/taskcluster_sub_win32/clang.py
         toolchains:
-            - win32-clang-cl-st-an
-            - win32-rust
+            - win64-clang-cl-st-an
+            - win64-rust
             - win64-cbindgen
             - win64-sccache
             - win64-node
 
     win64-st-an/debug:
         description: "Win64 Static Analysis Debug (clang-cl)"
         index:
             product: firefox