Backed out 2 changesets (bug 1479800, bug 1483779)for frequent cgx and arm64 failures
authorarthur.iakab <aiakab@mozilla.com>
Fri, 17 Aug 2018 09:50:30 +0300
changeset 432053 8adbf514581c39a16e5b9fd8243db0e91c626c1e
parent 432052 f15fd461d2eca64077a42a6bcc04038cb741624e
child 432054 6ac9bb47e988cea5c3828f4fb5e9688d9bc7d148
push id106624
push useraiakab@mozilla.com
push dateFri, 17 Aug 2018 06:50:57 +0000
treeherdermozilla-inbound@8adbf514581c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1479800, 1483779
milestone63.0a1
backs out5fcbe08fb321a5076f56c380b554c63068efbb00
dccd5299c5ad9e4258eb7b08201f2f39164a2a54
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
Backed out 2 changesets (bug 1479800, bug 1483779)for frequent cgx and arm64 failures Backed out changeset 5fcbe08fb321 (bug 1483779) Backed out changeset dccd5299c5ad (bug 1479800)
Makefile.in
build/build-clang/build-clang.py
build/build-clang/clang-win64-st-an.json
build/build-clang/clang-win64.json
build/build-clang/r327876.patch
build/build-clang/workaround-issue38586.patch
build/moz.configure/toolchain.configure
--- a/Makefile.in
+++ b/Makefile.in
@@ -306,18 +306,21 @@ package-generated-sources:
 # PGO support, but we can't do this test in client.mk
 # No point in clobbering if PGO has been explicitly disabled.
 ifdef NO_PROFILE_GUIDED_OPTIMIZE
 maybe_clobber_profiledbuild:
 else
 ifneq ($(CC_TYPE),msvc)
 maybe_clobber_profiledbuild: clean
 ifneq (,$(findstring clang,$(CC_TYPE)))
+# 32-bit Windows PGO is currently blocked by bug 1479800
+ifneq ($(CC_TYPE)_$(CPU_ARCH),clang-cl_x86)
 	$(LLVM_PROFDATA) merge -o $(DEPTH)/merged.profdata $(DEPTH)/*.profraw
 endif
+endif
 else
 maybe_clobber_profiledbuild:
 	$(RM) $(DIST)/bin/*.pgc
 	find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
 endif # msvc
 endif # NO_PROFILE_GUIDED_OPTIMIZE
 
 .PHONY: maybe_clobber_profiledbuild
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -58,24 +58,16 @@ def import_clang_tidy(source_dir):
     sys.path.append(clang_plugin_path)
     from import_mozilla_checks import do_import
     do_import(clang_plugin_path, clang_tidy_path)
 
 
 def build_package(package_build_dir, cmake_args):
     if not os.path.exists(package_build_dir):
         os.mkdir(package_build_dir)
-    # If CMake has already been run, it may have been run with different
-    # arguments, so we need to re-run it.  Make sure the cached copy of the
-    # previous CMake run is cleared before running it again.
-    if os.path.exists(package_build_dir + "/CMakeCache.txt"):
-        os.remove(package_build_dir + "/CMakeCache.txt")
-    if os.path.exists(package_build_dir + "/CMakeFiles"):
-        shutil.rmtree(package_build_dir + "/CMakeFiles")
-
     run_in(package_build_dir, ["cmake"] + cmake_args)
     run_in(package_build_dir, ["ninja", "install"])
 
 
 @contextmanager
 def updated_env(env):
     old_env = os.environ.copy()
     os.environ.update(env)
@@ -179,125 +171,83 @@ def is_linux():
 
 def is_windows():
     return platform.system() == "Windows"
 
 
 def build_one_stage(cc, cxx, asm, ld, ar, ranlib, libtool,
                     src_dir, stage_dir, build_libcxx,
                     osx_cross_compile, build_type, assertions,
-                    python_path, gcc_dir, libcxx_include_dir,
-                    is_final_stage=False):
+                    python_path, gcc_dir, libcxx_include_dir):
     if not os.path.exists(stage_dir):
         os.mkdir(stage_dir)
 
     build_dir = stage_dir + "/build"
     inst_dir = stage_dir + "/clang"
 
+    # If CMake has already been run, it may have been run with different
+    # arguments, so we need to re-run it.  Make sure the cached copy of the
+    # previous CMake run is cleared before running it again.
+    if os.path.exists(build_dir + "/CMakeCache.txt"):
+        os.remove(build_dir + "/CMakeCache.txt")
+    if os.path.exists(build_dir + "/CMakeFiles"):
+        shutil.rmtree(build_dir + "/CMakeFiles")
+
     # cmake doesn't deal well with backslashes in paths.
     def slashify_path(path):
         return path.replace('\\', '/')
 
-    def cmake_base_args(cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir):
-        cmake_args = [
-            "-GNinja",
-            "-DCMAKE_C_COMPILER=%s" % slashify_path(cc[0]),
-            "-DCMAKE_CXX_COMPILER=%s" % slashify_path(cxx[0]),
-            "-DCMAKE_ASM_COMPILER=%s" % slashify_path(asm[0]),
-            "-DCMAKE_LINKER=%s" % slashify_path(ld[0]),
-            "-DCMAKE_AR=%s" % slashify_path(ar),
-            "-DCMAKE_C_FLAGS=%s" % ' '.join(cc[1:]),
-            "-DCMAKE_CXX_FLAGS=%s" % ' '.join(cxx[1:]),
-            "-DCMAKE_ASM_FLAGS=%s" % ' '.join(asm[1:]),
-            "-DCMAKE_EXE_LINKER_FLAGS=%s" % ' '.join(ld[1:]),
-            "-DCMAKE_SHARED_LINKER_FLAGS=%s" % ' '.join(ld[1:]),
-            "-DCMAKE_BUILD_TYPE=%s" % build_type,
-            "-DCMAKE_INSTALL_PREFIX=%s" % inst_dir,
-            "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64",
-            "-DLLVM_ENABLE_ASSERTIONS=%s" % ("ON" if assertions else "OFF"),
-            "-DPYTHON_EXECUTABLE=%s" % slashify_path(python_path),
-            "-DLLVM_TOOL_LIBCXX_BUILD=%s" % ("ON" if build_libcxx else "OFF"),
-            "-DLIBCXX_LIBCPPABI_VERSION=\"\"",
-        ]
-        if is_windows():
-            cmake_args.insert(-1, "-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON")
-            cmake_args.insert(-1, "-DLLVM_USE_CRT_RELEASE=MT")
-        if ranlib is not None:
-            cmake_args += ["-DCMAKE_RANLIB=%s" % slashify_path(ranlib)]
-        if libtool is not None:
-            cmake_args += ["-DCMAKE_LIBTOOL=%s" % slashify_path(libtool)]
-        if osx_cross_compile:
-            cmake_args += [
-                "-DCMAKE_SYSTEM_NAME=Darwin",
-                "-DCMAKE_SYSTEM_VERSION=10.10",
-                "-DLLVM_ENABLE_THREADS=OFF",
-                "-DLIBCXXABI_LIBCXX_INCLUDES=%s" % libcxx_include_dir,
-                "-DCMAKE_OSX_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
-                "-DCMAKE_FIND_ROOT_PATH=%s" % slashify_path(os.getenv("CROSS_CCTOOLS_PATH")), # noqa
-                "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER",
-                "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY",
-                "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY",
-                "-DCMAKE_MACOSX_RPATH=ON",
-                "-DCMAKE_OSX_ARCHITECTURES=x86_64",
-                "-DDARWIN_osx_ARCHS=x86_64",
-                "-DDARWIN_osx_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
-                "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin11"
-            ]
-        return cmake_args
-
-    cmake_args = cmake_base_args(
-        cc, cxx, asm, ld, ar, ranlib, libtool, inst_dir)
-    cmake_args += [
-        src_dir
-    ]
+    cmake_args = ["-GNinja",
+                  "-DCMAKE_C_COMPILER=%s" % slashify_path(cc[0]),
+                  "-DCMAKE_CXX_COMPILER=%s" % slashify_path(cxx[0]),
+                  "-DCMAKE_ASM_COMPILER=%s" % slashify_path(asm[0]),
+                  "-DCMAKE_LINKER=%s" % slashify_path(ld[0]),
+                  "-DCMAKE_AR=%s" % slashify_path(ar),
+                  "-DCMAKE_C_FLAGS=%s" % ' '.join(cc[1:]),
+                  "-DCMAKE_CXX_FLAGS=%s" % ' '.join(cxx[1:]),
+                  "-DCMAKE_ASM_FLAGS=%s" % ' '.join(asm[1:]),
+                  "-DCMAKE_EXE_LINKER_FLAGS=%s" % ' '.join(ld[1:]),
+                  "-DCMAKE_SHARED_LINKER_FLAGS=%s" % ' '.join(ld[1:]),
+                  "-DCMAKE_BUILD_TYPE=%s" % build_type,
+                  "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64",
+                  "-DLLVM_ENABLE_ASSERTIONS=%s" % ("ON" if assertions else "OFF"),
+                  "-DPYTHON_EXECUTABLE=%s" % slashify_path(python_path),
+                  "-DCMAKE_INSTALL_PREFIX=%s" % inst_dir,
+                  "-DLLVM_TOOL_LIBCXX_BUILD=%s" % ("ON" if build_libcxx else "OFF"),
+                  "-DLIBCXX_LIBCPPABI_VERSION=\"\"",
+                  src_dir]
+    if is_windows():
+        cmake_args.insert(-1, "-DLLVM_EXPORT_SYMBOLS_FOR_PLUGINS=ON")
+        cmake_args.insert(-1, "-DLLVM_USE_CRT_RELEASE=MT")
+    if ranlib is not None:
+        cmake_args += ["-DCMAKE_RANLIB=%s" % slashify_path(ranlib)]
+    if libtool is not None:
+        cmake_args += ["-DCMAKE_LIBTOOL=%s" % slashify_path(libtool)]
+    if osx_cross_compile:
+        cmake_args += ["-DCMAKE_SYSTEM_NAME=Darwin",
+                       "-DCMAKE_SYSTEM_VERSION=10.10",
+                       "-DLLVM_ENABLE_THREADS=OFF",
+                       "-DLIBCXXABI_LIBCXX_INCLUDES=%s" % libcxx_include_dir,
+                       "-DCMAKE_OSX_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
+                       "-DCMAKE_FIND_ROOT_PATH=%s" % slashify_path(os.getenv("CROSS_CCTOOLS_PATH")), # noqa
+                       "-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER",
+                       "-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY",
+                       "-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY",
+                       "-DCMAKE_MACOSX_RPATH=ON",
+                       "-DCMAKE_OSX_ARCHITECTURES=x86_64",
+                       "-DDARWIN_osx_ARCHS=x86_64",
+                       "-DDARWIN_osx_SYSROOT=%s" % slashify_path(os.getenv("CROSS_SYSROOT")),
+                       "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-apple-darwin11"]
     build_package(build_dir, cmake_args)
 
     if is_linux():
         install_libgcc(gcc_dir, inst_dir)
     # For some reasons the import library clang.lib of clang.exe is not
     # installed, so we copy it by ourselves.
     if is_windows():
-        # The compiler-rt cmake scripts don't allow to build it for multiple
-        # targets at once on Windows, so manually build the 32-bits compiler-rt
-        # during the final stage.
-        build_32_bit = False
-        if is_final_stage:
-            # Only build the 32-bits compiler-rt when we originally built for
-            # 64-bits, which we detect through the contents of the LIB
-            # environment variable, which we also adjust for a 32-bits build
-            # at the same time.
-            old_lib = os.environ['LIB']
-            new_lib = []
-            for l in old_lib.split(os.pathsep):
-                if l.endswith('x64'):
-                    l = l[:-3] + 'x86'
-                    build_32_bit = True
-                elif l.endswith('amd64'):
-                    l = l[:-5]
-                    build_32_bit = True
-                new_lib.append(l)
-        if build_32_bit:
-            os.environ['LIB'] = os.pathsep.join(new_lib)
-            compiler_rt_build_dir = stage_dir + '/compiler-rt'
-            compiler_rt_inst_dir = inst_dir + '/lib/clang/'
-            subdirs = os.listdir(compiler_rt_inst_dir)
-            assert len(subdirs) == 1
-            compiler_rt_inst_dir += subdirs[0]
-            cmake_args = cmake_base_args(
-                [os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + cc[1:],
-                [os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + cxx[1:],
-                [os.path.join(inst_dir, 'bin', 'clang-cl.exe'), '-m32'] + asm[1:],
-                ld, ar, ranlib, libtool, compiler_rt_inst_dir)
-            cmake_args += [
-                '-DLLVM_CONFIG_PATH=%s' % slashify_path(
-                    os.path.join(inst_dir, 'bin', 'llvm-config')),
-                os.path.join(src_dir, 'projects', 'compiler-rt'),
-            ]
-            build_package(compiler_rt_build_dir, cmake_args)
-            os.environ['LIB'] = old_lib
         install_import_library(build_dir, inst_dir)
         install_asan_symbols(build_dir, inst_dir)
 
 
 # Return the absolute path of a build tool.  We first look to see if the
 # variable is defined in the config file, and if so we make sure it's an
 # absolute path to an existing tool, otherwise we look for a program in
 # $PATH named "key".
@@ -660,34 +610,32 @@ if __name__ == "__main__":
                 (cc_name, exe_ext)] + extra_cflags2,
             [stage1_inst_dir + "/bin/%s%s" %
                 (cxx_name, exe_ext)] + extra_cxxflags2,
             [stage1_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_asmflags,
             [ld] + extra_ldflags,
             ar, ranlib, libtool,
             llvm_source_dir, stage2_dir, build_libcxx, osx_cross_compile,
-            build_type, assertions, python_path, gcc_dir, libcxx_include_dir,
-            stages == 2)
+            build_type, assertions, python_path, gcc_dir, libcxx_include_dir)
 
     if stages > 2:
         stage3_dir = build_dir + '/stage3'
         final_stage_dir = stage3_dir
         build_one_stage(
             [stage2_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_cflags2,
             [stage2_inst_dir + "/bin/%s%s" %
                 (cxx_name, exe_ext)] + extra_cxxflags2,
             [stage2_inst_dir + "/bin/%s%s" %
                 (cc_name, exe_ext)] + extra_asmflags,
             [ld] + extra_ldflags,
             ar, ranlib, libtool,
             llvm_source_dir, stage3_dir, build_libcxx, osx_cross_compile,
-            build_type, assertions, python_path, gcc_dir, libcxx_include_dir,
-            stages == 3)
+            build_type, assertions, python_path, gcc_dir, libcxx_include_dir)
 
     package_name = "clang"
     if build_clang_tidy:
         prune_final_dir_for_clang_tidy(os.path.join(final_stage_dir, "clang"))
         package_name = "clang-tidy"
 
     if not args.skip_tar:
         ext = "bz2" if is_darwin() or is_windows() else "xz"
--- a/build/build-clang/clang-win64-st-an.json
+++ b/build/build-clang/clang-win64-st-an.json
@@ -11,13 +11,12 @@
     "libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
     "python_path": "c:/mozilla-build/python/python.exe",
     "cc": "cl.exe",
     "cxx": "cl.exe",
     "ml": "ml64.exe",
     "patches": [
       "r318309.patch",
       "r320462.patch",
-      "r327876.patch",
       "loosen-msvc-detection.patch",
       "fflush-before-unlocking.patch"
     ]
 }
--- a/build/build-clang/clang-win64.json
+++ b/build/build-clang/clang-win64.json
@@ -10,12 +10,11 @@
     "compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",
     "libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
     "python_path": "c:/mozilla-build/python/python.exe",
     "cc": "cl.exe",
     "cxx": "cl.exe",
     "ml": "ml64.exe",
     "patches": [
       "loosen-msvc-detection.patch",
-      "r339636.patch",
-      "workaround-issue38586.patch"
+      "r339636.patch"
     ]
 }
deleted file mode 100644
--- a/build/build-clang/r327876.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 522a892efc2ff22a2fd421b1ef4d9d9739d78b2e Mon Sep 17 00:00:00 2001
-From: Vitaly Buka <vitalybuka@google.com>
-Date: Mon, 19 Mar 2018 18:22:35 +0000
-Subject: [PATCH] Fix CMake/MSVC when compiler-rt and llvm are built separately
-
-Summary:
-For some reason CMake can't find the `append` macro if LLVM is built separately and imported via `LLVM_CONFIG_PATH`.
-
-Patch by Loo Rong Jie
-
-Reviewers: rnk, vitalybuka
-
-Reviewed By: rnk, vitalybuka
-
-Subscribers: dberris, mgorny, llvm-commits, #sanitizers
-
-Differential Revision: https://reviews.llvm.org/D43458
-
-git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@327876 91177308-0d34-0410-b5e6-96231b3b80d8
----
- CMakeLists.txt | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
-index 4b953b212..a02ef9532 100644
---- a/compiler-rt/CMakeLists.txt
-+++ b/compiler-rt/CMakeLists.txt
-@@ -339,7 +339,7 @@ if (CMAKE_LINKER MATCHES "link.exe$")
-   # it, but CMake doesn't seem to have a way to set linker flags for
-   # individual static libraries, so we enable the suppression flag for
-   # the whole compiler-rt project.
--  append("/IGNORE:4221" CMAKE_STATIC_LINKER_FLAGS)
-+  set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /IGNORE:4221")
- endif()
- 
- add_subdirectory(include)
--- 
-2.18.0
-
deleted file mode 100644
--- a/build/build-clang/workaround-issue38586.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
-index 86ca2b3ef..f6ddd24eb 100644
---- a/compiler-rt/CMakeLists.txt
-+++ b/compiler-rt/CMakeLists.txt
-@@ -284,6 +284,26 @@ if(MSVC)
-   # warning from the MS linker complaining that it can't find the 'vc140.pdb'
-   # file used by our object library compilations.
-   list(APPEND SANITIZER_COMMON_CFLAGS /Z7)
-+
-+# Copied from llvm/cmake/modules/LLVMProcessSources.cmake
-+function(llvm_replace_compiler_option var old new)
-+  # Replaces a compiler option or switch `old' in `var' by `new'.
-+  # If `old' is not in `var', appends `new' to `var'.
-+  # Example: llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
-+  # If the option already is on the variable, don't add it:
-+  if( "${${var}}" MATCHES "(^| )${new}($| )" )
-+    set(n "")
-+  else()
-+    set(n "${new}")
-+  endif()
-+  if( "${${var}}" MATCHES "(^| )${old}($| )" )
-+    string( REGEX REPLACE "(^| )${old}($| )" " ${n} " ${var} "${${var}}" )
-+  else()
-+    set( ${var} "${${var}} ${n}" )
-+  endif()
-+  set( ${var} "${${var}}" PARENT_SCOPE )
-+endfunction(llvm_replace_compiler_option)
-+
-   llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/Z[i7I]" "/Z7")
-   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_DEBUG "/Z[i7I]" "/Z7")
-   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z[i7I]" "/Z7")
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1257,20 +1257,19 @@ def pgo_flags(compiler, build_env, targe
             use_cflags=['-fprofile-use', '-fprofile-correction',
                         '-Wcoverage-mismatch'],
             use_ldflags=['-fprofile-use'],
         )
 
     if compiler.type in ('clang-cl', 'clang'):
         profdata = os.path.join(topobjdir, 'merged.profdata')
         if compiler.type == 'clang-cl':
+            # 32-bit PGO is currently blocked by bug 1479800
             if target.cpu == 'x86_64':
                 gen_ldflags = ['clang_rt.profile-x86_64.lib']
-            elif target.cpu == 'x86':
-                gen_ldflags = ['clang_rt.profile-i386.lib']
             else:
                 gen_ldflags = None
         else:
             gen_ldflags = ['-fprofile-instr-generate']
 
         if gen_ldflags:
             return namespace(
                 gen_cflags=['-fprofile-instr-generate'],