Browse Source

mozilla rel-257 rebase part 16

Ian Neal 4 years ago
parent
commit
a7e1a42614
60 changed files with 10508 additions and 97 deletions
  1. 0 21
      comm-esr60/mozilla-esr60/patches/1584803-version-beta1.patch
  2. 0 31
      comm-esr60/mozilla-esr60/patches/PARTLY-1445766-61a1.patch
  3. 0 6
      comm-esr60/mozilla-esr60/patches/series
  4. 342 0
      rel-257/mozilla-esr60/patches/1372381-1-61a1.patch
  5. 118 0
      rel-257/mozilla-esr60/patches/1372381-2-61a1.patch
  6. 383 0
      rel-257/mozilla-esr60/patches/1372381-3-61a1.patch
  7. 88 0
      rel-257/mozilla-esr60/patches/1372381-4-61a1.patch
  8. 95 0
      rel-257/mozilla-esr60/patches/1397263-1-64a1.patch
  9. 459 0
      rel-257/mozilla-esr60/patches/1397263-2-64a1.patch
  10. 130 0
      rel-257/mozilla-esr60/patches/1397263-3-64a1.patch
  11. 139 0
      rel-257/mozilla-esr60/patches/1397263-4-64a1.patch
  12. 109 0
      rel-257/mozilla-esr60/patches/1397263-5-64a1.patch
  13. 157 0
      rel-257/mozilla-esr60/patches/1397263-6-64a1.patch
  14. 331 0
      rel-257/mozilla-esr60/patches/1419892-61a1.patch
  15. 103 0
      rel-257/mozilla-esr60/patches/1429875-1-61a1.patch
  16. 54 0
      rel-257/mozilla-esr60/patches/1429875-2-61a1.patch
  17. 287 0
      rel-257/mozilla-esr60/patches/1429875-3-61a1.patch
  18. 1775 0
      rel-257/mozilla-esr60/patches/1429875-4-61a1.patch
  19. 386 0
      rel-257/mozilla-esr60/patches/1429875-5-61a1.patch
  20. 154 0
      rel-257/mozilla-esr60/patches/1445398-61a1.patch
  21. 90 0
      rel-257/mozilla-esr60/patches/1445766-61a1.patch
  22. 79 0
      rel-257/mozilla-esr60/patches/1449623-1-61a1.patch
  23. 37 0
      rel-257/mozilla-esr60/patches/1449623-2-61a1.patch
  24. 101 0
      rel-257/mozilla-esr60/patches/1451529-61a1.patch
  25. 307 0
      rel-257/mozilla-esr60/patches/1454771-1-61a1.patch
  26. 81 0
      rel-257/mozilla-esr60/patches/1454771-2-61a1.patch
  27. 172 0
      rel-257/mozilla-esr60/patches/1454825-61a1.patch
  28. 285 0
      rel-257/mozilla-esr60/patches/1457524-1-61a1.patch
  29. 35 0
      rel-257/mozilla-esr60/patches/1457524-2-61a1.patch
  30. 82 0
      rel-257/mozilla-esr60/patches/1457524-3-61a1.patch
  31. 40 0
      rel-257/mozilla-esr60/patches/1457524-4-61a1.patch
  32. 31 0
      rel-257/mozilla-esr60/patches/1457524-5-61a1.patch
  33. 28 0
      rel-257/mozilla-esr60/patches/1457524-6-61a1.patch
  34. 257 0
      rel-257/mozilla-esr60/patches/1458161-61a1.patch
  35. 28 0
      rel-257/mozilla-esr60/patches/1464161-62a1.patch
  36. 58 0
      rel-257/mozilla-esr60/patches/1467327-62a1.patch
  37. 694 0
      rel-257/mozilla-esr60/patches/1469091-63a1.patch
  38. 78 0
      rel-257/mozilla-esr60/patches/1480553-3only-63a1.patch
  39. 98 0
      rel-257/mozilla-esr60/patches/1486905-63a1.patch
  40. 62 0
      rel-257/mozilla-esr60/patches/1490549-1-64a1.patch
  41. 274 0
      rel-257/mozilla-esr60/patches/1490549-2-64a1.patch
  42. 297 0
      rel-257/mozilla-esr60/patches/1490549-3-64a1.patch
  43. 54 0
      rel-257/mozilla-esr60/patches/1490549-4-64a1.patch
  44. 37 0
      rel-257/mozilla-esr60/patches/1494958-64a1.patch
  45. 218 0
      rel-257/mozilla-esr60/patches/1498450-partial-64a1.patch
  46. 62 0
      rel-257/mozilla-esr60/patches/1514089-66a1.patch
  47. 7 10
      rel-257/mozilla-esr60/patches/1515528-1-66a1.patch
  48. 36 0
      rel-257/mozilla-esr60/patches/1515528-2-66a1.patch
  49. 468 0
      rel-257/mozilla-esr60/patches/1515528-3-66a1.patch
  50. 37 0
      rel-257/mozilla-esr60/patches/1515528-4-66a1.patch
  51. 44 0
      rel-257/mozilla-esr60/patches/1515528-5-66a1.patch
  52. 2 2
      rel-257/mozilla-esr60/patches/1515550-66a1.patch
  53. 200 0
      rel-257/mozilla-esr60/patches/1515579-2only-66a1.patch
  54. 106 0
      rel-257/mozilla-esr60/patches/1515843-1-64a1.patch
  55. 542 0
      rel-257/mozilla-esr60/patches/1515843-2-64a1.patch
  56. 275 0
      rel-257/mozilla-esr60/patches/1515843-3-64a1.patch
  57. 2 2
      rel-257/mozilla-esr60/patches/1522560-66a1.patch
  58. 3 25
      rel-257/mozilla-esr60/patches/1523003-67a1.patch
  59. 35 0
      rel-257/mozilla-esr60/patches/1556662-69a1.patch
  60. 56 0
      rel-257/mozilla-esr60/patches/series

+ 0 - 21
comm-esr60/mozilla-esr60/patches/1584803-version-beta1.patch

@@ -1,21 +0,0 @@
-# HG changeset patch
-# User Frank-Rainer Grahl <frgrahl@gmx.net>
-# Date 1575680160 -3600
-# Parent  5106d4dee994d80da824de8ea8a5832e8ce31fa8
-Bug 1584803 - Report Gecko as 60 to make websites doing stupid version sniffing happy. r=IanN a=IanN
-SeaMonkey 2.53 Beta 1 branch
-
-diff --git a/config/milestone.txt b/config/milestone.txt
---- a/config/milestone.txt
-+++ b/config/milestone.txt
-@@ -5,9 +5,9 @@
- #    x.x.x.x
- #    x.x.x+
- #
- # Referenced by milestone.py.
- # Hopefully I'll be able to automate replacement of *all*
- # hardcoded milestones in the tree from these two files.
- #--------------------------------------------------------
- 
--56.0.3
-+60.3.1

+ 0 - 31
comm-esr60/mozilla-esr60/patches/PARTLY-1445766-61a1.patch

@@ -1,31 +0,0 @@
-# HG changeset patch
-# User Ryan VanderMeulen <ryanvm@gmail.com>
-# Date 1521061409 14400
-# Node ID bfe4b0a2e835de50b680b787a32a4316f3cd9e22
-# Parent  9db081733cebcb7781a991f8c2819e78d5f1755d
-Bug 1445766 - Fix some non-unified build bustage in gfx/layers. r=lsalzman
-
-diff --git a/gfx/layers/TextureDIB.cpp b/gfx/layers/TextureDIB.cpp
---- a/gfx/layers/TextureDIB.cpp
-+++ b/gfx/layers/TextureDIB.cpp
-@@ -1,18 +1,19 @@
- /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-  * This Source Code Form is subject to the terms of the Mozilla Public
-  * License, v. 2.0. If a copy of the MPL was not distributed with this
-  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
- 
- #include "TextureDIB.h"
- #include "gfx2DGlue.h"
- #include "mozilla/gfx/DataSurfaceHelpers.h" // For BufferSizeFromDimensions
-+#include "mozilla/ipc/ProtocolUtils.h"
- #include "mozilla/layers/ISurfaceAllocator.h"
--#include "mozilla/ipc/ProtocolUtils.h"
-+#include "mozilla/layers/TextureForwarder.h" // For LayersIPCChannel
- 
- namespace mozilla {
- 
- using namespace gfx;
- 
- namespace layers {
- 
- /**

+ 0 - 6
comm-esr60/mozilla-esr60/patches/series

@@ -217,12 +217,6 @@ NOBUG-BACKOUT-1439860-60.patch
 TOP-9999999-rust133-257.patch
 TOP-9999999-fixlangpack-257.patch
 mozilla-esr60-top-nonexisting.patch
-PARTLY-1445766-61a1.patch
-1584803-version-beta1.patch
-1515550-66a1.patch
-1515528-66a1.patch
-1522560-66a1.patch
-1523003-67a1.patch
 1593162-72a1.patch
 1558387-69a1.patch
 1448787-61a1-partly.patch

+ 342 - 0
rel-257/mozilla-esr60/patches/1372381-1-61a1.patch

@@ -0,0 +1,342 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1525111739 25200
+# Node ID 79f78ded94a2fb592b558e6119813ba551e7784f
+# Parent  2b10dfb5711c56bd20c0dde903a2c2f75bf2d824
+Bug 1372381 - Generate automation.py with GENERATED_FILES rather than Makefile.in r=mshal
+
+This commit also removes "DEFAULT_APP", which is unused.
+
+MozReview-Commit-ID: 5YYaC5LJqUn
+
+diff --git a/build/automation-build.mk b/build/automation-build.mk
+deleted file mode 100644
+--- a/build/automation-build.mk
++++ /dev/null
+@@ -1,67 +0,0 @@
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-
+-include $(MOZILLA_DIR)/build/binary-location.mk
+-
+-browser_path := '"$(browser_path)"'
+-
+-_PROFILE_DIR = $(TARGET_DEPTH)/_profile/pgo
+-
+-ABSOLUTE_TOPSRCDIR = $(abspath $(MOZILLA_DIR))
+-_CERTS_SRC_DIR = $(ABSOLUTE_TOPSRCDIR)/build/pgo/certs
+-
+-AUTOMATION_PPARGS = 	\
+-			-DBROWSER_PATH=$(browser_path) \
+-			-DXPC_BIN_PATH='"$(DIST)/bin"' \
+-			-DBIN_SUFFIX='"$(BIN_SUFFIX)"' \
+-			-DPROFILE_DIR='"$(_PROFILE_DIR)"' \
+-			-DCERTS_SRC_DIR='"$(_CERTS_SRC_DIR)"' \
+-			-DPERL='"$(PERL)"' \
+-			$(NULL)
+-
+-ifeq ($(OS_ARCH),Darwin)
+-AUTOMATION_PPARGS += -DIS_MAC=1
+-else
+-AUTOMATION_PPARGS += -DIS_MAC=0
+-endif
+-
+-ifeq ($(OS_ARCH),Linux)
+-AUTOMATION_PPARGS += -DIS_LINUX=1
+-else
+-AUTOMATION_PPARGS += -DIS_LINUX=0
+-endif
+-
+-ifeq ($(host_os), cygwin)
+-AUTOMATION_PPARGS += -DIS_CYGWIN=1
+-endif
+-
+-ifeq ($(ENABLE_TESTS), 1)
+-AUTOMATION_PPARGS += -DIS_TEST_BUILD=1
+-else
+-AUTOMATION_PPARGS += -DIS_TEST_BUILD=0
+-endif
+-
+-ifeq ($(MOZ_DEBUG), 1)
+-AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=1
+-else
+-AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0
+-endif
+-
+-ifdef MOZ_CRASHREPORTER
+-AUTOMATION_PPARGS += -DCRASHREPORTER=1
+-else
+-AUTOMATION_PPARGS += -DCRASHREPORTER=0
+-endif
+-
+-ifdef MOZ_ASAN
+-AUTOMATION_PPARGS += -DIS_ASAN=1
+-else
+-AUTOMATION_PPARGS += -DIS_ASAN=0
+-endif
+-
+-automation.py: $(MOZILLA_DIR)/build/automation.py.in $(MOZILLA_DIR)/build/automation-build.mk
+-	$(call py_action,preprocessor, \
+-	$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< -o $@)
+-
+-GARBAGE += automation.py automation.pyc
+diff --git a/build/automation.py.in b/build/automation.py.in
+--- a/build/automation.py.in
++++ b/build/automation.py.in
+@@ -48,17 +48,16 @@ from mozscreenshot import printstatus, d
+ #expand _IS_LINUX = __IS_LINUX__ != 0
+ #ifdef IS_CYGWIN
+ #expand _IS_CYGWIN = __IS_CYGWIN__ == 1
+ #else
+ _IS_CYGWIN = False
+ #endif
+ #expand _BIN_SUFFIX = __BIN_SUFFIX__
+ 
+-#expand _DEFAULT_APP = "./" + __BROWSER_PATH__
+ #expand _CERTS_SRC_DIR = __CERTS_SRC_DIR__
+ #expand _IS_TEST_BUILD = __IS_TEST_BUILD__
+ #expand _IS_DEBUG_BUILD = __IS_DEBUG_BUILD__
+ #expand _CRASHREPORTER = __CRASHREPORTER__ == 1
+ #expand _IS_ASAN = __IS_ASAN__ == 1
+ 
+ 
+ if _IS_WIN32:
+@@ -94,17 +93,16 @@ class Automation(object):
+   IS_WIN32 = _IS_WIN32
+   IS_MAC = _IS_MAC
+   IS_LINUX = _IS_LINUX
+   IS_CYGWIN = _IS_CYGWIN
+   BIN_SUFFIX = _BIN_SUFFIX
+ 
+   UNIXISH = not IS_WIN32 and not IS_MAC
+ 
+-  DEFAULT_APP = _DEFAULT_APP
+   CERTS_SRC_DIR = _CERTS_SRC_DIR
+   IS_TEST_BUILD = _IS_TEST_BUILD
+   IS_DEBUG_BUILD = _IS_DEBUG_BUILD
+   CRASHREPORTER = _CRASHREPORTER
+   IS_ASAN = _IS_ASAN
+ 
+   # timeout, in seconds
+   DEFAULT_TIMEOUT = 60.0
+@@ -133,17 +131,16 @@ class Automation(object):
+     return [
+            "UNIXISH",
+            "IS_WIN32",
+            "IS_MAC",
+            "log",
+            "runApp",
+            "Process",
+            "DIST_BIN",
+-           "DEFAULT_APP",
+            "CERTS_SRC_DIR",
+            "environment",
+            "IS_TEST_BUILD",
+            "IS_DEBUG_BUILD",
+            "DEFAULT_TIMEOUT",
+           ]
+ 
+   class Process(subprocess.Popen):
+diff --git a/build/gen_automation.py b/build/gen_automation.py
+new file mode 100644
+--- /dev/null
++++ b/build/gen_automation.py
+@@ -0,0 +1,48 @@
++# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
++# vim: set filetype=python:
++# This Source Code Form is subject to the terms of the Mozilla Public
++# License, v. 2.0. If a copy of the MPL was not distibuted with this
++# file, You can obtain one at http://mozilla.og/MPL/2.0/.
++
++import sys
++import buildconfig
++from mozbuild.preprocessor import Preprocessor
++
++
++def main(output, input_file):
++    pp = Preprocessor()
++    pp.context.update(buildconfig.defines['ALLDEFINES'])
++
++    substs = buildconfig.substs
++
++    # Substs taken verbatim.
++    substs_vars = (
++        'BIN_SUFFIX',
++    )
++    for var in substs_vars:
++        pp.context[var] = '"%s"' % substs[var]
++
++    # Derived values.
++    for key, condition in (
++            ('IS_MAC', substs['OS_ARCH'] == 'Darwin'),
++            ('IS_LINUX', substs['OS_ARCH'] == 'Linux'),
++            ('IS_TEST_BUILD', substs.get('ENABLE_TESTS') == '1'),
++            ('IS_DEBUG_BUILD', substs.get('MOZ_DEBUG') == '1'),
++            ('CRASHREPORTER', substs.get('MOZ_CRASHREPORTER')),
++            ('IS_ASAN', substs.get('MOZ_ASAN'))):
++        if condition:
++            pp.context[key] = '1'
++        else:
++            pp.context[key] = '0'
++
++    pp.context.update({
++        'XPC_BIN_PATH': '"%s/dist/bin"' % buildconfig.topobjdir,
++        'CERTS_SRC_DIR': '"%s/build/pgo/certs"' % buildconfig.topsrcdir,
++    })
++
++    pp.out = output
++    pp.do_include(input_file)
++
++
++if __name__ == '__main__':
++    main(*sys.agv[1:])
+diff --git a/build/moz.build b/build/moz.build
+--- a/build/moz.build
++++ b/build/moz.build
+@@ -91,16 +91,30 @@ if CONFIG['MOZ_APP_BASENAME']:
+     if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android' and CONFIG['MOZ_UPDATER']:
+         FINAL_TARGET_PP_FILES += ['update-settings.ini']
+ 
+     GENERATED_FILES += ['application.ini.h']
+     appini = GENERATED_FILES['application.ini.h']
+     appini.script = 'appini_header.py'
+     appini.inputs = ['!application.ini']
+ 
++if CONFIG['ENABLE_TESTS']:
++    GENERATED_FILES += ['automation.py']
++    auto = GENERATED_FILES['automation.py']
++    auto.script = 'gen_automation.py'
++    auto.inputs = ['automation.py.in']
++
++    TEST_HARNESS_FILES.reftest += [
++        '!automation.py',
++    ]
++
++    TEST_HARNESS_FILES.testing.mochitest += [
++        '!automation.py',
++    ]
++
+ # NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
+ OBJDIR_FILES += ['/.gdbinit']
+ 
+ # Put a .lldbinit in the bin directory and the objdir, to be picked up
+ # automatically by LLDB when we debug executables using either of those two
+ # directories as the current working directory.  The .lldbinit file will
+ # load $(topsrcdir)/.lldbinit, which is where the actual debugging commands are.
+ DEFINES['topsrcdir'] = TOPSRCDIR
+diff --git a/layout/tools/reftest/Makefile.in b/layout/tools/reftest/Makefile.in
+--- a/layout/tools/reftest/Makefile.in
++++ b/layout/tools/reftest/Makefile.in
+@@ -2,17 +2,13 @@
+ # This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ _DEST_DIR = $(DEPTH)/_tests/reftest
+ 
+ include $(topsrcdir)/config/rules.mk
+ 
+-# We're installing to _tests/reftest
+-TARGET_DEPTH = ../..
+-include $(topsrcdir)/build/automation-build.mk
+-
+ # copy harness and the reftest extension bits to $(_DEST_DIR)
+ # This needs to happen after jar.mn handling from rules.mk included above.
+ # The order of the :: rules ensures that.
+ libs::
+ 	(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - reftest) | (cd $(_DEST_DIR) && tar -xf -)
+diff --git a/layout/tools/reftest/moz.build b/layout/tools/reftest/moz.build
+--- a/layout/tools/reftest/moz.build
++++ b/layout/tools/reftest/moz.build
+@@ -9,19 +9,17 @@ with Files('**'):
+     SCHEDULES.exclusive = ['reftest']
+ 
+ XPI_NAME = 'reftest'
+ USE_EXTENSION_MANIFEST = True
+ JAR_MANIFESTS += ['jar.mn']
+ FINAL_TARGET_PP_FILES += ['install.rdf']
+ FINAL_TARGET_FILES += ['bootstrap.js']
+ 
+-GENERATED_FILES += ['automation.py']
+ TEST_HARNESS_FILES.reftest += [
+-    '!automation.py',
+     '/build/mobile/remoteautomation.py',
+     '/build/pgo/server-locations.txt',
+     '/testing/mochitest/server.js',
+     'mach_test_package_commands.py',
+     'output.py',
+     'reftest-preferences.js',
+     'reftestcommandline.py',
+     'remotereftest.py',
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -554,17 +554,18 @@ class TupBackend(CommonBackend):
+             extra_exports = {
+                 'buildid.h': ['MOZ_BUILD_DATE'],
+             }
+             for f in obj.outputs:
+                 exports = extra_exports.get(f)
+                 if exports:
+                     backend_file.export(exports)
+ 
+-            if any(f in obj.outputs for f in ('source-repo.h', 'buildid.h')):
++            if any(f.endswith(('automation.py', 'source-repo.h', 'buildid.h'))
++                   for f in obj.outputs):
+                 extra_outputs = [self._early_generated_files]
+             else:
+                 extra_outputs = [self._installed_files] if obj.required_for_compile else []
+                 full_inputs += [self._early_generated_files]
+ 
+             backend_file.rule(
+                 display='python {script}:{method} -> [%o]'.format(script=obj.script, method=obj.method),
+                 cmd=cmd,
+diff --git a/testing/mochitest/Makefile.in b/testing/mochitest/Makefile.in
+--- a/testing/mochitest/Makefile.in
++++ b/testing/mochitest/Makefile.in
+@@ -2,18 +2,14 @@
+ # This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ 
+ _DEST_DIR = $(DEPTH)/_tests/$(relativesrcdir)
+ 
+ include $(topsrcdir)/config/rules.mk
+-# We're installing to _tests/testing/mochitest, so this is the depth
+-# necessary for relative objdir paths.
+-TARGET_DEPTH = ../../..
+-include $(topsrcdir)/build/automation-build.mk
+ 
+ libs:: 
+ 	(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - mochijar) | (cd $(_DEST_DIR) && tar -xf -)
+ 
+ $(_DEST_DIR):
+ 	$(NSINSTALL) -D $@
+diff --git a/testing/mochitest/moz.build b/testing/mochitest/moz.build
+--- a/testing/mochitest/moz.build
++++ b/testing/mochitest/moz.build
+@@ -23,22 +23,17 @@ if CONFIG['OS_TARGET'] != 'Android':
+     DEFINES['MOCHITEST_BOOTSTRAP'] = True
+     FINAL_TARGET_FILES += ['bootstrap.js']
+ 
+ MOCHITEST_MANIFESTS += [
+     'tests/MochiKit-1.4.2/tests/mochitest.ini',
+ ]
+ MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
+ 
+-GENERATED_FILES += [
+-    'automation.py',
+-]
+-
+ TEST_HARNESS_FILES.testing.mochitest += [
+-    '!automation.py',
+     '/build/mobile/remoteautomation.py',
+     '/build/pgo/server-locations.txt',
+     '/build/sanitizers/lsan_suppressions.txt',
+     '/build/sanitizers/ubsan_suppressions.txt',
+     '/build/valgrind/cross-architecture.sup',
+     '/build/valgrind/i386-pc-linux-gnu.sup',
+     '/build/valgrind/x86_64-pc-linux-gnu.sup',
+     '/netwerk/test/httpserver/httpd.js',

+ 118 - 0
rel-257/mozilla-esr60/patches/1372381-2-61a1.patch

@@ -0,0 +1,118 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1525111821 25200
+# Node ID 0a1897a68d63001f12a4dd9620ab8cefff207176
+# Parent  c3c6f8df99a9fc312e740afd5f054adfaac02efd
+Bug 1372381 - Temporarily skip certain problematic binaries in the Tup backend. r=mshal
+
+MozReview-Commit-ID: 7lopI8UQPSZ
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -76,32 +76,45 @@ class BackendTupfile(object):
+         self.sources = defaultdict(list)
+         self.host_sources = defaultdict(list)
+         self.variables = {}
+         self.static_lib = None
+         self.shared_lib = None
+         self.program = None
+         self.exports = set()
+ 
++        # These files are special, ignore anything that generates them or
++        # depends on them.
++        self._skip_files = [
++            'signmar',
++            'libxul.so',
++            'libtestcrasher.so',
++        ]
++
+         self.fh = FileAvoidWrite(self.name, capture_diff=True)
+         self.fh.write('# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.\n')
+         self.fh.write('\n')
+ 
+     def write(self, buf):
+         self.fh.write(buf)
+ 
+     def include_rules(self):
+         if not self.rules_included:
+             self.write('include_rules\n')
+             self.rules_included = True
+ 
+     def rule(self, cmd, inputs=None, outputs=None, display=None,
+              extra_inputs=None, extra_outputs=None, check_unchanged=False):
+         inputs = inputs or []
+         outputs = outputs or []
++
++        for f in inputs + outputs:
++            if any(f.endswith(skip_file) for skip_file in self._skip_files):
++                return
++
+         display = display or ""
+         self.include_rules()
+         flags = ""
+         if check_unchanged:
+             # This flag causes tup to compare the outputs with the previous run
+             # of the command, and skip the rest of the DAG for any that are the
+             # same.
+             flags += "o"
+@@ -273,19 +286,16 @@ class TupBackend(CommonBackend):
+         return cmd
+ 
+     def _lib_paths(self, objdir, libs):
+         return [mozpath.relpath(mozpath.join(l.objdir, l.import_name), objdir)
+                 for l in libs]
+ 
+     def _gen_shared_library(self, backend_file):
+         shlib = backend_file.shared_lib
+-        if shlib.name == 'libxul.so':
+-            # This will fail to link currently due to missing rust symbols.
+-            return
+ 
+         if shlib.cxx_link:
+             mkshlib = (
+                 [backend_file.environment.substs['CXX']] +
+                 backend_file.local_flags['CXX_LDFLAGS']
+             )
+         else:
+             mkshlib = (
+@@ -303,19 +313,16 @@ class TupBackend(CommonBackend):
+         objs, _, shared_libs, os_libs, static_libs = self._expand_libs(shlib)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
+ 
+         list_file_name = '%s.list' % shlib.name.replace('.', '_')
+         list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
+ 
+         inputs = objs + static_libs + shared_libs
+-        if any(i.endswith('libxul.so') for i in inputs):
+-            # Don't attempt to link anything that depends on libxul.
+-            return
+ 
+         symbols_file = []
+         if shlib.symbols_file:
+             inputs.append(shlib.symbols_file)
+             # TODO: Assumes GNU LD
+             symbols_file = ['-Wl,--version-script,%s' % shlib.symbols_file]
+ 
+         cmd = (
+@@ -343,19 +350,16 @@ class TupBackend(CommonBackend):
+ 
+     def _gen_program(self, backend_file):
+         cc_or_cxx = 'CXX' if backend_file.program.cxx_link else 'CC'
+         objs, _, shared_libs, os_libs, static_libs = self._expand_libs(backend_file.program)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
+ 
+         inputs = objs + static_libs + shared_libs
+-        if any(i.endswith('libxul.so') for i in inputs):
+-            # Don't attempt to link anything that depends on libxul.
+-            return
+ 
+         list_file_name = '%s.list' % backend_file.program.name.replace('.', '_')
+         list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
+ 
+         outputs = [mozpath.relpath(backend_file.program.output_path.full_path,
+                                    backend_file.objdir)]
+         cmd = (
+             [backend_file.environment.substs[cc_or_cxx], '-o', '%o'] +

+ 383 - 0
rel-257/mozilla-esr60/patches/1372381-3-61a1.patch

@@ -0,0 +1,383 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1525111844 25200
+# Node ID 539a4a607ef98975ae0cde61c793723a6b1e19c5
+# Parent  4c0bf9cb831bcfdc520c138996420ebde3b594c4
+Bug 1372381 - Compile host libraries, host programs, and simple programs in the Tup backend. r=mshal
+
+MozReview-Commit-ID: 2AcpqiOqSSf
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -34,17 +34,20 @@ from ..frontend.data import (
+     GeneratedFile,
+     GeneratedSources,
+     HostDefines,
+     HostSources,
+     JARManifest,
+     ObjdirFiles,
+     PerSourceFlag,
+     Program,
++    SimpleProgram,
++    HostLibrary,
+     HostProgram,
++    HostSimpleProgram,
+     SharedLibrary,
+     Sources,
+     StaticLibrary,
+     VariablePassthru,
+ )
+ from ..util import (
+     FileAvoidWrite,
+     expand_variables,
+@@ -73,17 +76,19 @@ class BackendTupfile(object):
+         self.delayed_installed_files = []
+         self.per_source_flags = defaultdict(list)
+         self.local_flags = defaultdict(list)
+         self.sources = defaultdict(list)
+         self.host_sources = defaultdict(list)
+         self.variables = {}
+         self.static_lib = None
+         self.shared_lib = None
+-        self.program = None
++        self.programs = []
++        self.host_programs = []
++        self.host_library = None
+         self.exports = set()
+ 
+         # These files are special, ignore anything that generates them or
+         # depends on them.
+         self._skip_files = [
+             'signmar',
+             'libxul.so',
+             'libtestcrasher.so',
+@@ -213,21 +218,27 @@ class TupBackend(CommonBackend):
+     """
+ 
+     def _init(self):
+         CommonBackend._init(self)
+ 
+         self._backend_files = {}
+         self._cmd = MozbuildObject.from_environment()
+         self._manifest_entries = OrderedDefaultDict(set)
+-        self._compile_env_gen_files = (
++
++        # These are a hack to approximate things that are needed for the
++        # compile phase.
++        self._compile_env_files = (
++            '*.api',
+             '*.c',
++            '*.cfg',
+             '*.cpp',
+             '*.h',
+             '*.inc',
++            '*.msg',
+             '*.py',
+             '*.rs',
+         )
+ 
+         # These are 'group' dependencies - All rules that list these as an output
+         # will be built before any rules that list this as an input.
+         self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
+         self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
+@@ -342,30 +353,37 @@ class TupBackend(CommonBackend):
+             display='LINK %o'
+         )
+         backend_file.symlink_rule(mozpath.join(backend_file.objdir,
+                                                shlib.lib_name),
+                                   output=mozpath.join(self.environment.topobjdir,
+                                                       shlib.install_target,
+                                                       shlib.lib_name))
+ 
++    def _gen_programs(self, backend_file):
++        for p in backend_file.programs:
++            self._gen_program(backend_file, p)
+ 
+-    def _gen_program(self, backend_file):
+-        cc_or_cxx = 'CXX' if backend_file.program.cxx_link else 'CC'
+-        objs, _, shared_libs, os_libs, static_libs = self._expand_libs(backend_file.program)
++    def _gen_program(self, backend_file, prog):
++        cc_or_cxx = 'CXX' if prog.cxx_link else 'CC'
++        objs, _, shared_libs, os_libs, static_libs = self._expand_libs(prog)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
+ 
+         inputs = objs + static_libs + shared_libs
+ 
+-        list_file_name = '%s.list' % backend_file.program.name.replace('.', '_')
++        list_file_name = '%s.list' % prog.name.replace('.', '_')
+         list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
+ 
+-        outputs = [mozpath.relpath(backend_file.program.output_path.full_path,
+-                                   backend_file.objdir)]
++        if isinstance(prog, SimpleProgram):
++            outputs = [prog.name]
++        else:
++            outputs = [mozpath.relpath(prog.output_path.full_path,
++                                       backend_file.objdir)]
++
+         cmd = (
+             [backend_file.environment.substs[cc_or_cxx], '-o', '%o'] +
+             backend_file.local_flags['CXX_LDFLAGS'] +
+             [list_file] +
+             backend_file.local_flags['LDFLAGS'] +
+             static_libs +
+             [backend_file.environment.substs['MOZ_PROGRAM_LDFLAGS']] +
+             shared_libs +
+@@ -375,16 +393,67 @@ class TupBackend(CommonBackend):
+         backend_file.rule(
+             cmd=cmd,
+             inputs=inputs,
+             outputs=outputs,
+             display='LINK %o'
+         )
+ 
+ 
++    def _gen_host_library(self, backend_file):
++        objs = backend_file.host_library.objs
++        inputs = objs
++        outputs = [backend_file.host_library.name]
++        cmd = (
++            [backend_file.environment.substs['HOST_AR']] +
++            [backend_file.environment.substs['HOST_AR_FLAGS'].replace('$@', '%o')] +
++            objs
++        )
++        backend_file.rule(
++            cmd=cmd,
++            inputs=inputs,
++            outputs=outputs,
++            display='AR %o'
++        )
++
++
++    def _gen_host_programs(self, backend_file):
++        for p in backend_file.host_programs:
++            self._gen_host_program(backend_file, p)
++
++
++    def _gen_host_program(self, backend_file, prog):
++        _, _, _, extra_libs, _ = self._expand_libs(prog)
++        objs = prog.objs
++        outputs = [prog.program]
++        host_libs = []
++        for lib in prog.linked_libraries:
++            if isinstance(lib, HostLibrary):
++                host_libs.append(lib)
++        host_libs = self._lib_paths(backend_file.objdir, host_libs)
++
++        inputs = objs + host_libs
++        use_cxx = any(f.endswith(('.cc', '.cpp')) for f in prog.source_files())
++        cc_or_cxx = 'HOST_CXX' if use_cxx else 'HOST_CC'
++        cmd = (
++            [backend_file.environment.substs[cc_or_cxx], '-o', '%o'] +
++            backend_file.local_flags['HOST_CXX_LDFLAGS'] +
++            backend_file.local_flags['HOST_LDFLAGS'] +
++            objs +
++            host_libs +
++            extra_libs
++        )
++        backend_file.rule(
++            cmd=cmd,
++            inputs=inputs,
++            outputs=outputs,
++            display='LINK %o'
++        )
++
++
+     def _gen_static_library(self, backend_file):
+         ar = [
+             backend_file.environment.substs['AR'],
+             backend_file.environment.substs['AR_FLAGS'].replace('$@', '%o')
+         ]
+ 
+         objs, _, shared_libs, _, static_libs = self._expand_libs(backend_file.static_lib)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+@@ -416,17 +485,17 @@ class TupBackend(CommonBackend):
+             return True
+ 
+         backend_file = self._get_backend_file_for(obj)
+ 
+         if isinstance(obj, GeneratedFile):
+             skip_files = []
+ 
+             if self.environment.is_artifact_build:
+-                skip_files = self._compile_env_gen_files
++                skip_files = self._compile_env_gen
+ 
+             for f in obj.outputs:
+                 if any(mozpath.match(f, p) for p in skip_files):
+                     return False
+ 
+             if backend_file.requires_delay(obj.inputs):
+                 backend_file.delayed_generated_files.append(obj)
+             else:
+@@ -458,20 +527,22 @@ class TupBackend(CommonBackend):
+         elif isinstance(obj, HostSources):
+             backend_file.host_sources[obj.canonical_suffix].extend(obj.files)
+         elif isinstance(obj, VariablePassthru):
+             backend_file.variables = obj.variables
+         elif isinstance(obj, StaticLibrary):
+             backend_file.static_lib = obj
+         elif isinstance(obj, SharedLibrary):
+             backend_file.shared_lib = obj
+-        elif isinstance(obj, HostProgram):
+-            pass
+-        elif isinstance(obj, Program):
+-            backend_file.program = obj
++        elif isinstance(obj, (HostProgram, HostSimpleProgram)):
++            backend_file.host_programs.append(obj)
++        elif isinstance(obj, HostLibrary):
++            backend_file.host_library = obj
++        elif isinstance(obj, (Program, SimpleProgram)):
++            backend_file.programs.append(obj)
+         elif isinstance(obj, DirectoryTraversal):
+             pass
+ 
+         return True
+ 
+     def consume_finished(self):
+         CommonBackend.consume_finished(self)
+ 
+@@ -479,21 +550,23 @@ class TupBackend(CommonBackend):
+         # simply write out the resulting files here.
+         for target, entries in self._manifest_entries.iteritems():
+             with self._write_file(mozpath.join(self.environment.topobjdir,
+                                                target)) as fh:
+                 fh.write(''.join('%s\n' % e for e in sorted(entries)))
+ 
+         for objdir, backend_file in sorted(self._backend_files.items()):
+             backend_file.gen_sources_rules([self._installed_files])
+-            for condition, gen_method in ((backend_file.shared_lib, self._gen_shared_library),
+-                                          (backend_file.static_lib and backend_file.static_lib.no_expand_lib,
+-                                           self._gen_static_library),
+-                                          (backend_file.program, self._gen_program)):
+-                if condition:
++            for var, gen_method in ((backend_file.shared_lib, self._gen_shared_library),
++                                    (backend_file.static_lib and backend_file.static_lib.no_expand_lib,
++                                     self._gen_static_library),
++                                    (backend_file.programs, self._gen_programs),
++                                    (backend_file.host_programs, self._gen_host_programs),
++                                    (backend_file.host_library, self._gen_host_library)):
++                if var:
+                     backend_file.export_shell()
+                     gen_method(backend_file)
+             for obj in backend_file.delayed_generated_files:
+                 self._process_generated_file(backend_file, obj)
+             for path, output, output_group in backend_file.delayed_installed_files:
+                 backend_file.symlink_rule(path, output=output, output_group=output_group)
+             with self._write_file(fh=backend_file):
+                 pass
+@@ -528,17 +601,16 @@ class TupBackend(CommonBackend):
+         if not os.path.exists(mozpath.join(self.environment.topsrcdir, ".tup")):
+             tup = self.environment.substs.get('TUP', 'tup')
+             self._cmd.run_process(cwd=self.environment.topsrcdir, log_name='tup', args=[tup, 'init'])
+ 
+     def _process_generated_file(self, backend_file, obj):
+         # TODO: These are directories that don't work in the tup backend
+         # yet, because things they depend on aren't built yet.
+         skip_directories = (
+-            'layout/style/test', # HostSimplePrograms
+             'toolkit/library', # libxul.so
+         )
+         if obj.script and obj.method and obj.relobjdir not in skip_directories:
+             backend_file.export_shell()
+             cmd = self._py_action('file_generate')
+             if obj.localized:
+                 cmd.append('--locale=en-US')
+             cmd.extend([
+@@ -601,16 +673,21 @@ class TupBackend(CommonBackend):
+ 
+         if target.startswith('_tests'):
+             # TODO: TEST_HARNESS_FILES present a few challenges for the tup
+             # backend (bug 1372381).
+             return
+ 
+         for path, files in obj.files.walk():
+             for f in files:
++                output_group = None
++                if any(mozpath.match(mozpath.basename(f), p)
++                       for p in self._compile_env_files):
++                    output_group = self._installed_files
++
+                 if not isinstance(f, ObjDirPath):
+                     backend_file = self._get_backend_file(mozpath.join(target, path))
+                     if '*' in f:
+                         if f.startswith('/') or isinstance(f, AbsolutePath):
+                             basepath, wild = os.path.split(f.full_path)
+                             if '*' in basepath:
+                                 raise Exception("Wildcards are only supported in the filename part of "
+                                                 "srcdir-relative or absolute paths.")
+@@ -624,40 +701,38 @@ class TupBackend(CommonBackend):
+                                     if '*' not in p:
+                                         yield p + '/'
+                             prefix = ''.join(_prefix(f.full_path))
+                             self.backend_input_files.add(prefix)
+                             finder = FileFinder(prefix)
+                             for p, _ in finder.find(f.full_path[len(prefix):]):
+                                 backend_file.symlink_rule(mozpath.join(prefix, p),
+                                                           output=mozpath.join(f.target_basename, p),
+-                                                          output_group=self._installed_files)
++                                                          output_group=output_group)
+                     else:
+-                        backend_file.symlink_rule(f.full_path, output=f.target_basename, output_group=self._installed_files)
++                        backend_file.symlink_rule(f.full_path, output=f.target_basename, output_group=output_group)
+                 else:
+                     if (self.environment.is_artifact_build and
+                         any(mozpath.match(f.target_basename, p) for p in self._compile_env_gen_files)):
+                         # If we have an artifact build we never would have generated this file,
+                         # so do not attempt to install it.
+                         continue
+ 
+                     # We're not generating files in these directories yet, so
+                     # don't attempt to install files generated from them.
+-                    if f.context.relobjdir not in ('layout/style/test',
+-                                                   'toolkit/library',
++                    if f.context.relobjdir not in ('toolkit/library',
+                                                    'js/src/shell'):
+                         output = mozpath.join('$(MOZ_OBJ_ROOT)', target, path,
+                                               f.target_basename)
+                         gen_backend_file = self._get_backend_file(f.context.relobjdir)
+                         if gen_backend_file.requires_delay([f]):
+-                            output_group = self._installed_files if f.target_basename.endswith('.h') else None
+                             gen_backend_file.delayed_installed_files.append((f.full_path, output, output_group))
+                         else:
+                             gen_backend_file.symlink_rule(f.full_path, output=output,
+-                                                          output_group=self._installed_files)
++                                                          output_group=output_group)
+ 
+     def _process_final_target_pp_files(self, obj, backend_file):
+         for i, (path, files) in enumerate(obj.files.walk()):
+             for f in files:
+                 self._preprocess(backend_file, f.full_path,
+                                  destdir=mozpath.join(self.environment.topobjdir, obj.install_target, path))
+ 
+     def _process_computed_flags(self, obj, backend_file):
+diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py
+--- a/python/mozbuild/mozbuild/frontend/data.py
++++ b/python/mozbuild/mozbuild/frontend/data.py
+@@ -516,16 +516,24 @@ class SimpleProgram(BaseProgram):
+ 
+ 
+ class HostSimpleProgram(HostMixin, BaseProgram):
+     """Context derived container object for each program in
+     HOST_SIMPLE_PROGRAMS"""
+     SUFFIX_VAR = 'HOST_BIN_SUFFIX'
+     KIND = 'host'
+ 
++    def source_files(self):
++        for srcs in self.sources.values():
++            for f in srcs:
++                if ('host_%s' % mozpath.basename(mozpath.splitext(f)[0]) ==
++                    mozpath.splitext(self.program)[0]):
++                    return [f]
++        return []
++
+ 
+ def cargo_output_directory(context, target_var):
+     # cargo creates several directories and places its build artifacts
+     # in those directories.  The directory structure depends not only
+     # on the target, but also what sort of build we are doing.
+     rust_build_kind = 'release'
+     if context.config.substs.get('MOZ_DEBUG_RUST'):
+         rust_build_kind = 'debug'

+ 88 - 0
rel-257/mozilla-esr60/patches/1372381-4-61a1.patch

@@ -0,0 +1,88 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1525111844 25200
+# Node ID c2420955ce61a3e5c650b309e96564f9a494bdf8
+# Parent  d73a278cd50416fdc4b2f9bc15b096b384595ded
+Bug 1372381 - Install TEST_HARNESS_FILES in the tup backend. r=mshal
+
+MozReview-Commit-ID: 3PTtvoh8D9L
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -50,16 +50,17 @@ from ..frontend.data import (
+ )
+ from ..util import (
+     FileAvoidWrite,
+     expand_variables,
+ )
+ from ..frontend.context import (
+     AbsolutePath,
+     ObjDirPath,
++    RenamedSourcePath,
+ )
+ 
+ 
+ class BackendTupfile(object):
+     """Represents a generated Tupfile.
+     """
+ 
+     def __init__(self, objdir, environment, topsrcdir, topobjdir):
+@@ -666,21 +667,16 @@ class TupBackend(CommonBackend):
+                 'dist/xpi-stage',
+                 '_tests',
+                 'dist/include',
+                 'dist/sdk',
+             ))
+             if not path:
+                 raise Exception("Cannot install to " + target)
+ 
+-        if target.startswith('_tests'):
+-            # TODO: TEST_HARNESS_FILES present a few challenges for the tup
+-            # backend (bug 1372381).
+-            return
+-
+         for path, files in obj.files.walk():
+             for f in files:
+                 output_group = None
+                 if any(mozpath.match(mozpath.basename(f), p)
+                        for p in self._compile_env_files):
+                     output_group = self._installed_files
+ 
+                 if not isinstance(f, ObjDirPath):
+@@ -697,20 +693,34 @@ class TupBackend(CommonBackend):
+                             pass
+                         else:
+                             def _prefix(s):
+                                 for p in mozpath.split(s):
+                                     if '*' not in p:
+                                         yield p + '/'
+                             prefix = ''.join(_prefix(f.full_path))
+                             self.backend_input_files.add(prefix)
++
++                            output_dir = ''
++                            # If we have a RenamedSourcePath here, the common backend
++                            # has generated this object from a jar manifest, and we
++                            # can rely on 'path' to be our destination path relative
++                            # to any wildcard match. Otherwise, the output file may
++                            # contribute to our destination directory.
++                            if not isinstance(f, RenamedSourcePath):
++                                output_dir = ''.join(_prefix(mozpath.dirname(f)))
++
+                             finder = FileFinder(prefix)
+                             for p, _ in finder.find(f.full_path[len(prefix):]):
++                                install_dir = prefix[len(obj.srcdir) + 1:]
++                                output = p
++                                if f.target_basename and '*' not in f.target_basename:
++                                    output = mozpath.join(f.target_basename, output)
+                                 backend_file.symlink_rule(mozpath.join(prefix, p),
+-                                                          output=mozpath.join(f.target_basename, p),
++                                                          output=mozpath.join(output_dir, output),
+                                                           output_group=output_group)
+                     else:
+                         backend_file.symlink_rule(f.full_path, output=f.target_basename, output_group=output_group)
+                 else:
+                     if (self.environment.is_artifact_build and
+                         any(mozpath.match(f.target_basename, p) for p in self._compile_env_gen_files)):
+                         # If we have an artifact build we never would have generated this file,
+                         # so do not attempt to install it.

+ 95 - 0
rel-257/mozilla-esr60/patches/1397263-1-64a1.patch

@@ -0,0 +1,95 @@
+# HG changeset patch
+# User Ted Mielczarek <ted@mielczarek.org>
+# Date 1538612969 14400
+# Node ID 73a4e7ed19f3447370cbe5fa7b7b30fc1a41710b
+# Parent  5de362d1bd072dc5e69ae2bf57d91b079d2ae897
+Bug 1397263 - move MIDL checks to moz.configure; r=glandium
+
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -151,17 +151,16 @@ dnl ====================================
+ 
+ WINVER=601
+ 
+ case "$target" in
+ *-mingw*)
+     if test "$GCC" != "yes"; then
+         # Check to see if we are really running in a msvc environemnt
+         _WIN32_MSVC=1
+-        AC_CHECK_PROGS(MIDL, midl)
+ 
+         # Make sure compilers are valid
+         CFLAGS="$CFLAGS -TC -nologo"
+         CXXFLAGS="$CXXFLAGS -TP -nologo"
+         AC_LANG_SAVE
+         AC_LANG_C
+         AC_TRY_COMPILE([#include <stdio.h>],
+             [ printf("Hello World\n"); ],,
+@@ -311,17 +310,16 @@ case "$target" in
+                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
+                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
+                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
+                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
+         then
+             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
+         fi
+ 
+-        AC_CHECK_PROGS(MIDL, $target-widl widl)
+         if test -n "$MIDL"; then
+             case "$target" in
+             i*86-*)
+                 MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
+                 ;;
+             x86_64-*)
+                 MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
+                 ;;
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -1217,16 +1217,45 @@ option('--enable-proxy-bypass-protection
+ 
+ @depends_if('--enable-proxy-bypass-protection')
+ def proxy_bypass_protection(_):
+     return True
+ 
+ set_config('MOZ_PROXY_BYPASS_PROTECTION', proxy_bypass_protection)
+ set_define('MOZ_PROXY_BYPASS_PROTECTION', proxy_bypass_protection)
+ 
++# MIDL
++# ==============================================================
++
++@depends(c_compiler, toolchain_prefix)
++def midl_names(c_compiler, toolchain_prefix):
++    if c_compiler and c_compiler.type in ['gcc', 'clang']:
++        # mingw
++        widl = ('widl', )
++        if toolchain_prefix:
++            prefixed = tuple('%s%s' % (p, 'widl') for p in toolchain_prefix)
++            widl = prefixed + widl
++        return widl
++
++    return ('midl',)
++
++@depends(target, '--enable-compile-environment')
++def check_for_midl(target, compile_environment):
++    if target.os != 'WINNT':
++        return
++
++    if compile_environment:
++        return True
++
++
++midl = check_prog('MIDL', midl_names, when=check_for_midl, allow_missing=True)
++
++# Needed until we move MIDL_FLAGS and --disable-accessibility from old-configure
++add_old_configure_assignment('MIDL', midl)
++
+ # Addon signing
+ # ==============================================================
+ 
+ option('--with-unsigned-addon-scopes',
+        nargs='+', choices=('app', 'system'),
+        help='Addon scopes where signature is not required')
+ 
+ @depends('--with-unsigned-addon-scopes')

+ 459 - 0
rel-257/mozilla-esr60/patches/1397263-2-64a1.patch

@@ -0,0 +1,459 @@
+# HG changeset patch
+# User Nathan Froyd <froydnj@mozilla.com>
+# Date 1538612969 14400
+# Node ID b4dec9b774a82ccbe834eeb9727186e793699e97
+# Parent  30656c817ea7b3145ddc524b94463d81eda0e256
+Bug 1397263 - move AS checks to toolchain.configure; r=glandium
+
+This is a fairly straightforward port of the AS tool checks from old-configure
+to toolchain.configure. AS is a little quirky in that we currently do a
+normal-looking check for it, but then override that value to be the C compiler
+for non-Windows builds, and ml[64]/armasm64 for Windows builds.
+
+After migrating those checks, the only things left in the MOZ_DEFAULT_COMPILER
+macro in compiler-opts.m4 were some unused bits, so I removed them:
+* Setting of CPP/CXXCPP, which are set in toolchain.configure now
+* Setting HOST_LDFLAGS to empty, which doesn't seem particularly useful.
+
+There was also a quirky old test that the assembler was ml[64] when js-ctypes
+is enabled that I removed, I don't think it provides any value since this
+patch will ensure that we're using the right assembler for Windows builds.
+
+diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
+--- a/build/autoconf/compiler-opts.m4
++++ b/build/autoconf/compiler-opts.m4
+@@ -1,44 +1,14 @@
+ dnl This Source Code Form is subject to the terms of the Mozilla Public
+ dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+ dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ dnl Add compiler specific options
+ 
+-AC_DEFUN([MOZ_DEFAULT_COMPILER],
+-[
+-dnl Default to MSVC for win32 and gcc-4.2 for darwin
+-dnl ==============================================================
+-if test -z "$CROSS_COMPILE"; then
+-case "$target" in
+-*-mingw*)
+-    if test -z "$CPP"; then CPP="$CC -E -nologo"; fi
+-    if test -z "$CXXCPP"; then CXXCPP="$CXX -TP -E -nologo"; ac_cv_prog_CXXCPP="$CXXCPP"; fi
+-    if test -z "$AS"; then
+-        case "${target_cpu}" in
+-        i*86)
+-            AS=ml;
+-            ;;
+-        x86_64)
+-            AS=ml64;
+-            ;;
+-        esac
+-    fi
+-    if test -z "$MIDL"; then MIDL=midl; fi
+-
+-    # need override this flag since we don't use $(LDFLAGS) for this.
+-    if test -z "$HOST_LDFLAGS" ; then
+-        HOST_LDFLAGS=" "
+-    fi
+-    ;;
+-esac
+-fi
+-])
+-
+ dnl ============================================================================
+ dnl C++ rtti
+ dnl We don't use it in the code, but it can be usefull for debugging, so give
+ dnl the user the option of enabling it.
+ dnl ============================================================================
+ AC_DEFUN([MOZ_RTTI],
+ [
+ MOZ_ARG_ENABLE_BOOL(cpp-rtti,
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -774,16 +774,43 @@ def default_cxx_compilers(c_compiler, ot
+             return (os.path.join(dir, file.replace('clang', 'clang++')),)
+ 
+         return (c_compiler.compiler,)
+ 
+     return default_cxx_compilers
+ 
+ 
+ @template
++def provided_program(env_var):
++    '''Template handling cases where a program can be specified either as a
++    path or as a path with applicable arguments.
++    '''
++
++    @depends_if(env_var)
++    @imports(_from='itertools', _import='takewhile')
++    @imports(_from='mozbuild.shellutil', _import='split', _as='shell_split')
++    def provided(cmd):
++        # Assume the first dash-prefixed item (and any subsequent items) are
++        # command-line options, the item before the dash-prefixed item is
++        # the program we're looking for, and anything before that is a wrapper
++        # of some kind (e.g. sccache).
++        cmd = shell_split(cmd[0])
++
++        without_flags = list(takewhile(lambda x: not x.startswith('-'), cmd))
++
++        return namespace(
++            wrapper=without_flags[:-1],
++            program=without_flags[-1],
++            flags=cmd[len(without_flags):],
++        )
++
++    return provided
++
++
++@template
+ def compiler(language, host_or_target, c_compiler=None, other_compiler=None,
+              other_c_compiler=None):
+     '''Template handling the generic base checks for the compiler for the
+     given `language` on the given platform (`host_or_target`).
+     `host_or_target` is either `host` or `target` (the @depends functions
+     from init.configure.
+     When the language is 'C++', `c_compiler` is the result of the `compiler`
+     template for the language 'C' for the same `host_or_target`.
+@@ -818,41 +845,24 @@ def compiler(language, host_or_target, c
+     }[language]()
+ 
+     what = 'the %s %s compiler' % (host_or_target_str, language)
+ 
+     option(env=var, nargs=1, help='Path to %s' % what)
+ 
+     # Handle the compiler given by the user through one of the CC/CXX/HOST_CC/
+     # HOST_CXX variables.
+-    @depends_if(var)
+-    @imports(_from='itertools', _import='takewhile')
+-    @imports(_from='mozbuild.shellutil', _import='split', _as='shell_split')
+-    def provided_compiler(cmd):
+-        # Historically, the compiler variables have contained more than the
+-        # path to the compiler itself. So for backwards compatibility, try to
+-        # find what is what in there, assuming the first dash-prefixed item is
+-        # a compiler option, the item before that is the compiler, and anything
+-        # before that is a compiler wrapper.
+-        cmd = shell_split(cmd[0])
+-
+-        without_flags = list(takewhile(lambda x: not x.startswith('-'), cmd))
+-
+-        return namespace(
+-            wrapper=without_flags[:-1],
+-            compiler=without_flags[-1],
+-            flags=cmd[len(without_flags):],
+-        )
++    provided_compiler = provided_program(var)
+ 
+     # Normally, we'd use `var` instead of `_var`, but the interaction with
+     # old-configure complicates things, and for now, we a) can't take the plain
+     # result from check_prog as CC/CXX/HOST_CC/HOST_CXX and b) have to let
+     # old-configure AC_SUBST it (because it's autoconf doing it, not us)
+     compiler = check_prog('_%s' % var, what=what, progs=default_compilers,
+-                          input=provided_compiler.compiler,
++                          input=provided_compiler.program,
+                           paths=toolchain_search_path)
+ 
+     @depends(compiler, provided_compiler, compiler_wrapper, host_or_target)
+     @checking('whether %s can be used' % what, lambda x: bool(x))
+     @imports(_from='mozbuild.shellutil', _import='quote')
+     def valid_compiler(compiler, provided_compiler, compiler_wrapper,
+                        host_or_target):
+         wrapper = list(compiler_wrapper or ())
+@@ -1570,16 +1580,81 @@ def select_linker(linker, c_compiler, de
+     )
+ 
+ 
+ set_config('LD_IS_BFD', depends(select_linker.KIND)
+            (lambda x: x == 'bfd' or None))
+ set_config('LINKER_LDFLAGS', select_linker.LINKER_FLAG)
+ 
+ 
++# Assembler detection
++# ==============================================================
++
++js_option(env='AS', nargs=1, help='Path to the assembler')
++
++@depends(target, c_compiler)
++def as_info(target, c_compiler):
++    if c_compiler.type in ('msvc', 'clang-cl'):
++        ml = {
++            'x86': 'ml',
++            'x86_64': 'ml64',
++            'aarch64': 'armasm64.exe',
++        }.get(target.cpu)
++        return namespace(
++            type='masm',
++            names=(ml, )
++        )
++    # When building with anything but MSVC, we just use the C compiler as the assembler.
++    return namespace(
++        type='gcc',
++        names=(c_compiler.compiler, )
++    )
++
++# One would expect the assembler to be specified merely as a program.  But in
++# cases where the assembler is passed down into js/, it can be specified in
++# the same way as CC: a program + a list of argument flags.  We might as well
++# permit the same behavior in general, even though it seems somewhat unusual.
++# So we have to do the same sort of dance as we did above with
++# `provided_compiler`.
++provided_assembler = provided_program('AS')
++assembler = check_prog('_AS', input=provided_assembler.program,
++                       what='the assembler', progs=as_info.names)
++
++@depends(as_info, assembler, provided_assembler, c_compiler)
++def as_with_flags(as_info, assembler, provided_assembler, c_compiler):
++    if provided_assembler:
++        return provided_assembler.wrapper + \
++            [provided_assembler.program] + \
++            provided_assembler.flags
++
++    if as_info.type == 'masm':
++        return assembler
++
++    assert as_info.type == 'gcc'
++
++    # Need to add compiler wrappers and flags as appropriate.
++    return c_compiler.wrapper + [assembler] + c_compiler.flags
++
++
++add_old_configure_assignment('AS', as_with_flags)
++
++@depends(as_info, target)
++def as_dash_c_flag(as_info, target):
++    # armasm64 doesn't understand -c.
++    if as_info.type == 'masm' and target.cpu == 'aarch64':
++        return ''
++    else:
++        return '-c'
++
++
++set_config('AS_DASH_C_FLAG', as_dash_c_flag)
++
++# clang plugin handling
++# ==============================================================
++
+ js_option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN',
+           help="Enable building with the mozilla clang plugin")
+ 
+ add_old_configure_assignment('ENABLE_CLANG_PLUGIN',
+                              depends_if('--enable-clang-plugin')(lambda _: True))
+ 
+ js_option('--enable-mozsearch-plugin', env='ENABLE_MOZSEARCH_PLUGIN',
+           help="Enable building with the mozsearch indexer plugin")
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -58,18 +58,16 @@ dnl ====================================
+ MISSING_X=
+ 
+ dnl Initialize the Pthread test variables early so they can be
+ dnl  overridden by each platform.
+ dnl ========================================================
+ USE_PTHREADS=
+ _PTHREAD_LDFLAGS=""
+ 
+-MOZ_DEFAULT_COMPILER
+-
+ if test -z "$JS_STANDALONE"; then
+   autoconfmk=autoconf-js.mk
+ fi
+ AC_SUBST(autoconfmk)
+ 
+ if test -n "$JS_STANDALONE"; then
+   jsconfdefs=$_objdir/js/src/js-confdefs.h
+ else
+@@ -394,20 +392,17 @@ AC_SUBST(MOZJS_MAJOR_VERSION)
+ AC_SUBST(MOZJS_MINOR_VERSION)
+ AC_SUBST(MOZJS_PATCH_VERSION)
+ AC_SUBST(MOZJS_ALPHA)
+ 
+ 
+ dnl ========================================================
+ dnl set the defaults first
+ dnl ========================================================
+-AS_BIN=$AS
+ AR_EXTRACT='$(AR) x'
+-AS='$(CC)'
+-AS_DASH_C_FLAG='-c'
+ MOZ_USER_DIR=".mozilla"
+ 
+ MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
+ 
+ dnl Configure platform-specific CPU architecture compiler options.
+ dnl ==============================================================
+ MOZ_ARCH_OPTS
+ 
+@@ -663,19 +658,16 @@ case "$target" in
+         MOZ_OPTIMIZE_FLAGS="-O2"
+ 
+         WIN32_CONSOLE_EXE_LDFLAGS=-mconsole
+         WIN32_GUI_EXE_LDFLAGS=-mwindows
+     else
+         TARGET_COMPILER_ABI=msvc
+         HOST_CC='$(CC)'
+         HOST_CXX='$(CXX)'
+-        if test "$AS_BIN"; then
+-            AS="$(basename "$AS_BIN")"
+-        fi
+         AR='lib'
+         AR_FLAGS='-NOLOGO -OUT:$@'
+         AR_EXTRACT=
+         RANLIB='echo not_ranlib'
+         STRIP='echo not_strip'
+         PKG_SKIP_STRIP=1
+         WIN32_SUBSYSTEM_VERSION=6.01
+         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
+@@ -1685,25 +1677,16 @@ AC_SUBST_LIST(EDITLINE_LIBS)
+ 
+ dnl ========================================================
+ dnl =
+ dnl = Standalone module options
+ dnl =
+ dnl ========================================================
+ MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
+ 
+-if test "$JS_HAS_CTYPES"; then
+-  dnl JS_HAS_CTYPES is defined by Python configure. This check remains
+-  dnl as long as determining $AS remains in old-configure.
+-  dnl Error out if we're on MSVC and MASM is unavailable.
+-  if test -n "$_MSC_VER" -a \( "$AS" != "ml.exe" -a "$AS" != "ml64.exe" \); then
+-    AC_MSG_ERROR([\"$AS\" is not a suitable assembler to build js-ctypes. If you are building with MS Visual Studio 8 Express, you may download the MASM 8.0 package, upgrade to Visual Studio 9 Express, or install the Vista SDK. Or do not use --enable-ctypes.])
+-  fi
+-fi
+-
+ dnl ========================================================
+ dnl =
+ dnl = Options for generating the shell as a script
+ dnl =
+ dnl ========================================================
+ 
+ MOZ_ARG_WITH_STRING(qemu-exe,
+ [  --with-qemu-exe=path   Use path as an arm emulator on host platforms],
+@@ -1718,19 +1701,17 @@ dnl ====================================
+ dnl =
+ dnl = Maintainer debug option (no --enable equivalent)
+ dnl =
+ dnl ========================================================
+ 
+ AC_SUBST(AR)
+ AC_SUBST(AR_FLAGS)
+ AC_SUBST(AR_EXTRACT)
+-AC_SUBST(AS)
+ AC_SUBST_LIST(ASFLAGS)
+-AC_SUBST(AS_DASH_C_FLAG)
+ AC_SUBST(RC)
+ AC_SUBST(RCFLAGS)
+ AC_SUBST(WINDRES)
+ AC_SUBST(IMPLIB)
+ AC_SUBST(FILTER)
+ AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
+ AC_SUBST(WARNINGS_AS_ERRORS)
+ AC_SUBST(LIBICONV)
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -73,18 +73,16 @@ dnl ====================================
+ MISSING_X=
+ 
+ dnl Initialize the Pthread test variables early so they can be
+ dnl  overridden by each platform.
+ dnl ========================================================
+ MOZ_USE_PTHREADS=
+ _PTHREAD_LDFLAGS=""
+ 
+-MOZ_DEFAULT_COMPILER
+-
+ if test "$COMPILE_ENVIRONMENT"; then
+     MOZ_ANDROID_NDK
+ fi # COMPILE_ENVIRONMENT
+ 
+ case "$target" in
+ *-android*|*-linuxandroid*)
+     AC_DEFINE(ANDROID)
+     ;;
+@@ -431,20 +429,17 @@ AC_PATH_XTRA
+ 
+ XCFLAGS="$X_CFLAGS"
+ 
+ fi # COMPILE_ENVIRONMENT
+ 
+ dnl ========================================================
+ dnl set the defaults first
+ dnl ========================================================
+-AS_BIN=$AS
+ AR_EXTRACT='$(AR) x'
+-AS='$(CC)'
+-AS_DASH_C_FLAG='-c'
+ MOZ_USER_DIR=".mozilla"
+ 
+ MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib"
+ 
+ MOZ_FS_LAYOUT=unix
+ 
+ dnl Configure platform-specific CPU architecture compiler options.
+ dnl ==============================================================
+@@ -859,19 +854,16 @@ case "$target" in
+             # function thunks need to be generated for cross-DLL calls.
+             MOZ_FOLD_LIBS_FLAGS="-mnop-fun-dllimport"
+         else
+             # Silence problematic clang warnings
+             CXXFLAGS="$CXXFLAGS -Wno-incompatible-ms-struct"
+         fi
+     else
+         TARGET_COMPILER_ABI=msvc
+-        if test "$AS_BIN"; then
+-            AS="$(basename "$AS_BIN")"
+-        fi
+         AR='lib'
+         AR_FLAGS='-NOLOGO -OUT:$@'
+         AR_EXTRACT=
+         RANLIB='echo not_ranlib'
+         STRIP='echo not_strip'
+         PKG_SKIP_STRIP=1
+         WIN32_SUBSYSTEM_VERSION=6.01
+         WIN32_CONSOLE_EXE_LDFLAGS=-SUBSYSTEM:CONSOLE,$WIN32_SUBSYSTEM_VERSION
+@@ -4011,19 +4003,17 @@ dnl ====================================
+ dnl =
+ dnl = Maintainer debug option (no --enable equivalent)
+ dnl =
+ dnl ========================================================
+ 
+ AC_SUBST(AR)
+ AC_SUBST(AR_FLAGS)
+ AC_SUBST(AR_EXTRACT)
+-AC_SUBST(AS)
+ AC_SUBST_LIST(ASFLAGS)
+-AC_SUBST(AS_DASH_C_FLAG)
+ AC_SUBST(RC)
+ AC_SUBST(RCFLAGS)
+ AC_SUBST(WINDRES)
+ AC_SUBST(IMPLIB)
+ AC_SUBST(FILTER)
+ AC_SUBST(MOZ_AUTH_EXTENSION)
+ AC_SUBST(MOZ_PREF_EXTENSIONS)
+ AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -163,20 +163,17 @@ class BackendTupfile(object):
+             (sources['.s'], 'AS', 'ASFLAGS', as_dash_c, ''),
+             (sources['.cpp'], 'CXX', 'CXXFLAGS', '-c', ''),
+             (sources['.c'], 'CC', 'CFLAGS', '-c', ''),
+             (host_sources['.cpp'], 'HOST_CXX', 'HOST_CXXFLAGS', '-c', 'host_'),
+             (host_sources['.c'], 'HOST_CC', 'HOST_CFLAGS', '-c', 'host_'),
+         ]
+         for srcs, compiler, flags, dash_c, prefix in compilers:
+             for src in sorted(srcs):
+-                # AS can be set to $(CC), so we need to call expand_variables on
+-                # the compiler to get the real value.
+-                compiler_value = self.variables.get(compiler, self.environment.substs[compiler])
+-                cmd = [expand_variables(compiler_value, self.environment.substs)]
++                cmd = [self.variables.get(compiler, self.environment.substs[compiler])]
+                 cmd.extend(shell_quote(f) for f in self.local_flags[flags])
+                 cmd.extend(shell_quote(f) for f in self.per_source_flags[src])
+                 cmd.extend([dash_c, '%f', '-o', '%o'])
+                 self.rule(
+                     cmd=cmd,
+                     inputs=[src],
+                     extra_inputs=extra_inputs,
+                     outputs=[prefix + '%B.o'],

+ 130 - 0
rel-257/mozilla-esr60/patches/1397263-3-64a1.patch

@@ -0,0 +1,130 @@
+# HG changeset patch
+# User Ted Mielczarek <ted@mielczarek.org>
+# Date 1538612969 14400
+# Node ID b3ad0438392892aeab8c88826d347164640ba602
+# Parent  d6c38aa3ef4396c0c92f6a76157c34e83a4d7ee2
+Bug 1397263 - move MIDL_FLAGS to toolkit/moz.configure; r=glandium
+
+This is a straightforward port of MIDL_FLAGS from old-configure to
+moz.configure. The only behavioral change is that it removes support for
+prepending MIDL_FLAGS from the environment in configure, but I doubt anyone
+uses that.
+
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -256,26 +256,16 @@ case "$target" in
+             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
+                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
+             fi
+             ;;
+         esac
+ 
+         INCREMENTAL_LINKER=1
+ 
+-        # Set midl environment
+-        case "$target" in
+-        i*86-*)
+-            MIDL_FLAGS="${MIDL_FLAGS} -env win32"
+-            ;;
+-        x86_64-*)
+-            MIDL_FLAGS="${MIDL_FLAGS} -env x64"
+-            ;;
+-        esac
+-
+         unset _MSVC_VER_FILTER
+ 
+         WRAP_STL_INCLUDES=1
+         STL_FLAGS="-I${DIST}/stl_wrappers"
+         CFLAGS="$CFLAGS -D_HAS_EXCEPTIONS=0"
+         CXXFLAGS="$CXXFLAGS -D_HAS_EXCEPTIONS=0"
+     else
+         # Check w32api version
+@@ -308,27 +298,16 @@ case "$target" in
+                 "$_WINDRES_MINOR_VERSION" -lt "$WINDRES_MINOR_VERSION" -o \
+                 "$_WINDRES_MAJOR_VERSION" -eq "$WINDRES_MAJOR_VERSION" -a \
+                 "$_WINDRES_MINOR_VERSION" -eq "$WINDRES_MINOR_VERSION" -a \
+                 "$_WINDRES_RELEASE_VERSION" -lt "$WINDRES_RELEASE_VERSION"
+         then
+             AC_MSG_ERROR([windres version $WINDRES_VERSION or higher is required to build.])
+         fi
+ 
+-        if test -n "$MIDL"; then
+-            case "$target" in
+-            i*86-*)
+-                MIDL_FLAGS="$MIDL_FLAGS --win32 -m32"
+-                ;;
+-            x86_64-*)
+-                MIDL_FLAGS="$MIDL_FLAGS --win64 -m64"
+-                ;;
+-            esac
+-        fi
+-
+         # strsafe.h on mingw uses macros for function deprecation that pollutes namespace
+         # causing problems with local implementations with the same name.
+         AC_DEFINE(STRSAFE_NO_DEPRECATE)
+     fi # !GNU_CC
+ 
+     AC_DEFINE_UNQUOTED(WINVER,0x$WINVER)
+     AC_DEFINE_UNQUOTED(_WIN32_WINNT,0x$WINVER)
+     # Require OS features provided by IE 8.0 (Win7)
+@@ -345,17 +324,16 @@ if test -n "$_WIN32_MSVC"; then
+     # Since we're skipping compiler and library checks, hard-code
+     # some facts here.
+     AC_DEFINE(HAVE_IO_H)
+     AC_DEFINE(HAVE_ISATTY)
+ fi
+ 
+ fi # COMPILE_ENVIRONMENT
+ 
+-AC_SUBST(MIDL_FLAGS)
+ AC_SUBST(_MSC_VER)
+ 
+ AC_SUBST(GNU_AS)
+ AC_SUBST(GNU_CC)
+ AC_SUBST(GNU_CXX)
+ 
+ AC_SUBST_LIST(STL_FLAGS)
+ AC_SUBST(WRAP_STL_INCLUDES)
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -1243,18 +1243,37 @@ def check_for_midl(target, compile_envir
+         return
+ 
+     if compile_environment:
+         return True
+ 
+ 
+ midl = check_prog('MIDL', midl_names, when=check_for_midl, allow_missing=True)
+ 
+-# Needed until we move MIDL_FLAGS and --disable-accessibility from old-configure
++
++@depends(c_compiler, target, when=depends(midl, target)(lambda m, t: m and t.kernel == 'WINNT'))
++def midl_flags(c_compiler, target):
++    if c_compiler and c_compiler.type in ('msvc', 'clang-cl'):
++        env = {
++            'x86': 'win32',
++            'x86_64': 'x64',
++            'aarch64': 'arm64',
++        }[target.cpu]
++        return ['-env', env]
++
++    # mingw
++    return {
++        'x86': ['--win32', '-m32'],
++        'x86_64': ['--win64', '-m64'],
++    }[target.cpu]
++
++
++# Needed until we move --disable-accessibility from old-configure
+ add_old_configure_assignment('MIDL', midl)
++set_config('MIDL_FLAGS', midl_flags)
+ 
+ # Addon signing
+ # ==============================================================
+ 
+ option('--with-unsigned-addon-scopes',
+        nargs='+', choices=('app', 'system'),
+        help='Addon scopes where signature is not required')
+ 

+ 139 - 0
rel-257/mozilla-esr60/patches/1397263-4-64a1.patch

@@ -0,0 +1,139 @@
+# HG changeset patch
+# User Ted Mielczarek <ted@mielczarek.org>
+# Date 1538612969 14400
+# Node ID 23f384237f7320a5f5ef99f19781feb0227faf7e
+# Parent  24bf8ec3d58af1350e3d2408834a1e5cd222067d
+Bug 1397263 - move GNU_AS checks to toolchain.configure; r=glandium
+
+The GNU_AS check in old-configure depended on running with the value
+of $AS before it gets reset to just be the C compiler, which breaks when
+we move setting AS into moz.configure.
+
+This patch moves the GNU_AS check to toolchain.configure and changes it
+so that it works when the assembler is the C compiler.  We do have to
+fix things slightly for clang, because the previous check was
+succeeding, but not because of clang: it was detecting the presence of
+"GNU" in the output for GNU ld/gold and a message about the GNU GPL.
+
+diff --git a/build/autoconf/toolchain.m4 b/build/autoconf/toolchain.m4
+--- a/build/autoconf/toolchain.m4
++++ b/build/autoconf/toolchain.m4
+@@ -9,30 +9,23 @@ dnl However, theses checks are not neces
+ dnl the corresponding variables already, so just skip those tests
+ dnl entirely.
+ define([AC_PROG_CPP],[])
+ define([AC_PROG_CXXCPP],[])
+ define([AC_HEADER_STDC], [])
+ 
+ AC_DEFUN([MOZ_TOOL_VARIABLES],
+ [
+-GNU_AS=
+-
+ GNU_CC=
+ GNU_CXX=
+ if test "$CC_TYPE" = "gcc"; then
+     GNU_CC=1
+     GNU_CXX=1
+ fi
+ 
+-if test "`echo | $AS -o conftest.out -v 2>&1 | grep -c GNU`" != "0"; then
+-    GNU_AS=1
+-fi
+-rm -f conftest.out
+-
+ CLANG_CC=
+ CLANG_CXX=
+ CLANG_CL=
+ if test "$CC_TYPE" = "clang"; then
+     GNU_CC=1
+     GNU_CXX=1
+     CLANG_CC=1
+     CLANG_CXX=1
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -1631,16 +1631,42 @@ def as_with_flags(as_info, assembler, pr
+     assert as_info.type == 'gcc'
+ 
+     # Need to add compiler wrappers and flags as appropriate.
+     return c_compiler.wrapper + [assembler] + c_compiler.flags
+ 
+ 
+ add_old_configure_assignment('AS', as_with_flags)
+ 
++
++@depends(assembler, c_compiler, extra_toolchain_flags)
++@imports('subprocess')
++@imports(_from='os', _import='devnull')
++def gnu_as(assembler, c_compiler, toolchain_flags):
++    # clang uses a compatible GNU assembler.
++    if c_compiler.type == 'clang':
++        return True
++
++    if c_compiler.type == 'gcc':
++        cmd = [assembler] + c_compiler.flags
++        if toolchain_flags:
++            cmd += toolchain_flags
++        cmd += ['-Wa,--version', '-c', '-o', devnull, '-x', 'assembler', '-']
++        # We don't actually have to provide any input on stdin, `Popen.communicate` will
++        # close the stdin pipe.
++        # clang will error if it uses its integrated assembler for this target,
++        # so handle failures gracefully.
++        if 'GNU' in check_cmd_output(*cmd, stdin=subprocess.PIPE, onerror=lambda: '').decode('utf-8'):
++            return True
++
++
++set_config('GNU_AS', gnu_as)
++add_old_configure_assignment('GNU_AS', gnu_as)
++
++
+ @depends(as_info, target)
+ def as_dash_c_flag(as_info, target):
+     # armasm64 doesn't understand -c.
+     if as_info.type == 'masm' and target.cpu == 'aarch64':
+         return ''
+     else:
+         return '-c'
+ 
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -296,17 +296,16 @@ if test -n "$SBCONF"; then
+     if test $_sb_version_major -eq 1 -a $_sb_version_minor -eq 0 -a $_sb_version_point -le 16; then
+         QEMU_CANT_RUN_JS_SHELL=1
+     fi
+ fi
+ AC_SUBST(QEMU_CANT_RUN_JS_SHELL)
+ 
+ AC_SUBST(_MSC_VER)
+ 
+-AC_SUBST(GNU_AS)
+ AC_SUBST(GNU_CC)
+ AC_SUBST(GNU_CXX)
+ 
+ dnl ========================================================
+ dnl Checks for programs.
+ dnl ========================================================
+ if test "$COMPILE_ENVIRONMENT"; then
+ 
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -326,17 +326,16 @@ if test -n "$_WIN32_MSVC"; then
+     AC_DEFINE(HAVE_IO_H)
+     AC_DEFINE(HAVE_ISATTY)
+ fi
+ 
+ fi # COMPILE_ENVIRONMENT
+ 
+ AC_SUBST(_MSC_VER)
+ 
+-AC_SUBST(GNU_AS)
+ AC_SUBST(GNU_CC)
+ AC_SUBST(GNU_CXX)
+ 
+ AC_SUBST_LIST(STL_FLAGS)
+ AC_SUBST(WRAP_STL_INCLUDES)
+ 
+ dnl ========================================================
+ dnl Checks for programs.

+ 109 - 0
rel-257/mozilla-esr60/patches/1397263-5-64a1.patch

@@ -0,0 +1,109 @@
+# HG changeset patch
+# User Nathan Froyd <froydnj@mozilla.com>
+# Date 1538612969 14400
+# Node ID 237dbec378d81d707afbf97e1818fea97c972844
+# Parent  3c6e70777b996db8f24ec0b2b07e05ad73122e9c
+Bug 1397263 - move ASOUTOPTION to moz.configure; r=mshal
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -1668,16 +1668,28 @@ def as_dash_c_flag(as_info, target):
+     if as_info.type == 'masm' and target.cpu == 'aarch64':
+         return ''
+     else:
+         return '-c'
+ 
+ 
+ set_config('AS_DASH_C_FLAG', as_dash_c_flag)
+ 
++
++@depends(as_info, target)
++def as_outoption(as_info, target):
++    # The uses of ASOUTOPTION depend on the spacing for -o/-Fo.
++    if as_info.type == 'masm' and target.cpu != 'aarch64':
++        return '-Fo'
++
++    return '-o '
++
++
++set_config('ASOUTOPTION', as_outoption)
++
+ # clang plugin handling
+ # ==============================================================
+ 
+ js_option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN',
+           help="Enable building with the mozilla clang plugin")
+ 
+ add_old_configure_assignment('ENABLE_CLANG_PLUGIN',
+                              depends_if('--enable-clang-plugin')(lambda _: True))
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -378,22 +378,16 @@ IFLAGS2 = -m 755
+ endif
+ 
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ OUTOPTION = -Fo# eol
+ else
+ OUTOPTION = -o # eol
+ endif # WINNT && !GNU_CC
+ 
+-ifneq (,$(filter ml%,$(AS)))
+-ASOUTOPTION = -Fo# eol
+-else
+-ASOUTOPTION = -o # eol
+-endif
+-
+ ifeq (,$(CROSS_COMPILE))
+ HOST_OUTOPTION = $(OUTOPTION)
+ else
+ HOST_OUTOPTION = -o # eol
+ endif
+ ################################################################################
+ 
+ # Ensure the build config is up to date. This is done automatically when builds
+diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
+--- a/python/mozbuild/mozbuild/frontend/emitter.py
++++ b/python/mozbuild/mozbuild/frontend/emitter.py
+@@ -1293,16 +1293,17 @@ class TreeMetadataEmitter(LoggingMixin):
+                                         context.get('ASFLAGS'))
+ 
+         if context.get('USE_YASM') is True:
+             yasm = context.config.substs.get('YASM')
+             if not yasm:
+                 raise SandboxValidationError('yasm is not available', context)
+             passthru.variables['AS'] = yasm
+             passthru.variables['AS_DASH_C_FLAG'] = ''
++            passthru.variables['ASOUTOPTION'] = '-o '
+             computed_as_flags.resolve_flags('OS',
+                                             context.config.substs.get('YASM_ASFLAGS', []))
+ 
+ 
+         if passthru.variables:
+             yield passthru
+ 
+         if context.objdir in self._compile_dirs:
+diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
++++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+@@ -444,17 +444,18 @@ class TestEmitterBasic(unittest.TestCase
+         self.assertIsInstance(asflags, ComputedFlags)
+ 
+         self.assertEqual(asflags.flags['OS'], reader.config.substs['YASM_ASFLAGS'])
+ 
+         maxDiff = self.maxDiff
+         self.maxDiff = None
+         self.assertEqual(passthru.variables,
+                          {'AS': 'yasm',
+-                          'AS_DASH_C_FLAG': ''})
++                          'AS_DASH_C_FLAG': '',
++                          'ASOUTOPTION': '-o '})
+         self.maxDiff = maxDiff
+ 
+ 
+     def test_generated_files(self):
+         reader = self.reader('generated-files')
+         objs = self.read_topsrcdir(reader)
+ 
+         self.assertEqual(len(objs), 3)

+ 157 - 0
rel-257/mozilla-esr60/patches/1397263-6-64a1.patch

@@ -0,0 +1,157 @@
+# HG changeset patch
+# User Nathan Froyd <froydnj@mozilla.com>
+# Date 1538612969 14400
+# Node ID d678adeaddcd50c3d49c6a4afe3395f1a10853e1
+# Parent  5125a4fecee091e008a8a404eebfdfc8bbb5af35
+Bug 1397263 - move --enable-accessibility to moz.configure; r=mshal
+
+diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
+--- a/build/moz.configure/old.configure
++++ b/build/moz.configure/old.configure
+@@ -164,17 +164,16 @@ def old_configure_options(*options):
+ 
+     return depends(prepare_configure, extra_old_configure_args, all_options,
+                    *options)
+ 
+ 
+ @old_configure_options(
+     '--cache-file',
+     '--datadir',
+-    '--enable-accessibility',
+     '--enable-alsa',
+     '--enable-bundled-fonts',
+     '--enable-content-sandbox',
+     '--enable-cookies',
+     '--enable-cpp-rtti',
+     '--enable-crashreporter',
+     '--enable-dbus',
+     '--enable-debug-js-modules',
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -1895,17 +1895,16 @@ MOZ_SPELLCHECK=1
+ MOZ_TOOLKIT_SEARCH=1
+ MOZ_UNIVERSALCHARDET=1
+ MOZ_XUL=1
+ MOZ_ZIPWRITER=1
+ MOZ_NO_SMART_CARDS=
+ NECKO_COOKIES=1
+ MOZ_USE_NATIVE_POPUP_WINDOWS=
+ MOZ_EXCLUDE_HYPHENATION_DICTIONARIES=
+-ACCESSIBILITY=1
+ MOZ_CONTENT_SANDBOX=
+ MOZ_GMP_SANDBOX=
+ MOZ_SANDBOX=1
+ MOZ_BINARY_EXTENSIONS=
+ MOZ_DEVTOOLS=server
+ 
+ case "$target_os" in
+     mingw*)
+@@ -2274,37 +2273,16 @@ AC_SUBST(MOZ_ENABLE_DBUS)
+ 
+ dnl =========================================================
+ dnl = Whether to exclude hyphenations files in the build
+ dnl =========================================================
+ if test -n "$MOZ_EXCLUDE_HYPHENATION_DICTIONARIES"; then
+     AC_DEFINE(MOZ_EXCLUDE_HYPHENATION_DICTIONARIES)
+ fi
+ 
+-dnl ========================================================
+-dnl accessibility support on by default on all platforms
+-dnl ========================================================
+-MOZ_ARG_DISABLE_BOOL(accessibility,
+-[  --disable-accessibility Disable accessibility support],
+-    ACCESSIBILITY=,
+-    ACCESSIBILITY=1 )
+-if test "$ACCESSIBILITY"; then
+-    case "$target" in
+-    *-mingw*)
+-        if test -z "$MIDL"; then
+-            if test "$GCC" != "yes"; then
+-                AC_MSG_ERROR([MIDL could not be found. Building accessibility without MIDL is not supported.])
+-            else
+-                AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
+-            fi
+-        fi
+-    esac
+-    AC_DEFINE(ACCESSIBILITY)
+-fi
+-
+ AC_TRY_COMPILE([#include <linux/ethtool.h>],
+                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
+                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
+ 
+ AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
+ 
+ if test -n "$MOZ_WEBRTC"; then
+     MOZ_RAW=1
+@@ -3995,17 +3973,16 @@ AC_SUBST(MOZ_AUTH_EXTENSION)
+ AC_SUBST(MOZ_PREF_EXTENSIONS)
+ AC_SUBST_LIST(MOZ_DEBUG_LDFLAGS)
+ AC_SUBST(WARNINGS_AS_ERRORS)
+ AC_SUBST_SET(MOZ_EXTENSIONS)
+ AC_SUBST(MOZ_TOOLKIT_SEARCH)
+ AC_SUBST(MOZ_FEEDS)
+ 
+ AC_SUBST(MOZ_UNIVERSALCHARDET)
+-AC_SUBST(ACCESSIBILITY)
+ AC_SUBST(MOZ_SPELLCHECK)
+ AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
+ AC_SUBST(MOZ_CRASHREPORTER)
+ AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
+ AC_SUBST(MOZ_MAINTENANCE_SERVICE)
+ AC_SUBST(MOZ_STUB_INSTALLER)
+ AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
+ AC_SUBST(MOZ_ENABLE_SIGNMAR)
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -1261,20 +1261,46 @@ def midl_flags(c_compiler, target):
+ 
+     # mingw
+     return {
+         'x86': ['--win32', '-m32'],
+         'x86_64': ['--win64', '-m64'],
+     }[target.cpu]
+ 
+ 
+-# Needed until we move --disable-accessibility from old-configure
+-add_old_configure_assignment('MIDL', midl)
+ set_config('MIDL_FLAGS', midl_flags)
+ 
++# Accessibility
++# ==============================================================
++
++option('--disable-accessibility', help='Disable accessibility support')
++
++@depends('--disable-accessibility', check_for_midl, midl, c_compiler)
++def accessibility(value, check_for_midl, midl, c_compiler):
++    enabled = bool(value)
++
++    if not enabled:
++        return
++
++    if check_for_midl and not midl:
++        if c_compiler and c_compiler.type in ('gcc', 'clang'):
++            die('You have accessibility enabled, but widl could not be found. '
++                'Add --disable-accessibility to your mozconfig or install widl. '
++                'See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.')
++        else:
++            die('MIDL could not be found. '
++                'Building accessibility without MIDL is not supported.')
++
++    return enabled
++
++
++set_config('ACCESSIBILITY', accessibility)
++set_define('ACCESSIBILITY', accessibility)
++add_old_configure_assignment('ACCESSIBILITY', accessibility)
++
+ # Addon signing
+ # ==============================================================
+ 
+ option('--with-unsigned-addon-scopes',
+        nargs='+', choices=('app', 'system'),
+        help='Addon scopes where signature is not required')
+ 
+ @depends('--with-unsigned-addon-scopes')

+ 331 - 0
rel-257/mozilla-esr60/patches/1419892-61a1.patch

@@ -0,0 +1,331 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1522103391 25200
+# Node ID 25bffacec2573375a58f67d11c4516b607f9bfbf
+# Parent  19fc460c37a235747f57ae6228d8cb20bb7b60bd
+Bug 1419892 - Link programs and libraries in the tup backend. r=mshal
+
+MozReview-Commit-ID: 26Yb0QdCn5H
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -29,17 +29,21 @@ from ..frontend.data import (
+     FinalTargetPreprocessedFiles,
+     GeneratedFile,
+     GeneratedSources,
+     HostDefines,
+     HostSources,
+     JARManifest,
+     ObjdirFiles,
+     PerSourceFlag,
++    Program,
++    HostProgram,
++    SharedLibrary,
+     Sources,
++    StaticLibrary,
+     VariablePassthru,
+ )
+ from ..util import (
+     FileAvoidWrite,
+     expand_variables,
+ )
+ from ..frontend.context import (
+     AbsolutePath,
+@@ -57,21 +61,25 @@ class BackendTupfile(object):
+         self.relobjdir = mozpath.relpath(objdir, topobjdir)
+         self.environment = environment
+         self.name = mozpath.join(objdir, 'Tupfile')
+         self.rules_included = False
+         self.shell_exported = False
+         self.defines = []
+         self.host_defines = []
+         self.delayed_generated_files = []
++        self.delayed_installed_files = []
+         self.per_source_flags = defaultdict(list)
+         self.local_flags = defaultdict(list)
+         self.sources = defaultdict(list)
+         self.host_sources = defaultdict(list)
+         self.variables = {}
++        self.static_lib = None
++        self.shared_lib = None
++        self.program = None
+ 
+         self.fh = FileAvoidWrite(self.name, capture_diff=True)
+         self.fh.write('# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.\n')
+         self.fh.write('\n')
+ 
+     def write(self, buf):
+         self.fh.write(buf)
+ 
+@@ -188,16 +196,28 @@ class TupOnly(CommonBackend, PartialBack
+         # will be built before any rules that list this as an input.
+         self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
+         self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
+         # The preprocessor including source-repo.h and buildid.h creates
+         # dependencies that aren't specified by moz.build and cause errors
+         # in Tup. Express these as a group dependency.
+         self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
+ 
++        # application.ini.h is a special case since we need to process
++        # the FINAL_TARGET_PP_FILES for application.ini before running
++        # the GENERATED_FILES script, and tup doesn't handle the rules
++        # out of order. Similarly, dependentlibs.list uses libxul as
++        # an input, so must be written after the rule for libxul.
++        self._delayed_files = (
++            'application.ini.h',
++            'dependentlibs.list',
++            'dependentlibs.list.gtest'
++        )
++
++
+     def _get_backend_file(self, relobjdir):
+         objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
+         if objdir not in self._backend_files:
+             self._backend_files[objdir] = \
+                     BackendTupfile(objdir, self.environment,
+                                    self.environment.topsrcdir, self.environment.topobjdir)
+         return self._backend_files[objdir]
+ 
+@@ -207,16 +227,139 @@ class TupOnly(CommonBackend, PartialBack
+     def _py_action(self, action):
+         cmd = [
+             '$(PYTHON)',
+             '-m',
+             'mozbuild.action.%s' % action,
+         ]
+         return cmd
+ 
++    def _lib_paths(self, objdir, libs):
++        return [mozpath.relpath(mozpath.join(l.objdir, l.import_name), objdir)
++                for l in libs]
++
++    def _gen_shared_library(self, backend_file):
++        if backend_file.shared_lib.name == 'libxul.so':
++            # This will fail to link currently due to missing rust symbols.
++            return
++
++        if backend_file.shared_lib.cxx_link:
++            mkshlib = (
++                [backend_file.environment.substs['CXX']] +
++                backend_file.local_flags['CXX_LDFLAGS']
++            )
++        else:
++            mkshlib = (
++                [backend_file.environment.substs['CC']] +
++                backend_file.local_flags['C_LDFLAGS']
++            )
++
++        mkshlib += (
++            backend_file.environment.substs['DSO_PIC_CFLAGS'] +
++            [backend_file.environment.substs['DSO_LDOPTS']] +
++            ['-Wl,-h,%s' % backend_file.shared_lib.soname] +
++            ['-o', backend_file.shared_lib.lib_name]
++        )
++
++        objs, _, shared_libs, os_libs, static_libs = self._expand_libs(backend_file.shared_lib)
++        static_libs = self._lib_paths(backend_file.objdir, static_libs)
++        shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
++
++        list_file_name = '%s.list' % backend_file.shared_lib.name.replace('.', '_')
++        list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
++
++        inputs = objs + static_libs + shared_libs
++        if any(i.endswith('libxul.so') for i in inputs):
++            # Don't attempt to link anything that depends on libxul.
++            return
++
++        symbols_file = []
++        if backend_file.shared_lib.symbols_file:
++            inputs.append(backend_file.shared_lib.symbols_file)
++            # TODO: Assumes GNU LD
++            symbols_file = ['-Wl,--version-script,%s' % backend_file.shared_lib.symbols_file]
++
++        cmd = (
++            mkshlib +
++            [list_file] +
++            backend_file.local_flags['LDFLAGS'] +
++            static_libs +
++            shared_libs +
++            symbols_file +
++            [backend_file.environment.substs['OS_LIBS']] +
++            os_libs
++        )
++        backend_file.rule(
++            cmd=cmd,
++            inputs=inputs,
++            outputs=[backend_file.shared_lib.lib_name],
++            display='LINK %o'
++        )
++
++
++    def _gen_program(self, backend_file):
++        cc_or_cxx = 'CXX' if backend_file.program.cxx_link else 'CC'
++        objs, _, shared_libs, os_libs, static_libs = self._expand_libs(backend_file.program)
++        static_libs = self._lib_paths(backend_file.objdir, static_libs)
++        shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
++
++        inputs = objs + static_libs + shared_libs
++        if any(i.endswith('libxul.so') for i in inputs):
++            # Don't attempt to link anything that depends on libxul.
++            return
++
++        list_file_name = '%s.list' % backend_file.program.name.replace('.', '_')
++        list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
++
++        outputs = [mozpath.relpath(backend_file.program.output_path.full_path,
++                                   backend_file.objdir)]
++        cmd = (
++            [backend_file.environment.substs[cc_or_cxx], '-o', '%o'] +
++            backend_file.local_flags['CXX_LDFLAGS'] +
++            [list_file] +
++            backend_file.local_flags['LDFLAGS'] +
++            static_libs +
++            [backend_file.environment.substs['MOZ_PROGRAM_LDFLAGS']] +
++            shared_libs +
++            [backend_file.environment.substs['OS_LIBS']] +
++            os_libs
++        )
++        backend_file.rule(
++            cmd=cmd,
++            inputs=inputs,
++            outputs=outputs,
++            display='LINK %o'
++        )
++
++
++    def _gen_static_library(self, backend_file):
++        ar = [
++            backend_file.environment.substs['AR'],
++            backend_file.environment.substs['AR_FLAGS'].replace('$@', '%o')
++        ]
++
++        objs, _, shared_libs, _, static_libs = self._expand_libs(backend_file.static_lib)
++        static_libs = self._lib_paths(backend_file.objdir, static_libs)
++        shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
++
++        inputs = objs + static_libs
++
++        cmd = (
++            ar +
++            inputs
++        )
++
++        backend_file.rule(
++            cmd=cmd,
++            inputs=inputs,
++            outputs=[backend_file.static_lib.name],
++            display='AR %o'
++        )
++
++
+     def consume_object(self, obj):
+         """Write out build files necessary to build with tup."""
+ 
+         if not isinstance(obj, ContextDerived):
+             return False
+ 
+         consumed = CommonBackend.consume_object(self, obj)
+         if consumed:
+@@ -229,21 +372,17 @@ class TupOnly(CommonBackend, PartialBack
+ 
+             if self.environment.is_artifact_build:
+                 skip_files = self._compile_env_gen_files
+ 
+             for f in obj.outputs:
+                 if any(mozpath.match(f, p) for p in skip_files):
+                     return False
+ 
+-            if 'application.ini.h' in obj.outputs:
+-                # application.ini.h is a special case since we need to process
+-                # the FINAL_TARGET_PP_FILES for application.ini before running
+-                # the GENERATED_FILES script, and tup doesn't handle the rules
+-                # out of order.
++            if any([f in obj.outputs for f in self._delayed_files]):
+                 backend_file.delayed_generated_files.append(obj)
+             else:
+                 self._process_generated_file(backend_file, obj)
+         elif (isinstance(obj, ChromeManifestEntry) and
+               obj.install_target.startswith('dist/bin')):
+             top_level = mozpath.join(obj.install_target, 'chrome.manifest')
+             if obj.path != top_level:
+                 entry = 'manifest %s' % mozpath.relpath(obj.path,
+@@ -265,16 +404,24 @@ class TupOnly(CommonBackend, PartialBack
+         elif isinstance(obj, ComputedFlags):
+             self._process_computed_flags(obj, backend_file)
+         elif isinstance(obj, (Sources, GeneratedSources)):
+             backend_file.sources[obj.canonical_suffix].extend(obj.files)
+         elif isinstance(obj, HostSources):
+             backend_file.host_sources[obj.canonical_suffix].extend(obj.files)
+         elif isinstance(obj, VariablePassthru):
+             backend_file.variables = obj.variables
++        elif isinstance(obj, StaticLibrary):
++            backend_file.static_lib = obj
++        elif isinstance(obj, SharedLibrary):
++            backend_file.shared_lib = obj
++        elif isinstance(obj, HostProgram):
++            pass
++        elif isinstance(obj, Program):
++            backend_file.program = obj
+ 
+         # The top-level Makefile.in still contains our driver target and some
+         # things related to artifact builds, so as a special case ensure the
+         # make backend generates a Makefile there.
+         if obj.objdir == self.environment.topobjdir:
+             return False
+ 
+         return True
+@@ -285,19 +432,28 @@ class TupOnly(CommonBackend, PartialBack
+         # The approach here is similar to fastermake.py, but we
+         # simply write out the resulting files here.
+         for target, entries in self._manifest_entries.iteritems():
+             with self._write_file(mozpath.join(self.environment.topobjdir,
+                                                target)) as fh:
+                 fh.write(''.join('%s\n' % e for e in sorted(entries)))
+ 
+         for objdir, backend_file in sorted(self._backend_files.items()):
++            backend_file.gen_sources_rules([self._installed_files])
++            for condition, gen_method in ((backend_file.shared_lib, self._gen_shared_library),
++                                          (backend_file.static_lib and backend_file.static_lib.no_expand_lib,
++                                           self._gen_static_library),
++                                          (backend_file.program, self._gen_program)):
++                if condition:
++                    backend_file.export_shell()
++                    gen_method(backend_file)
+             for obj in backend_file.delayed_generated_files:
+                 self._process_generated_file(backend_file, obj)
+-            backend_file.gen_sources_rules([self._installed_files])
++            for path, output in backend_file.delayed_installed_files:
++                backend_file.symlink_rule(path, output=output)
+             with self._write_file(fh=backend_file):
+                 pass
+ 
+         with self._write_file(mozpath.join(self.environment.topobjdir, 'Tuprules.tup')) as fh:
+             acdefines_flags = ' '.join(['-D%s=%s' % (name, shell_quote(value))
+                 for (name, value) in sorted(self.environment.acdefines.iteritems())])
+             # TODO: AB_CD only exists in Makefiles at the moment.
+             acdefines_flags += ' -DAB_CD=en-US'
+@@ -431,18 +587,21 @@ class TupOnly(CommonBackend, PartialBack
+                     # We're not generating files in these directories yet, so
+                     # don't attempt to install files generated from them.
+                     if f.context.relobjdir not in ('layout/style/test',
+                                                    'toolkit/library',
+                                                    'js/src/shell'):
+                         output = mozpath.join('$(MOZ_OBJ_ROOT)', target, path,
+                                               f.target_basename)
+                         gen_backend_file = self._get_backend_file(f.context.relobjdir)
+-                        gen_backend_file.symlink_rule(f.full_path, output=output,
+-                                                      output_group=self._installed_files)
++                        if f.target_basename in self._delayed_files:
++                            gen_backend_file.delayed_installed_files.append((f.full_path, output))
++                        else:
++                            gen_backend_file.symlink_rule(f.full_path, output=output,
++                                                          output_group=self._installed_files)
+ 
+     def _process_final_target_pp_files(self, obj, backend_file):
+         for i, (path, files) in enumerate(obj.files.walk()):
+             for f in files:
+                 self._preprocess(backend_file, f.full_path,
+                                  destdir=mozpath.join(self.environment.topobjdir, obj.install_target, path))
+ 
+     def _process_computed_flags(self, obj, backend_file):

+ 103 - 0
rel-257/mozilla-esr60/patches/1429875-1-61a1.patch

@@ -0,0 +1,103 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1521588665 25200
+# Node ID 36f505b0e0da72cbcd109ec7eeb2fb449f6da927
+# Parent  16485dd5b222edabfd7a86d4a1cc3e2ea2efa8b1
+Bug 1429875 - Add a "name" property to Library and Program objects that corresponds to the output basename. r=glandium
+
+MozReview-Commit-ID: J4gt1fGUzOa
+
+diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py
+--- a/python/mozbuild/mozbuild/frontend/data.py
++++ b/python/mozbuild/mozbuild/frontend/data.py
+@@ -470,16 +470,19 @@ class BaseProgram(Linkable):
+         if not program.endswith(bin_suffix):
+             program += bin_suffix
+         self.program = program
+         self.is_unit_test = is_unit_test
+ 
+     def __repr__(self):
+         return '<%s: %s/%s>' % (type(self).__name__, self.relobjdir, self.program)
+ 
++    @property
++    def name(self):
++        return self.program
+ 
+ class Program(BaseProgram):
+     """Context derived container object for PROGRAM"""
+     SUFFIX_VAR = 'BIN_SUFFIX'
+     KIND = 'target'
+ 
+ 
+ class HostProgram(HostMixin, BaseProgram):
+@@ -584,16 +587,20 @@ class BaseLibrary(Linkable):
+             )
+             self.import_name = self.lib_name
+ 
+         self.refs = []
+ 
+     def __repr__(self):
+         return '<%s: %s/%s>' % (type(self).__name__, self.relobjdir, self.lib_name)
+ 
++    @property
++    def name(self):
++        return self.lib_name
++
+ 
+ class Library(BaseLibrary):
+     """Context derived container object for a library"""
+     KIND = 'target'
+     __slots__ = (
+     )
+ 
+     def __init__(self, context, basename, real_name=None):
+diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
++++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+@@ -649,16 +649,20 @@ class TestEmitterBasic(unittest.TestCase
+         self.assertIsInstance(objs[3], Program)
+         self.assertIsInstance(objs[4], SimpleProgram)
+         self.assertIsInstance(objs[5], SimpleProgram)
+ 
+         self.assertEqual(objs[3].program, 'test_program.prog')
+         self.assertEqual(objs[4].program, 'test_program1.prog')
+         self.assertEqual(objs[5].program, 'test_program2.prog')
+ 
++        self.assertEqual(objs[3].name, 'test_program.prog')
++        self.assertEqual(objs[4].name, 'test_program1.prog')
++        self.assertEqual(objs[5].name, 'test_program2.prog')
++
+         self.assertEqual(objs[4].objs,
+                          [mozpath.join(reader.config.topobjdir,
+                                        'test_program1.%s' %
+                                        reader.config.substs['OBJ_SUFFIX'])])
+         self.assertEqual(objs[5].objs,
+                          [mozpath.join(reader.config.topobjdir,
+                                        'test_program2.%s' %
+                                        reader.config.substs['OBJ_SUFFIX'])])
+@@ -1163,19 +1167,25 @@ class TestEmitterBasic(unittest.TestCase
+ 
+     def test_linkables_cxx_link(self):
+         """Test that linkables transitively set cxx_link properly."""
+         reader = self.reader('test-linkables-cxx-link')
+         got_results = 0
+         for obj in self.read_topsrcdir(reader):
+             if isinstance(obj, SharedLibrary):
+                 if obj.basename == 'cxx_shared':
++                    self.assertEquals(obj.name, '%scxx_shared%s' %
++                                      (reader.config.dll_prefix,
++                                       reader.config.dll_suffix))
+                     self.assertTrue(obj.cxx_link)
+                     got_results += 1
+                 elif obj.basename == 'just_c_shared':
++                    self.assertEquals(obj.name, '%sjust_c_shared%s' %
++                                      (reader.config.dll_prefix,
++                                       reader.config.dll_suffix))
+                     self.assertFalse(obj.cxx_link)
+                     got_results += 1
+         self.assertEqual(got_results, 2)
+ 
+     def test_generated_sources(self):
+         """Test that GENERATED_SOURCES works properly."""
+         reader = self.reader('generated-sources')
+         objs = self.read_topsrcdir(reader)

+ 54 - 0
rel-257/mozilla-esr60/patches/1429875-2-61a1.patch

@@ -0,0 +1,54 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1521588665 25200
+# Node ID 4cdc60a9f06ee184973d888f7013a4ab30fe4e99
+# Parent  aff558e26f4e9a6152cbdff745407bc9c91f849c
+Bug 1429875 - Do not take DIST_INSTALL into account when deciding to build static libraries. r=glandium
+
+Now that we're no longer shipping the SDK we no longer need real libraries for
+the libraries that were created by this rule.
+
+MozReview-Commit-ID: ALATVGBayHu
+
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -95,38 +95,23 @@ endif # ENABLE_TESTS
+ # Library rules
+ #
+ # If FORCE_STATIC_LIB is set, build a static library.
+ # Otherwise, build a shared library.
+ #
+ 
+ ifndef LIBRARY
+ ifdef REAL_LIBRARY
+-# Don't build actual static library if a shared library is also built
+-ifdef FORCE_SHARED_LIB
+-# ... except when we really want one
+ ifdef NO_EXPAND_LIBS
+ LIBRARY			:= $(REAL_LIBRARY)
+ else
+ LIBRARY			:= $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
+ endif
+-else
+-# Only build actual library if it is installed in DIST/lib
+-ifeq (,$(DIST_INSTALL)$(NO_EXPAND_LIBS))
+-LIBRARY			:= $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
+-else
+-ifdef NO_EXPAND_LIBS
+-LIBRARY			:= $(REAL_LIBRARY)
+-else
+-LIBRARY			:= $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
+ endif
+ endif
+-endif
+-endif # REAL_LIBRARY
+-endif # LIBRARY
+ 
+ ifndef HOST_LIBRARY
+ ifdef HOST_LIBRARY_NAME
+ HOST_LIBRARY		:= $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
+ endif
+ endif
+ 
+ ifdef FORCE_SHARED_LIB

+ 287 - 0
rel-257/mozilla-esr60/patches/1429875-3-61a1.patch

@@ -0,0 +1,287 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1521588665 25200
+# Node ID decbe4a4cdc77b610f7b9bae8622dbfcd00f2694
+# Parent  58b5ccfbef2a6e87add725909625a0bdbc8a7ac9
+Bug 1429875 - Add a unit test for linkage variables in the make backend. r=glandium
+
+MozReview-Commit-ID: HREobMhWTwg
+
+diff --git a/python/mozbuild/mozbuild/test/backend/common.py b/python/mozbuild/mozbuild/test/backend/common.py
+--- a/python/mozbuild/mozbuild/test/backend/common.py
++++ b/python/mozbuild/mozbuild/test/backend/common.py
+@@ -192,16 +192,27 @@ CONFIGS = defaultdict(lambda: {
+         'defines': {},
+         'non_global_defines': [],
+         'substs': {
+             'COMPILE_ENVIRONMENT': '1',
+             'LIB_SUFFIX': '.a',
+             'BIN_SUFFIX': '',
+         },
+     },
++    'linkage': {
++        'defines': {},
++        'non_global_defines': [],
++        'substs': {
++            'COMPILE_ENVIRONMENT': '1',
++            'LIB_SUFFIX': 'a',
++            'BIN_SUFFIX': '.exe',
++            'DLL_SUFFIX': '.so',
++            'OBJ_SUFFIX': 'o',
++        },
++    },
+ })
+ 
+ 
+ class BackendTester(unittest.TestCase):
+     def setUp(self):
+         self._old_env = dict(os.environ)
+         os.environ.pop('MOZ_OBJDIR', None)
+ 
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/moz.build
+@@ -0,0 +1,11 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++include('templates.mozbuild')
++
++DIRS += [
++     'real',
++     'shared',
++     'prog',
++     'static',
++]
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/prog/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/prog/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/prog/moz.build
+@@ -0,0 +1,11 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++DIRS += ['qux']
++
++Program('MyProgram')
++
++USE_LIBS += [
++    'bar',
++    'baz',
++]
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/prog/qux/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/prog/qux/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/prog/qux/moz.build
+@@ -0,0 +1,6 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++SOURCES += ['qux1.c']
++
++SharedLibrary('qux')
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/prog/qux/qux1.c b/python/mozbuild/mozbuild/test/backend/data/linkage/prog/qux/qux1.c
+new file mode 100644
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/real/foo/foo1.c b/python/mozbuild/mozbuild/test/backend/data/linkage/real/foo/foo1.c
+new file mode 100644
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/real/foo/foo2.c b/python/mozbuild/mozbuild/test/backend/data/linkage/real/foo/foo2.c
+new file mode 100644
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/real/foo/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/real/foo/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/real/foo/moz.build
+@@ -0,0 +1,9 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++SOURCES += [
++    'foo1.c',
++    'foo2.c'
++]
++
++FINAL_LIBRARY = 'foo'
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/real/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/real/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/real/moz.build
+@@ -0,0 +1,14 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++DIRS += [
++    'foo',
++]
++
++NO_EXPAND_LIBS = True
++
++OS_LIBS += ['-lbaz']
++
++USE_LIBS += ['static:baz']
++
++Library('foo')
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/shared/baz/baz1.c b/python/mozbuild/mozbuild/test/backend/data/linkage/shared/baz/baz1.c
+new file mode 100644
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/shared/baz/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/shared/baz/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/shared/baz/moz.build
+@@ -0,0 +1,6 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++SOURCES += ['baz1.c']
++
++FINAL_LIBRARY = 'baz'
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/shared/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/shared/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/shared/moz.build
+@@ -0,0 +1,14 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++DIRS += [
++    'baz',
++]
++
++STATIC_LIBRARY_NAME = 'baz_s'
++FORCE_STATIC_LIB = True
++
++OS_LIBS += ['-lfoo']
++USE_LIBS += ['qux']
++
++SharedLibrary('baz')
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar1.cc b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar1.cc
+new file mode 100644
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/moz.build
+@@ -0,0 +1,8 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++SOURCES += [
++    'bar1.cc',
++]
++
++FINAL_LIBRARY = 'bar'
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/static/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/static/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/static/moz.build
+@@ -0,0 +1,12 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++DIRS += [
++    'bar',
++]
++
++USE_LIBS += ['foo']
++
++OS_LIBS += ['-lbar']
++
++Library('bar')
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/templates.mozbuild b/python/mozbuild/mozbuild/test/backend/data/linkage/templates.mozbuild
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/templates.mozbuild
+@@ -0,0 +1,23 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++@template
++def Library(name):
++    LIBRARY_NAME = name
++
++@template
++def SharedLibrary(name):
++    FORCE_SHARED_LIB = True
++    LIBRARY_NAME = name
++
++@template
++def Binary():
++    # Add -lfoo for testing purposes.
++    OS_LIBS += ['foo']
++
++
++@template
++def Program(name):
++    PROGRAM = name
++
++    Binary()
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
++++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+@@ -982,16 +982,61 @@ class TestRecursiveMakeBackend(BackendTe
+ 
+         with open(os.path.join(env.topobjdir, 'cxx-library', 'backend.mk'), 'rb') as fh:
+             lines = fh.readlines()
+             lines = [line.rstrip() for line in lines]
+ 
+             for line in lines:
+                 self.assertNotIn('LIB_IS_C_ONLY', line)
+ 
++    def test_linkage(self):
++        env = self._consume('linkage', RecursiveMakeBackend)
++        expected_linkage = {
++            'prog': {
++                'SHARED_LIBS': ['$(DEPTH)/shared/baz', '$(DEPTH)/prog/qux/qux'],
++                'STATIC_LIBS': ['$(DEPTH)/static/bar%s' % env.lib_suffix],
++                'OS_LIBS': ['-lfoo', '-lbaz', '-lbar'],
++            },
++            'shared': {
++                'OS_LIBS': ['-lfoo'],
++                'SHARED_LIBS': ['$(DEPTH)/prog/qux/qux'],
++                'STATIC_LIBS': ['$(DEPTH)/shared/baz/shared_baz%s' %
++                                env.lib_suffix],
++            },
++            'static': {
++                'STATIC_LIBS': [
++                    '$(DEPTH)/static/bar/static_bar.a',
++                    '$(DEPTH)/real/foo.a',
++                ],
++                'OS_LIBS': ['-lbar'],
++                'SHARED_LIBS': [],
++            },
++            'real': {
++                'STATIC_LIBS': [
++                    '$(DEPTH)/shared/baz_s%s' % env.lib_suffix,
++                    '$(DEPTH)/real/foo/real_foo%s' % env.lib_suffix,
++                ],
++                'SHARED_LIBS': [],
++                'OS_LIBS': ['-lbaz'],
++            }
++        }
++        actual_linkage = {}
++        for name in expected_linkage.keys():
++            with open(os.path.join(env.topobjdir, name, 'backend.mk'), 'rb') as fh:
++                actual_linkage[name] = [line.rstrip() for line in fh.readlines()]
++        for name in expected_linkage:
++            for var in expected_linkage[name]:
++                for val in expected_linkage[name][var]:
++                    line = '%s += %s' % (var, val)
++                    self.assertIn(line,
++                                  actual_linkage[name])
++                    actual_linkage[name].remove(line)
++                for line in actual_linkage[name]:
++                    self.assertNotIn('%s +=' % var, line)
++
+     def test_jar_manifests(self):
+         env = self._consume('jar-manifests', RecursiveMakeBackend)
+ 
+         with open(os.path.join(env.topobjdir, 'backend.mk'), 'rb') as fh:
+             lines = fh.readlines()
+ 
+         lines = [line.rstrip() for line in lines]
+ 

+ 1775 - 0
rel-257/mozilla-esr60/patches/1429875-4-61a1.patch

@@ -0,0 +1,1775 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1521588665 25200
+# Node ID 7547d66e0f518d20f61b492eac027d5a34ac6fb4
+# Parent  7c6a1aeeb4dfc8fa4ab38927c17cead8d5f39988
+Bug 1429875 - Remove expandlibs and instead generate list files in the mozbuild backend. r=glandium
+
+MozReview-Commit-ID: 5eLwnh1HHGj
+
+diff --git a/build/clang-plugin/Makefile.in b/build/clang-plugin/Makefile.in
+--- a/build/clang-plugin/Makefile.in
++++ b/build/clang-plugin/Makefile.in
+@@ -8,20 +8,16 @@ include $(topsrcdir)/config/config.mk
+ # variable to limit ourselves to what we need to build the clang plugin.
+ ifneq ($(HOST_OS_ARCH),WINNT)
+ DSO_LDOPTS := -shared
+ endif
+ 
+ ifeq ($(HOST_OS_ARCH)_$(OS_ARCH),Linux_Darwin)
+ # Use the host compiler instead of the target compiler.
+ CXX := $(HOST_CXX)
+-# expandlibs doesn't know the distinction between host and target toolchains,
+-# and on cross linux/darwin builds, the options to give to the linker for file
+-# lists differ between both, so don't use file lists.
+-EXPAND_MKSHLIB_ARGS :=
+ endif
+ 
+ # Use the default OS X deployment target to enable using the libc++ headers
+ # correctly.  Note that the binary produced here is a host tool and doesn't need
+ # to be distributed.
+ MACOSX_DEPLOYMENT_TARGET :=
+ 
+ # Temporarily relax the requirements for libstdc++ symbol versions on static
+diff --git a/config/config.mk b/config/config.mk
+--- a/config/config.mk
++++ b/config/config.mk
+@@ -411,28 +411,16 @@ JAVAC_FLAGS += -source 1.4
+ 
+ ifdef MOZ_DEBUG
+ JAVAC_FLAGS += -g
+ endif
+ 
+ # MDDEPDIR is the subdirectory where dependency files are stored
+ MDDEPDIR := .deps
+ 
+-EXPAND_LIBS_EXEC = $(PYTHON) $(MOZILLA_DIR)/config/expandlibs_exec.py
+-EXPAND_LIBS_GEN = $(PYTHON) $(MOZILLA_DIR)/config/expandlibs_gen.py
+-EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
+-EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
+-EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
+-EXPAND_LINK = $(EXPAND_LIBS_EXEC) --uselist -- $(LINKER)
+-EXPAND_MKSHLIB_ARGS = --uselist
+-ifdef SYMBOL_ORDER
+-EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER)
+-endif
+-EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
+-
+ # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
+ # this file
+ OBJ_SUFFIX := $(_OBJ_SUFFIX)
+ 
+ # PGO builds with GCC build objects with instrumentation in a first pass,
+ # then objects optimized, without instrumentation, in a second pass. If
+ # we overwrite the objects from the first pass with those from the second,
+ # we end up not getting instrumentation data for better optimization on
+diff --git a/config/expandlibs.py b/config/expandlibs.py
+deleted file mode 100644
+--- a/config/expandlibs.py
++++ /dev/null
+@@ -1,143 +0,0 @@
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-
+-'''Expandlibs is a system that allows to replace some libraries with a
+-descriptor file containing some linking information about them.
+-
+-The descriptor file format is as follows:
+----8<-----
+-OBJS = a.o b.o ...
+-LIBS = libfoo.a libbar.a ...
+---->8-----
+-
+-(In the example above, OBJ_SUFFIX is o and LIB_SUFFIX is a).
+-
+-Expandlibs also canonicalizes how to pass libraries to the linker, such
+-that only the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} form needs to be used:
+-given a list of files, expandlibs will replace items with the form
+-${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} following these rules:
+-
+-- If a ${DLL_PREFIX}${ROOT}.${DLL_SUFFIX} or
+-  ${DLL_PREFIX}${ROOT}.${IMPORT_LIB_SUFFIX} file exists, use that instead
+-- If the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} file exists, use it
+-- If a ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX}.${LIB_DESC_SUFFIX} file exists,
+-  replace ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} with the OBJS and LIBS the
+-  descriptor contains. And for each of these LIBS, also apply the same
+-  rules.
+-'''
+-from __future__ import with_statement
+-import sys, os, errno
+-import expandlibs_config as conf
+-
+-def ensureParentDir(file):
+-    '''Ensures the directory parent to the given file exists'''
+-    dir = os.path.dirname(file)
+-    if dir and not os.path.exists(dir):
+-        try:
+-            os.makedirs(dir)
+-        except OSError, error:
+-            if error.errno != errno.EEXIST:
+-                raise
+-
+-def relativize(path):
+-    '''Returns a path relative to the current working directory, if it is
+-    shorter than the given path'''
+-    def splitpath(path):
+-        dir, file = os.path.split(path)
+-        if os.path.splitdrive(dir)[1] == os.sep:
+-            return [file]
+-        return splitpath(dir) + [file]
+-
+-    if not os.path.exists(path):
+-        return path
+-    curdir = splitpath(os.path.abspath(os.curdir))
+-    abspath = splitpath(os.path.abspath(path))
+-    while curdir and abspath and curdir[0] == abspath[0]:
+-        del curdir[0]
+-        del abspath[0]
+-    if not curdir and not abspath:
+-        return '.'
+-    relpath = os.path.join(*[os.pardir for i in curdir] + abspath)
+-    if len(path) > len(relpath):
+-        return relpath
+-    return path
+-
+-def isObject(path):
+-    '''Returns whether the given path points to an object file, that is,
+-    ends with OBJ_SUFFIX or .i_o'''
+-    return os.path.splitext(path)[1] in [conf.OBJ_SUFFIX, '.i_o']
+-
+-def isDynamicLib(path):
+-    '''Returns whether the given path points to a dynamic library, that is,
+-    ends with DLL_SUFFIX.'''
+-    # On mac, the xul library is named XUL, instead of libxul.dylib. Assume any
+-    # file by that name is a dynamic library.
+-    return os.path.splitext(path)[1] == conf.DLL_SUFFIX or os.path.basename(path) == 'XUL'
+-
+-class LibDescriptor(dict):
+-    KEYS = ['OBJS', 'LIBS']
+-
+-    def __init__(self, content=None):
+-        '''Creates an instance of a lib descriptor, initialized with contents
+-        from a list of strings when given. This is intended for use with
+-        file.readlines()'''
+-        if isinstance(content, list) and all([isinstance(item, str) for item in content]):
+-            pass
+-        elif content is not None:
+-            raise TypeError("LibDescriptor() arg 1 must be None or a list of strings")
+-        super(LibDescriptor, self).__init__()
+-        for key in self.KEYS:
+-            self[key] = []
+-        if not content:
+-            return
+-        for key, value in [(s.strip() for s in item.split('=', 2)) for item in content if item.find('=') >= 0]:
+-            if key in self.KEYS:
+-                self[key] = value.split()
+-
+-    def __str__(self):
+-        '''Serializes the lib descriptor'''
+-        return '\n'.join('%s = %s' % (k, ' '.join(self[k])) for k in self.KEYS if len(self[k]))
+-
+-class ExpandArgs(list):
+-    def __init__(self, args):
+-        '''Creates a clone of the |args| list and performs file expansion on
+-        each item it contains'''
+-        super(ExpandArgs, self).__init__()
+-        self._descs = set()
+-        for arg in args:
+-            self += self._expand(arg)
+-
+-    def _expand(self, arg):
+-        '''Internal function doing the actual work'''
+-        (root, ext) = os.path.splitext(arg)
+-        if ext != conf.LIB_SUFFIX or not os.path.basename(root).startswith(conf.LIB_PREFIX):
+-            return [relativize(arg)]
+-        if conf.LIB_PREFIX:
+-            dll = root.replace(conf.LIB_PREFIX, conf.DLL_PREFIX, 1) + conf.DLL_SUFFIX
+-        else:
+-            dll = root + conf.DLL_SUFFIX
+-        if os.path.exists(dll):
+-            if conf.IMPORT_LIB_SUFFIX:
+-                return [relativize(root + conf.IMPORT_LIB_SUFFIX)]
+-            else:
+-                return [relativize(dll)]
+-        return self._expand_desc(arg)
+-
+-    def _expand_desc(self, arg):
+-        '''Internal function taking care of lib descriptor expansion only'''
+-        desc = os.path.abspath(arg + conf.LIBS_DESC_SUFFIX)
+-        if os.path.exists(desc):
+-            if desc in self._descs:
+-                return []
+-            self._descs.add(desc)
+-            with open(desc, 'r') as f:
+-                desc = LibDescriptor(f.readlines())
+-            objs = [relativize(o) for o in desc['OBJS']]
+-            for lib in desc['LIBS']:
+-                objs += self._expand(lib)
+-            return objs
+-        return [relativize(arg)]
+-
+-if __name__ == '__main__':
+-    print " ".join(ExpandArgs(sys.argv[1:]))
+diff --git a/config/expandlibs_config.py b/config/expandlibs_config.py
+deleted file mode 100644
+--- a/config/expandlibs_config.py
++++ /dev/null
+@@ -1,29 +0,0 @@
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-
+-from buildconfig import substs
+-
+-def normalize_suffix(suffix):
+-    '''Returns a normalized suffix, i.e. ensures it starts with a dot and
+-    doesn't starts or ends with whitespace characters'''
+-    value = suffix.strip()
+-    if len(value) and not value.startswith('.'):
+-        value = '.' + value
+-    return value
+-
+-# Variables from the build system
+-AR = substs['AR']
+-AR_EXTRACT = substs['AR_EXTRACT'].replace('$(AR)', AR)
+-DLL_PREFIX = substs['DLL_PREFIX']
+-LIB_PREFIX = substs['LIB_PREFIX']
+-RUST_LIB_PREFIX = substs['RUST_LIB_PREFIX']
+-OBJ_SUFFIX = normalize_suffix(substs['OBJ_SUFFIX'])
+-LIB_SUFFIX = normalize_suffix(substs['LIB_SUFFIX'])
+-RUST_LIB_SUFFIX = normalize_suffix(substs['RUST_LIB_SUFFIX'])
+-DLL_SUFFIX = normalize_suffix(substs['DLL_SUFFIX'])
+-IMPORT_LIB_SUFFIX = normalize_suffix(substs['IMPORT_LIB_SUFFIX'])
+-LIBS_DESC_SUFFIX = normalize_suffix(substs['LIBS_DESC_SUFFIX'])
+-EXPAND_LIBS_LIST_STYLE = substs['EXPAND_LIBS_LIST_STYLE']
+-EXPAND_LIBS_ORDER_STYLE = substs['EXPAND_LIBS_ORDER_STYLE']
+-LD_PRINT_ICF_SECTIONS = substs['LD_PRINT_ICF_SECTIONS']
+diff --git a/config/expandlibs_exec.py b/config/expandlibs_exec.py
+deleted file mode 100644
+--- a/config/expandlibs_exec.py
++++ /dev/null
+@@ -1,354 +0,0 @@
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-
+-'''expandlibs-exec.py applies expandlibs rules, and some more (see below) to
+-a given command line, and executes that command line with the expanded
+-arguments.
+-
+-With the --extract argument (useful for e.g. $(AR)), it extracts object files
+-from static libraries (or use those listed in library descriptors directly).
+-
+-With the --uselist argument (useful for e.g. $(CC)), it replaces all object
+-files with a list file. This can be used to avoid limitations in the length
+-of a command line. The kind of list file format used depends on the
+-EXPAND_LIBS_LIST_STYLE variable: 'list' for MSVC style lists (@file.list)
+-or 'linkerscript' for GNU ld linker scripts.
+-See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
+-
+-With the --symbol-order argument, followed by a file name, it will add the
+-relevant linker options to change the order in which the linker puts the
+-symbols appear in the resulting binary. Only works for ELF targets.
+-'''
+-from __future__ import with_statement
+-import sys
+-import os
+-from expandlibs import (
+-    ExpandArgs,
+-    relativize,
+-    isDynamicLib,
+-    isObject,
+-)
+-import expandlibs_config as conf
+-from optparse import OptionParser
+-import subprocess
+-import tempfile
+-import shutil
+-import subprocess
+-import re
+-from mozbuild.makeutil import Makefile
+-
+-# The are the insert points for a GNU ld linker script, assuming a more
+-# or less "standard" default linker script. This is not a dict because
+-# order is important.
+-SECTION_INSERT_BEFORE = [
+-  ('.text', '.fini'),
+-  ('.rodata', '.rodata1'),
+-  ('.data.rel.ro', '.dynamic'),
+-  ('.data', '.data1'),
+-]
+-
+-class ExpandArgsMore(ExpandArgs):
+-    ''' Meant to be used as 'with ExpandArgsMore(args) as ...: '''
+-    def __enter__(self):
+-        self.tmp = []
+-        return self
+-        
+-    def __exit__(self, type, value, tb):
+-        '''Automatically remove temporary files'''
+-        for tmp in self.tmp:
+-            if os.path.isdir(tmp):
+-                shutil.rmtree(tmp, True)
+-            else:
+-                os.remove(tmp)
+-
+-    def extract(self):
+-        self[0:] = self._extract(self)
+-
+-    def _extract(self, args):
+-        '''When a static library name is found, either extract its contents
+-        in a temporary directory or use the information found in the
+-        corresponding lib descriptor.
+-        '''
+-        ar_extract = conf.AR_EXTRACT.split()
+-        newlist = []
+-
+-        def lookup(base, f):
+-            for root, dirs, files in os.walk(base):
+-                if f in files:
+-                    return os.path.join(root, f)
+-
+-        for arg in args:
+-            if os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
+-                if os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
+-                    newlist += self._extract(self._expand_desc(arg))
+-                    continue
+-                elif os.path.exists(arg) and (len(ar_extract) or conf.AR == 'lib'):
+-                    tmp = tempfile.mkdtemp(dir=os.curdir)
+-                    self.tmp.append(tmp)
+-                    if conf.AR == 'lib':
+-                        out = subprocess.check_output([conf.AR, '-NOLOGO', '-LIST', arg])
+-                        files = out.splitlines()
+-                        # If lib -list returns a list full of dlls, it's an
+-                        # import lib.
+-                        if all(isDynamicLib(f) for f in files):
+-                            newlist += [arg]
+-                            continue
+-                        for f in files:
+-                            subprocess.call([conf.AR, '-NOLOGO', '-EXTRACT:%s' % f, os.path.abspath(arg)], cwd=tmp)
+-                    else:
+-                        subprocess.call(ar_extract + [os.path.abspath(arg)], cwd=tmp)
+-                    objs = []
+-                    basedir = os.path.dirname(arg)
+-                    for root, dirs, files in os.walk(tmp):
+-                        for f in files:
+-                            if isObject(f):
+-                                # If the file extracted from the library also
+-                                # exists in the directory containing the
+-                                # library, or one of its subdirectories, use
+-                                # that instead.
+-                                maybe_obj = lookup(os.path.join(basedir, os.path.relpath(root, tmp)), f)
+-                                if maybe_obj:
+-                                    objs.append(relativize(maybe_obj))
+-                                else:
+-                                    objs.append(relativize(os.path.join(root, f)))
+-                    newlist += sorted(objs)
+-                    continue
+-            newlist += [arg]
+-        return newlist
+-
+-    def makelist(self):
+-        '''Replaces object file names with a temporary list file, using a
+-        list format depending on the EXPAND_LIBS_LIST_STYLE variable
+-        '''
+-        objs = [o for o in self if isObject(o)]
+-        if not len(objs): return
+-        fd, tmp = tempfile.mkstemp(suffix=".list",dir=os.curdir)
+-        if conf.EXPAND_LIBS_LIST_STYLE == "linkerscript":
+-            content = ['INPUT("%s")\n' % obj for obj in objs]
+-            ref = tmp
+-        elif conf.EXPAND_LIBS_LIST_STYLE == "filelist":
+-            content = ["%s\n" % obj for obj in objs]
+-            ref = "-Wl,-filelist," + tmp
+-        elif conf.EXPAND_LIBS_LIST_STYLE == "list":
+-            content = ["%s\n" % obj for obj in objs]
+-            ref = "@" + tmp
+-        else:
+-            os.close(fd)
+-            os.remove(tmp)
+-            return
+-        self.tmp.append(tmp)
+-        f = os.fdopen(fd, "w")
+-        f.writelines(content)
+-        f.close()
+-        idx = self.index(objs[0])
+-        newlist = self[0:idx] + [ref] + [os.path.normpath(item) for item in self[idx:] if item not in objs]
+-        self[0:] = newlist
+-
+-    def _getFoldedSections(self):
+-        '''Returns a dict about folded sections.
+-        When section A and B are folded into section C, the dict contains:
+-        { 'A': 'C',
+-          'B': 'C',
+-          'C': ['A', 'B'] }'''
+-        if not conf.LD_PRINT_ICF_SECTIONS:
+-            return {}
+-
+-        proc = subprocess.Popen(self + [conf.LD_PRINT_ICF_SECTIONS], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
+-        (stdout, stderr) = proc.communicate()
+-        result = {}
+-        # gold's --print-icf-sections output looks like the following:
+-        # ld: ICF folding section '.section' in file 'file.o'into '.section' in file 'file.o'
+-        # In terms of words, chances are this will change in the future,
+-        # especially considering "into" is misplaced. Splitting on quotes
+-        # seems safer.
+-        for l in stderr.split('\n'):
+-            quoted = l.split("'")
+-            if len(quoted) > 5 and quoted[1] != quoted[5]:
+-                result[quoted[1]] = [quoted[5]]
+-                if quoted[5] in result:
+-                    result[quoted[5]].append(quoted[1])
+-                else:
+-                    result[quoted[5]] = [quoted[1]]
+-        return result
+-
+-    def _getOrderedSections(self, ordered_symbols):
+-        '''Given an ordered list of symbols, returns the corresponding list
+-        of sections following the order.'''
+-        if not conf.EXPAND_LIBS_ORDER_STYLE in ['linkerscript', 'section-ordering-file']:
+-            raise Exception('EXPAND_LIBS_ORDER_STYLE "%s" is not supported' % conf.EXPAND_LIBS_ORDER_STYLE)
+-        finder = SectionFinder([arg for arg in self if isObject(arg) or os.path.splitext(arg)[1] == conf.LIB_SUFFIX])
+-        folded = self._getFoldedSections()
+-        sections = set()
+-        ordered_sections = []
+-        for symbol in ordered_symbols:
+-            symbol_sections = finder.getSections(symbol)
+-            all_symbol_sections = []
+-            for section in symbol_sections:
+-                if section in folded:
+-                    if isinstance(folded[section], str):
+-                        section = folded[section]
+-                    all_symbol_sections.append(section)
+-                    all_symbol_sections.extend(folded[section])
+-                else:
+-                    all_symbol_sections.append(section)
+-            for section in all_symbol_sections:
+-                if not section in sections:
+-                    ordered_sections.append(section)
+-                    sections.add(section)
+-        return ordered_sections
+-
+-    def orderSymbols(self, order):
+-        '''Given a file containing a list of symbols, adds the appropriate
+-        argument to make the linker put the symbols in that order.'''
+-        with open(order) as file:
+-            sections = self._getOrderedSections([l.strip() for l in file.readlines() if l.strip()])
+-        split_sections = {}
+-        linked_sections = [s[0] for s in SECTION_INSERT_BEFORE]
+-        for s in sections:
+-            for linked_section in linked_sections:
+-                if s.startswith(linked_section):
+-                    if linked_section in split_sections:
+-                        split_sections[linked_section].append(s)
+-                    else:
+-                        split_sections[linked_section] = [s]
+-                    break
+-        content = []
+-        # Order is important
+-        linked_sections = [s for s in linked_sections if s in split_sections]
+-
+-        if conf.EXPAND_LIBS_ORDER_STYLE == 'section-ordering-file':
+-            option = '-Wl,--section-ordering-file,%s'
+-            content = sections
+-            for linked_section in linked_sections:
+-                content.extend(split_sections[linked_section])
+-                content.append('%s.*' % linked_section)
+-                content.append(linked_section)
+-
+-        elif conf.EXPAND_LIBS_ORDER_STYLE == 'linkerscript':
+-            option = '-Wl,-T,%s'
+-            section_insert_before = dict(SECTION_INSERT_BEFORE)
+-            for linked_section in linked_sections:
+-                content.append('SECTIONS {')
+-                content.append('  %s : {' % linked_section)
+-                content.extend('    *(%s)' % s for s in split_sections[linked_section])
+-                content.append('  }')
+-                content.append('}')
+-                content.append('INSERT BEFORE %s' % section_insert_before[linked_section])
+-        else:
+-            raise Exception('EXPAND_LIBS_ORDER_STYLE "%s" is not supported' % conf.EXPAND_LIBS_ORDER_STYLE)
+-
+-        fd, tmp = tempfile.mkstemp(dir=os.curdir)
+-        f = os.fdopen(fd, "w")
+-        f.write('\n'.join(content)+'\n')
+-        f.close()
+-        self.tmp.append(tmp)
+-        self.append(option % tmp)
+-
+-class SectionFinder(object):
+-    '''Instances of this class allow to map symbol names to sections in
+-    object files.'''
+-
+-    def __init__(self, objs):
+-        '''Creates an instance, given a list of object files.'''
+-        if not conf.EXPAND_LIBS_ORDER_STYLE in ['linkerscript', 'section-ordering-file']:
+-            raise Exception('EXPAND_LIBS_ORDER_STYLE "%s" is not supported' % conf.EXPAND_LIBS_ORDER_STYLE)
+-        self.mapping = {}
+-        for obj in objs:
+-            if not isObject(obj) and os.path.splitext(obj)[1] != conf.LIB_SUFFIX:
+-                raise Exception('%s is not an object nor a static library' % obj)
+-            for symbol, section in SectionFinder._getSymbols(obj):
+-                sym = SectionFinder._normalize(symbol)
+-                if sym in self.mapping:
+-                    if not section in self.mapping[sym]:
+-                        self.mapping[sym].append(section)
+-                else:
+-                    self.mapping[sym] = [section]
+-
+-    def getSections(self, symbol):
+-        '''Given a symbol, returns a list of sections containing it or the
+-        corresponding thunks. When the given symbol is a thunk, returns the
+-        list of sections containing its corresponding normal symbol and the
+-        other thunks for that symbol.'''
+-        sym = SectionFinder._normalize(symbol)
+-        if sym in self.mapping:
+-            return self.mapping[sym]
+-        return []
+-
+-    @staticmethod
+-    def _normalize(symbol):
+-        '''For normal symbols, return the given symbol. For thunks, return
+-        the corresponding normal symbol.'''
+-        if re.match('^_ZThn[0-9]+_', symbol):
+-            return re.sub('^_ZThn[0-9]+_', '_Z', symbol)
+-        return symbol
+-
+-    @staticmethod
+-    def _getSymbols(obj):
+-        '''Returns a list of (symbol, section) contained in the given object
+-        file.'''
+-        proc = subprocess.Popen(['objdump', '-t', obj], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
+-        (stdout, stderr) = proc.communicate()
+-        syms = []
+-        for line in stdout.splitlines():
+-            # Each line has the following format:
+-            # <addr> [lgu!][w ][C ][W ][Ii ][dD ][FfO ] <section>\t<length> <symbol>
+-            tmp = line.split(' ',1)
+-            # This gives us ["<addr>", "[lgu!][w ][C ][W ][Ii ][dD ][FfO ] <section>\t<length> <symbol>"]
+-            # We only need to consider cases where "<section>\t<length> <symbol>" is present,
+-            # and where the [FfO] flag is either F (function) or O (object).
+-            if len(tmp) > 1 and len(tmp[1]) > 6 and tmp[1][6] in ['O', 'F']:
+-                tmp = tmp[1][8:].split()
+-                # That gives us ["<section>","<length>", "<symbol>"]
+-                syms.append((tmp[-1], tmp[0]))
+-        return syms
+-
+-def print_command(out, args):
+-    print >>out, "Executing: " + " ".join(args)
+-    for tmp in [f for f in args.tmp if os.path.isfile(f)]:
+-        print >>out, tmp + ":"
+-        with open(tmp) as file:
+-            print >>out, "".join(["    " + l for l in file.readlines()])
+-    out.flush()
+-
+-def main(args, proc_callback=None):
+-    parser = OptionParser()
+-    parser.add_option("--extract", action="store_true", dest="extract",
+-        help="when a library has no descriptor file, extract it first, when possible")
+-    parser.add_option("--uselist", action="store_true", dest="uselist",
+-        help="use a list file for objects when executing a command")
+-    parser.add_option("--verbose", action="store_true", dest="verbose",
+-        help="display executed command and temporary files content")
+-    parser.add_option("--symbol-order", dest="symbol_order", metavar="FILE",
+-        help="use the given list of symbols to order symbols in the resulting binary when using with a linker")
+-
+-    (options, args) = parser.parse_args(args)
+-
+-    with ExpandArgsMore(args) as args:
+-        if options.extract:
+-            args.extract()
+-        if options.symbol_order:
+-            args.orderSymbols(options.symbol_order)
+-        if options.uselist:
+-            args.makelist()
+-
+-        if options.verbose:
+-            print_command(sys.stderr, args)
+-        try:
+-            proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
+-            if proc_callback:
+-                proc_callback(proc)
+-        except Exception, e:
+-            print >>sys.stderr, 'error: Launching', args, ':', e
+-            raise e
+-        (stdout, stderr) = proc.communicate()
+-        if proc.returncode and not options.verbose:
+-            print_command(sys.stderr, args)
+-        sys.stderr.write(stdout)
+-        sys.stderr.flush()
+-        if proc.returncode:
+-            return proc.returncode
+-        return 0
+-
+-if __name__ == '__main__':
+-    exit(main(sys.argv[1:]))
+diff --git a/config/expandlibs_gen.py b/config/expandlibs_gen.py
+deleted file mode 100644
+--- a/config/expandlibs_gen.py
++++ /dev/null
+@@ -1,41 +0,0 @@
+-# This Source Code Form is subject to the terms of the Mozilla Public
+-# License, v. 2.0. If a copy of the MPL was not distributed with this
+-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+-
+-'''Given a list of object files and library names, prints a library
+-descriptor to standard output'''
+-
+-from __future__ import with_statement
+-import sys
+-import os
+-import expandlibs_config as conf
+-from expandlibs import LibDescriptor, isObject, ensureParentDir
+-from optparse import OptionParser
+-
+-def generate(args):
+-    desc = LibDescriptor()
+-    for arg in args:
+-        if isObject(arg):
+-            if os.path.exists(arg):
+-                desc['OBJS'].append(os.path.abspath(arg))
+-            else:
+-                raise Exception("File not found: %s" % arg)
+-        elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
+-            if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
+-                desc['LIBS'].append(os.path.abspath(arg))
+-            else:
+-                raise Exception("File not found: %s" % arg)
+-    return desc
+-
+-if __name__ == '__main__':
+-    parser = OptionParser()
+-    parser.add_option("-o", dest="output", metavar="FILE",
+-        help="send output to the given file")
+-
+-    (options, args) = parser.parse_args()
+-    if not options.output:
+-        raise Exception("Missing option: -o")
+-
+-    ensureParentDir(options.output)
+-    with open(options.output, 'w') as outfile:
+-        print >>outfile, generate(args)
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -96,19 +96,18 @@ endif # ENABLE_TESTS
+ #
+ # If FORCE_STATIC_LIB is set, build a static library.
+ # Otherwise, build a shared library.
+ #
+ 
+ ifndef LIBRARY
+ ifdef REAL_LIBRARY
+ ifdef NO_EXPAND_LIBS
++# Only build actual library if it is requested.
+ LIBRARY			:= $(REAL_LIBRARY)
+-else
+-LIBRARY			:= $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
+ endif
+ endif
+ endif
+ 
+ ifndef HOST_LIBRARY
+ ifdef HOST_LIBRARY_NAME
+ HOST_LIBRARY		:= $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
+ endif
+@@ -434,32 +433,35 @@ ECHO := true
+ QUIET := -q
+ endif
+ 
+ # Do everything from scratch
+ everything::
+ 	$(MAKE) clean
+ 	$(MAKE) all
+ 
+-STATIC_LIB_DEP = $(if $(wildcard $(1).$(LIBS_DESC_SUFFIX)),$(1).$(LIBS_DESC_SUFFIX),$(1))
+-STATIC_LIBS_DEPS := $(foreach l,$(STATIC_LIBS),$(call STATIC_LIB_DEP,$(l)))
+-
+ # Dependencies which, if modified, should cause everything to rebuild
+ GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(MOZILLA_DIR)/config/config.mk
+ 
+ ##############################################
+ ifdef COMPILE_ENVIRONMENT
+ OBJ_TARGETS = $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS)
+ 
+ compile:: host target
+ 
+ host:: $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_RUST_PROGRAMS) $(HOST_RUST_LIBRARY_FILE)
+ 
+ target:: $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(RUST_LIBRARY_FILE) $(RUST_PROGRAMS)
+ 
++ifndef LIBRARY
++ifdef OBJS
++target:: $(OBJS)
++endif
++endif
++
+ syms::
+ 
+ include $(MOZILLA_DIR)/config/makefiles/target_binaries.mk
+ endif
+ 
+ ##############################################
+ ifneq (1,$(NO_PROFILE_GUIDED_OPTIMIZE))
+ ifdef MOZ_PROFILE_USE
+@@ -533,35 +535,35 @@ distclean::
+ 	$(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
+ 	$(wildcard *.$(IMPORT_LIB_SUFFIX))
+ 
+ alltags:
+ 	$(RM) TAGS
+ 	find $(topsrcdir) -name dist -prune -o \( -name '*.[hc]' -o -name '*.cp' -o -name '*.cpp' -o -name '*.idl' \) -print | $(TAG_PROGRAM)
+ 
+ define EXPAND_CC_OR_CXX
+-$(if $(PROG_IS_C_ONLY_$(1)),$(EXPAND_CC),$(EXPAND_CCC))
++$(if $(PROG_IS_C_ONLY_$(1)),$(CC),$(CCC))
+ endef
+ 
+ # Workaround a bug of MSVC 2017 Update 8 (see bug 1485224)
+ ifeq ($(CC_TYPE)_$(HOST_OS_ARCH)_$(MOZ_PROFILE_GENERATE),msvc_WINNT_1)
+ LINKER_OUT=$(subst /,\,$1)
+ else
+ LINKER_OUT=$1
+ endif
+ 
+ #
+ # PROGRAM = Foo
+ # creates OBJS, links with LIBS to create Foo
+ #
+-$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(RESFILE) $(GLOBAL_DEPS)
++$(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(RESFILE) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ 	@$(RM) $@.manifest
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+-	$(EXPAND_LINK) -NOLOGO -OUT:$(call LINKER_OUT,$@) -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(PROGOBJS) $(RESFILE) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
++	$(LINKER) -NOLOGO -OUT:$(call LINKER_OUT,$@) -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		else \
+ 			echo 'Embedding manifest from $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+@@ -572,140 +574,133 @@ ifdef MSMANIFEST_TOOL
+ 	fi
+ endif	# MSVC with manifest tool
+ ifdef MOZ_PROFILE_GENERATE
+ # touch it a few seconds into the future to work around FAT's
+ # 2-second granularity
+ 	touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
+ endif
+ else # !WINNT || GNU_CC
+-	$(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
++	$(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
+ 	$(call py_action,check_binary,--target $@)
+ endif # WINNT && !GNU_CC
+ 
+ ifdef ENABLE_STRIP
+ 	$(STRIP) $(STRIP_FLAGS) $@
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+ $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
+-	$(EXPAND_LIBS_EXEC) -- $(LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		else \
+ 			echo 'Embedding manifest from $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		fi; \
+ 	elif test -f '$(srcdir)/$@.manifest'; then \
+ 		echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
+ 		$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
+ 	fi
+ endif	# MSVC with manifest tool
+ else
+ ifeq ($(HOST_CPP_PROG_LINK),1)
+-	$(EXPAND_LIBS_EXEC) -- $(HOST_CXX) -o $@ $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CXX) -o $@ $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+-	$(EXPAND_LIBS_EXEC) -- $(HOST_CC) -o $@ $(HOST_C_LDFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CC) -o $@ $(HOST_C_LDFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif # HOST_CPP_PROG_LINK
+ endif
+ ifndef CROSS_COMPILE
+ 	$(call py_action,check_binary,--host $@)
+ endif
+ 
+ #
+ # This is an attempt to support generation of multiple binaries
+ # in one directory, it assumes everything to compile Foo is in
+ # Foo.o (from either Foo.c or Foo.cpp).
+ #
+ # SIMPLE_PROGRAMS = Foo Bar
+ # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
+ #
+-$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
++$(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+-	$(EXPAND_LINK) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
++	$(LINKER) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $($@_OBJS) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		rm -f $@.manifest; \
+ 	fi
+ endif	# MSVC with manifest tool
+ else
+-	$(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
++	$(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) -o $@ $($@_OBJS) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
+ 	$(call py_action,check_binary,--target $@)
+ endif # WINNT && !GNU_CC
+ 
+ ifdef ENABLE_STRIP
+ 	$(STRIP) $(STRIP_FLAGS) $@
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+ $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
+-	$(EXPAND_LIBS_EXEC) -- $(LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
+-	$(EXPAND_LIBS_EXEC) -- $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+-	$(EXPAND_LIBS_EXEC) -- $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+ endif
+ ifndef CROSS_COMPILE
+ 	$(call py_action,check_binary,--host $@)
+ endif
+ 
+-$(filter %.$(LIB_SUFFIX),$(LIBRARY)): $(OBJS) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
++$(LIBRARY): $(OBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+-# Always remove both library and library descriptor
+-	$(RM) $(REAL_LIBRARY) $(REAL_LIBRARY).$(LIBS_DESC_SUFFIX)
+-	$(EXPAND_AR) $(AR_FLAGS) $(OBJS) $(STATIC_LIBS)
+-
+-$(filter-out %.$(LIB_SUFFIX),$(LIBRARY)): $(filter %.$(LIB_SUFFIX),$(LIBRARY)) $(OBJS) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+-# When we only build a library descriptor, blow out any existing library
+-	$(REPORT_BUILD)
+-	$(if $(filter %.$(LIB_SUFFIX),$(LIBRARY)),,$(RM) $(REAL_LIBRARY))
+-	$(EXPAND_LIBS_GEN) -o $@ $(OBJS) $(STATIC_LIBS)
++	$(RM) $(REAL_LIBRARY)
++	$(AR) $(AR_FLAGS) $(OBJS) $($@_OBJS)
+ 
+ ifeq ($(OS_ARCH),WINNT)
+ # Import libraries are created by the rules creating shared libraries.
+ # The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
+ # but make will happily consider the import library before it is refreshed
+ # when rebuilding the corresponding shared library. Defining an empty recipe
+ # for import libraries forces make to wait for the shared library recipe to
+ # have run before considering other targets that depend on the import library.
+ # See bug 795204.
+ $(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
+ endif
+ 
+ $(HOST_LIBRARY): $(HOST_OBJS) Makefile
+ 	$(REPORT_BUILD)
+ 	$(RM) $@
+-	$(EXPAND_LIBS_EXEC) --extract -- $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
++	$(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
+ 
+ # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
+ # so instead of deleting .o files after repacking them into a dylib, we make
+ # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
+ # so no need to conditionalize on OS version or debugging format.
+ 
+-$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(STATIC_LIBS_DEPS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
++$(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifndef INCREMENTAL_LINKER
+ 	$(RM) $@
+ endif
+-	$(EXPAND_MKSHLIB) $(OBJS) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS)
++	$(MKSHLIB) $($@_OBJS) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS)
+ 	$(call py_action,check_binary,--target $@)
+ 
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ ifdef MSMANIFEST_TOOL
+ ifdef EMBED_MANIFEST_AT
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+diff --git a/config/tests/python.ini b/config/tests/python.ini
+--- a/config/tests/python.ini
++++ b/config/tests/python.ini
+@@ -1,5 +1,4 @@
+ [test_mozbuild_reading.py]
+-[unit-expandlibs.py]
+ [unit-mozunit.py]
+ [unit-nsinstall.py]
+ [unit-printprereleasesuffix.py]
+diff --git a/config/tests/unit-expandlibs.py b/config/tests/unit-expandlibs.py
+deleted file mode 100644
+--- a/config/tests/unit-expandlibs.py
++++ /dev/null
+@@ -1,431 +0,0 @@
+-import subprocess
+-import unittest
+-import sys
+-import os
+-import imp
+-from tempfile import mkdtemp
+-from shutil import rmtree
+-import mozunit
+-
+-from UserString import UserString
+-# Create a controlled configuration for use by expandlibs
+-config_win = {
+-    'AR': 'lib',
+-    'AR_EXTRACT': '',
+-    'DLL_PREFIX': '',
+-    'LIB_PREFIX': '',
+-    'OBJ_SUFFIX': '.obj',
+-    'LIB_SUFFIX': '.lib',
+-    'DLL_SUFFIX': '.dll',
+-    'IMPORT_LIB_SUFFIX': '.lib',
+-    'LIBS_DESC_SUFFIX': '.desc',
+-    'EXPAND_LIBS_LIST_STYLE': 'list',
+-}
+-config_unix = {
+-    'AR': 'ar',
+-    'AR_EXTRACT': 'ar -x',
+-    'DLL_PREFIX': 'lib',
+-    'LIB_PREFIX': 'lib',
+-    'OBJ_SUFFIX': '.o',
+-    'LIB_SUFFIX': '.a',
+-    'DLL_SUFFIX': '.so',
+-    'IMPORT_LIB_SUFFIX': '',
+-    'LIBS_DESC_SUFFIX': '.desc',
+-    'EXPAND_LIBS_LIST_STYLE': 'linkerscript',
+-}
+-
+-config = sys.modules['expandlibs_config'] = imp.new_module('expandlibs_config')
+-
+-from expandlibs import LibDescriptor, ExpandArgs, relativize
+-from expandlibs_gen import generate
+-from expandlibs_exec import ExpandArgsMore, SectionFinder
+-
+-def Lib(name):
+-    return config.LIB_PREFIX + name + config.LIB_SUFFIX
+-
+-def Obj(name):
+-    return name + config.OBJ_SUFFIX
+-
+-def Dll(name):
+-    return config.DLL_PREFIX + name + config.DLL_SUFFIX
+-
+-def ImportLib(name):
+-    if not len(config.IMPORT_LIB_SUFFIX): return Dll(name)
+-    return config.LIB_PREFIX + name + config.IMPORT_LIB_SUFFIX
+-
+-class TestRelativize(unittest.TestCase):
+-    def test_relativize(self):
+-        '''Test relativize()'''
+-        os_path_exists = os.path.exists
+-        def exists(path):
+-            return True
+-        os.path.exists = exists
+-        self.assertEqual(relativize(os.path.abspath(os.curdir)), os.curdir)
+-        self.assertEqual(relativize(os.path.abspath(os.pardir)), os.pardir)
+-        self.assertEqual(relativize(os.path.join(os.curdir, 'a')), 'a')
+-        self.assertEqual(relativize(os.path.join(os.path.abspath(os.curdir), 'a')), 'a')
+-        # relativize is expected to return the absolute path if it is shorter
+-        self.assertEqual(relativize(os.sep), os.sep)
+-        os.path.exists = os.path.exists
+-
+-class TestLibDescriptor(unittest.TestCase):
+-    def test_serialize(self):
+-        '''Test LibDescriptor's serialization'''
+-        desc = LibDescriptor()
+-        desc[LibDescriptor.KEYS[0]] = ['a', 'b']
+-        self.assertEqual(str(desc), "{0} = a b".format(LibDescriptor.KEYS[0]))
+-        desc['unsupported-key'] = ['a']
+-        self.assertEqual(str(desc), "{0} = a b".format(LibDescriptor.KEYS[0]))
+-        desc[LibDescriptor.KEYS[1]] = ['c', 'd', 'e']
+-        self.assertEqual(str(desc),
+-                         "{0} = a b\n{1} = c d e"
+-                         .format(LibDescriptor.KEYS[0], LibDescriptor.KEYS[1]))
+-        desc[LibDescriptor.KEYS[0]] = []
+-        self.assertEqual(str(desc), "{0} = c d e".format(LibDescriptor.KEYS[1]))
+-
+-    def test_read(self):
+-        '''Test LibDescriptor's initialization'''
+-        desc_list = ["# Comment",
+-                     "{0} = a b".format(LibDescriptor.KEYS[1]),
+-                     "", # Empty line
+-                     "foo = bar", # Should be discarded
+-                     "{0} = c d e".format(LibDescriptor.KEYS[0])]
+-        desc = LibDescriptor(desc_list)
+-        self.assertEqual(desc[LibDescriptor.KEYS[1]], ['a', 'b'])
+-        self.assertEqual(desc[LibDescriptor.KEYS[0]], ['c', 'd', 'e'])
+-        self.assertEqual(False, 'foo' in desc)
+-
+-def wrap_method(conf, wrapped_method):
+-    '''Wrapper used to call a test with a specific configuration'''
+-    def _method(self):
+-        for key in conf:
+-            setattr(config, key, conf[key])
+-        self.init()
+-        try:
+-            wrapped_method(self)
+-        except:
+-            raise
+-        finally:
+-            self.cleanup()
+-    return _method
+-
+-class ReplicateTests(type):
+-    '''Replicates tests for unix and windows variants'''
+-    def __new__(cls, clsName, bases, dict):
+-        for name in [key for key in dict if key.startswith('test_')]:
+-            dict[name + '_unix'] = wrap_method(config_unix, dict[name])
+-            dict[name + '_unix'].__doc__ = dict[name].__doc__ + ' (unix)'
+-            dict[name + '_win'] = wrap_method(config_win, dict[name])
+-            dict[name + '_win'].__doc__ = dict[name].__doc__ + ' (win)'
+-            del dict[name]
+-        return type.__new__(cls, clsName, bases, dict)
+-
+-class TestCaseWithTmpDir(unittest.TestCase):
+-    __metaclass__ = ReplicateTests
+-    def init(self):
+-        self.tmpdir = os.path.abspath(mkdtemp(dir=os.curdir))
+-
+-    def cleanup(self):
+-        rmtree(self.tmpdir)
+-
+-    def touch(self, files):
+-        for f in files:
+-            open(f, 'w').close()
+-
+-    def tmpfile(self, *args):
+-        return os.path.join(self.tmpdir, *args)
+-
+-class TestExpandLibsGen(TestCaseWithTmpDir):
+-    def test_generate(self):
+-        '''Test library descriptor generation'''
+-        files = [self.tmpfile(f) for f in
+-                 [Lib('a'), Obj('b'), Lib('c'), Obj('d'), Obj('e'), Lib('f')]]
+-        self.touch(files[:-1])
+-        self.touch([files[-1] + config.LIBS_DESC_SUFFIX])
+-
+-        desc = generate(files)
+-        self.assertEqual(desc['OBJS'], [self.tmpfile(Obj(s)) for s in ['b', 'd', 'e']])
+-        self.assertEqual(desc['LIBS'], [self.tmpfile(Lib(s)) for s in ['a', 'c', 'f']])
+-
+-        self.assertRaises(Exception, generate, files + [self.tmpfile(Obj('z'))])
+-        self.assertRaises(Exception, generate, files + [self.tmpfile(Lib('y'))])
+-
+-class TestExpandInit(TestCaseWithTmpDir):
+-    def init(self):
+-        ''' Initializes test environment for library expansion tests'''
+-        super(TestExpandInit, self).init()
+-        # Create 2 fake libraries, each containing 3 objects, and the second
+-        # including the first one and another library.
+-        os.mkdir(self.tmpfile('libx'))
+-        os.mkdir(self.tmpfile('liby'))
+-        self.libx_files = [self.tmpfile('libx', Obj(f)) for f in ['g', 'h', 'i']]
+-        self.liby_files = [self.tmpfile('liby', Obj(f)) for f in ['j', 'k', 'l']] + [self.tmpfile('liby', Lib('z'))]
+-        self.touch(self.libx_files + self.liby_files)
+-        with open(self.tmpfile('libx', Lib('x') + config.LIBS_DESC_SUFFIX), 'w') as f:
+-            f.write(str(generate(self.libx_files)))
+-        with open(self.tmpfile('liby', Lib('y') + config.LIBS_DESC_SUFFIX), 'w') as f:
+-            f.write(str(generate(self.liby_files + [self.tmpfile('libx', Lib('x'))])))
+-
+-        # Create various objects and libraries 
+-        self.arg_files = [self.tmpfile(f) for f in [Lib('a'), Obj('b'), Obj('c'), Lib('d'), Obj('e')]]
+-        # We always give library names (LIB_PREFIX/SUFFIX), even for
+-        # dynamic/import libraries
+-        self.files = self.arg_files + [self.tmpfile(ImportLib('f'))]
+-        self.arg_files += [self.tmpfile(Lib('f'))]
+-        self.touch(self.files)
+-
+-    def assertRelEqual(self, args1, args2):
+-        self.assertEqual(args1, [relativize(a) for a in args2])
+-
+-class TestExpandArgs(TestExpandInit):
+-    def test_expand(self):
+-        '''Test library expansion'''
+-        # Expanding arguments means libraries with a descriptor are expanded
+-        # with the descriptor content, and import libraries are used when
+-        # a library doesn't exist
+-        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
+-        self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files) 
+-
+-        # When a library exists at the same time as a descriptor, we still use
+-        # the descriptor.
+-        self.touch([self.tmpfile('libx', Lib('x'))])
+-        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
+-        self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
+-
+-        self.touch([self.tmpfile('liby', Lib('y'))])
+-        args = ExpandArgs(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))])
+-        self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)
+-
+-class TestExpandArgsMore(TestExpandInit):
+-    def test_makelist(self):
+-        '''Test grouping object files in lists'''
+-        # ExpandArgsMore does the same as ExpandArgs
+-        with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
+-            self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files) 
+-
+-            # But also has an extra method replacing object files with a list
+-            args.makelist()
+-            # self.files has objects at #1, #2, #4
+-            self.assertRelEqual(args[:3], ['foo', '-bar'] + self.files[:1])
+-            self.assertRelEqual(args[4:], [self.files[3]] + self.files[5:] + [self.tmpfile('liby', Lib('z'))])
+-
+-            # Check the list file content
+-            objs = [f for f in self.files + self.liby_files + self.libx_files if f.endswith(config.OBJ_SUFFIX)]
+-            if config.EXPAND_LIBS_LIST_STYLE == "linkerscript":
+-                self.assertNotEqual(args[3][0], '@')
+-                filename = args[3]
+-                content = ['INPUT("{0}")'.format(relativize(f)) for f in objs]
+-                with open(filename, 'r') as f:
+-                    self.assertEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
+-            elif config.EXPAND_LIBS_LIST_STYLE == "list":
+-                self.assertEqual(args[3][0], '@')
+-                filename = args[3][1:]
+-                content = objs
+-                with open(filename, 'r') as f:
+-                    self.assertRelEqual([l.strip() for l in f.readlines() if len(l.strip())], content)
+-
+-            tmp = args.tmp
+-        # Check that all temporary files are properly removed
+-        self.assertEqual(True, all([not os.path.exists(f) for f in tmp]))
+-
+-    def test_extract(self):
+-        '''Test library extraction'''
+-        # Divert subprocess.call
+-        subprocess_call = subprocess.call
+-        subprocess_check_output = subprocess.check_output
+-        def call(args, **kargs):
+-            if config.AR == 'lib':
+-                self.assertEqual(args[:2], [config.AR, '-NOLOGO'])
+-                self.assertTrue(args[2].startswith('-EXTRACT:'))
+-                extract = [args[2][len('-EXTRACT:'):]]
+-                self.assertTrue(extract)
+-                args = args[3:]
+-            else:
+-                # The command called is always AR_EXTRACT
+-                ar_extract = config.AR_EXTRACT.split()
+-                self.assertEqual(args[:len(ar_extract)], ar_extract)
+-                args = args[len(ar_extract):]
+-            # Remaining argument is always one library
+-            self.assertEqual(len(args), 1)
+-            arg = args[0]
+-            self.assertEqual(os.path.splitext(arg)[1], config.LIB_SUFFIX)
+-            # Simulate file extraction
+-            lib = os.path.splitext(os.path.basename(arg))[0]
+-            if config.AR != 'lib':
+-                extract = [lib, lib + '2']
+-            extract = [os.path.join(kargs['cwd'], f) for f in extract]
+-            if config.AR != 'lib':
+-                extract = [Obj(f) for f in extract]
+-            if not lib in extracted:
+-                extracted[lib] = []
+-            extracted[lib].extend(extract)
+-            self.touch(extract)
+-        subprocess.call = call
+-
+-        def check_output(args, **kargs):
+-            # The command called is always AR
+-            ar = config.AR
+-            self.assertEqual(args[0:3], [ar, '-NOLOGO', '-LIST'])
+-            # Remaining argument is always one library
+-            self.assertRelEqual([os.path.splitext(arg)[1] for arg in args[3:]],
+-[config.LIB_SUFFIX])
+-            # Simulate LIB -NOLOGO -LIST
+-            lib = os.path.splitext(os.path.basename(args[3]))[0]
+-            return '%s\n%s\n' % (Obj(lib), Obj(lib + '2'))
+-        subprocess.check_output = check_output
+-
+-        # ExpandArgsMore does the same as ExpandArgs
+-        self.touch([self.tmpfile('liby', Lib('y'))])
+-        for iteration in (1, 2):
+-            with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
+-                files = self.files + self.liby_files + self.libx_files
+-
+-                self.assertRelEqual(args, ['foo', '-bar'] + files)
+-
+-                extracted = {}
+-                # ExpandArgsMore also has an extra method extracting static libraries
+-                # when possible
+-                args.extract()
+-
+-                # With AR_EXTRACT, it uses the descriptors when there are, and
+-                # actually
+-                # extracts the remaining libraries
+-                extracted_args = []
+-                for f in files:
+-                    if f.endswith(config.LIB_SUFFIX):
+-                        base = os.path.splitext(os.path.basename(f))[0]
+-                        # On the first iteration, we test the behavior of
+-                        # extracting archives that don't have a copy of their
+-                        # contents next to them, which is to use the file
+-                        # extracted from the archive in a temporary directory.
+-                        # On the second iteration, we test extracting archives
+-                        # that do have a copy of their contents next to them,
+-                        # in which case those contents are used instead of the
+-                        # temporarily extracted files.
+-                        if iteration == 1:
+-                            extracted_args.extend(sorted(extracted[base]))
+-                        else:
+-                            dirname = os.path.dirname(f[len(self.tmpdir)+1:])
+-                            if base.endswith('f'):
+-                                dirname = os.path.join(dirname, 'foo', 'bar')
+-                            extracted_args.extend([self.tmpfile(dirname, Obj(base)), self.tmpfile(dirname, Obj(base + '2'))])
+-                    else:
+-                        extracted_args.append(f)
+-                self.assertRelEqual(args, ['foo', '-bar'] + extracted_args)
+-
+-                tmp = args.tmp
+-            # Check that all temporary files are properly removed
+-            self.assertEqual(True, all([not os.path.exists(f) for f in tmp]))
+-
+-            # Create archives contents next to them for the second iteration.
+-            base = os.path.splitext(Lib('_'))[0]
+-            self.touch(self.tmpfile(Obj(base.replace('_', suffix))) for suffix in ('a', 'a2', 'd', 'd2'))
+-            try:
+-                os.makedirs(self.tmpfile('foo', 'bar'))
+-            except:
+-                pass
+-            self.touch(self.tmpfile('foo', 'bar', Obj(base.replace('_', suffix))) for suffix in ('f', 'f2'))
+-            self.touch(self.tmpfile('liby', Obj(base.replace('_', suffix))) for suffix in ('z', 'z2'))
+-
+-        # Restore subprocess.call and subprocess.check_output
+-        subprocess.call = subprocess_call
+-        subprocess.check_output = subprocess_check_output
+-
+-class FakeProcess(object):
+-    def __init__(self, out, err = ''):
+-        self.out = out
+-        self.err = err
+-
+-    def communicate(self):
+-        return (self.out, self.err)
+-
+-OBJDUMPS = {
+-'foo.o': '''
+-00000000 g     F .text\t00000001 foo
+-00000000 g     F .text._Z6foobarv\t00000001 _Z6foobarv
+-00000000 g     F .text.hello\t00000001 hello
+-00000000 g     F .text._ZThn4_6foobarv\t00000001 _ZThn4_6foobarv
+-''',
+-'bar.o': '''
+-00000000 g     F .text.hi\t00000001 hi
+-00000000 g     F .text.hot._Z6barbazv\t00000001 .hidden _Z6barbazv
+-''',
+-}
+-
+-PRINT_ICF = '''
+-ld: ICF folding section '.text.hello' in file 'foo.o'into '.text.hi' in file 'bar.o'
+-ld: ICF folding section '.foo' in file 'foo.o'into '.foo' in file 'bar.o'
+-'''
+-
+-class SubprocessPopen(object):
+-    def __init__(self, test):
+-        self.test = test
+-
+-    def __call__(self, args, stdout = None, stderr = None):
+-        self.test.assertEqual(stdout, subprocess.PIPE)
+-        self.test.assertEqual(stderr, subprocess.PIPE)
+-        if args[0] == 'objdump':
+-            self.test.assertEqual(args[1], '-t')
+-            self.test.assertTrue(args[2] in OBJDUMPS)
+-            return FakeProcess(OBJDUMPS[args[2]])
+-        else:
+-            return FakeProcess('', PRINT_ICF)
+-
+-class TestSectionFinder(unittest.TestCase):
+-    def test_getSections(self):
+-        '''Test SectionFinder'''
+-        # Divert subprocess.Popen
+-        subprocess_popen = subprocess.Popen
+-        subprocess.Popen = SubprocessPopen(self)
+-        config.EXPAND_LIBS_ORDER_STYLE = 'linkerscript'
+-        config.OBJ_SUFFIX = '.o'
+-        config.LIB_SUFFIX = '.a'
+-        finder = SectionFinder(['foo.o', 'bar.o'])
+-        self.assertEqual(finder.getSections('foobar'), [])
+-        self.assertEqual(finder.getSections('_Z6barbazv'), ['.text.hot._Z6barbazv'])
+-        self.assertEqual(finder.getSections('_Z6foobarv'), ['.text._Z6foobarv', '.text._ZThn4_6foobarv'])
+-        self.assertEqual(finder.getSections('_ZThn4_6foobarv'), ['.text._Z6foobarv', '.text._ZThn4_6foobarv'])
+-        subprocess.Popen = subprocess_popen
+-
+-class TestSymbolOrder(unittest.TestCase):
+-    def test_getOrderedSections(self):
+-        '''Test ExpandMoreArgs' _getOrderedSections'''
+-        # Divert subprocess.Popen
+-        subprocess_popen = subprocess.Popen
+-        subprocess.Popen = SubprocessPopen(self)
+-        config.EXPAND_LIBS_ORDER_STYLE = 'linkerscript'
+-        config.OBJ_SUFFIX = '.o'
+-        config.LIB_SUFFIX = '.a'
+-        config.LD_PRINT_ICF_SECTIONS = ''
+-        args = ExpandArgsMore(['foo', '-bar', 'bar.o', 'foo.o'])
+-        self.assertEqual(args._getOrderedSections(['_Z6foobarv', '_Z6barbazv']), ['.text._Z6foobarv', '.text._ZThn4_6foobarv', '.text.hot._Z6barbazv'])
+-        self.assertEqual(args._getOrderedSections(['_ZThn4_6foobarv', '_Z6barbazv']), ['.text._Z6foobarv', '.text._ZThn4_6foobarv', '.text.hot._Z6barbazv'])
+-        subprocess.Popen = subprocess_popen
+-
+-    def test_getFoldedSections(self):
+-        '''Test ExpandMoreArgs' _getFoldedSections'''
+-        # Divert subprocess.Popen
+-        subprocess_popen = subprocess.Popen
+-        subprocess.Popen = SubprocessPopen(self)
+-        config.LD_PRINT_ICF_SECTIONS = '-Wl,--print-icf-sections'
+-        args = ExpandArgsMore(['foo', '-bar', 'bar.o', 'foo.o'])
+-        self.assertEqual(args._getFoldedSections(), {'.text.hello': ['.text.hi'], '.text.hi': ['.text.hello']})
+-        subprocess.Popen = subprocess_popen
+-
+-    def test_getOrderedSectionsWithICF(self):
+-        '''Test ExpandMoreArgs' _getOrderedSections, with ICF'''
+-        # Divert subprocess.Popen
+-        subprocess_popen = subprocess.Popen
+-        subprocess.Popen = SubprocessPopen(self)
+-        config.EXPAND_LIBS_ORDER_STYLE = 'linkerscript'
+-        config.OBJ_SUFFIX = '.o'
+-        config.LIB_SUFFIX = '.a'
+-        config.LD_PRINT_ICF_SECTIONS = '-Wl,--print-icf-sections'
+-        args = ExpandArgsMore(['foo', '-bar', 'bar.o', 'foo.o'])
+-        self.assertEqual(args._getOrderedSections(['hello', '_Z6barbazv']), ['.text.hello', '.text.hi', '.text.hot._Z6barbazv'])
+-        self.assertEqual(args._getOrderedSections(['_ZThn4_6foobarv', 'hi', '_Z6barbazv']), ['.text._Z6foobarv', '.text._ZThn4_6foobarv', '.text.hi', '.text.hello', '.text.hot._Z6barbazv'])
+-        subprocess.Popen = subprocess_popen
+-
+-
+-if __name__ == '__main__':
+-    mozunit.main(runwith='unittest')
+diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py
+--- a/python/mozbuild/mozbuild/backend/common.py
++++ b/python/mozbuild/mozbuild/backend/common.py
+@@ -22,30 +22,37 @@ from mozbuild.frontend.data import (
+     BaseProgram,
+     ChromeManifestEntry,
+     ConfigFileSubstitution,
+     Exports,
+     FinalTargetPreprocessedFiles,
+     FinalTargetFiles,
+     GeneratedSources,
+     GnProjectData,
++    HostLibrary,
++    HostRustLibrary,
+     IPDLCollection,
++    RustLibrary,
+     SharedLibrary,
++    StaticLibrary,
+     UnifiedSources,
+     XPIDLFile,
+     WebIDLCollection,
+ )
+ from mozbuild.jar import (
+     DeprecatedJarManifest,
+     JarManifestParser,
+ )
+ from mozbuild.preprocessor import Preprocessor
+ from mozpack.chrome.manifest import parse_manifest_line
+ 
+-from mozbuild.util import group_unified_files
++from mozbuild.util import (
++    group_unified_files,
++    mkdir,
++)
+ 
+ class XPIDLManager(object):
+     """Helps manage XPCOM IDLs in the context of the build system."""
+     def __init__(self, config):
+         self.config = config
+         self.topsrcdir = config.topsrcdir
+         self.topobjdir = config.topobjdir
+ 
+@@ -191,16 +198,97 @@ class CommonBackend(BuildBackend):
+ 
+         # Write out a file listing generated sources.
+         with self._write_file(mozpath.join(topobjdir, 'generated-sources.json')) as fh:
+             d = {
+                 'sources': sorted(self._generated_sources),
+             }
+             json.dump(d, fh, sort_keys=True, indent=4)
+ 
++    def _expand_libs(self, input_bin):
++        os_libs = []
++        shared_libs = []
++        static_libs = []
++        objs = []
++
++        seen_objs = set()
++        seen_libs = set()
++
++        def add_objs(lib):
++            for o in lib.objs:
++                if o not in seen_objs:
++                    seen_objs.add(o)
++                    objs.append(o)
++
++        def expand(lib, recurse_objs, system_libs):
++            if isinstance(lib, StaticLibrary):
++                if lib.no_expand_lib:
++                    static_libs.append(lib)
++                    recurse_objs = False
++                elif recurse_objs:
++                    add_objs(lib)
++
++                for l in lib.linked_libraries:
++                    expand(l, recurse_objs, system_libs)
++
++                if system_libs:
++                    for l in lib.linked_system_libs:
++                        if l not in seen_libs:
++                            seen_libs.add(l)
++                            os_libs.append(l)
++
++            elif isinstance(lib, SharedLibrary):
++                if lib not in seen_libs:
++                    seen_libs.add(lib)
++                    shared_libs.append(lib)
++
++        add_objs(input_bin)
++
++        system_libs = not isinstance(input_bin, StaticLibrary)
++        for lib in input_bin.linked_libraries:
++            if isinstance(lib, RustLibrary):
++                continue
++            elif isinstance(lib, StaticLibrary):
++                expand(lib, True, system_libs)
++            elif isinstance(lib, SharedLibrary):
++                if lib not in seen_libs:
++                    seen_libs.add(lib)
++                    shared_libs.append(lib)
++
++        for lib in input_bin.linked_system_libs:
++            if lib not in seen_libs:
++                seen_libs.add(lib)
++                os_libs.append(lib)
++
++        return objs, shared_libs, os_libs, static_libs
++
++    def _make_list_file(self, objdir, objs, name):
++        if not objs:
++            return None
++        list_style = self.environment.substs.get('EXPAND_LIBS_LIST_STYLE')
++        list_file_path = mozpath.join(objdir, name)
++        objs = [os.path.relpath(o, objdir) for o in objs]
++        if list_style == 'linkerscript':
++            ref = list_file_path
++            content = '\n'.join('INPUT("%s")' % o for o in objs)
++        elif list_style == 'filelist':
++            ref = "-Wl,-filelist," + list_file_path
++            content = '\n'.join(objs)
++        elif list_style == 'list':
++            ref = "@" + list_file_path
++            content = '\n'.join(objs)
++        else:
++            return None
++
++        mkdir(objdir)
++        with self._write_file(list_file_path) as fh:
++            fh.write(content)
++
++        return ref
++
+     def _handle_generated_sources(self, files):
+         self._generated_sources.update(mozpath.relpath(f, self.environment.topobjdir) for f in files)
+ 
+     def _handle_webidl_collection(self, webidls):
+ 
+         bindings_dir = mozpath.join(self.environment.topobjdir, 'dom', 'bindings')
+ 
+         all_inputs = set(webidls.all_static_sources())
+diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py
+--- a/python/mozbuild/mozbuild/backend/recursivemake.py
++++ b/python/mozbuild/mozbuild/backend/recursivemake.py
+@@ -1307,77 +1307,78 @@ class RecursiveMakeBackend(CommonBackend
+     def _process_host_library(self, libdef, backend_file):
+         backend_file.write('HOST_LIBRARY_NAME = %s\n' % libdef.basename)
+ 
+     def _build_target_for_obj(self, obj):
+         return '%s/%s' % (mozpath.relpath(obj.objdir,
+             self.environment.topobjdir), obj.KIND)
+ 
+     def _process_linked_libraries(self, obj, backend_file):
+-        def write_shared_and_system_libs(lib):
+-            for l in lib.linked_libraries:
+-                if isinstance(l, (StaticLibrary, RustLibrary)):
+-                    write_shared_and_system_libs(l)
+-                else:
+-                    backend_file.write_once('SHARED_LIBS += %s/%s\n'
+-                        % (pretty_relpath(l), l.import_name))
+-            for l in lib.linked_system_libs:
+-                backend_file.write_once('OS_LIBS += %s\n' % l)
+-
+         def pretty_relpath(lib):
+             return '$(DEPTH)/%s' % mozpath.relpath(lib.objdir, topobjdir)
+ 
+         topobjdir = mozpath.normsep(obj.topobjdir)
+         # This will create the node even if there aren't any linked libraries.
+         build_target = self._build_target_for_obj(obj)
+         self._compile_graph[build_target]
+ 
++        objs, shared_libs, os_libs, static_libs = self._expand_libs(obj)
++
++        if obj.KIND == 'target':
++            obj_target = obj.name
++            if isinstance(obj, Program):
++                obj_target = self._pretty_path(obj.output_path, backend_file)
++
++            objs_ref = ' \\\n    '.join(os.path.relpath(o, obj.objdir)
++                                        for o in objs)
++            # Don't bother with a list file if we're only linking objects built
++            # in this directory or building a real static library. This
++            # accommodates clang-plugin, where we would otherwise pass an
++            # incorrect list file format to the host compiler as well as when
++            # creating an archive with AR, which doesn't understand list files.
++            if (objs == obj.objs and not isinstance(obj, StaticLibrary) or
++                isinstance(obj, StaticLibrary) and obj.no_expand_lib):
++                backend_file.write_once('%s_OBJS := %s\n' %
++                                        (obj.name, objs_ref))
++                backend_file.write_once('%s: %s\n' % (obj_target, objs_ref))
++            elif not isinstance(obj, StaticLibrary):
++                list_file_path = '%s.list' % obj.name.replace('.', '_')
++                list_file_ref = self._make_list_file(obj.objdir, objs,
++                                                     list_file_path)
++                backend_file.write_once('%s_OBJS := %s\n' %
++                                        (obj.name, list_file_ref))
++                backend_file.write_once('%s: %s\n' % (obj_target, list_file_path))
++                backend_file.write_once('%s: %s\n' % (obj_target, objs_ref))
++
++        for lib in shared_libs:
++            backend_file.write_once('SHARED_LIBS += %s/%s\n' %
++                                    (pretty_relpath(lib), lib.import_name))
++        for lib in static_libs:
++            backend_file.write_once('STATIC_LIBS += %s/%s\n' %
++                                    (pretty_relpath(lib), lib.import_name))
++        for lib in os_libs:
++            if obj.KIND == 'target':
++                backend_file.write_once('OS_LIBS += %s\n' % lib)
++            else:
++                backend_file.write_once('HOST_EXTRA_LIBS += %s\n' % lib)
++
+         for lib in obj.linked_libraries:
+             if not isinstance(lib, ExternalLibrary):
+                 self._compile_graph[build_target].add(
+                     self._build_target_for_obj(lib))
+-            relpath = pretty_relpath(lib)
+-            if isinstance(obj, Library):
+-                if isinstance(lib, RustLibrary):
+-                    # We don't need to do anything here; we will handle
+-                    # linkage for any RustLibrary elsewhere.
+-                    continue
+-                elif isinstance(lib, StaticLibrary):
+-                    backend_file.write_once('STATIC_LIBS += %s/%s\n'
+-                                        % (relpath, lib.import_name))
+-                    if isinstance(obj, SharedLibrary):
+-                        write_shared_and_system_libs(lib)
+-                elif isinstance(obj, SharedLibrary):
+-                    backend_file.write_once('SHARED_LIBS += %s/%s\n'
+-                                        % (relpath, lib.import_name))
+-            elif isinstance(obj, (Program, SimpleProgram)):
+-                if isinstance(lib, StaticLibrary):
+-                    backend_file.write_once('STATIC_LIBS += %s/%s\n'
+-                                        % (relpath, lib.import_name))
+-                    write_shared_and_system_libs(lib)
+-                else:
+-                    backend_file.write_once('SHARED_LIBS += %s/%s\n'
+-                                        % (relpath, lib.import_name))
+-            elif isinstance(obj, (HostLibrary, HostProgram, HostSimpleProgram)):
+-                assert isinstance(lib, (HostLibrary, HostRustLibrary))
+-                backend_file.write_once('HOST_LIBS += %s/%s\n'
+-                                   % (relpath, lib.import_name))
++            if isinstance(lib, (HostLibrary, HostRustLibrary)):
++                backend_file.write_once('HOST_LIBS += %s/%s\n' %
++                                        (pretty_relpath(lib), lib.import_name))
+ 
+         # We have to link any Rust libraries after all intermediate static
+         # libraries have been listed to ensure that the Rust libraries are
+         # searched after the C/C++ objects that might reference Rust symbols.
+         if isinstance(obj, SharedLibrary):
+             self._process_rust_libraries(obj, backend_file, pretty_relpath)
+ 
+-        for lib in obj.linked_system_libs:
+-            if obj.KIND == 'target':
+-                backend_file.write_once('OS_LIBS += %s\n' % lib)
+-            else:
+-                backend_file.write_once('HOST_EXTRA_LIBS += %s\n' % lib)
+-
+         # Process library-based defines
+         self._process_defines(obj.lib_defines, backend_file)
+ 
+     def _process_rust_libraries(self, obj, backend_file, pretty_relpath):
+         assert isinstance(obj, SharedLibrary)
+ 
+         # If this library does not depend on any Rust libraries, then we are done.
+         direct_linked = [l for l in obj.linked_libraries if isinstance(l, RustLibrary)]
+diff --git a/python/mozbuild/mozbuild/test/backend/common.py b/python/mozbuild/mozbuild/test/backend/common.py
+--- a/python/mozbuild/mozbuild/test/backend/common.py
++++ b/python/mozbuild/mozbuild/test/backend/common.py
+@@ -201,16 +201,17 @@ CONFIGS = defaultdict(lambda: {
+         'defines': {},
+         'non_global_defines': [],
+         'substs': {
+             'COMPILE_ENVIRONMENT': '1',
+             'LIB_SUFFIX': 'a',
+             'BIN_SUFFIX': '.exe',
+             'DLL_SUFFIX': '.so',
+             'OBJ_SUFFIX': 'o',
++            'EXPAND_LIBS_LIST_STYLE': 'list',
+         },
+     },
+ })
+ 
+ 
+ class BackendTester(unittest.TestCase):
+     def setUp(self):
+         self._old_env = dict(os.environ)
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar2.cc b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar2.cc
+new file mode 100644
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar_helper/bar_helper1.cpp b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar_helper/bar_helper1.cpp
+new file mode 100644
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar_helper/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar_helper/moz.build
+new file mode 100644
+--- /dev/null
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/bar_helper/moz.build
+@@ -0,0 +1,8 @@
++# Any copyright is dedicated to the Public Domain.
++# http://creativecommons.org/publicdomain/zero/1.0/
++
++SOURCES += [
++    'bar_helper1.cpp',
++]
++
++FINAL_LIBRARY = 'bar'
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/moz.build b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/moz.build
+--- a/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/moz.build
++++ b/python/mozbuild/mozbuild/test/backend/data/linkage/static/bar/moz.build
+@@ -1,8 +1,13 @@
+ # Any copyright is dedicated to the Public Domain.
+ # http://creativecommons.org/publicdomain/zero/1.0/
+ 
+ SOURCES += [
+     'bar1.cc',
++    'bar2.cc',
++]
++
++DIRS += [
++    'bar_helper',
+ ]
+ 
+ FINAL_LIBRARY = 'bar'
+\ No newline at end of file
+diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
++++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
+@@ -986,40 +986,34 @@ class TestRecursiveMakeBackend(BackendTe
+ 
+             for line in lines:
+                 self.assertNotIn('LIB_IS_C_ONLY', line)
+ 
+     def test_linkage(self):
+         env = self._consume('linkage', RecursiveMakeBackend)
+         expected_linkage = {
+             'prog': {
+-                'SHARED_LIBS': ['$(DEPTH)/shared/baz', '$(DEPTH)/prog/qux/qux'],
+-                'STATIC_LIBS': ['$(DEPTH)/static/bar%s' % env.lib_suffix],
++                'SHARED_LIBS': ['$(DEPTH)/prog/qux/qux.so',
++                                '$(DEPTH)/shared/baz.so'],
++                'STATIC_LIBS': ['$(DEPTH)/real/foo.a'],
+                 'OS_LIBS': ['-lfoo', '-lbaz', '-lbar'],
+             },
+             'shared': {
+                 'OS_LIBS': ['-lfoo'],
+-                'SHARED_LIBS': ['$(DEPTH)/prog/qux/qux'],
+-                'STATIC_LIBS': ['$(DEPTH)/shared/baz/shared_baz%s' %
+-                                env.lib_suffix],
++                'SHARED_LIBS': ['$(DEPTH)/prog/qux/qux.so'],
++                'STATIC_LIBS': [],
+             },
+             'static': {
+-                'STATIC_LIBS': [
+-                    '$(DEPTH)/static/bar/static_bar.a',
+-                    '$(DEPTH)/real/foo.a',
+-                ],
++                'STATIC_LIBS': ['$(DEPTH)/real/foo.a'],
+                 'OS_LIBS': ['-lbar'],
+-                'SHARED_LIBS': [],
++                'SHARED_LIBS': ['$(DEPTH)/prog/qux/qux.so'],
+             },
+             'real': {
+-                'STATIC_LIBS': [
+-                    '$(DEPTH)/shared/baz_s%s' % env.lib_suffix,
+-                    '$(DEPTH)/real/foo/real_foo%s' % env.lib_suffix,
+-                ],
+-                'SHARED_LIBS': [],
++                'STATIC_LIBS': [],
++                'SHARED_LIBS': ['$(DEPTH)/prog/qux/qux.so'],
+                 'OS_LIBS': ['-lbaz'],
+             }
+         }
+         actual_linkage = {}
+         for name in expected_linkage.keys():
+             with open(os.path.join(env.topobjdir, name, 'backend.mk'), 'rb') as fh:
+                 actual_linkage[name] = [line.rstrip() for line in fh.readlines()]
+         for name in expected_linkage:
+@@ -1027,16 +1021,44 @@ class TestRecursiveMakeBackend(BackendTe
+                 for val in expected_linkage[name][var]:
+                     line = '%s += %s' % (var, val)
+                     self.assertIn(line,
+                                   actual_linkage[name])
+                     actual_linkage[name].remove(line)
+                 for line in actual_linkage[name]:
+                     self.assertNotIn('%s +=' % var, line)
+ 
++    def test_list_files(self):
++        env = self._consume('linkage', RecursiveMakeBackend)
++        expected_list_files = {
++            'prog/MyProgram_exe.list': [
++                '../static/bar/bar1.o',
++                '../static/bar/bar2.o',
++                '../static/bar/bar_helper/bar_helper1.o',
++            ],
++            'shared/baz_so.list': [
++                'baz/baz1.o',
++            ],
++        }
++        actual_list_files = {}
++        for name in expected_list_files.keys():
++            with open(os.path.join(env.topobjdir, name), 'rb') as fh:
++                actual_list_files[name] = [mozpath.normsep(line.rstrip())
++                                           for line in fh.readlines()]
++        for name in expected_list_files:
++            self.assertEqual(actual_list_files[name],
++                             expected_list_files[name])
++
++        # We don't produce a list file for a shared library composed only of
++        # object files in its directory, but instead list them in a variable.
++        with open(os.path.join(env.topobjdir, 'prog', 'qux', 'backend.mk'), 'rb') as fh:
++            lines = [line.rstrip() for line in fh.readlines()]
++
++        self.assertIn('qux.so_OBJS := qux1.o', lines)
++
+     def test_jar_manifests(self):
+         env = self._consume('jar-manifests', RecursiveMakeBackend)
+ 
+         with open(os.path.join(env.topobjdir, 'backend.mk'), 'rb') as fh:
+             lines = fh.readlines()
+ 
+         lines = [line.rstrip() for line in lines]
+ 

+ 386 - 0
rel-257/mozilla-esr60/patches/1429875-5-61a1.patch

@@ -0,0 +1,386 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1521589452 25200
+# Node ID cd90d8ccc5be982afb1bab0a2f2a649e10491817
+# Parent  163ba7d41603d79603f7f6a03b6cc21c246267d5
+Bug 1429875 - Implement OBJ_SUFFIX overriding for the profile generation phase on linux in mozbuild. r=glandium
+
+MozReview-Commit-ID: 8PtgxfbxuE
+
+diff --git a/config/config.mk b/config/config.mk
+--- a/config/config.mk
++++ b/config/config.mk
+@@ -415,25 +415,28 @@ endif
+ 
+ # MDDEPDIR is the subdirectory where dependency files are stored
+ MDDEPDIR := .deps
+ 
+ # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including
+ # this file
+ OBJ_SUFFIX := $(_OBJ_SUFFIX)
+ 
++OBJS_VAR_SUFFIX := OBJS
++
+ # PGO builds with GCC build objects with instrumentation in a first pass,
+ # then objects optimized, without instrumentation, in a second pass. If
+ # we overwrite the objects from the first pass with those from the second,
+ # we end up not getting instrumentation data for better optimization on
+ # incremental builds. As a consequence, we use a different object suffix
+ # for the first pass.
+-ifndef NO_PROFILE_GUIDED_OPTIMIZE
+ ifdef MOZ_PROFILE_GENERATE
+ ifdef GNU_CC
++OBJS_VAR_SUFFIX := PGO_OBJS
++ifndef NO_PROFILE_GUIDED_OPTIMIZE
+ OBJ_SUFFIX := i_o
+ endif
+ endif
+ endif
+ 
+ PLY_INCLUDE = -I$(MOZILLA_DIR)/other-licenses/ply
+ 
+ export CL_INCLUDES_PREFIX
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -553,17 +553,17 @@ endif
+ #
+ # PROGRAM = Foo
+ # creates OBJS, links with LIBS to create Foo
+ #
+ $(PROGRAM): $(PROGOBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(RESFILE) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ 	@$(RM) $@.manifest
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+-	$(LINKER) -NOLOGO -OUT:$(call LINKER_OUT,$@) -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
++	$(LINKER) -NOLOGO -OUT:$(call LINKER_OUT,$@) -PDB:$(LINK_PDBFILE) -IMPLIB:$(basename $(@F)).lib $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $($(notdir $@)_$(OBJS_VAR_SUFFIX)) $(RESFILE) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		else \
+ 			echo 'Embedding manifest from $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+@@ -574,17 +574,17 @@ ifdef MSMANIFEST_TOOL
+ 	fi
+ endif	# MSVC with manifest tool
+ ifdef MOZ_PROFILE_GENERATE
+ # touch it a few seconds into the future to work around FAT's
+ # 2-second granularity
+ 	touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
+ endif
+ else # !WINNT || GNU_CC
+-	$(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_OBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
++	$(call EXPAND_CC_OR_CXX,$@) -o $@ $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) $($(notdir $@)_$(OBJS_VAR_SUFFIX)) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
+ 	$(call py_action,check_binary,--target $@)
+ endif # WINNT && !GNU_CC
+ 
+ ifdef ENABLE_STRIP
+ 	$(STRIP) $(STRIP_FLAGS) $@
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+@@ -625,25 +625,25 @@ endif
+ # Foo.o (from either Foo.c or Foo.cpp).
+ #
+ # SIMPLE_PROGRAMS = Foo Bar
+ # creates Foo.o Bar.o, links with LIBS to create Foo, Bar.
+ #
+ $(SIMPLE_PROGRAMS): %$(BIN_SUFFIX): %.$(OBJ_SUFFIX) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+-	$(LINKER) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $($@_OBJS) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
++	$(LINKER) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $($@_$(OBJS_VAR_SUFFIX)) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_PROGRAM_LDFLAGS) $(STATIC_LIBS) $(SHARED_LIBS) $(OS_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		rm -f $@.manifest; \
+ 	fi
+ endif	# MSVC with manifest tool
+ else
+-	$(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) -o $@ $($@_OBJS) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
++	$(call EXPAND_CC_OR_CXX,$@) $(COMPUTED_CXX_LDFLAGS) $(PGO_CFLAGS) -o $@ $($@_$(OBJS_VAR_SUFFIX)) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(STATIC_LIBS) $(MOZ_PROGRAM_LDFLAGS) $(SHARED_LIBS) $(OS_LIBS)
+ 	$(call py_action,check_binary,--target $@)
+ endif # WINNT && !GNU_CC
+ 
+ ifdef ENABLE_STRIP
+ 	$(STRIP) $(STRIP_FLAGS) $@
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+@@ -662,17 +662,17 @@ endif
+ endif
+ ifndef CROSS_COMPILE
+ 	$(call py_action,check_binary,--host $@)
+ endif
+ 
+ $(LIBRARY): $(OBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ 	$(RM) $(REAL_LIBRARY)
+-	$(AR) $(AR_FLAGS) $(OBJS) $($@_OBJS)
++	$(AR) $(AR_FLAGS) $(OBJS) $($@_$(OBJS_VAR_SUFFIX))
+ 
+ ifeq ($(OS_ARCH),WINNT)
+ # Import libraries are created by the rules creating shared libraries.
+ # The rules to copy them to $(DIST)/lib depend on $(IMPORT_LIBRARY),
+ # but make will happily consider the import library before it is refreshed
+ # when rebuilding the corresponding shared library. Defining an empty recipe
+ # for import libraries forces make to wait for the shared library recipe to
+ # have run before considering other targets that depend on the import library.
+@@ -690,17 +690,17 @@ endif
+ # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
+ # so no need to conditionalize on OS version or debugging format.
+ 
+ $(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifndef INCREMENTAL_LINKER
+ 	$(RM) $@
+ endif
+-	$(MKSHLIB) $($@_OBJS) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS)
++	$(MKSHLIB) $($@_$(OBJS_VAR_SUFFIX)) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS)
+ 	$(call py_action,check_binary,--target $@)
+ 
+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
+ ifdef MSMANIFEST_TOOL
+ ifdef EMBED_MANIFEST_AT
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py
+--- a/python/mozbuild/mozbuild/backend/common.py
++++ b/python/mozbuild/mozbuild/backend/common.py
+@@ -203,25 +203,31 @@ class CommonBackend(BuildBackend):
+             }
+             json.dump(d, fh, sort_keys=True, indent=4)
+ 
+     def _expand_libs(self, input_bin):
+         os_libs = []
+         shared_libs = []
+         static_libs = []
+         objs = []
++        no_pgo_objs = []
+ 
+         seen_objs = set()
+         seen_libs = set()
+ 
+         def add_objs(lib):
+             for o in lib.objs:
+                 if o not in seen_objs:
+                     seen_objs.add(o)
+                     objs.append(o)
++                    # This is slightly odd, buf for consistency with the
++                    # recursivemake backend we don't replace OBJ_SUFFIX if any
++                    # object in a library has `no_pgo` set.
++                    if lib.no_pgo_objs or lib.no_pgo:
++                        no_pgo_objs.append(o)
+ 
+         def expand(lib, recurse_objs, system_libs):
+             if isinstance(lib, StaticLibrary):
+                 if lib.no_expand_lib:
+                     static_libs.append(lib)
+                     recurse_objs = False
+                 elif recurse_objs:
+                     add_objs(lib)
+@@ -253,17 +259,17 @@ class CommonBackend(BuildBackend):
+                     seen_libs.add(lib)
+                     shared_libs.append(lib)
+ 
+         for lib in input_bin.linked_system_libs:
+             if lib not in seen_libs:
+                 seen_libs.add(lib)
+                 os_libs.append(lib)
+ 
+-        return objs, shared_libs, os_libs, static_libs
++        return objs, no_pgo_objs, shared_libs, os_libs, static_libs
+ 
+     def _make_list_file(self, objdir, objs, name):
+         if not objs:
+             return None
+         list_style = self.environment.substs.get('EXPAND_LIBS_LIST_STYLE')
+         list_file_path = mozpath.join(objdir, name)
+         objs = [os.path.relpath(o, objdir) for o in objs]
+         if list_style == 'linkerscript':
+diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py
+--- a/python/mozbuild/mozbuild/backend/recursivemake.py
++++ b/python/mozbuild/mozbuild/backend/recursivemake.py
+@@ -1315,43 +1315,78 @@ class RecursiveMakeBackend(CommonBackend
+         def pretty_relpath(lib):
+             return '$(DEPTH)/%s' % mozpath.relpath(lib.objdir, topobjdir)
+ 
+         topobjdir = mozpath.normsep(obj.topobjdir)
+         # This will create the node even if there aren't any linked libraries.
+         build_target = self._build_target_for_obj(obj)
+         self._compile_graph[build_target]
+ 
+-        objs, shared_libs, os_libs, static_libs = self._expand_libs(obj)
++        objs, no_pgo_objs, shared_libs, os_libs, static_libs = self._expand_libs(obj)
+ 
+         if obj.KIND == 'target':
+             obj_target = obj.name
+             if isinstance(obj, Program):
+                 obj_target = self._pretty_path(obj.output_path, backend_file)
+ 
++            is_unit_test = isinstance(obj, BaseProgram) and obj.is_unit_test
++            profile_gen_objs = []
++
++            if (self.environment.substs.get('MOZ_PGO') and
++                self.environment.substs.get('GNU_CC')):
++                # We use a different OBJ_SUFFIX for the profile generate phase on
++                # linux. These get picked up via OBJS_VAR_SUFFIX in config.mk.
++                if not is_unit_test and not isinstance(obj, SimpleProgram):
++                    profile_gen_objs = [o if o in no_pgo_objs else '%s.%s' %
++                                        (mozpath.splitext(o)[0], 'i_o') for o in objs]
++
++            def write_obj_deps(target, objs_ref, pgo_objs_ref):
++                if pgo_objs_ref:
++                    backend_file.write('ifdef MOZ_PROFILE_GENERATE\n')
++                    backend_file.write('%s: %s\n' % (target, pgo_objs_ref))
++                    backend_file.write('else\n')
++                    backend_file.write('%s: %s\n' % (target, objs_ref))
++                    backend_file.write('endif\n')
++                else:
++                    backend_file.write('%s: %s\n' % (target, objs_ref))
++
+             objs_ref = ' \\\n    '.join(os.path.relpath(o, obj.objdir)
+                                         for o in objs)
++            pgo_objs_ref = ' \\\n    '.join(os.path.relpath(o, obj.objdir)
++                                            for o in profile_gen_objs)
+             # Don't bother with a list file if we're only linking objects built
+             # in this directory or building a real static library. This
+             # accommodates clang-plugin, where we would otherwise pass an
+             # incorrect list file format to the host compiler as well as when
+             # creating an archive with AR, which doesn't understand list files.
+             if (objs == obj.objs and not isinstance(obj, StaticLibrary) or
+-                isinstance(obj, StaticLibrary) and obj.no_expand_lib):
+-                backend_file.write_once('%s_OBJS := %s\n' %
+-                                        (obj.name, objs_ref))
+-                backend_file.write_once('%s: %s\n' % (obj_target, objs_ref))
++              isinstance(obj, StaticLibrary) and obj.no_expand_lib):
++                backend_file.write_once('%s_OBJS := %s\n' % (obj.name,
++                                                             objs_ref))
++                if profile_gen_objs:
++                    backend_file.write_once('%s_PGO_OBJS := %s\n' % (obj.name,
++                                                                     pgo_objs_ref))
++                write_obj_deps(obj_target, objs_ref, pgo_objs_ref)
+             elif not isinstance(obj, StaticLibrary):
+                 list_file_path = '%s.list' % obj.name.replace('.', '_')
+                 list_file_ref = self._make_list_file(obj.objdir, objs,
+                                                      list_file_path)
+                 backend_file.write_once('%s_OBJS := %s\n' %
+                                         (obj.name, list_file_ref))
+                 backend_file.write_once('%s: %s\n' % (obj_target, list_file_path))
+-                backend_file.write_once('%s: %s\n' % (obj_target, objs_ref))
++                if profile_gen_objs:
++                    pgo_list_file_path = '%s_pgo.list' % obj.name.replace('.', '_')
++                    pgo_list_file_ref = self._make_list_file(obj.objdir,
++                                                             profile_gen_objs,
++                                                             pgo_list_file_path)
++                    backend_file.write_once('%s_PGO_OBJS := %s\n' %
++                                            (obj.name, pgo_list_file_ref))
++                    backend_file.write_once('%s: %s\n' % (obj_target,
++                                                          pgo_list_file_path))
++                write_obj_deps(obj_target, objs_ref, pgo_objs_ref)
+ 
+         for lib in shared_libs:
+             backend_file.write_once('SHARED_LIBS += %s/%s\n' %
+                                     (pretty_relpath(lib), lib.import_name))
+         for lib in static_libs:
+             backend_file.write_once('STATIC_LIBS += %s/%s\n' %
+                                     (pretty_relpath(lib), lib.import_name))
+         for lib in os_libs:
+diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py
+--- a/python/mozbuild/mozbuild/frontend/data.py
++++ b/python/mozbuild/mozbuild/frontend/data.py
+@@ -378,26 +378,30 @@ class LinkageMultipleRustLibrariesError(
+ 
+ class Linkable(ContextDerived):
+     """Generic context derived container object for programs and libraries"""
+     __slots__ = (
+         'cxx_link',
+         'lib_defines',
+         'linked_libraries',
+         'linked_system_libs',
++        'no_pgo_sources',
++        'no_pgo',
+         'sources',
+     )
+ 
+     def __init__(self, context):
+         ContextDerived.__init__(self, context)
+         self.cxx_link = False
+         self.linked_libraries = []
+         self.linked_system_libs = []
+         self.lib_defines = Defines(context, {})
+         self.sources = defaultdict(list)
++        self.no_pgo_sources = []
++        self.no_pgo = False
+ 
+     def link_library(self, obj):
+         assert isinstance(obj, BaseLibrary)
+         if obj.KIND != self.KIND:
+             raise LinkageWrongKindError('%s != %s' % (obj.KIND, self.KIND))
+         # Linking multiple Rust libraries into an object would result in
+         # multiple copies of the Rust standard library, as well as linking
+         # errors from duplicate symbols.
+@@ -427,26 +431,33 @@ class Linkable(ContextDerived):
+     def source_files(self):
+         all_sources = []
+         # This is ordered for reproducibility and consistently w/
+         # config/rules.mk
+         for suffix in ('.c', '.S', '.cpp', '.m', '.mm', '.s'):
+             all_sources += self.sources.get(suffix, [])
+         return all_sources
+ 
+-    @property
+-    def objs(self):
++    def _get_objs(self, sources):
+         obj_prefix = ''
+         if self.KIND == 'host':
+             obj_prefix = 'host_'
+ 
+         return [mozpath.join(self.objdir, '%s%s.%s' % (obj_prefix,
+                                                        mozpath.splitext(mozpath.basename(f))[0],
+                                                        self.config.substs.get('OBJ_SUFFIX', '')))
+-                for f in self.source_files()]
++                for f in sources]
++
++    @property
++    def no_pgo_objs(self):
++        return self._get_objs(self.no_pgo_sources)
++
++    @property
++    def objs(self):
++        return self._get_objs(self.source_files())
+ 
+ 
+ class BaseProgram(Linkable):
+     """Context derived container object for programs, which is a unicode
+     string.
+ 
+     This class handles automatically appending a binary suffix to the program
+     name.
+diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
+--- a/python/mozbuild/mozbuild/frontend/emitter.py
++++ b/python/mozbuild/mozbuild/frontend/emitter.py
+@@ -945,16 +945,20 @@ class TreeMetadataEmitter(LoggingMixin):
+                     ctxt_sources[variable][canonical_suffix] += sorted(srcs)
+                     yield obj
+ 
+         if ctxt_sources:
+             for linkable in linkables:
+                 for target_var in ('SOURCES', 'UNIFIED_SOURCES'):
+                     for suffix, srcs in ctxt_sources[target_var].items():
+                         linkable.sources[suffix] += srcs
++                if no_pgo_sources:
++                    linkable.no_pgo_sources = no_pgo_sources
++                elif no_pgo:
++                    linkable.no_pgo = True
+             for host_linkable in host_linkables:
+                 for suffix, srcs in ctxt_sources['HOST_SOURCES'].items():
+                     host_linkable.sources[suffix] += srcs
+ 
+         for f, flags in all_flags.iteritems():
+             if flags.flags:
+                 ext = mozpath.splitext(f)[1]
+                 yield PerSourceFlag(context, f, flags.flags)

+ 154 - 0
rel-257/mozilla-esr60/patches/1445398-61a1.patch

@@ -0,0 +1,154 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1521759792 25200
+# Node ID d2fdb62d06d0f42a412204e0f098d232fe5d8c68
+# Parent  7e6847a36676408c57f5163b663ddd1f814037ba
+Bug 1445398 - Do not re-generate buildid.h for every Tup build. r=mshal
+
+MozReview-Commit-ID: ErkTDOU8lYH
+
+diff --git a/Makefile.in b/Makefile.in
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -141,25 +141,22 @@ ifneq (,$(filter FasterMake+RecursiveMak
+ install-manifests: faster
+ .PHONY: faster
+ faster: install-dist/idl
+ 	$(MAKE) -C faster FASTER_RECURSIVE_MAKE=1
+ endif
+ 
+ .PHONY: tup
+ tup:
+-	$(call BUILDSTATUS,TIERS $(if $(MOZ_ARTIFACT_BUILDS),artifact )make tup)
++	$(call BUILDSTATUS,TIERS $(if $(MOZ_ARTIFACT_BUILDS),artifact )tup)
+ ifdef MOZ_ARTIFACT_BUILDS
+ 	$(call BUILDSTATUS,TIER_START artifact)
+ 	$(MAKE) recurse_artifact
+ 	$(call BUILDSTATUS,TIER_FINISH artifact)
+ endif
+-	$(call BUILDSTATUS,TIER_START make)
+-	$(MAKE) buildid.h source-repo.h
+-	$(call BUILDSTATUS,TIER_FINISH make)
+ 	$(call BUILDSTATUS,TIER_START tup)
+ 	@$(TUP) $(if $(findstring s,$(filter-out --%,$(MAKEFLAGS))),,--verbose)
+ 	$(call BUILDSTATUS,TIER_FINISH tup)
+ 
+ .PHONY: $(addprefix install-,$(install_manifests))
+ $(addprefix install-,$(install_manifests)): install-%: $(install_manifest_depends)
+ ifneq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
+ 	@# If we're using the hybrid FasterMake/RecursiveMake backend, we want
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -183,16 +183,20 @@ class TupOnly(CommonBackend, PartialBack
+             '*.py',
+             '*.rs',
+         )
+ 
+         # These are 'group' dependencies - All rules that list these as an output
+         # will be built before any rules that list this as an input.
+         self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
+         self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
++        # The preprocessor including source-repo.h and buildid.h creates
++        # dependencies that aren't specified by moz.build and cause errors
++        # in Tup. Express these as a group dependency.
++        self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
+ 
+     def _get_backend_file(self, relobjdir):
+         objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
+         if objdir not in self._backend_files:
+             self._backend_files[objdir] = \
+                     BackendTupfile(objdir, self.environment,
+                                    self.environment.topsrcdir, self.environment.topobjdir)
+         return self._backend_files[objdir]
+@@ -216,24 +220,20 @@ class TupOnly(CommonBackend, PartialBack
+ 
+         consumed = CommonBackend.consume_object(self, obj)
+         if consumed:
+             return True
+ 
+         backend_file = self._get_backend_file_for(obj)
+ 
+         if isinstance(obj, GeneratedFile):
+-            # These files are already generated by make before tup runs.
+-            skip_files = (
+-                'buildid.h',
+-                'source-repo.h',
+-            )
++            skip_files = []
+ 
+             if self.environment.is_artifact_build:
+-                skip_files = skip_files + self._compile_env_gen_files
++                skip_files = self._compile_env_gen_files
+ 
+             for f in obj.outputs:
+                 if any(mozpath.match(f, p) for p in skip_files):
+                     return False
+ 
+             if 'application.ini.h' in obj.outputs:
+                 # application.ini.h is a special case since we need to process
+                 # the FINAL_TARGET_PP_FILES for application.ini before running
+@@ -266,16 +266,22 @@ class TupOnly(CommonBackend, PartialBack
+             self._process_computed_flags(obj, backend_file)
+         elif isinstance(obj, (Sources, GeneratedSources)):
+             backend_file.sources[obj.canonical_suffix].extend(obj.files)
+         elif isinstance(obj, HostSources):
+             backend_file.host_sources[obj.canonical_suffix].extend(obj.files)
+         elif isinstance(obj, VariablePassthru):
+             backend_file.variables = obj.variables
+ 
++        # The top-level Makefile.in still contains our driver target and some
++        # things related to artifact builds, so as a special case ensure the
++        # make backend generates a Makefile there.
++        if obj.objdir == self.environment.topobjdir:
++            return False
++
+         return True
+ 
+     def consume_finished(self):
+         CommonBackend.consume_finished(self)
+ 
+         # The approach here is similar to fastermake.py, but we
+         # simply write out the resulting files here.
+         for target, entries in self._manifest_entries.iteritems():
+@@ -342,17 +348,21 @@ class TupOnly(CommonBackend, PartialBack
+             full_inputs = [f.full_path for f in obj.inputs]
+             cmd.extend(full_inputs)
+             cmd.extend(shell_quote(f) for f in obj.flags)
+ 
+             outputs = []
+             outputs.extend(obj.outputs)
+             outputs.append('%s.pp' % obj.outputs[0])
+ 
+-            extra_outputs = [self._installed_files] if obj.required_for_compile else None
++            if any(f in obj.outputs for f in ('source-repo.h', 'buildid.h')):
++                extra_outputs = [self._early_generated_files]
++            else:
++                extra_outputs = [self._installed_files] if obj.required_for_compile else []
++                full_inputs += [self._early_generated_files]
+ 
+             backend_file.rule(
+                 display='python {script}:{method} -> [%o]'.format(script=obj.script, method=obj.method),
+                 cmd=cmd,
+                 inputs=full_inputs,
+                 outputs=outputs,
+                 extra_outputs=extra_outputs,
+             )
+@@ -506,16 +516,17 @@ class TupOnly(CommonBackend, PartialBack
+ 
+         base_input = mozpath.basename(input_file)
+         if base_input.endswith('.in'):
+             base_input = mozpath.splitext(base_input)[0]
+         output = mozpath.join(destdir, base_input) if destdir else base_input
+ 
+         backend_file.rule(
+             inputs=[input_file],
++            extra_inputs=[self._early_generated_files],
+             display='Preprocess %o',
+             cmd=cmd,
+             outputs=[output],
+         )
+ 
+     def _handle_ipdl_sources(self, ipdl_dir, sorted_ipdl_sources, sorted_nonstatic_ipdl_sources,
+                              sorted_static_ipdl_sources, unified_ipdl_cppsrcs_mapping):
+         # Preferably we wouldn't have to import ipdl, but we need to parse the

+ 90 - 0
rel-257/mozilla-esr60/patches/1445766-61a1.patch

@@ -0,0 +1,90 @@
+# HG changeset patch
+# User Ryan VanderMeulen <ryanvm@gmail.com>
+# Date 1521061409 14400
+# Node ID bfe4b0a2e835de50b680b787a32a4316f3cd9e22
+# Parent  0d6dd2674522e12d0cdef7f58a514ddf6589002d
+Bug 1445766 - Fix some non-unified build bustage in gfx/layers. r=lsalzman
+
+diff --git a/gfx/layers/TextureDIB.cpp b/gfx/layers/TextureDIB.cpp
+--- a/gfx/layers/TextureDIB.cpp
++++ b/gfx/layers/TextureDIB.cpp
+@@ -2,18 +2,19 @@
+ /* vim: set ts=8 sts=2 et sw=2 tw=80: */
+ /* This Source Code Form is subject to the terms of the Mozilla Public
+  * License, v. 2.0. If a copy of the MPL was not distributed with this
+  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+ 
+ #include "TextureDIB.h"
+ #include "gfx2DGlue.h"
+ #include "mozilla/gfx/DataSurfaceHelpers.h"  // For BufferSizeFromDimensions
++#include "mozilla/ipc/ProtocolUtils.h"
+ #include "mozilla/layers/ISurfaceAllocator.h"
+-#include "mozilla/ipc/ProtocolUtils.h"
++#include "mozilla/layers/TextureForwarder.h" // For LayersIPCChannel
+ 
+ namespace mozilla {
+ 
+ using namespace gfx;
+ 
+ namespace layers {
+ 
+ /**
+diff --git a/gfx/layers/client/SingleTiledContentClient.cpp b/gfx/layers/client/SingleTiledContentClient.cpp
+--- a/gfx/layers/client/SingleTiledContentClient.cpp
++++ b/gfx/layers/client/SingleTiledContentClient.cpp
+@@ -268,18 +268,20 @@ void ClientSingleTiledLayerBuffer::Paint
+ 
+   if (dtOnWhite) {
+     dt = gfx::Factory::CreateDualDrawTarget(dt, dtOnWhite);
+     dtOnWhite = nullptr;
+   }
+ 
+   if (asyncPaint) {
+     // Create a capture draw target
+-    RefPtr<DrawTargetCapture> captureDT = Factory::CreateCaptureDrawTarget(
+-        dt->GetBackendType(), dt->GetSize(), dt->GetFormat());
++    RefPtr<gfx::DrawTargetCapture> captureDT =
++      gfx::Factory::CreateCaptureDrawTarget(dt->GetBackendType(),
++                                            dt->GetSize(),
++                                            dt->GetFormat());
+ 
+     RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(captureDT);
+     if (!ctx) {
+       gfxDevCrash(gfx::LogReason::InvalidContext)
+           << "SingleTiledContextClient context problem " << gfx::hexa(dt);
+       return;
+     }
+     ctx->SetMatrix(
+diff --git a/gfx/layers/ipc/RefCountedShmem.cpp b/gfx/layers/ipc/RefCountedShmem.cpp
+--- a/gfx/layers/ipc/RefCountedShmem.cpp
++++ b/gfx/layers/ipc/RefCountedShmem.cpp
+@@ -68,26 +68,27 @@ int32_t RefCountedShm::Release(const Ref
+   auto* counter = aShm.buffer().get<Atomic<int32_t>>();
+   if (counter) {
+     return --(*counter);
+   }
+ 
+   return 0;
+ }
+ 
+-bool RefCountedShm::Alloc(IProtocol* aAllocator, size_t aSize,
++bool RefCountedShm::Alloc(mozilla::ipc::IProtocol* aAllocator, size_t aSize,
+                           RefCountedShmem& aShm) {
+   MOZ_ASSERT(!IsValid(aShm));
+   auto shmType = ipc::SharedMemory::SharedMemoryType::TYPE_BASIC;
+   auto size = aSize + SHM_REFCOUNT_HEADER_SIZE;
+   if (!aAllocator->AllocUnsafeShmem(size, shmType, &aShm.buffer())) {
+     return false;
+   }
+   return true;
+ }
+ 
+-void RefCountedShm::Dealloc(IProtocol* aAllocator, RefCountedShmem& aShm) {
++void RefCountedShm::Dealloc(mozilla::ipc::IProtocol* aAllocator,
++                            RefCountedShmem& aShm) {
+   aAllocator->DeallocShmem(aShm.buffer());
+   aShm.buffer() = ipc::Shmem();
+ }
+ 
+ }  // namespace layers
+ }  // namespace mozilla

+ 79 - 0
rel-257/mozilla-esr60/patches/1449623-1-61a1.patch

@@ -0,0 +1,79 @@
+# HG changeset patch
+# User Mike Shal <mshal@mozilla.com>
+# Date 1522186016 14400
+# Node ID 9a0ae010bb5acf43a861b2eee5c97839f9a89129
+# Parent  d4e1cab84d549fb2886dc1aebd9c72bfed03d658
+Bug 1449623 - Rework exports in the tup backend; r=chmanchester
+
+In some cases we need to export other environment variables, so make it
+easier to track them.
+
+MozReview-Commit-ID: 82OOlRTdhH0
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -57,29 +57,29 @@ class BackendTupfile(object):
+ 
+     def __init__(self, objdir, environment, topsrcdir, topobjdir):
+         self.topsrcdir = topsrcdir
+         self.objdir = objdir
+         self.relobjdir = mozpath.relpath(objdir, topobjdir)
+         self.environment = environment
+         self.name = mozpath.join(objdir, 'Tupfile')
+         self.rules_included = False
+-        self.shell_exported = False
+         self.defines = []
+         self.host_defines = []
+         self.delayed_generated_files = []
+         self.delayed_installed_files = []
+         self.per_source_flags = defaultdict(list)
+         self.local_flags = defaultdict(list)
+         self.sources = defaultdict(list)
+         self.host_sources = defaultdict(list)
+         self.variables = {}
+         self.static_lib = None
+         self.shared_lib = None
+         self.program = None
++        self.exports = set()
+ 
+         self.fh = FileAvoidWrite(self.name, capture_diff=True)
+         self.fh.write('# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT EDIT.\n')
+         self.fh.write('\n')
+ 
+     def write(self, buf):
+         self.fh.write(buf)
+ 
+@@ -152,23 +152,26 @@ class BackendTupfile(object):
+                 self.rule(
+                     cmd=cmd,
+                     inputs=[src],
+                     extra_inputs=extra_inputs,
+                     outputs=[prefix + '%B.o'],
+                     display='%s %%f' % compiler,
+                 )
+ 
++    def export(self, env):
++        for var in env:
++            if var not in self.exports:
++                self.exports.add(var)
++                self.write('export %s\n' % var)
++
+     def export_shell(self):
+-        if not self.shell_exported:
+-            # These are used by mach/mixin/process.py to determine the current
+-            # shell.
+-            for var in ('SHELL', 'MOZILLABUILD', 'COMSPEC'):
+-                self.write('export %s\n' % var)
+-            self.shell_exported = True
++        # These are used by mach/mixin/process.py to determine the current
++        # shell.
++        self.export(['SHELL', 'MOZILLABUILD', 'COMSPEC'])
+ 
+     def close(self):
+         return self.fh.close()
+ 
+     @property
+     def diff(self):
+         return self.fh.diff
+ 

+ 37 - 0
rel-257/mozilla-esr60/patches/1449623-2-61a1.patch

@@ -0,0 +1,37 @@
+# HG changeset patch
+# User Mike Shal <mshal@mozilla.com>
+# Date 1522261802 14400
+# Node ID 9d74dd42478a408a0b02f3301c62607ec6dae3c0
+# Parent  a42f07f14b4556b82709f2a111ceffa5b5eaaa7a
+Bug 1449623 - Export MOZ_BUILD_DATE for buildid.h; r=chmanchester
+
+MozReview-Commit-ID: HnlTcIKQwJC
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -507,16 +507,24 @@ class TupOnly(CommonBackend, PartialBack
+             full_inputs = [f.full_path for f in obj.inputs]
+             cmd.extend(full_inputs)
+             cmd.extend(shell_quote(f) for f in obj.flags)
+ 
+             outputs = []
+             outputs.extend(obj.outputs)
+             outputs.append('%s.pp' % obj.outputs[0])
+ 
++            extra_exports = {
++                'buildid.h': ['MOZ_BUILD_DATE'],
++            }
++            for f in obj.outputs:
++                exports = extra_exports.get(f)
++                if exports:
++                    backend_file.export(exports)
++
+             if any(f in obj.outputs for f in ('source-repo.h', 'buildid.h')):
+                 extra_outputs = [self._early_generated_files]
+             else:
+                 extra_outputs = [self._installed_files] if obj.required_for_compile else []
+                 full_inputs += [self._early_generated_files]
+ 
+             backend_file.rule(
+                 display='python {script}:{method} -> [%o]'.format(script=obj.script, method=obj.method),

+ 101 - 0
rel-257/mozilla-esr60/patches/1451529-61a1.patch

@@ -0,0 +1,101 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1522880919 25200
+# Node ID 1903ca3d1be1cf0f7c8263f92dfa14a0f5fa77c1
+# Parent  ec67f6a7023913a38413e6448e8d9c9109fc3a55
+Bug 1451529 - Install shared libs in the Tup backend. r=mshal
+
+MozReview-Commit-ID: Jn9Uk5XmFxJ
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -235,72 +235,78 @@ class TupOnly(CommonBackend, PartialBack
+         ]
+         return cmd
+ 
+     def _lib_paths(self, objdir, libs):
+         return [mozpath.relpath(mozpath.join(l.objdir, l.import_name), objdir)
+                 for l in libs]
+ 
+     def _gen_shared_library(self, backend_file):
+-        if backend_file.shared_lib.name == 'libxul.so':
++        shlib = backend_file.shared_lib
++        if shlib.name == 'libxul.so':
+             # This will fail to link currently due to missing rust symbols.
+             return
+ 
+-        if backend_file.shared_lib.cxx_link:
++        if shlib.cxx_link:
+             mkshlib = (
+                 [backend_file.environment.substs['CXX']] +
+                 backend_file.local_flags['CXX_LDFLAGS']
+             )
+         else:
+             mkshlib = (
+                 [backend_file.environment.substs['CC']] +
+                 backend_file.local_flags['C_LDFLAGS']
+             )
+ 
+         mkshlib += (
+             backend_file.environment.substs['DSO_PIC_CFLAGS'] +
+             [backend_file.environment.substs['DSO_LDOPTS']] +
+-            ['-Wl,-h,%s' % backend_file.shared_lib.soname] +
+-            ['-o', backend_file.shared_lib.lib_name]
++            ['-Wl,-h,%s' % shlib.soname] +
++            ['-o', shlib.lib_name]
+         )
+ 
+-        objs, _, shared_libs, os_libs, static_libs = self._expand_libs(backend_file.shared_lib)
++        objs, _, shared_libs, os_libs, static_libs = self._expand_libs(shlib)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
+ 
+-        list_file_name = '%s.list' % backend_file.shared_lib.name.replace('.', '_')
++        list_file_name = '%s.list' % shlib.name.replace('.', '_')
+         list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
+ 
+         inputs = objs + static_libs + shared_libs
+         if any(i.endswith('libxul.so') for i in inputs):
+             # Don't attempt to link anything that depends on libxul.
+             return
+ 
+         symbols_file = []
+-        if backend_file.shared_lib.symbols_file:
+-            inputs.append(backend_file.shared_lib.symbols_file)
++        if shlib.symbols_file:
++            inputs.append(shlib.symbols_file)
+             # TODO: Assumes GNU LD
+-            symbols_file = ['-Wl,--version-script,%s' % backend_file.shared_lib.symbols_file]
++            symbols_file = ['-Wl,--version-script,%s' % shlib.symbols_file]
+ 
+         cmd = (
+             mkshlib +
+             [list_file] +
+             backend_file.local_flags['LDFLAGS'] +
+             static_libs +
+             shared_libs +
+             symbols_file +
+             [backend_file.environment.substs['OS_LIBS']] +
+             os_libs
+         )
+         backend_file.rule(
+             cmd=cmd,
+             inputs=inputs,
+-            outputs=[backend_file.shared_lib.lib_name],
++            outputs=[shlib.lib_name],
+             display='LINK %o'
+         )
++        backend_file.symlink_rule(mozpath.join(backend_file.objdir,
++                                               shlib.lib_name),
++                                  output=mozpath.join(self.environment.topobjdir,
++                                                      shlib.install_target,
++                                                      shlib.lib_name))
+ 
+ 
+     def _gen_program(self, backend_file):
+         cc_or_cxx = 'CXX' if backend_file.program.cxx_link else 'CC'
+         objs, _, shared_libs, os_libs, static_libs = self._expand_libs(backend_file.program)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
+ 

+ 307 - 0
rel-257/mozilla-esr60/patches/1454771-1-61a1.patch

@@ -0,0 +1,307 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1524693018 25200
+# Node ID dee93aadc7215d19a1c75ea00ff05037755d1e0b
+# Parent  561bfe94e749fd26db1446707f741a8e4bfb64d7
+Bug 1454771 - Move tup invocation from Makefile.in to mach. r=mshal
+
+MozReview-Commit-ID: HkhK4oe93Vm
+
+diff --git a/python/mozbuild/mozbuild/backend/base.py b/python/mozbuild/mozbuild/backend/base.py
+--- a/python/mozbuild/mozbuild/backend/base.py
++++ b/python/mozbuild/mozbuild/backend/base.py
+@@ -189,17 +189,17 @@ class BuildBackend(LoggingMixin):
+ 
+         This is the main method used by child classes to react to build
+         metadata.
+         """
+ 
+     def consume_finished(self):
+         """Called when consume() has completed handling all objects."""
+ 
+-    def build(self, config, output, jobs, verbose):
++    def build(self, config, output, jobs, verbose, what=None):
+         """Called when 'mach build' is executed.
+ 
+         This should return the status value of a subprocess, where 0 denotes
+         success and any other value is an error code. A return value of None
+         indicates that the default 'make -f client.mk' should run.
+         """
+         return None
+ 
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -9,27 +9,29 @@ import sys
+ 
+ import mozpack.path as mozpath
+ from mozbuild.base import MozbuildObject
+ from mozbuild.backend.base import PartialBackend, HybridBackend
+ from mozbuild.backend.recursivemake import RecursiveMakeBackend
+ from mozbuild.shellutil import quote as shell_quote
+ from mozbuild.util import OrderedDefaultDict
+ from collections import defaultdict
++import multiprocessing
+ 
+ from mozpack.files import (
+     FileFinder,
+ )
+ 
+ from .common import CommonBackend
+ from ..frontend.data import (
+     ChromeManifestEntry,
+     ComputedFlags,
+     ContextDerived,
+     Defines,
++    DirectoryTraversal,
+     FinalTargetFiles,
+     FinalTargetPreprocessedFiles,
+     GeneratedFile,
+     GeneratedSources,
+     HostDefines,
+     HostSources,
+     JARManifest,
+     ObjdirFiles,
+@@ -186,17 +188,17 @@ class BackendTupfile(object):
+                 return True
+         return False
+ 
+     @property
+     def diff(self):
+         return self.fh.diff
+ 
+ 
+-class TupOnly(CommonBackend, PartialBackend):
++class TupBackend(CommonBackend):
+     """Backend that generates Tupfiles for the tup build system.
+     """
+ 
+     def _init(self):
+         CommonBackend._init(self)
+ 
+         self._backend_files = {}
+         self._cmd = MozbuildObject.from_environment()
+@@ -214,16 +216,32 @@ class TupOnly(CommonBackend, PartialBack
+         # will be built before any rules that list this as an input.
+         self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
+         self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
+         # The preprocessor including source-repo.h and buildid.h creates
+         # dependencies that aren't specified by moz.build and cause errors
+         # in Tup. Express these as a group dependency.
+         self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
+ 
++    def build(self, config, output, jobs, verbose, what=None):
++        if not what:
++            what = [self.environment.topobjdir]
++        args = [self.environment.substs['TUP'], 'upd'] + what
++        if self.environment.substs.get('MOZ_AUTOMATION'):
++            args += ['--quiet']
++        if verbose:
++            args += ['--verbose']
++        if jobs > 0:
++            args += ['-j%d' % jobs]
++        else:
++            args += ['-j%d' % multiprocessing.cpu_count()]
++        return config.run_process(args=args,
++                                  line_handler=output.on_line,
++                                  ensure_exit_code=False)
++
+     def _get_backend_file(self, relobjdir):
+         objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
+         if objdir not in self._backend_files:
+             self._backend_files[objdir] = \
+                     BackendTupfile(objdir, self.environment,
+                                    self.environment.topsrcdir, self.environment.topobjdir)
+         return self._backend_files[objdir]
+ 
+@@ -424,22 +442,18 @@ class TupOnly(CommonBackend, PartialBack
+         elif isinstance(obj, StaticLibrary):
+             backend_file.static_lib = obj
+         elif isinstance(obj, SharedLibrary):
+             backend_file.shared_lib = obj
+         elif isinstance(obj, HostProgram):
+             pass
+         elif isinstance(obj, Program):
+             backend_file.program = obj
+-
+-        # The top-level Makefile.in still contains our driver target and some
+-        # things related to artifact builds, so as a special case ensure the
+-        # make backend generates a Makefile there.
+-        if obj.objdir == self.environment.topobjdir:
+-            return False
++        elif isinstance(obj, DirectoryTraversal):
++            pass
+ 
+         return True
+ 
+     def consume_finished(self):
+         CommonBackend.consume_finished(self)
+ 
+         # The approach here is similar to fastermake.py, but we
+         # simply write out the resulting files here.
+@@ -791,16 +805,8 @@ class TupOnly(CommonBackend, PartialBack
+             extra_outputs=[self._installed_files],
+             check_unchanged=True,
+         )
+         backend_file.sources['.cpp'].extend(u[0] for u in unified_source_mapping)
+         backend_file.sources['.cpp'].extend(sorted(global_define_files))
+ 
+         test_backend_file = self._get_backend_file('dom/bindings/test')
+         test_backend_file.sources['.cpp'].extend(sorted('../%sBinding.cpp' % s for s in webidls.all_test_stems()))
+-
+-
+-class TupBackend(HybridBackend(TupOnly, RecursiveMakeBackend)):
+-    def build(self, config, output, jobs, verbose):
+-        status = config._run_make(directory=self.environment.topobjdir, target='tup',
+-                                  line_handler=output.on_line, log=False, print_directory=False,
+-                                  ensure_exit_code=False, num_jobs=jobs, silent=not verbose)
+-        return status
+diff --git a/python/mozbuild/mozbuild/controller/building.py b/python/mozbuild/mozbuild/controller/building.py
+--- a/python/mozbuild/mozbuild/controller/building.py
++++ b/python/mozbuild/mozbuild/controller/building.py
+@@ -956,25 +956,74 @@ class BuildDriver(MozbuildObject):
+                 return 1
+ 
+             if directory is not None:
+                 disable_extra_make_dependencies=True
+                 directory = mozpath.normsep(directory)
+                 if directory.startswith('/'):
+                     directory = directory[1:]
+ 
+-            status = None
++            def backend_out_of_date(backend_file):
++                dep_file = '%s.in' % backend_file
++                if not os.path.exists(backend_file):
++                    return True
++                if not os.path.exists(dep_file):
++                    return True
++
++                dep_files = None
++                with open(dep_file, 'r') as fh:
++                    dep_files = fh.read().splitlines()
++                if not dep_files:
++                    return True
++
++                mtime = os.path.getmtime(backend_file)
++                for f in dep_files:
++                    if os.path.getmtime(f) > mtime:
++                        return True
++
++                return False
++
++            def maybe_invoke_backend(active_backend):
++                # Attempt to bypass the make-oriented logic below. Note this
++                # will only succeed in case we're building with a non-make
++                # backend (Tup), and otherwise be harmless.
++                if active_backend:
++                    if 'Make' in active_backend:
++                        return None
++                    if backend_out_of_date(mozpath.join(self.topobjdir,
++                                                        'backend.%sBackend' %
++                                                        active_backend)):
++                        print('Build configuration changed. Regenerating backend.')
++                        args = [config.substs['PYTHON'],
++                                mozpath.join(self.topobjdir, 'config.status')]
++                        self.run_process(args, cwd=self.topobjdir)
++                    backend_cls = get_backend_class(active_backend)(config)
++                    return backend_cls.build(self, output, jobs, verbose, what)
++                return None
++
+             monitor.start_resource_recording()
+-            if what:
+-                top_make = os.path.join(self.topobjdir, 'Makefile')
+-                if not os.path.exists(top_make):
+-                    print('Your tree has not been configured yet. Please run '
+-                        '|mach build| with no arguments.')
+-                    return 1
++
++            config = None
++            try:
++                config = self.config_environment
++            except Exception:
++                pass
+ 
++            if config is None:
++                config_rc = self.configure(buildstatus_messages=True,
++                                           line_handler=output.on_line)
++                if config_rc != 0:
++                    return config_rc
++
++                config = self.config_environment
++
++            status = maybe_invoke_backend(config.substs.get('BUILD_BACKENDS',
++                                                            [None])[0])
++
++            if what and status is None:
+                 # Collect target pairs.
+                 target_pairs = []
+                 for target in what:
+                     path_arg = self._wrap_path_argument(target)
+ 
+                     if directory is not None:
+                         make_dir = os.path.join(self.topobjdir, directory)
+                         make_target = target
+@@ -1033,55 +1082,28 @@ class BuildDriver(MozbuildObject):
+                     status = self._run_make(directory=make_dir, target=make_target,
+                         line_handler=output.on_line, log=False, print_directory=False,
+                         ensure_exit_code=False, num_jobs=jobs, silent=not verbose,
+                         append_env={b'NO_BUILDSTATUS_MESSAGES': b'1'},
+                         keep_going=keep_going)
+ 
+                     if status != 0:
+                         break
+-            else:
+-                # Try to call the default backend's build() method. This will
+-                # run configure to determine BUILD_BACKENDS if it hasn't run
+-                # yet.
+-                config = None
+-                try:
+-                    config = self.config_environment
+-                except Exception:
+-                    config_rc = self.configure(buildstatus_messages=True,
+-                                               line_handler=output.on_line)
+-                    if config_rc != 0:
+-                        return config_rc
+ 
+-                    # Even if configure runs successfully, we may have trouble
+-                    # getting the config_environment for some builds, such as
+-                    # OSX Universal builds. These have to go through client.mk
+-                    # regardless.
+-                    try:
+-                        config = self.config_environment
+-                    except Exception:
+-                        pass
+-
+-                if config:
+-                    active_backend = config.substs.get('BUILD_BACKENDS', [None])[0]
+-                    if active_backend:
+-                        backend_cls = get_backend_class(active_backend)(config)
+-                        status = backend_cls.build(self, output, jobs, verbose)
+-
++            elif status is None:
+                 # If the backend doesn't specify a build() method, then just
+                 # call client.mk directly.
+-                if status is None:
+-                    status = self._run_client_mk(line_handler=output.on_line,
+-                                                 jobs=jobs,
+-                                                 verbose=verbose,
+-                                                 keep_going=keep_going)
++                status = self._run_client_mk(line_handler=output.on_line,
++                                             jobs=jobs,
++                                             verbose=verbose,
++                                             keep_going=keep_going)
+ 
+-                self.log(logging.WARNING, 'warning_summary',
+-                    {'count': len(monitor.warnings_database)},
+-                    '{count} compiler warnings present.')
++            self.log(logging.WARNING, 'warning_summary',
++                     {'count': len(monitor.warnings_database)},
++                     '{count} compiler warnings present.')
+ 
+             # Try to run the active build backend's post-build step, if possible.
+             try:
+                 config = self.config_environment
+                 active_backend = config.substs.get('BUILD_BACKENDS', [None])[0]
+                 if active_backend:
+                     backend_cls = get_backend_class(active_backend)(config)
+                     new_status = backend_cls.post_build(self, output, jobs, verbose, status)

+ 81 - 0
rel-257/mozilla-esr60/patches/1454771-2-61a1.patch

@@ -0,0 +1,81 @@
+# HG changeset patch
+# User Chris Manchester <cmanchester@mozilla.com>
+# Date 1524693342 25200
+# Node ID fc793911d371a449b30a81575e5e9a39c6f4f072
+# Parent  4f56b35e6df04c2f3d67e994bfe56c81916aaa21
+Bug 1454771 - Add mozconfig variables to the environment when running tup. r=mshal
+
+MozReview-Commit-ID: BneMu8DfKLY
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -3,19 +3,21 @@
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ from __future__ import absolute_import, unicode_literals
+ 
+ import os
+ import sys
+ 
+ import mozpack.path as mozpath
++from mozbuild import shellutil
+ from mozbuild.base import MozbuildObject
+ from mozbuild.backend.base import PartialBackend, HybridBackend
+ from mozbuild.backend.recursivemake import RecursiveMakeBackend
++from mozbuild.mozconfig import MozconfigLoader
+ from mozbuild.shellutil import quote as shell_quote
+ from mozbuild.util import OrderedDefaultDict
+ from collections import defaultdict
+ import multiprocessing
+ 
+ from mozpack.files import (
+     FileFinder,
+ )
+@@ -216,31 +218,45 @@ class TupBackend(CommonBackend):
+         # will be built before any rules that list this as an input.
+         self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
+         self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
+         # The preprocessor including source-repo.h and buildid.h creates
+         # dependencies that aren't specified by moz.build and cause errors
+         # in Tup. Express these as a group dependency.
+         self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
+ 
++    def _get_mozconfig_env(self, config):
++        env = {}
++        loader = MozconfigLoader(config.topsrcdir)
++        mozconfig = loader.read_mozconfig(config.substs['MOZCONFIG'])
++        make_extra = mozconfig['make_extra'] or []
++        env = {}
++        for line in make_extra:
++            if line.startswith('export '):
++                line = line[len('export '):]
++            key, value = line.split('=')
++            env[key] = value
++        return env
++
+     def build(self, config, output, jobs, verbose, what=None):
+         if not what:
+             what = [self.environment.topobjdir]
+         args = [self.environment.substs['TUP'], 'upd'] + what
+         if self.environment.substs.get('MOZ_AUTOMATION'):
+             args += ['--quiet']
+         if verbose:
+             args += ['--verbose']
+         if jobs > 0:
+             args += ['-j%d' % jobs]
+         else:
+             args += ['-j%d' % multiprocessing.cpu_count()]
+         return config.run_process(args=args,
+                                   line_handler=output.on_line,
+-                                  ensure_exit_code=False)
++                                  ensure_exit_code=False,
++                                  append_env=self._get_mozconfig_env(config))
+ 
+     def _get_backend_file(self, relobjdir):
+         objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
+         if objdir not in self._backend_files:
+             self._backend_files[objdir] = \
+                     BackendTupfile(objdir, self.environment,
+                                    self.environment.topsrcdir, self.environment.topobjdir)
+         return self._backend_files[objdir]

+ 172 - 0
rel-257/mozilla-esr60/patches/1454825-61a1.patch

@@ -0,0 +1,172 @@
+# HG changeset patch
+# User Mike Shal <mshal@mozilla.com>
+# Date 1524009159 14400
+# Node ID 559cd1e5c775b528fb71ac25c371520a4ee8ec01
+# Parent  f251fab6ad98dded5382968e9cd999636a199487
+Bug 1454825 - Tup backend: Handle dependent GENERATED_FILES better; r=chmanchester
+
+Work around the fact that tup is bad at handling out-of-order rules by
+delaying them based on what outputs we've already seen in rule().
+
+MozReview-Commit-ID: G2tyeQr7MTh
+
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -59,16 +59,17 @@ class BackendTupfile(object):
+         self.topsrcdir = topsrcdir
+         self.objdir = objdir
+         self.relobjdir = mozpath.relpath(objdir, topobjdir)
+         self.environment = environment
+         self.name = mozpath.join(objdir, 'Tupfile')
+         self.rules_included = False
+         self.defines = []
+         self.host_defines = []
++        self.outputs = set()
+         self.delayed_generated_files = []
+         self.delayed_installed_files = []
+         self.per_source_flags = defaultdict(list)
+         self.local_flags = defaultdict(list)
+         self.sources = defaultdict(list)
+         self.host_sources = defaultdict(list)
+         self.variables = {}
+         self.static_lib = None
+@@ -110,16 +111,18 @@ class BackendTupfile(object):
+             'inputs': ' '.join(inputs),
+             'extra_inputs': ' | ' + ' '.join(extra_inputs) if extra_inputs else '',
+             'display': '^%s^ ' % caret_text if caret_text else '',
+             'cmd': ' '.join(cmd),
+             'outputs': ' '.join(outputs),
+             'extra_outputs': ' | ' + ' '.join(extra_outputs) if extra_outputs else '',
+         })
+ 
++        self.outputs.update(outputs)
++
+     def symlink_rule(self, source, output=None, output_group=None):
+         outputs = [output] if output else [mozpath.basename(source)]
+         if output_group:
+             outputs.append(output_group)
+ 
+         # The !tup_ln macro does a symlink or file copy (depending on the
+         # platform) without shelling out to a subprocess.
+         self.rule(
+@@ -166,16 +169,28 @@ class BackendTupfile(object):
+     def export_shell(self):
+         # These are used by mach/mixin/process.py to determine the current
+         # shell.
+         self.export(['SHELL', 'MOZILLABUILD', 'COMSPEC'])
+ 
+     def close(self):
+         return self.fh.close()
+ 
++    def requires_delay(self, inputs):
++        # We need to delay the generated file rule in the Tupfile until the
++        # generated inputs in the current directory are processed. We do this by
++        # checking all ObjDirPaths to make sure they are in
++        # self.outputs, or are in other directories.
++        for f in inputs:
++            if (isinstance(f, ObjDirPath) and
++                f.target_basename not in self.outputs and
++                mozpath.dirname(f.full_path) == self.objdir):
++                return True
++        return False
++
+     @property
+     def diff(self):
+         return self.fh.diff
+ 
+ 
+ class TupOnly(CommonBackend, PartialBackend):
+     """Backend that generates Tupfiles for the tup build system.
+     """
+@@ -199,28 +214,16 @@ class TupOnly(CommonBackend, PartialBack
+         # will be built before any rules that list this as an input.
+         self._installed_idls = '$(MOZ_OBJ_ROOT)/<installed-idls>'
+         self._installed_files = '$(MOZ_OBJ_ROOT)/<installed-files>'
+         # The preprocessor including source-repo.h and buildid.h creates
+         # dependencies that aren't specified by moz.build and cause errors
+         # in Tup. Express these as a group dependency.
+         self._early_generated_files = '$(MOZ_OBJ_ROOT)/<early-generated-files>'
+ 
+-        # application.ini.h is a special case since we need to process
+-        # the FINAL_TARGET_PP_FILES for application.ini before running
+-        # the GENERATED_FILES script, and tup doesn't handle the rules
+-        # out of order. Similarly, dependentlibs.list uses libxul as
+-        # an input, so must be written after the rule for libxul.
+-        self._delayed_files = (
+-            'application.ini.h',
+-            'dependentlibs.list',
+-            'dependentlibs.list.gtest'
+-        )
+-
+-
+     def _get_backend_file(self, relobjdir):
+         objdir = mozpath.normpath(mozpath.join(self.environment.topobjdir, relobjdir))
+         if objdir not in self._backend_files:
+             self._backend_files[objdir] = \
+                     BackendTupfile(objdir, self.environment,
+                                    self.environment.topsrcdir, self.environment.topobjdir)
+         return self._backend_files[objdir]
+ 
+@@ -381,17 +384,17 @@ class TupOnly(CommonBackend, PartialBack
+ 
+             if self.environment.is_artifact_build:
+                 skip_files = self._compile_env_gen_files
+ 
+             for f in obj.outputs:
+                 if any(mozpath.match(f, p) for p in skip_files):
+                     return False
+ 
+-            if any([f in obj.outputs for f in self._delayed_files]):
++            if backend_file.requires_delay(obj.inputs):
+                 backend_file.delayed_generated_files.append(obj)
+             else:
+                 self._process_generated_file(backend_file, obj)
+         elif (isinstance(obj, ChromeManifestEntry) and
+               obj.install_target.startswith('dist/bin')):
+             top_level = mozpath.join(obj.install_target, 'chrome.manifest')
+             if obj.path != top_level:
+                 entry = 'manifest %s' % mozpath.relpath(obj.path,
+@@ -451,18 +454,18 @@ class TupOnly(CommonBackend, PartialBack
+                                           (backend_file.static_lib and backend_file.static_lib.no_expand_lib,
+                                            self._gen_static_library),
+                                           (backend_file.program, self._gen_program)):
+                 if condition:
+                     backend_file.export_shell()
+                     gen_method(backend_file)
+             for obj in backend_file.delayed_generated_files:
+                 self._process_generated_file(backend_file, obj)
+-            for path, output in backend_file.delayed_installed_files:
+-                backend_file.symlink_rule(path, output=output)
++            for path, output, output_group in backend_file.delayed_installed_files:
++                backend_file.symlink_rule(path, output=output, output_group=output_group)
+             with self._write_file(fh=backend_file):
+                 pass
+ 
+         with self._write_file(mozpath.join(self.environment.topobjdir, 'Tuprules.tup')) as fh:
+             acdefines_flags = ' '.join(['-D%s=%s' % (name, shell_quote(value))
+                 for (name, value) in sorted(self.environment.acdefines.iteritems())])
+             # TODO: AB_CD only exists in Makefiles at the moment.
+             acdefines_flags += ' -DAB_CD=en-US'
+@@ -604,18 +607,19 @@ class TupOnly(CommonBackend, PartialBack
+                     # We're not generating files in these directories yet, so
+                     # don't attempt to install files generated from them.
+                     if f.context.relobjdir not in ('layout/style/test',
+                                                    'toolkit/library',
+                                                    'js/src/shell'):
+                         output = mozpath.join('$(MOZ_OBJ_ROOT)', target, path,
+                                               f.target_basename)
+                         gen_backend_file = self._get_backend_file(f.context.relobjdir)
+-                        if f.target_basename in self._delayed_files:
+-                            gen_backend_file.delayed_installed_files.append((f.full_path, output))
++                        if gen_backend_file.requires_delay([f]):
++                            output_group = self._installed_files if f.target_basename.endswith('.h') else None
++                            gen_backend_file.delayed_installed_files.append((f.full_path, output, output_group))
+                         else:
+                             gen_backend_file.symlink_rule(f.full_path, output=output,
+                                                           output_group=self._installed_files)
+ 
+     def _process_final_target_pp_files(self, obj, backend_file):
+         for i, (path, files) in enumerate(obj.files.walk()):
+             for f in files:
+                 self._preprocess(backend_file, f.full_path,

+ 285 - 0
rel-257/mozilla-esr60/patches/1457524-1-61a1.patch

@@ -0,0 +1,285 @@
+# HG changeset patch
+# User Xidorn Quan <me@upsuper.org>
+# Date 1525225885 -36000
+# Node ID 619efecc323332781743562873290a894ee6bd29
+# Parent  acf54fd131992d757d122b00437653838a84a5ac
+Bug 1457524 part 1 - Use a list for rust tests. r=froydnj
+
+MozReview-Commit-ID: 6A0hHClXDUE
+
+diff --git a/build/templates.mozbuild b/build/templates.mozbuild
+--- a/build/templates.mozbuild
++++ b/build/templates.mozbuild
+@@ -125,17 +125,10 @@ def DisableStlWrapping():
+ @template
+ def NoVisibilityFlags():
+     COMPILE_FLAGS['VISIBILITY'] = []
+ 
+ @template
+ def AllowCompilerWarnings():
+     COMPILE_FLAGS['WARNINGS_AS_ERRORS'] = []
+ 
+-@template
+-def RustTest(name, features=None):
+-    RUST_TEST = name
+-
+-    if features:
+-        RUST_TEST_FEATURES = features
+-
+ include('gecko_templates.mozbuild')
+ include('test_templates.mozbuild')
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -969,24 +969,26 @@ force-cargo-library-build:
+ 
+ force-cargo-library-check:
+ 	$(call CARGO_CHECK,$(target_cargo_env_vars)) --lib $(cargo_target_flag) $(rust_features_flag)
+ else
+ force-cargo-library-check:
+ 	@true
+ endif # RUST_LIBRARY_FILE
+ 
+-ifdef RUST_TEST
++ifdef RUST_TESTS
++
++rust_test_options := $(foreach test,$(RUST_TESTS),-p $(test))
+ 
+ ifdef RUST_TEST_FEATURES
+ rust_features_flag := --features "$(RUST_TEST_FEATURES)"
+ endif
+ 
+ force-cargo-test-run:
+-	$(call RUN_CARGO,test $(cargo_target_flag) -p $(RUST_TEST) $(rust_features_flag),$(target_cargo_env_vars))
++	$(call RUN_CARGO,test $(cargo_target_flag) $(rust_test_options) $(rust_features_flag),$(target_cargo_env_vars))
+ 
+ check:: force-cargo-test-run
+ endif
+ 
+ ifdef HOST_RUST_LIBRARY_FILE
+ 
+ ifdef HOST_RUST_LIBRARY_FEATURES
+ host_rust_features_flag := --features "$(HOST_RUST_LIBRARY_FEATURES)"
+diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py
+--- a/python/mozbuild/mozbuild/backend/recursivemake.py
++++ b/python/mozbuild/mozbuild/backend/recursivemake.py
+@@ -59,17 +59,17 @@ from ..frontend.data import (
+     LocalizedPreprocessedFiles,
+     ObjdirFiles,
+     ObjdirPreprocessedFiles,
+     PerSourceFlag,
+     Program,
+     RustLibrary,
+     HostRustLibrary,
+     RustProgram,
+-    RustTest,
++    RustTests,
+     SharedLibrary,
+     SimpleProgram,
+     Sources,
+     StaticLibrary,
+     TestManifest,
+     VariablePassthru,
+     XPIDLFile,
+ )
+@@ -603,18 +603,18 @@ class RecursiveMakeBackend(CommonBackend
+             self._compile_graph[build_target]
+ 
+         elif isinstance(obj, HostRustProgram):
+             self._process_host_rust_program(obj, backend_file)
+             # Hook the program into the compile graph.
+             build_target = self._build_target_for_obj(obj)
+             self._compile_graph[build_target]
+ 
+-        elif isinstance(obj, RustTest):
+-            self._process_rust_test(obj, backend_file)
++        elif isinstance(obj, RustTests):
++            self._process_rust_tests(obj, backend_file)
+ 
+         elif isinstance(obj, Program):
+             self._process_program(obj, backend_file)
+             self._process_linked_libraries(obj, backend_file)
+             self._no_skip['syms'].add(backend_file.relobjdir)
+ 
+         elif isinstance(obj, HostProgram):
+             self._process_host_program(obj.program, backend_file)
+@@ -1144,20 +1144,20 @@ class RecursiveMakeBackend(CommonBackend
+                                         'RUST_PROGRAMS',
+                                         'RUST_CARGO_PROGRAMS')
+ 
+     def _process_host_rust_program(self, obj, backend_file):
+         self._process_rust_program_base(obj, backend_file,
+                                         'HOST_RUST_PROGRAMS',
+                                         'HOST_RUST_CARGO_PROGRAMS')
+ 
+-    def _process_rust_test(self, obj, backend_file):
++    def _process_rust_tests(self, obj, backend_file):
+         self._no_skip['check'].add(backend_file.relobjdir)
+         backend_file.write_once('CARGO_FILE := $(srcdir)/Cargo.toml\n')
+-        backend_file.write_once('RUST_TEST := %s\n' % obj.name)
++        backend_file.write_once('RUST_TESTS := %s\n' % ' '.join(obj.names))
+         backend_file.write_once('RUST_TEST_FEATURES := %s\n' % ' '.join(obj.features))
+ 
+     def _process_simple_program(self, obj, backend_file):
+         if obj.is_unit_test:
+             backend_file.write('CPP_UNIT_TESTS += %s\n' % obj.program)
+             assert obj.cxx_link
+         else:
+             backend_file.write('SIMPLE_PROGRAMS += %s\n' % obj.program)
+diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py
+--- a/python/mozbuild/mozbuild/frontend/context.py
++++ b/python/mozbuild/mozbuild/frontend/context.py
+@@ -1243,28 +1243,22 @@ VARIABLES = {
+ 
+     'HOST_RUST_LIBRARY_FEATURES': (List, list,
+         """Cargo features to activate for this host library.
+ 
+         This variable should not be used directly; you should be using the
+         HostRustLibrary template instead.
+         """),
+ 
+-    'RUST_TEST': (unicode, unicode,
+-        """Name of a Rust test to build and run via `cargo test`.
+-
+-        This variable should not be used directly; you should be using the
+-        RustTest template instead.
++    'RUST_TESTS': (TypedList(unicode), list,
++        """Names of Rust tests to build and run via `cargo test`.
+         """),
+ 
+-    'RUST_TEST_FEATURES': (List, list,
+-        """Cargo features to activate for RUST_TEST.
+-
+-        This variable should not be used directly; you should be using the
+-        RustTest template instead.
++    'RUST_TEST_FEATURES': (TypedList(unicode), list,
++        """Cargo features to activate for RUST_TESTS.
+         """),
+ 
+     'UNIFIED_SOURCES': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
+         """Source code files that can be compiled together.
+ 
+         This variable contains a list of source code files to compile,
+         that can be concatenated all together and built as a single source
+         file. This can help make the build faster and reduce the debug info
+diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py
+--- a/python/mozbuild/mozbuild/frontend/data.py
++++ b/python/mozbuild/mozbuild/frontend/data.py
+@@ -560,25 +560,25 @@ class RustProgram(BaseRustProgram):
+ 
+ 
+ class HostRustProgram(BaseRustProgram):
+     SUFFIX_VAR = 'HOST_BIN_SUFFIX'
+     KIND = 'host'
+     TARGET_SUBST_VAR = 'RUST_HOST_TARGET'
+ 
+ 
+-class RustTest(ContextDerived):
++class RustTests(ContextDerived):
+     __slots__ = (
+-        'name',
++        'names',
+         'features',
+     )
+ 
+-    def __init__(self, context, name, features):
++    def __init__(self, context, names, features):
+         ContextDerived.__init__(self, context)
+-        self.name = name
++        self.names = names
+         self.features = features
+ 
+ 
+ class BaseLibrary(Linkable):
+     """Generic context derived container object for libraries."""
+     __slots__ = (
+         'basename',
+         'lib_name',
+diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
+--- a/python/mozbuild/mozbuild/frontend/emitter.py
++++ b/python/mozbuild/mozbuild/frontend/emitter.py
+@@ -56,17 +56,17 @@ from .data import (
+     ObjdirFiles,
+     ObjdirPreprocessedFiles,
+     PerSourceFlag,
+     WebIDLCollection,
+     Program,
+     RustLibrary,
+     HostRustLibrary,
+     RustProgram,
+-    RustTest,
++    RustTests,
+     SharedLibrary,
+     SimpleProgram,
+     Sources,
+     StaticLibrary,
+     TestHarnessFiles,
+     TestManifest,
+     UnifiedSources,
+     VariablePassthru,
+@@ -1262,23 +1262,23 @@ class TreeMetadataEmitter(LoggingMixin):
+ 
+         for c in components:
+             if c.endswith('.manifest'):
+                 yield ChromeManifestEntry(context, 'chrome.manifest',
+                                           Manifest('components',
+                                                    mozpath.basename(c)))
+ 
+         if self.config.substs.get('MOZ_RUST_TESTS', None):
+-            rust_test = context.get('RUST_TEST', None)
+-            if rust_test:
++            rust_tests = context.get('RUST_TESTS', [])
++            if rust_tests:
+                 # TODO: more sophisticated checking of the declared name vs.
+                 # contents of the Cargo.toml file.
+                 features = context.get('RUST_TEST_FEATURES', [])
+ 
+-                yield RustTest(context, rust_test, features)
++                yield RustTests(context, rust_tests, features)
+ 
+         for obj in self._process_test_manifests(context):
+             yield obj
+ 
+         for obj in self._process_jar_manifests(context):
+             yield obj
+ 
+         for name, jar in context.get('JAVA_JAR_TARGETS', {}).items():
+diff --git a/testing/geckodriver/moz.build b/testing/geckodriver/moz.build
+--- a/testing/geckodriver/moz.build
++++ b/testing/geckodriver/moz.build
+@@ -1,17 +1,17 @@
+ # This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ RUST_PROGRAMS += ["geckodriver"]
+ 
+ # https://bugzil.la/1425365
+ if CONFIG["OS_ARCH"] != "WINNT":
+-    RustTest("geckodriver")
++    RUST_TESTS = ["geckodriver"]
+ 
+ with Files("**"):
+     BUG_COMPONENT = ("Testing", "Marionette")
+ 
+ SPHINX_TREES["geckodriver"] = "doc"
+ 
+ with Files('doc/**'):
+     SCHEDULES.exclusive = ['docs']
+diff --git a/toolkit/library/rust/moz.build b/toolkit/library/rust/moz.build
+--- a/toolkit/library/rust/moz.build
++++ b/toolkit/library/rust/moz.build
+@@ -5,9 +5,12 @@
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ include('gkrust-features.mozbuild')
+ 
+ RustLibrary('gkrust', gkrust_features, '..')
+ 
+ # Target directory doesn't matter a lot here, since we can't share panic=abort
+ # compilation artifacts with gkrust.
+-RustTest('stylo_tests', gkrust_features)
++RUST_TESTS = [
++    'stylo_tests',
++]
++RUST_TEST_FEATURES = gkrust_features

+ 35 - 0
rel-257/mozilla-esr60/patches/1457524-2-61a1.patch

@@ -0,0 +1,35 @@
+# HG changeset patch
+# User Xidorn Quan <me@upsuper.org>
+# Date 1525245205 -36000
+# Node ID e8616e9830d785506c79ed0280dc8486067c9d46
+# Parent  64fd09ce83eed7697114fb12eee971aba1de813a
+Bug 1457524 part 2 - Run all rust tests regardless of failures. r=froydnj
+
+MozReview-Commit-ID: K4ZhFOWd6gd
+
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -977,18 +977,21 @@ endif # RUST_LIBRARY_FILE
+ ifdef RUST_TESTS
+ 
+ rust_test_options := $(foreach test,$(RUST_TESTS),-p $(test))
+ 
+ ifdef RUST_TEST_FEATURES
+ rust_features_flag := --features "$(RUST_TEST_FEATURES)"
+ endif
+ 
++# Don't stop at the first failure. We want to list all failures together.
++rust_test_flag := --no-fail-fast
++
+ force-cargo-test-run:
+-	$(call RUN_CARGO,test $(cargo_target_flag) $(rust_test_options) $(rust_features_flag),$(target_cargo_env_vars))
++	$(call RUN_CARGO,test $(cargo_target_flag) $(rust_test_flag) $(rust_test_options) $(rust_features_flag),$(target_cargo_env_vars))
+ 
+ check:: force-cargo-test-run
+ endif
+ 
+ ifdef HOST_RUST_LIBRARY_FILE
+ 
+ ifdef HOST_RUST_LIBRARY_FEATURES
+ host_rust_features_flag := --features "$(HOST_RUST_LIBRARY_FEATURES)"

+ 82 - 0
rel-257/mozilla-esr60/patches/1457524-3-61a1.patch

@@ -0,0 +1,82 @@
+# HG changeset patch
+# User Xidorn Quan <me@upsuper.org>
+# Date 1525255324 -36000
+# Node ID 4340083e6691e1d2aaec806461fd8d355fcf451b
+# Parent  12c4ce3c0ac903e917c168ea527dff9d768d2019
+Bug 1457524 part 3 - Check rustdoc for rust tests. r=froydnj
+
+MozReview-Commit-ID: 4qRccUcXq6O
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -256,22 +256,33 @@ set_config('RUST_TARGET_ENV_NAME', rust_
+ set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
+ 
+ set_config('RUSTC_VERSION', depends(rustc_info)(lambda i: str(i.version)))
+ 
+ # Until we remove all the other Rust checks in old-configure.
+ add_old_configure_assignment('RUSTC', rustc)
+ add_old_configure_assignment('RUST_TARGET', rust_target_triple)
+ 
++# Rustdoc is required by Rust tests below.
++rustdoc = check_prog('RUSTDOC', add_rustup_path('rustdoc'), allow_missing=True)
++
+ # This option is separate from --enable-tests because Rust tests are particularly
+ # expensive in terms of compile time (especially for code in libxul).
+ option('--enable-rust-tests',
+        help='Enable building of Rust tests, and build-time execution of them')
+ 
+-set_config('MOZ_RUST_TESTS', depends('--enable-rust-tests')(lambda v: bool(v)))
++
++@depends('--enable-rust-tests', rustdoc)
++def rust_tests(enable_rust_tests, rustdoc):
++    if enable_rust_tests and not rustdoc:
++        die('--enable-rust-tests requires rustdoc')
++    return bool(enable_rust_tests)
++
++
++set_config('MOZ_RUST_TESTS', rust_tests)
+ 
+ option(env='WIN64_LINK', nargs=1, help='Path to link.exe that targets win64')
+ option(env='WIN64_LIB', nargs=1, help='Paths to libraries for the win64 linker')
+ 
+ set_config('WIN64_LINK', depends('WIN64_LINK')(lambda x: x))
+ set_config('WIN64_LIB', depends('WIN64_LIB')(lambda x: x))
+ 
+ 
+diff --git a/build/mozconfig.rust b/build/mozconfig.rust
+--- a/build/mozconfig.rust
++++ b/build/mozconfig.rust
+@@ -1,9 +1,10 @@
+ # Options to enable rust in automation builds.
+ 
+ TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
+ 
+ # Tell configure to use the tooltool rustc.
+ RUSTC="$TOOLTOOL_DIR/rustc/bin/rustc"
+ CARGO="$TOOLTOOL_DIR/rustc/bin/cargo"
++RUSTDOC="$TOOLTOOL_DIR/rustc/bin/rustdoc"
+ 
+ ac_add_options --enable-rust-simd
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -893,16 +893,17 @@ endif
+ 
+ # We use the + prefix to pass down the jobserver fds to cargo, but we
+ # don't use the prefix when make -n is used, so that cargo doesn't run
+ # in that case)
+ define RUN_CARGO
+ $(if $(findstring n,$(filter-out --%, $(MAKEFLAGS))),,+)env $(environment_cleaner) $(rust_unlock_unstable) $(rustflags_override) $(sccache_wrap) \
+ 	CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
+ 	RUSTC=$(RUSTC) \
++	RUSTDOC=$(RUSTDOC) \
+ 	MOZ_SRC=$(topsrcdir) \
+ 	MOZ_DIST=$(ABS_DIST) \
+ 	LIBCLANG_PATH="$(MOZ_LIBCLANG_PATH)" \
+ 	CLANG_PATH="$(MOZ_CLANG_PATH)" \
+ 	PKG_CONFIG_ALLOW_CROSS=1 \
+ 	RUST_BACKTRACE=full \
+ 	MOZ_TOPOBJDIR=$(topobjdir) \
+ 	$(cargo_incremental) \

+ 40 - 0
rel-257/mozilla-esr60/patches/1457524-4-61a1.patch

@@ -0,0 +1,40 @@
+# HG changeset patch
+# User Xidorn Quan <me@upsuper.org>
+# Date 1525259227 -36000
+# Node ID 904aaf73eb3a620cb2ea3f44ee35243e0b385ca9
+# Parent  504919daeab8d70c4fb613c356a26ca516440aec
+Bug 1457524 part 4 - Allow 16% false positives in test bloom::create_and_insert_some_stuff. r=heycam
+
+It seems that the result of hash algorithm used in bloom filter depends
+on the pointer length. On 64bit platforms, there are 135 false positives
+in the first part of that test, and 8 in the second part. However, on
+32bit platforms, the numbers become 157 and 16 correspondingly.
+
+16 is still less than 20% in the second part, so all fine, but 157 is
+slightly larger than 15% in the test assertion. Given it is what we are
+shipping, we probably should just accept this and loosen the assertion.
+
+MozReview-Commit-ID: 9kFXBzLFAzE
+
+diff --git a/servo/components/selectors/bloom.rs b/servo/components/selectors/bloom.rs
+--- a/servo/components/selectors/bloom.rs
++++ b/servo/components/selectors/bloom.rs
+@@ -320,17 +320,17 @@ fn create_and_insert_some_stuff() {
+ 
+     for i in 0_usize .. 1000 {
+         assert!(bf.might_contain(&i));
+     }
+ 
+     let false_positives =
+         (1001_usize .. 2000).filter(|i| bf.might_contain(i)).count();
+ 
+-    assert!(false_positives < 150, "{} is not < 150", false_positives); // 15%.
++    assert!(false_positives < 160, "{} is not < 160", false_positives); // 16%.
+ 
+     for i in 0_usize .. 100 {
+         bf.remove(&i);
+     }
+ 
+     for i in 100_usize .. 1000 {
+         assert!(bf.might_contain(&i));
+     }

+ 31 - 0
rel-257/mozilla-esr60/patches/1457524-5-61a1.patch

@@ -0,0 +1,31 @@
+# HG changeset patch
+# User Xidorn Quan <me@upsuper.org>
+# Date 1525226493 -36000
+# Node ID b4ac7ba11da57b93a53df945a1dae2bf21b214d2
+# Parent  d32b7b4964b3a8ebdebb5713d9e1bfdd788a06d2
+Bug 1457524 part 5 - Add crates with tests into the list of RUST_TESTS. r=froydnj,heycam
+
+MozReview-Commit-ID: AaENV1xKKTg
+
+diff --git a/toolkit/library/rust/moz.build b/toolkit/library/rust/moz.build
+--- a/toolkit/library/rust/moz.build
++++ b/toolkit/library/rust/moz.build
+@@ -6,11 +6,18 @@
+ 
+ include('gkrust-features.mozbuild')
+ 
+ RustLibrary('gkrust', gkrust_features, '..')
+ 
+ # Target directory doesn't matter a lot here, since we can't share panic=abort
+ # compilation artifacts with gkrust.
+ RUST_TESTS = [
++    'selectors',
++    'servo_arc',
+     'stylo_tests',
+ ]
+ RUST_TEST_FEATURES = gkrust_features
++
++if CONFIG['CPU_ARCH'] != 'x86':
++    # malloc_size_of_derive is a build dependency, so if we are doing
++    # cross-compile for x86, this may not run correctly.
++    RUST_TESTS += ['malloc_size_of_derive']

+ 28 - 0
rel-257/mozilla-esr60/patches/1457524-6-61a1.patch

@@ -0,0 +1,28 @@
+# HG changeset patch
+# User Xidorn Quan <me@upsuper.org>
+# Date 1525482247 -36000
+# Node ID a5832837830da61ee3ccd851d068b28a36951b0b
+# Parent  6c47c8fd6e9d32286aad9a7389a8ab903b2218d5
+Bug 1457524 followup - Unset RUSTDOC for no-compile environment and add it to mozconfigs.
+
+diff --git a/build/mozconfig.no-compile b/build/mozconfig.no-compile
+--- a/build/mozconfig.no-compile
++++ b/build/mozconfig.no-compile
+@@ -8,16 +8,17 @@ NO_CACHE=1
+ 
+ # Override any toolchain defines we've inherited from other mozconfigs.
+ unset CC
+ unset CXX
+ unset HOST_CC
+ unset HOST_CXX
+ unset RUSTC
+ unset CARGO
++unset RUSTDOC
+ unset MAKECAB
+ unset TOOLCHAIN_PREFIX
+ unset BINDGEN_CFLAGS
+ unset LLVM_CONFIG
+ unset WIN64_LINK
+ unset WIN64_LIB
+ 
+ unset MOZ_STDCXX_COMPAT

+ 257 - 0
rel-257/mozilla-esr60/patches/1458161-61a1.patch

@@ -0,0 +1,257 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1525138203 -32400
+# Node ID b115bb8f62e31ceb53e9f5c30e0224da0a8c603b
+# Parent  818c0f8c207d035ae2a2443b00b8296a86dbf1e8
+Bug 1458161 - Hook rust OOM handler. r=froydnj
+
+OOM rust crashes are currently not identified as such in crash reports
+because rust libstd handles the OOMs and panics itself.
+
+There are unstable ways to hook into this, which unfortunately are under
+active changes in rust 1.27, but we're currently on 1.24 and 1.27 is not
+released yet. The APIs didn't change between 1.24 and 1.26, so it's
+fine-ish to use them as long as we limit their use to those versions.
+
+As long as the Firefox versions we ship (as opposed to downstream) use
+the "right" version of rust, we're good to go.
+
+The APIs are in their phase of stabilization, so there shouldn't be too
+many variants of the code to support.
+
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -250,16 +250,18 @@ def rust_target_env_name(triple):
+ # We need this to form various Cargo environment variables, as there is no
+ # uppercase function in make, and we don't want to shell out just for
+ # converting a string to uppercase.
+ set_config('RUST_TARGET_ENV_NAME', rust_target_env_name)
+ 
+ # This is used for putting source info into symbol files.
+ set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
+ 
++set_config('RUSTC_VERSION', depends(rustc_info)(lambda i: str(i.version)))
++
+ # Until we remove all the other Rust checks in old-configure.
+ add_old_configure_assignment('RUSTC', rustc)
+ add_old_configure_assignment('RUST_TARGET', rust_target_triple)
+ 
+ # This option is separate from --enable-tests because Rust tests are particularly
+ # expensive in terms of compile time (especially for code in libxul).
+ option('--enable-rust-tests',
+        help='Enable building of Rust tests, and build-time execution of them')
+diff --git a/toolkit/library/gtest/rust/Cargo.toml b/toolkit/library/gtest/rust/Cargo.toml
+--- a/toolkit/library/gtest/rust/Cargo.toml
++++ b/toolkit/library/gtest/rust/Cargo.toml
+@@ -9,16 +9,17 @@ description = "Testing code for libgkrus
+ bindgen = ["gkrust-shared/bindgen"]
+ servo = ["gkrust-shared/servo"]
+ quantum_render = ["gkrust-shared/quantum_render"]
+ cubeb-remoting = ["gkrust-shared/cubeb-remoting"]
+ cubeb_pulse_rust = ["gkrust-shared/cubeb_pulse_rust"]
+ gecko_debug = ["gkrust-shared/gecko_debug"]
+ simd-accel = ["gkrust-shared/simd-accel"]
+ no-static-ideograph-encoder-tables = ["gkrust-shared/no-static-ideograph-encoder-tables"]
++oom_with_global_alloc = ["gkrust-shared/oom_with_global_alloc"]
+ 
+ [dependencies]
+ mp4parse-gtest = { path = "../../../../dom/media/gtest" }
+ nsstring-gtest = { path = "../../../../xpcom/rust/gtest/nsstring" }
+ xpcom-gtest = { path = "../../../../xpcom/rust/gtest/xpcom" }
+ gkrust-shared = { path = "../../rust/shared" }
+ 
+ [lib]
+diff --git a/toolkit/library/rust/Cargo.toml b/toolkit/library/rust/Cargo.toml
+--- a/toolkit/library/rust/Cargo.toml
++++ b/toolkit/library/rust/Cargo.toml
+@@ -9,16 +9,17 @@ description = "Rust code for libxul"
+ bindgen = ["gkrust-shared/bindgen"]
+ servo = ["gkrust-shared/servo"]
+ quantum_render = ["gkrust-shared/quantum_render"]
+ cubeb-remoting = ["gkrust-shared/cubeb-remoting"]
+ cubeb_pulse_rust = ["gkrust-shared/cubeb_pulse_rust"]
+ gecko_debug = ["gkrust-shared/gecko_debug"]
+ simd-accel = ["gkrust-shared/simd-accel"]
+ no-static-ideograph-encoder-tables = ["gkrust-shared/no-static-ideograph-encoder-tables"]
++oom_with_global_alloc = ["gkrust-shared/oom_with_global_alloc"]
+ 
+ [dependencies]
+ gkrust-shared = { path = "shared" }
+ 
+ [dev-dependencies]
+ stylo_tests = { path = "../../../servo/ports/geckolib/tests/" }
+ 
+ [lib]
+diff --git a/toolkit/library/rust/gkrust-features.mozbuild b/toolkit/library/rust/gkrust-features.mozbuild
+--- a/toolkit/library/rust/gkrust-features.mozbuild
++++ b/toolkit/library/rust/gkrust-features.mozbuild
+@@ -24,8 +24,13 @@ if CONFIG['MOZ_RUST_SIMD']:
+     gkrust_features += ['simd-accel']
+ 
+ # This feature is only supported on Linux and macOS, and this check needs to
+ # match MOZ_CUBEB_REMOTING in CubebUtils.cpp.
+ if (CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android') or CONFIG['OS_ARCH'] == 'Darwin':
+     gkrust_features += ['cubeb-remoting']
+ 
+ gkrust_features += ['no-static-ideograph-encoder-tables']
++
++# See details in toolkit/library/rust/shared/lib.rs
++# A string test is not the best thing, but it works well enough here.
++if CONFIG['RUSTC_VERSION'] < "1.27":
++    gkrust_features += ['oom_with_global_alloc']
+diff --git a/toolkit/library/rust/shared/Cargo.toml b/toolkit/library/rust/shared/Cargo.toml
+--- a/toolkit/library/rust/shared/Cargo.toml
++++ b/toolkit/library/rust/shared/Cargo.toml
+@@ -32,16 +32,17 @@ default = []
+ bindgen = ["geckoservo/bindgen"]
+ servo = ["geckoservo"]
+ quantum_render = ["webrender_bindings"]
+ cubeb-remoting = ["cubeb-sys", "audioipc-client", "audioipc-server"]
+ cubeb_pulse_rust = ["cubeb-sys", "cubeb-pulse"]
+ gecko_debug = ["geckoservo/gecko_debug", "nsstring/gecko_debug"]
+ simd-accel = ["encoding_c/simd-accel", "encoding_glue/simd-accel"]
+ no-static-ideograph-encoder-tables = ["encoding_c/no-static-ideograph-encoder-tables", "encoding_glue/no-static-ideograph-encoder-tables"]
++oom_with_global_alloc = []
+ 
+ [lib]
+ path = "lib.rs"
+ test = false
+ doctest = false
+ bench = false
+ doc = false
+ plugin = false
+diff --git a/toolkit/library/rust/shared/build.rs b/toolkit/library/rust/shared/build.rs
+new file mode 100644
+--- /dev/null
++++ b/toolkit/library/rust/shared/build.rs
+@@ -0,0 +1,8 @@
++fn main() {
++    // This is a rather awful thing to do, but we're only doing it on
++    // versions of rustc, >= 1.24 < 1.27, that are not going to change
++    // the unstable APIs we use from under us (1.26 being a beta as of
++    // writing, and close to release).
++    #[cfg(feature = "oom_with_global_alloc")]
++    println!("cargo:rustc-env=RUSTC_BOOTSTRAP=1");
++}
+diff --git a/toolkit/library/rust/shared/lib.rs b/toolkit/library/rust/shared/lib.rs
+--- a/toolkit/library/rust/shared/lib.rs
++++ b/toolkit/library/rust/shared/lib.rs
+@@ -1,12 +1,15 @@
+ // This Source Code Form is subject to the terms of the Mozilla Public
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
+ // file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
++#![cfg_attr(feature = "oom_with_global_alloc",
++            feature(global_allocator, alloc, alloc_system, allocator_api))]
++
+ #[cfg(feature="servo")]
+ extern crate geckoservo;
+ 
+ extern crate mp4parse_capi;
+ extern crate nsstring;
+ extern crate nserror;
+ extern crate xpcom;
+ extern crate netwerk_helper;
+@@ -82,8 +85,64 @@ pub extern "C" fn get_rust_panic_reason(
+             *reason = s as *const c_char;
+             *length = (*s).len();
+             true
+         } else {
+             false
+         }
+     }
+ }
++
++// Wrap the rust system allocator to override the OOM handler, redirecting
++// to Gecko's, which interacts with the crash reporter.
++// This relies on unstable APIs that have not changed between 1.24 and 1.27.
++// In 1.27, the API changed, so we'll need to adapt to those changes before
++// we can ship with 1.27. As of writing, there might still be further changes
++// to those APIs before 1.27 is released, so we wait for those.
++#[cfg(feature = "oom_with_global_alloc")]
++mod global_alloc {
++    extern crate alloc;
++    extern crate alloc_system;
++
++    use self::alloc::allocator::{Alloc, AllocErr, Layout};
++    use self::alloc_system::System;
++
++    pub struct GeckoHeap;
++
++    extern "C" {
++        fn GeckoHandleOOM(size: usize) -> !;
++    }
++
++    unsafe impl<'a> Alloc for &'a GeckoHeap {
++        unsafe fn alloc(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
++            System.alloc(layout)
++        }
++
++        unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout) {
++            System.dealloc(ptr, layout)
++        }
++
++        fn oom(&mut self, e: AllocErr) -> ! {
++            match e {
++                AllocErr::Exhausted { request } => unsafe { GeckoHandleOOM(request.size()) },
++                _ => System.oom(e),
++            }
++        }
++
++        unsafe fn realloc(
++            &mut self,
++            ptr: *mut u8,
++            layout: Layout,
++            new_layout: Layout,
++        ) -> Result<*mut u8, AllocErr> {
++            System.realloc(ptr, layout, new_layout)
++        }
++
++        unsafe fn alloc_zeroed(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> {
++            System.alloc_zeroed(layout)
++        }
++    }
++
++}
++
++#[cfg(feature = "oom_with_global_alloc")]
++#[global_allocator]
++static HEAP: global_alloc::GeckoHeap = global_alloc::GeckoHeap;
+diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
+--- a/toolkit/xre/nsAppRunner.cpp
++++ b/toolkit/xre/nsAppRunner.cpp
+@@ -230,16 +230,18 @@
+ #include "sandboxPermissions.h"
+ #endif
+ #endif
+ 
+ #ifdef MOZ_CODE_COVERAGE
+ #include "mozilla/CodeCoverageHandler.h"
+ #endif
+ 
++#include "mozilla/mozalloc_oom.h"
++
+ extern uint32_t gRestartMode;
+ extern void InstallSignalHandlers(const char* ProgramName);
+ 
+ #define FILE_COMPATIBILITY_INFO NS_LITERAL_CSTRING("compatibility.ini")
+ #define FILE_INVALIDATE_CACHES NS_LITERAL_CSTRING(".purgecaches")
+ #define FILE_STARTUP_INCOMPLETE NS_LITERAL_STRING(".startup-incomplete")
+ 
+ int gArgc;
+@@ -5171,8 +5173,14 @@ void OverrideDefaultLocaleIfNeeded() {
+   }
+ }
+ 
+ void XRE_EnableSameExecutableForContentProc() {
+   if (!PR_GetEnv("MOZ_SEPARATE_CHILD_PROCESS")) {
+     mozilla::ipc::GeckoChildProcessHost::EnableSameExecutableForContentProc();
+   }
+ }
++
++// Because rust doesn't handle weak symbols, this function wraps the weak
++// malloc_handle_oom for it.
++extern "C" void GeckoHandleOOM(size_t size) {
++  mozalloc_handle_oom(size);
++}

+ 28 - 0
rel-257/mozilla-esr60/patches/1464161-62a1.patch

@@ -0,0 +1,28 @@
+# HG changeset patch
+# User David Major <dmajor@mozilla.com>
+# Date 1527622669 14400
+# Node ID cb7aa98ed577830bb1603c7fab476f2568f633c3
+# Parent  fba30d75771c100fb63d89e6505cb409ecf52169
+Bug 1464161 - unset LINKER in mozconfig.no-compile. r=nalexander
+
+diff --git a/build/mozconfig.no-compile b/build/mozconfig.no-compile
+--- a/build/mozconfig.no-compile
++++ b/build/mozconfig.no-compile
+@@ -6,16 +6,17 @@ unset SCCACHE_VERBOSE_STATS
+ # In case it wasn't
+ NO_CACHE=1
+ 
+ # Override any toolchain defines we've inherited from other mozconfigs.
+ unset CC
+ unset CXX
+ unset HOST_CC
+ unset HOST_CXX
++unset LINKER
+ unset RUSTC
+ unset CARGO
+ unset RUSTDOC
+ unset MAKECAB
+ unset TOOLCHAIN_PREFIX
+ unset BINDGEN_CFLAGS
+ unset LLVM_CONFIG
+ unset WIN64_LINK

+ 58 - 0
rel-257/mozilla-esr60/patches/1467327-62a1.patch

@@ -0,0 +1,58 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1528333056 -32400
+# Node ID c557100a9ea864615954afb66b1f6f581246c298
+# Parent  efaef55caaee3f30ba79662f347557abfde84a8c
+Bug 1467327 - Use bootstrapped clang if no system clang is found. r=froydnj
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -633,32 +633,37 @@ def vc_compiler_path(host, target, vs_ma
+     paths = data.get(vc_target)
+     if not paths:
+         return
+     return paths
+ 
+ 
+ @depends(vc_compiler_path)
+ @imports('os')
++@imports(_from='os', _import='environ')
+ def toolchain_search_path(vc_compiler_path):
++    result = [environ.get('PATH')]
++
+     if vc_compiler_path:
+-        result = [os.environ.get('PATH')]
+         result.extend(vc_compiler_path)
+ 
+-        # Also add in the location to which `mach bootstrap` or
+-        # `mach artifact toolchain` installs clang.
+-        mozbuild_state_dir = os.environ.get('MOZBUILD_STATE_PATH',
+-                                            os.path.expanduser(os.path.join('~', '.mozbuild')))
+-        bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
+-        result.append(bootstrap_clang_path)
++    # Also add in the location to which `mach bootstrap` or
++    # `mach artifact toolchain` installs clang.
++    mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH',
++                                     os.path.expanduser(os.path.join('~', '.mozbuild')))
++    bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
++    result.append(bootstrap_clang_path)
+ 
++    if vc_compiler_path:
+         # We're going to alter PATH for good in windows.configure, but we also
+-        # need to do it for the valid_compiler() check below.
+-        os.environ['PATH'] = os.pathsep.join(result)
+-        return result
++        # need to do it for the valid_compiler() check below. This is only needed
++        # on Windows, where MSVC needs PATH set to find dlls.
++        environ['PATH'] = os.pathsep.join(result)
++
++    return result
+ 
+ 
+ @template
+ def default_c_compilers(host_or_target):
+     '''Template defining the set of default C compilers for the host and
+     target platforms.
+     `host_or_target` is either `host` or `target` (the @depends functions
+     from init.configure.

+ 694 - 0
rel-257/mozilla-esr60/patches/1469091-63a1.patch

@@ -0,0 +1,694 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1530770289 -32400
+# Node ID 531b966781e6b2c086a798b18cec231a26a9d3e5
+# Parent  44b9237f4c15de15f0e8282174113c39ddc59bca
+Bug 1469091 - Build the clang plugin as a host shared library. r=ted
+
+This adds just enough host shared library support for this one use case,
+but also takes shortcuts, because fully supporting host shared library
+is a deep rabbit hole I'm not ready to take just to fix --enable-lto
+--enable-clang-plugin on mac builds.
+
+One downside is that one my machine the plugin now takes > 80s to build,
+instead of 15s before, thanks to the lack of unified sources.
+
+diff --git a/build/clang-plugin/Makefile.in b/build/clang-plugin/Makefile.in
+--- a/build/clang-plugin/Makefile.in
++++ b/build/clang-plugin/Makefile.in
+@@ -1,23 +1,18 @@
+ # This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+ include $(topsrcdir)/config/config.mk
+ 
+-# In the current moz.build world, we need to override essentially every
+-# variable to limit ourselves to what we need to build the clang plugin.
++HOST_LDFLAGS := $(LLVM_LDFLAGS) $(CLANG_LDFLAGS)
++
+ ifneq ($(HOST_OS_ARCH),WINNT)
+-DSO_LDOPTS := -shared
+-endif
+-
+-ifeq ($(HOST_OS_ARCH)_$(OS_ARCH),Linux_Darwin)
+-# Use the host compiler instead of the target compiler.
+-CXX := $(HOST_CXX)
++HOST_LDFLAGS += -shared
+ endif
+ 
+ # Use the default OS X deployment target to enable using the libc++ headers
+ # correctly.  Note that the binary produced here is a host tool and doesn't need
+ # to be distributed.
+ MACOSX_DEPLOYMENT_TARGET :=
+ 
+ # Temporarily relax the requirements for libstdc++ symbol versions on static
+diff --git a/build/clang-plugin/moz.build b/build/clang-plugin/moz.build
+--- a/build/clang-plugin/moz.build
++++ b/build/clang-plugin/moz.build
+@@ -1,19 +1,19 @@
+ # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+ # vim: set filetype=python:
+ # This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ 
+-SharedLibrary('clang-plugin')
++HostSharedLibrary('clang-plugin')
+ 
+-SOURCES += ['!ThirdPartyPaths.cpp']
++HOST_SOURCES += ['!ThirdPartyPaths.cpp']
+ 
+-UNIFIED_SOURCES += [
++HOST_SOURCES += [
+     'ArithmeticArgChecker.cpp',
+     'AssertAssignmentChecker.cpp',
+     'CanRunScriptChecker.cpp',
+     'CustomTypeAnnotation.cpp',
+     'DanglingOnTemporaryChecker.cpp',
+     'DiagnosticsMatcher.cpp',
+     'ExplicitImplicitChecker.cpp',
+     'ExplicitOperatorBoolChecker.cpp',
+@@ -38,58 +38,44 @@ UNIFIED_SOURCES += [
+     'RefCountedInsideLambdaChecker.cpp',
+     'ScopeChecker.cpp',
+     'SprintfLiteralChecker.cpp',
+     'TrivialCtorDtorChecker.cpp',
+     'VariableUsageHelpers.cpp',
+ ]
+ 
+ if CONFIG['ENABLE_MOZSEARCH_PLUGIN']:
+-    UNIFIED_SOURCES += [
++    HOST_SOURCES += [
+         'mozsearch-plugin/FileOperations.cpp',
+         'mozsearch-plugin/JSONFormatter.cpp',
+         'mozsearch-plugin/MozsearchIndexer.cpp',
+         'mozsearch-plugin/StringOperations.cpp',
+     ]
+ 
+ GENERATED_FILES += ['ThirdPartyPaths.cpp']
+ third_party_paths = GENERATED_FILES['ThirdPartyPaths.cpp']
+ third_party_paths.script = "ThirdPartyPaths.py:generate"
+ third_party_paths.inputs = [
+     '/tools/rewriting/ThirdPartyPaths.txt',
+ ]
+ 
+-DisableStlWrapping()
+-NoVisibilityFlags()
++HOST_COMPILE_FLAGS['STL'] = []
++HOST_COMPILE_FLAGS['VISIBILITY'] = []
+ 
+ # libc++ is required to build plugins against clang on OS X.
+ if CONFIG['HOST_OS_ARCH'] == 'Darwin':
+-    CXXFLAGS += ['-stdlib=libc++']
+-    LDFLAGS += ['-lc++']
++    HOST_CXXFLAGS += ['-stdlib=libc++']
++    HOST_LDFLAGS += ['-lc++']
+ 
+ DIRS += [
+     'tests',
+ ]
+ 
+ 
+ # In the current moz.build world, we need to override essentially every
+ # variable to limit ourselves to what we need to build the clang plugin.
+ if CONFIG['HOST_OS_ARCH'] == 'WINNT':
+     extra_cxxflags = ['-GR-', '-EHsc']
+ else:
+     extra_cxxflags = ['-fno-rtti', '-fno-exceptions']
+ 
+ if CONFIG['LLVM_CXXFLAGS']:
+-    COMPILE_FLAGS['OS_CXXFLAGS'] = CONFIG['LLVM_CXXFLAGS'] + extra_cxxflags
+-
+-COMPILE_FLAGS['CLANG_PLUGIN'] = []
+-COMPILE_FLAGS['OPTIMIZE'] = []
+-COMPILE_FLAGS['DEBUG'] = []
+-COMPILE_FLAGS['OS_COMPILE_CXXFLAGS'] = []
+-
+-LINK_FLAGS['OS'] = CONFIG['LLVM_LDFLAGS'] + CONFIG['CLANG_LDFLAGS']
+-# The ldflags above override most other categories.
+-for var in ('LINKER', 'OPTIMIZE'):
+-    LINK_FLAGS[var] = []
+-
+-if CONFIG['HOST_OS_ARCH'] == 'Linux' and CONFIG['OS_ARCH'] == 'Darwin':
+-    # Don't pass OSX linker arguments.
+-    LINK_FLAGS['FIX_LINK_PATHS'] = []
++    HOST_COMPILE_FLAGS['HOST_CXXFLAGS'] = CONFIG['LLVM_CXXFLAGS'] + extra_cxxflags
+diff --git a/build/templates.mozbuild b/build/templates.mozbuild
+--- a/build/templates.mozbuild
++++ b/build/templates.mozbuild
+@@ -99,16 +99,27 @@ def HostSimplePrograms(names, ext='.cpp'
+     Those have a single source with the same base name as the executable.
+     '''
+     HOST_SIMPLE_PROGRAMS += names
+     HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
+         for name in names]
+ 
+ 
+ @template
++def HostSharedLibrary(name):
++    '''Template for build tools libraries.'''
++    if name != 'clang-plugin':
++        error('Please make sure host shared library support is complete '
++              'before using for something else than the clang plugin')
++
++    HOST_LIBRARY_NAME = name
++
++    FORCE_SHARED_LIB = True
++
++@template
+ def HostLibrary(name):
+     '''Template for build tools libraries.'''
+     HOST_LIBRARY_NAME = name
+ 
+ @template
+ def HostRustLibrary(name, features=None):
+     '''Template for host Rust libraries.'''
+     HostLibrary(name)
+diff --git a/config/recurse.mk b/config/recurse.mk
+--- a/config/recurse.mk
++++ b/config/recurse.mk
+@@ -167,25 +167,25 @@ accessible/xpcom/export: xpcom/xpidl/exp
+ 
+ # The widget binding generator code is part of the annotationProcessors.
+ widget/android/bindings/export: build/annotationProcessors/export
+ 
+ # .xpt generation needs the xpidl lex/yacc files
+ xpcom/xpidl/export: xpcom/idl-parser/xpidl/export
+ 
+ ifdef ENABLE_CLANG_PLUGIN
+-$(filter-out config/host build/unix/stdc++compat/% build/clang-plugin/%,$(compile_targets)): build/clang-plugin/target build/clang-plugin/tests/target
+-build/clang-plugin/tests/target: build/clang-plugin/target
++$(filter-out config/host build/unix/stdc++compat/% build/clang-plugin/%,$(compile_targets)): build/clang-plugin/host build/clang-plugin/tests/target
++build/clang-plugin/tests/target: build/clang-plugin/host
+ endif
+ 
+ # Interdependencies that moz.build world don't know about yet for compilation.
+ # Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
+ ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
+ toolkit/library/target: widget/gtk/mozgtk/gtk3/target
+ endif
+ ifdef MOZ_LDAP_XPCOM
+ ldap/target: security/target mozglue/build/target
+ toolkit/library/target: ldap/target
+ endif
+ endif
+ # Most things are built during compile (target/host), but some things happen during export
+ # Those need to depend on config/export for system wrappers.
+-$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/target: config/export
++$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/host: config/export
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -186,17 +186,17 @@ endif
+ ifdef MOZ_PROFILE_GENERATE
+ $(foreach category,$(INSTALL_TARGETS),\
+   $(eval $(category)_FILES := $(foreach file,$($(category)_FILES),$(if $(filter $(SIMPLE_PROGRAMS),$(notdir $(file))),,$(file)))))
+ SIMPLE_PROGRAMS :=
+ endif
+ 
+ ifdef COMPILE_ENVIRONMENT
+ ifndef TARGETS
+-TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS)
++TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_SHARED_LIBRARY)
+ endif
+ 
+ COBJS = $(notdir $(CSRCS:.c=.$(OBJ_SUFFIX)))
+ SOBJS = $(notdir $(SSRCS:.S=.$(OBJ_SUFFIX)))
+ # CPPSRCS can have different extensions (eg: .cpp, .cc)
+ CPPOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(CPPSRCS))))
+ CMOBJS = $(notdir $(CMSRCS:.m=.$(OBJ_SUFFIX)))
+ CMMOBJS = $(notdir $(CMMSRCS:.mm=.$(OBJ_SUFFIX)))
+@@ -220,16 +220,17 @@ endif
+ else
+ LIBRARY :=
+ SHARED_LIBRARY :=
+ IMPORT_LIBRARY :=
+ REAL_LIBRARY :=
+ PROGRAM :=
+ SIMPLE_PROGRAMS :=
+ HOST_LIBRARY :=
++HOST_SHARED_LIBRARY :=
+ HOST_PROGRAM :=
+ HOST_SIMPLE_PROGRAMS :=
+ endif
+ 
+ ALL_TRASH = \
+ 	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
+ 	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
+ 	$(OBJS:.$(OBJ_SUFFIX)=.i) $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
+@@ -442,17 +443,17 @@ everything::
+ GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(MOZILLA_DIR)/config/config.mk
+ 
+ ##############################################
+ ifdef COMPILE_ENVIRONMENT
+ OBJ_TARGETS = $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS)
+ 
+ compile:: host target
+ 
+-host:: $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_RUST_PROGRAMS) $(HOST_RUST_LIBRARY_FILE)
++host:: $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_RUST_PROGRAMS) $(HOST_RUST_LIBRARY_FILE) $(HOST_SHARED_LIBRARY)
+ 
+ target:: $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(RUST_LIBRARY_FILE) $(RUST_PROGRAMS)
+ 
+ ifndef LIBRARY
+ ifdef OBJS
+ target:: $(OBJS)
+ endif
+ endif
+@@ -680,16 +681,26 @@ ifeq ($(OS_ARCH),WINNT)
+ $(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
+ endif
+ 
+ $(HOST_LIBRARY): $(HOST_OBJS) Makefile
+ 	$(REPORT_BUILD)
+ 	$(RM) $@
+ 	$(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
+ 
++$(HOST_SHARED_LIBRARY): $(HOST_OBJS) Makefile
++	$(REPORT_BUILD)
++	$(RM) $@
++ifdef _MSC_VER
++	# /!\ We assume host and target are using the same compiler
++	$(LINKER) -NOLOGO -DLL -OUT:$@ $(HOST_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++else
++	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++endif
++
+ # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
+ # so instead of deleting .o files after repacking them into a dylib, we make
+ # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
+ # so no need to conditionalize on OS version or debugging format.
+ 
+ $(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifndef INCREMENTAL_LINKER
+diff --git a/moz.configure b/moz.configure
+--- a/moz.configure
++++ b/moz.configure
+@@ -213,16 +213,18 @@ def library_name_info_template(host_or_t
+ 
+     return library_name_info_impl
+ 
+ host_library_name_info = library_name_info_template(host)
+ library_name_info = library_name_info_template(target)
+ 
+ set_config('DLL_PREFIX', library_name_info.dll.prefix)
+ set_config('DLL_SUFFIX', library_name_info.dll.suffix)
++set_config('HOST_DLL_PREFIX', host_library_name_info.dll.prefix)
++set_config('HOST_DLL_SUFFIX', host_library_name_info.dll.suffix)
+ set_config('LIB_PREFIX', library_name_info.lib.prefix)
+ set_config('LIB_SUFFIX', library_name_info.lib.suffix)
+ set_config('RUST_LIB_PREFIX', library_name_info.rust_lib.prefix)
+ set_config('RUST_LIB_SUFFIX', library_name_info.rust_lib.suffix)
+ set_config('OBJ_SUFFIX', library_name_info.obj.suffix)
+ # Lots of compilation tests depend on this variable being present.
+ add_old_configure_assignment('OBJ_SUFFIX', library_name_info.obj.suffix)
+ set_config('IMPORT_LIB_SUFFIX', library_name_info.import_lib.suffix)
+@@ -290,17 +292,18 @@ set_config('LINK_GTEST_DURING_COMPILE', 
+ # ==============================================================
+ option('--enable-ui-locale', default='en-US',
+        help='Select the user interface locale (default: en-US)')
+ 
+ set_config('MOZ_UI_LOCALE', depends('--enable-ui-locale')(lambda x: x))
+ 
+ # clang-plugin location
+ # ==============================================================
+-@depends(library_name_info, check_build_environment, when='--enable-clang-plugin')
++@depends(host_library_name_info, check_build_environment,
++         when='--enable-clang-plugin')
+ def clang_plugin_path(library_name_info, build_env):
+     topobjdir = build_env.topobjdir
+     if topobjdir.endswith('/js/src'):
+         topobjdir = topobjdir[:-7]
+     return os.path.abspath(
+         os.path.join(topobjdir, 'build', 'clang-plugin',
+                      '%sclang-plugin%s' % (library_name_info.dll.prefix,
+                                            library_name_info.dll.suffix))
+diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py
+--- a/python/mozbuild/mozbuild/backend/common.py
++++ b/python/mozbuild/mozbuild/backend/common.py
+@@ -23,16 +23,17 @@ from mozbuild.frontend.data import (
+     ChromeManifestEntry,
+     ConfigFileSubstitution,
+     Exports,
+     FinalTargetPreprocessedFiles,
+     FinalTargetFiles,
+     GeneratedSources,
+     GnProjectData,
+     HostLibrary,
++    HostGeneratedSources,
+     HostRustLibrary,
+     IPDLCollection,
+     RustLibrary,
+     SharedLibrary,
+     StaticLibrary,
+     UnifiedSources,
+     XPIDLFile,
+     WebIDLCollection,
+@@ -152,17 +153,17 @@ class CommonBackend(BuildBackend):
+         elif isinstance(obj, BaseProgram):
+             self._binaries.programs.append(obj)
+             return False
+ 
+         elif isinstance(obj, SharedLibrary):
+             self._binaries.shared_libraries.append(obj)
+             return False
+ 
+-        elif isinstance(obj, GeneratedSources):
++        elif isinstance(obj, (GeneratedSources, HostGeneratedSources)):
+             self._handle_generated_sources(obj.files)
+             return False
+ 
+         elif isinstance(obj, Exports):
+             objdir_files = [f.full_path for path, files in obj.files.walk() for f in files if isinstance(f, ObjDirPath)]
+             if objdir_files:
+                 self._handle_generated_sources(objdir_files)
+             return False
+diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py
+--- a/python/mozbuild/mozbuild/backend/configenvironment.py
++++ b/python/mozbuild/mozbuild/backend/configenvironment.py
+@@ -132,16 +132,18 @@ class ConfigEnvironment(object):
+         self.lib_prefix = self.substs.get('LIB_PREFIX', '')
+         self.rust_lib_prefix = self.substs.get('RUST_LIB_PREFIX', '')
+         if 'LIB_SUFFIX' in self.substs:
+             self.lib_suffix = '.%s' % self.substs['LIB_SUFFIX']
+         if 'RUST_LIB_SUFFIX' in self.substs:
+             self.rust_lib_suffix = '.%s' % self.substs['RUST_LIB_SUFFIX']
+         self.dll_prefix = self.substs.get('DLL_PREFIX', '')
+         self.dll_suffix = self.substs.get('DLL_SUFFIX', '')
++        self.host_dll_prefix = self.substs.get('HOST_DLL_PREFIX', '')
++        self.host_dll_suffix = self.substs.get('HOST_DLL_SUFFIX', '')
+         if self.substs.get('IMPORT_LIB_SUFFIX'):
+             self.import_prefix = self.lib_prefix
+             self.import_suffix = '.%s' % self.substs['IMPORT_LIB_SUFFIX']
+         else:
+             self.import_prefix = self.dll_prefix
+             self.import_suffix = self.dll_suffix
+         self.bin_suffix = self.substs.get('BIN_SUFFIX', '')
+ 
+diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py
+--- a/python/mozbuild/mozbuild/backend/recursivemake.py
++++ b/python/mozbuild/mozbuild/backend/recursivemake.py
+@@ -39,16 +39,17 @@ from ..frontend.data import (
+     Defines,
+     DirectoryTraversal,
+     ExternalLibrary,
+     FinalTargetFiles,
+     FinalTargetPreprocessedFiles,
+     GeneratedFile,
+     GeneratedSources,
+     HostDefines,
++    HostGeneratedSources,
+     HostLibrary,
+     HostProgram,
+     HostRustProgram,
+     HostSimpleProgram,
+     HostSources,
+     InstallationTarget,
+     JARManifest,
+     JavaJarData,
+@@ -57,16 +58,17 @@ from ..frontend.data import (
+     LocalInclude,
+     LocalizedFiles,
+     LocalizedPreprocessedFiles,
+     ObjdirFiles,
+     ObjdirPreprocessedFiles,
+     PerSourceFlag,
+     Program,
+     RustLibrary,
++    HostSharedLibrary,
+     HostRustLibrary,
+     RustProgram,
+     RustTests,
+     SharedLibrary,
+     SimpleProgram,
+     Sources,
+     StaticLibrary,
+     TestManifest,
+@@ -472,26 +474,32 @@ class RecursiveMakeBackend(CommonBackend
+                 variables.append('GARBAGE')
+                 base = backend_file.objdir
+             else:
+                 base = backend_file.srcdir
+             for f in sorted(obj.files):
+                 f = mozpath.relpath(f, base)
+                 for var in variables:
+                     backend_file.write('%s += %s\n' % (var, f))
+-        elif isinstance(obj, HostSources):
++        elif isinstance(obj, (HostSources, HostGeneratedSources)):
+             suffix_map = {
+                 '.c': 'HOST_CSRCS',
+                 '.mm': 'HOST_CMMSRCS',
+                 '.cpp': 'HOST_CPPSRCS',
+             }
+-            var = suffix_map[obj.canonical_suffix]
++            variables = [suffix_map[obj.canonical_suffix]]
++            if isinstance(obj, GeneratedSources):
++                variables.append('GARBAGE')
++                base = backend_file.objdir
++            else:
++                base = backend_file.srcdir
+             for f in sorted(obj.files):
+-                backend_file.write('%s += %s\n' % (
+-                    var, mozpath.relpath(f, backend_file.srcdir)))
++                f = mozpath.relpath(f, base)
++                for var in variables:
++                    backend_file.write('%s += %s\n' % (var, f))
+         elif isinstance(obj, VariablePassthru):
+             # Sorted so output is consistent and we don't bump mtimes.
+             for k, v in sorted(obj.variables.items()):
+                 if k == 'HAS_MISC_RULE':
+                     self._no_skip['misc'].add(backend_file.relobjdir)
+                     continue
+                 if isinstance(v, list):
+                     for item in v:
+@@ -670,16 +678,20 @@ class RecursiveMakeBackend(CommonBackend
+         elif isinstance(obj, StaticLibrary):
+             self._process_static_library(obj, backend_file)
+             self._process_linked_libraries(obj, backend_file)
+ 
+         elif isinstance(obj, HostLibrary):
+             self._process_host_library(obj, backend_file)
+             self._process_linked_libraries(obj, backend_file)
+ 
++        elif isinstance(obj, HostSharedLibrary):
++            self._process_host_shared_library(obj, backend_file)
++            self._process_linked_libraries(obj, backend_file)
++
+         elif isinstance(obj, ObjdirFiles):
+             self._process_objdir_files(obj, obj.files, backend_file)
+ 
+         elif isinstance(obj, ObjdirPreprocessedFiles):
+             self._process_final_target_pp_files(obj, obj.files, backend_file, 'OBJDIR_PP_FILES')
+ 
+         elif isinstance(obj, LocalizedFiles):
+             self._process_localized_files(obj, obj.files, backend_file)
+@@ -1302,16 +1314,19 @@ class RecursiveMakeBackend(CommonBackend
+         target_dir = mozpath.normpath(target_dir)
+         backend_file.write('CARGO_TARGET_DIR := %s\n' % target_dir)
+         if libdef.features:
+             backend_file.write('%s := %s\n' % (libdef.FEATURES_VAR, ' '.join(libdef.features)))
+ 
+     def _process_host_library(self, libdef, backend_file):
+         backend_file.write('HOST_LIBRARY_NAME = %s\n' % libdef.basename)
+ 
++    def _process_host_shared_library(self, libdef, backend_file):
++        backend_file.write('HOST_SHARED_LIBRARY = %s\n' % libdef.lib_name)
++
+     def _build_target_for_obj(self, obj):
+         return '%s/%s' % (mozpath.relpath(obj.objdir,
+             self.environment.topobjdir), obj.KIND)
+ 
+     def _process_linked_libraries(self, obj, backend_file):
+         def pretty_relpath(lib):
+             return '$(DEPTH)/%s' % mozpath.relpath(lib.objdir, topobjdir)
+ 
+diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py
+--- a/python/mozbuild/mozbuild/frontend/context.py
++++ b/python/mozbuild/mozbuild/frontend/context.py
+@@ -1510,17 +1510,17 @@ VARIABLES = {
+ 
+     'USE_STATIC_LIBS': (bool, bool,
+         """Whether the code in this directory is a built against the static
+         runtime library.
+ 
+         This variable only has an effect when building with MSVC.
+         """),
+ 
+-    'HOST_SOURCES': (ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList), list,
++    'HOST_SOURCES': (ContextDerivedTypedList(Path, StrictOrderingOnAppendList), list,
+         """Source code files to compile with the host compiler.
+ 
+         This variable contains a list of source code files to compile.
+         with the host compiler.
+         """),
+ 
+     'HOST_LIBRARY_NAME': (unicode, unicode,
+         """Name of target library generated when cross compiling.
+diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py
+--- a/python/mozbuild/mozbuild/frontend/data.py
++++ b/python/mozbuild/mozbuild/frontend/data.py
+@@ -743,16 +743,32 @@ class SharedLibrary(Library):
+                 self.symbols_file = '%s.def' % self.lib_name
+             else:
+                 self.symbols_file = '%s.symbols' % self.lib_name
+         else:
+             # Explicitly provided name.
+             self.symbols_file = symbols_file
+ 
+ 
++class HostSharedLibrary(HostMixin, Library):
++    """Context derived container object for a host shared library.
++
++    This class supports less things than SharedLibrary does for target shared
++    libraries. Currently has enough build system support to build the clang
++    plugin."""
++    KIND = 'host'
++
++    def __init__(self, context, basename):
++        Library.__init__(self, context, basename)
++        self.lib_name = '%s%s%s' % (
++            context.config.host_dll_prefix,
++            self.basename,
++            context.config.host_dll_suffix,
++        )
++
+ 
+ class ExternalLibrary(object):
+     """Empty mixin for libraries built by an external build system."""
+ 
+ 
+ class ExternalStaticLibrary(StaticLibrary, ExternalLibrary):
+     """Context derived container for static libraries built by an external
+     build system."""
+@@ -977,16 +993,23 @@ class GeneratedSources(BaseSources):
+ 
+ class HostSources(HostMixin, BaseSources):
+     """Represents files to be compiled for the host during the build."""
+ 
+     def __init__(self, context, files, canonical_suffix):
+         BaseSources.__init__(self, context, files, canonical_suffix)
+ 
+ 
++class HostGeneratedSources(HostMixin, BaseSources):
++    """Represents generated files to be compiled for the host during the build."""
++
++    def __init__(self, context, files, canonical_suffix):
++        BaseSources.__init__(self, context, files, canonical_suffix)
++
++
+ class UnifiedSources(BaseSources):
+     """Represents files to be compiled in a unified fashion during the build."""
+ 
+     __slots__ = (
+         'have_unified_mapping',
+         'unified_source_mapping'
+     )
+ 
+diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
+--- a/python/mozbuild/mozbuild/frontend/emitter.py
++++ b/python/mozbuild/mozbuild/frontend/emitter.py
+@@ -35,19 +35,21 @@ from .data import (
+     FinalTargetFiles,
+     FinalTargetPreprocessedFiles,
+     GeneratedFile,
+     GeneratedSources,
+     GnProjectData,
+     ExternalStaticLibrary,
+     ExternalSharedLibrary,
+     HostDefines,
++    HostGeneratedSources,
+     HostLibrary,
+     HostProgram,
+     HostRustProgram,
++    HostSharedLibrary,
+     HostSimpleProgram,
+     HostSources,
+     InstallationTarget,
+     IPDLCollection,
+     JARManifest,
+     Library,
+     Linkable,
+     LocalInclude,
+@@ -348,17 +350,19 @@ class TreeMetadataEmitter(LoggingMixin):
+             self._link_library(context, obj, variable, path)
+ 
+         # Link system libraries from OS_LIBS/HOST_OS_LIBS.
+         for lib in context.get(variable.replace('USE', 'OS'), []):
+             obj.link_system_library(lib)
+ 
+         # We have to wait for all the self._link_library calls above to have
+         # happened for obj.cxx_link to be final.
+-        if not isinstance(obj, (StaticLibrary, HostLibrary,
++        # FIXME: Theoretically, HostSharedLibrary shouldn't be here (bug
++        # 1474022).
++        if not isinstance(obj, (StaticLibrary, HostLibrary, HostSharedLibrary,
+                                 BaseRustProgram)) and obj.cxx_link:
+             if context.config.substs.get(self.LIBSTDCXX_VAR[obj.KIND]):
+                 self._link_library(context, obj, variable,
+                                    self.STDCXXCOMPAT_NAME[obj.KIND])
+             if obj.KIND == 'target':
+                 for lib in context.config.substs.get('STLPORT_LIBS', []):
+                     obj.link_system_library(lib)
+ 
+@@ -641,16 +645,18 @@ class TreeMetadataEmitter(LoggingMixin):
+         if host_libname:
+             if host_libname == libname:
+                 raise SandboxValidationError('LIBRARY_NAME and '
+                     'HOST_LIBRARY_NAME must have a different value', context)
+ 
+             is_rust_library = context.get('IS_RUST_LIBRARY')
+             if is_rust_library:
+                 lib = self._rust_library(context, host_libname, {}, cls=HostRustLibrary)
++            elif context.get('FORCE_SHARED_LIB'):
++                lib = HostSharedLibrary(context, host_libname)
+             else:
+                 lib = HostLibrary(context, host_libname)
+             self._libs[host_libname].append(lib)
+             self._linkage.append((context, lib, 'HOST_USE_LIBS'))
+             host_linkables.append(lib)
+ 
+         final_lib = context.get('FINAL_LIBRARY')
+         if not libname and final_lib:
+@@ -852,19 +858,18 @@ class TreeMetadataEmitter(LoggingMixin):
+                     flags = context_srcs[f]
+                     if flags:
+                         all_flags[full_path] = flags
+ 
+                 if isinstance(f, SourcePath) and not os.path.exists(full_path):
+                     raise SandboxValidationError('File listed in %s does not '
+                         'exist: \'%s\'' % (symbol, full_path), context)
+ 
+-        # HOST_SOURCES and UNIFIED_SOURCES only take SourcePaths, so
+-        # there should be no generated source in here
+-        assert not gen_sources['HOST_SOURCES']
++        # UNIFIED_SOURCES only take SourcePaths, so there should be no
++        # generated source in here
+         assert not gen_sources['UNIFIED_SOURCES']
+ 
+         no_pgo = context.get('NO_PGO')
+         no_pgo_sources = [f for f, flags in all_flags.iteritems()
+                           if flags.no_pgo]
+         if no_pgo:
+             if no_pgo_sources:
+                 raise SandboxValidationError('NO_PGO and SOURCES[...].no_pgo '
+@@ -898,17 +903,17 @@ class TreeMetadataEmitter(LoggingMixin):
+         def canonical_suffix_for_file(f):
+             return canonicalized_suffix_map[mozpath.splitext(f)[1]]
+ 
+         # A map from moz.build variables to the canonical suffixes of file
+         # kinds that can be listed therein.
+         all_suffixes = list(suffix_map.keys())
+         varmap = dict(
+             SOURCES=(Sources, GeneratedSources, all_suffixes),
+-            HOST_SOURCES=(HostSources, None, ['.c', '.mm', '.cpp']),
++            HOST_SOURCES=(HostSources, HostGeneratedSources, ['.c', '.mm', '.cpp']),
+             UNIFIED_SOURCES=(UnifiedSources, None, ['.c', '.mm', '.cpp']),
+         )
+         # Track whether there are any C++ source files.
+         # Technically this won't do the right thing for SIMPLE_PROGRAMS in
+         # a directory with mixed C and C++ source, but it's not that important.
+         cxx_sources = defaultdict(bool)
+ 
+         # Source files to track for linkables associated with this context.

+ 78 - 0
rel-257/mozilla-esr60/patches/1480553-3only-63a1.patch

@@ -0,0 +1,78 @@
+# HG changeset patch
+# User Nathan Froyd <froydnj@mozilla.com>
+# Date 1533260440 14400
+# Node ID c6d07c3eec16e02846db3abadd7844c4fa4c4c13
+# Parent  35debefb5f62a58fb1da9afaa076e6a3e4122dee
+Bug 1480553 - part 3 - add mappings for aarch64 in Windows configure paths; r=glandium
+
+We need to add mappings for target.cpu to MSVC's arm64 name for
+determining various paths, and we need to add an extra case to
+get_vc_paths so the compiler can find all the necessary DLLs.
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -584,16 +584,17 @@ def get_vc_paths(topsrcdir):
+         tools_version = open(os.path.join(
+             path, r'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt'), 'rb').read().strip()
+         tools_path = os.path.join(
+             path, r'VC\Tools\MSVC', tools_version, r'bin\HostX64')
+         yield (Version(install['installationVersion']), {
+             'x64': [os.path.join(tools_path, 'x64')],
+             # The x64->x86 cross toolchain requires DLLs from the native x64 toolchain.
+             'x86': [os.path.join(tools_path, 'x86'), os.path.join(tools_path, 'x64')],
++            'arm64': [os.path.join(tools_path, 'x64')],
+         })
+ 
+ 
+ js_option('--with-visual-studio-version', nargs=1,
+           choices=('2017',),
+           help='Select a specific Visual Studio version to use')
+ 
+ 
+@@ -609,16 +610,17 @@ def vs_major_version(value):
+ @imports('platform')
+ def vc_compiler_path(host, target, vs_major_version, env, vs_release_name):
+     if host.kernel != 'WINNT':
+         return
+     vc_target = {
+         'x86': 'x86',
+         'x86_64': 'x64',
+         'arm': 'arm',
++        'aarch64': 'arm64'
+     }.get(target.cpu)
+     if vc_target is None:
+         return
+ 
+     all_versions = sorted(get_vc_paths(env.topsrcdir), key=itemgetter(0))
+     if not all_versions:
+         return
+     if vs_major_version:
+diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure
+--- a/build/moz.configure/windows.configure
++++ b/build/moz.configure/windows.configure
+@@ -342,22 +342,24 @@ set_config('INCLUDE', include_path)
+ @imports('os')
+ def lib_path(target, c_compiler, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir):
+     if not vc_path:
+         return
+     sdk_target = {
+         'x86': 'x86',
+         'x86_64': 'x64',
+         'arm': 'arm',
++        'aarch64': 'arm64',
+     }.get(target.cpu)
+ 
+     old_target = {
+         'x86': '',
+         'x86_64': 'amd64',
+         'arm': 'arm',
++        'aarch64': 'arm64'
+     }.get(target.cpu)
+     if old_target is None:
+         return
+     # As old_target can be '', and os.path.join will happily use the empty
+     # string, leading to a string ending with a backslash, that Make will
+     # interpret as a "string continues on next line" indicator, use variable
+     # args.
+     old_target = (old_target,) if old_target else ()

+ 98 - 0
rel-257/mozilla-esr60/patches/1486905-63a1.patch

@@ -0,0 +1,98 @@
+# HG changeset patch
+# User Nathan Froyd <froydnj@mozilla.com>
+# Date 1535639295 14400
+# Node ID 345269b39c6c2d08edebb8225e55c690dc019537
+# Parent  61813b822e04ec901a36d5519cc8854c9e9463a7
+Bug 1486905 - add a HOST_LINKER variable for cross windows builds; r=dmajor
+
+This setup seems to work well enough to enable me to link
+HOST_SIMPLE_PROGRAMS with an AArch64-cross setup.  Necessary library
+paths are passed to the linker via -LIBPATH and HOST_LDFLAGS rather than
+letting MSVC fish them out of the environment.  The change to
+HOST_SIMPLE_PROGRAMS to pass HOST_LDFLAGS was necessary for this to
+work, in addition to the HOST_LINKER changes.
+
+diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure
+--- a/build/moz.configure/windows.configure
++++ b/build/moz.configure/windows.configure
+@@ -448,16 +448,19 @@ def valid_mt(path):
+ 
+ 
+ set_config('MSMANIFEST_TOOL', depends(valid_mt)(lambda x: bool(x)))
+ 
+ 
+ link = check_prog('LINKER', ('lld-link.exe', 'link.exe'),
+                   paths=toolchain_search_path)
+ 
++host_link = check_prog('HOST_LINKER', ('lld-link.exe', 'link.exe'),
++                       paths=toolchain_search_path)
++
+ add_old_configure_assignment('LINKER', link)
+ 
+ 
+ # Normally, we'd just have CC, etc. set to absolute paths, but the build system
+ # doesn't currently handle properly the case where the paths contain spaces.
+ # Additionally, there's the issue described in toolchain.configure, in
+ # valid_compiler().
+ @depends(sdk_bin_path)
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -589,17 +589,17 @@ ifdef ENABLE_STRIP
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+ $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
+-	$(LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		else \
+ 			echo 'Embedding manifest from $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+@@ -648,17 +648,17 @@ ifdef ENABLE_STRIP
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+ $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
+-	$(LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
+ 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ 	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+ endif
+ ifndef CROSS_COMPILE
+@@ -685,18 +685,17 @@ endif
+ 	$(REPORT_BUILD)
+ 	$(RM) $@
+ 	$(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
+ 
+ $(HOST_SHARED_LIBRARY): $(HOST_OBJS) Makefile
+ 	$(REPORT_BUILD)
+ 	$(RM) $@
+ ifdef _MSC_VER
+-	# /!\ We assume host and target are using the same compiler
+-	$(LINKER) -NOLOGO -DLL -OUT:$@ $(HOST_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -DLL -OUT:$@ $(HOST_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+ 
+ # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
+ # so instead of deleting .o files after repacking them into a dylib, we make
+ # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
+ # so no need to conditionalize on OS version or debugging format.

+ 62 - 0
rel-257/mozilla-esr60/patches/1490549-1-64a1.patch

@@ -0,0 +1,62 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1536930958 0
+# Node ID 16416957bb5adb9dc00e63705c5f360c7aec21cd
+# Parent  f17b2b537dc25ec6fa36d8a2073b20ba6660fec3
+Bug 1490549 - Add some Windows-cross toolchain configure tests r=froydnj
+
+While those builds are not fully supported yet, it's better to ensure
+the coming changes to toolchain.configure won't break them.
+
+Differential Revision: https://phabricator.services.mozilla.com/D5828
+
+diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
++++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+@@ -1426,16 +1426,46 @@ class OSXCrossToolchainTest(BaseToolchai
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': 'Target C compiler target kernel (Linux) does not '
+                           'match --target kernel (Darwin)',
+         }, environ={
+             'CC': 'gcc',
+         })
+ 
+ 
++class WindowsCrossToolchainTest(BaseToolchainTest):
++    TARGET = 'x86_64-pc-mingw32'
++    DEFAULT_GCC_RESULT = LinuxToolchainTest.DEFAULT_GCC_RESULT
++    DEFAULT_GXX_RESULT = LinuxToolchainTest.DEFAULT_GXX_RESULT
++
++    def test_wsl_cross(self):
++        paths = {
++            '/usr/bin/cl': VS_2017u6 + VS_PLATFORM_X86_64,
++        }
++        paths.update(LinuxToolchainTest.PATHS)
++        self.do_toolchain_test(paths, {
++            'c_compiler': WindowsToolchainTest.VS_2017u6_RESULT,
++            'cxx_compiler': WindowsToolchainTest.VSXX_2017u6_RESULT,
++            'host_c_compiler': self.DEFAULT_GCC_RESULT,
++            'host_cxx_compiler': self.DEFAULT_GXX_RESULT,
++        })
++
++    def test_clang_cl_cross(self):
++        paths = {
++            '/usr/bin/clang-cl': CLANG_CL_3_9 + CLANG_CL_PLATFORM_X86_64,
++        }
++        paths.update(LinuxToolchainTest.PATHS)
++        self.do_toolchain_test(paths, {
++            'c_compiler': WindowsToolchainTest.CLANG_CL_3_9_RESULT,
++            'cxx_compiler': WindowsToolchainTest.CLANGXX_CL_3_9_RESULT,
++            'host_c_compiler': self.DEFAULT_GCC_RESULT,
++            'host_cxx_compiler': self.DEFAULT_GXX_RESULT,
++        })
++
++
+ class OpenBSDToolchainTest(BaseToolchainTest):
+     HOST = 'x86_64-unknown-openbsd6.1'
+     TARGET = 'x86_64-unknown-openbsd6.1'
+     PATHS = {
+         '/usr/bin/gcc': DEFAULT_GCC + GCC_PLATFORM_X86_64 + GCC_PLATFORM_OPENBSD,
+         '/usr/bin/g++': DEFAULT_GXX + GCC_PLATFORM_X86_64 + GCC_PLATFORM_OPENBSD,
+     }
+     DEFAULT_GCC_RESULT = LinuxToolchainTest.DEFAULT_GCC_RESULT

+ 274 - 0
rel-257/mozilla-esr60/patches/1490549-2-64a1.patch

@@ -0,0 +1,274 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1536946852 0
+# Node ID 394ff9e067c89cb615b304423f85b081686f5ca1
+# Parent  06196b2ecd94fe699d5357a9f4ce0e19469b97ff
+Bug 1490549 - Change how host compilers are found r=froydnj
+
+Before this change, we'd derive a host compiler and handle things as if
+HOST_CC/HOST_CXX had been passed. With this change, we change the list
+of compilers that are tested with check_prog instead.
+
+Depends on D5828
+
+Differential Revision: https://phabricator.services.mozilla.com/D5829
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -475,16 +475,24 @@ def get_compiler_info(compiler, language
+         cpu=data.get('CPU'),
+         kernel=data.get('KERNEL'),
+         endianness=data.get('ENDIANNESS'),
+         language='C++' if cplusplus else 'C',
+         language_version=cplusplus if cplusplus else stdc_version,
+     )
+ 
+ 
++def same_arch_different_bits():
++    return (
++        ('x86', 'x86_64'),
++        ('ppc', 'ppc64'),
++        ('sparc', 'sparc64'),
++    )
++
++
+ @imports(_from='mozbuild.shellutil', _import='quote')
+ def check_compiler(compiler, language, target):
+     info = get_compiler_info(compiler, language)
+ 
+     flags = []
+ 
+     def append_flag(flag):
+         if flag not in flags:
+@@ -532,24 +540,20 @@ def check_compiler(compiler, language, t
+             append_flag('--target=%s' % target.toolchain)
+         elif info.type == 'clang-cl':
+             # Ideally this would share the 'clang' branch above, but on Windows
+             # the --target needs additional data like ms-compatibility-version.
+             if (info.cpu, target.cpu) == ('x86_64', 'x86'):
+                 # -m32 does not use -Xclang, so add it directly.
+                 flags.append('-m32')
+         elif info.type == 'gcc':
+-            same_arch_different_bits = (
+-                ('x86', 'x86_64'),
+-                ('ppc', 'ppc64'),
+-                ('sparc', 'sparc64'),
+-            )
+-            if (target.cpu, info.cpu) in same_arch_different_bits:
++            same_arch = same_arch_different_bits()
++            if (target.cpu, info.cpu) in same_arch:
+                 append_flag('-m32')
+-            elif (info.cpu, target.cpu) in same_arch_different_bits:
++            elif (info.cpu, target.cpu) in same_arch:
+                 append_flag('-m64')
+ 
+     if not info.kernel or info.kernel != target.kernel:
+         if info.type == 'clang':
+             append_flag('--target=%s' % target.toolchain)
+ 
+     if not info.endianness or info.endianness != target.endianness:
+         if info.type == 'clang':
+@@ -659,62 +663,115 @@ def toolchain_search_path(vc_compiler_pa
+         # need to do it for the valid_compiler() check below. This is only needed
+         # on Windows, where MSVC needs PATH set to find dlls.
+         environ['PATH'] = os.pathsep.join(result)
+ 
+     return result
+ 
+ 
+ @template
+-def default_c_compilers(host_or_target):
++def default_c_compilers(host_or_target, other_c_compiler=None):
+     '''Template defining the set of default C compilers for the host and
+     target platforms.
+     `host_or_target` is either `host` or `target` (the @depends functions
+     from init.configure.
++    `other_c_compiler` is the `target` C compiler when `host_or_target` is `host`.
+     '''
+     assert host_or_target in (host, target)
+ 
++    other_c_compiler = () if other_c_compiler is None else (other_c_compiler,)
++
+     @depends(host_or_target, target, toolchain_prefix, android_clang_compiler,
+-             developer_options)
++             developer_options, *other_c_compiler)
+     def default_c_compilers(host_or_target, target, toolchain_prefix,
+-                            android_clang_compiler, developer_options):
++                            android_clang_compiler, developer_options,
++                            *other_c_compiler):
++        if host_or_target.kernel == 'WINNT':
++            supported = types = ('clang-cl', 'msvc', 'gcc', 'clang')
++        elif host_or_target.kernel == 'Darwin':
++            types = ('clang',)
++            supported = ('clang', 'gcc')
++        elif developer_options:
++            supported = types = ('clang', 'gcc')
++        else:
++            supported = types = ('gcc', 'clang')
++
++        info = other_c_compiler[0] if other_c_compiler else None
++        if info and info.type in supported:
++            # When getting default C compilers for the host, we prioritize the
++            # same compiler as the target C compiler.
++            prioritized = info.compiler
++            if info.type == 'gcc':
++                same_arch = same_arch_different_bits()
++                if (target.cpu != host_or_target.cpu and
++                        (target.cpu, host_or_target.cpu) not in same_arch and
++                        (host_or_target.cpu, target.cpu) not in same_arch):
++                    # If the target C compiler if GCC, and it can't be used with
++                    # -m32/-m64 for the host, it's probably toolchain-prefixed,
++                    # so we prioritize a raw 'gcc' instead.
++                    prioritized = info.type
++            elif info.type == 'clang' and android_clang_compiler:
++                # Android NDK clangs do not function as host compiler, so
++                # prioritize a raw 'clang' instead.
++                prioritized = info.type
++
++            types = [prioritized] + [t for t in types if t != info.type]
++
+         gcc = ('gcc',)
+         if toolchain_prefix and host_or_target is target:
+             gcc = tuple('%sgcc' % p for p in toolchain_prefix) + gcc
+-        # Android sets toolchain_prefix and android_clang_compiler, but
+-        # we want the latter to take precedence, because the latter can
+-        # point at clang, which is what we want to use.
+-        if android_clang_compiler and host_or_target is target:
+-            return (android_clang_compiler,) + gcc
+ 
+-        if host_or_target.kernel == 'WINNT':
+-            return ('clang-cl', 'cl') + gcc + ('clang',)
+-        if host_or_target.kernel == 'Darwin':
+-            return ('clang',)
+-        if developer_options:
+-            return ('clang',) + gcc
+-        return gcc + ('clang',)
++        result = []
++        for type in types:
++            # Android sets toolchain_prefix and android_clang_compiler, but
++            # we want the latter to take precedence, because the latter can
++            # point at clang, which is what we want to use.
++            if type == 'clang' and android_clang_compiler and host_or_target is target:
++                result.append(android_clang_compiler)
++            elif type == 'gcc':
++                result.extend(gcc)
++            elif type == 'msvc':
++                result.append('cl')
++            else:
++                result.append(type)
++
++        return tuple(result)
+ 
+     return default_c_compilers
+ 
+ 
+ @template
+-def default_cxx_compilers(c_compiler):
++def default_cxx_compilers(c_compiler, other_c_compiler=None, other_cxx_compiler=None):
+     '''Template defining the set of default C++ compilers for the host and
+     target platforms.
+     `c_compiler` is the @depends function returning a Compiler instance for
+     the desired platform.
+ 
+     Because the build system expects the C and C++ compilers to be from the
+     same compiler suite, we derive the default C++ compilers from the C
+     compiler that was found if none was provided.
++
++    We also factor the target C++ compiler when getting the default host
++    C++ compiler, using the same if the corresponding C compilers are the
++    same.
+     '''
+ 
+-    @depends(c_compiler)
+-    def default_cxx_compilers(c_compiler):
++    assert (other_c_compiler is None) == (other_cxx_compiler is None)
++    if other_c_compiler is not None:
++        other_compilers = (other_c_compiler, other_cxx_compiler)
++    else:
++        other_compilers = ()
++
++    @depends(c_compiler, *other_compilers)
++    def default_cxx_compilers(c_compiler, *other_compilers):
++        if other_compilers:
++            other_c_compiler, other_cxx_compiler = other_compilers
++            if other_c_compiler.compiler == c_compiler.compiler:
++                return (other_cxx_compiler.compiler,)
++
+         dir = os.path.dirname(c_compiler.compiler)
+         file = os.path.basename(c_compiler.compiler)
+ 
+         if c_compiler.type == 'gcc':
+             return (os.path.join(dir, file.replace('gcc', 'g++')),)
+ 
+         if c_compiler.type == 'clang':
+             return (os.path.join(dir, file.replace('clang', 'clang++')),)
+@@ -754,18 +811,18 @@ def compiler(language, host_or_target, c
+     var = {
+         ('C', target): 'CC',
+         ('C++', target): 'CXX',
+         ('C', host): 'HOST_CC',
+         ('C++', host): 'HOST_CXX',
+     }[language, host_or_target]
+ 
+     default_compilers = {
+-        'C': lambda: default_c_compilers(host_or_target),
+-        'C++': lambda: default_cxx_compilers(c_compiler),
++        'C': lambda: default_c_compilers(host_or_target, other_compiler),
++        'C++': lambda: default_cxx_compilers(c_compiler, other_c_compiler, other_compiler),
+     }[language]()
+ 
+     what = 'the %s %s compiler' % (host_or_target_str, language)
+ 
+     option(env=var, nargs=1, help='Path to %s' % what)
+ 
+     # Handle the compiler given by the user through one of the CC/CXX/HOST_CC/
+     # HOST_CXX variables.
+@@ -783,47 +840,16 @@ def compiler(language, host_or_target, c
+         without_flags = list(takewhile(lambda x: not x.startswith('-'), cmd))
+ 
+         return namespace(
+             wrapper=without_flags[:-1],
+             compiler=without_flags[-1],
+             flags=cmd[len(without_flags):],
+         )
+ 
+-    # Derive the host compiler from the corresponding target compiler when no
+-    # explicit compiler was given and we're not cross compiling. For the C++
+-    # compiler, though, prefer to derive from the host C compiler when it
+-    # doesn't match the target C compiler.
+-    # As a special case, since clang supports all kinds of targets in the same
+-    # executable, when cross compiling with clang, default to the same compiler
+-    # as the target compiler, resetting flags.  However, Android NDK clangs do
+-    # not function as host compilers -- they're target compilers only -- so
+-    # don't use clang target as host if the target OS is Android.
+-    if host_or_target == host:
+-        if other_c_compiler is not None:
+-            args = (c_compiler, other_c_compiler)
+-        else:
+-            args = ()
+-
+-        @depends(provided_compiler, other_compiler, cross_compiling,
+-                 target, *args)
+-        def provided_compiler(value, other_compiler, cross_compiling,
+-                              target, *args):
+-            if value:
+-                return value
+-            c_compiler, other_c_compiler = args if args else (None, None)
+-            if not cross_compiling and c_compiler == other_c_compiler:
+-                return other_compiler
+-            if cross_compiling and other_compiler.type == 'clang' and \
+-                    target.os != 'Android':
+-                return namespace(**{
+-                    k: [] if k == 'flags' else v
+-                    for k, v in other_compiler.__dict__.iteritems()
+-                })
+-
+     # Normally, we'd use `var` instead of `_var`, but the interaction with
+     # old-configure complicates things, and for now, we a) can't take the plain
+     # result from check_prog as CC/CXX/HOST_CC/HOST_CXX and b) have to let
+     # old-configure AC_SUBST it (because it's autoconf doing it, not us)
+     compiler = check_prog('_%s' % var, what=what, progs=default_compilers,
+                           input=provided_compiler.compiler,
+                           paths=toolchain_search_path)
+ 

+ 297 - 0
rel-257/mozilla-esr60/patches/1490549-3-64a1.patch

@@ -0,0 +1,297 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1536948083 0
+# Node ID e545bb3cfccacdd124562a5025f7978d19b52739
+# Parent  ec968c07f4b13813448934cdadce63c4e754481a
+Bug 1490549 - Make configure choose clang by default on all platforms r=froydnj
+
+Now that we ship builds using clang on all platforms, pick it during
+configure. It is still possible to opt-in to building other compilers by
+setting CC/CXX (or even only CC) to the desired compiler.
+
+Depends on D5829
+
+Differential Revision: https://phabricator.services.mozilla.com/D5637
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -675,29 +675,26 @@ def default_c_compilers(host_or_target, 
+     from init.configure.
+     `other_c_compiler` is the `target` C compiler when `host_or_target` is `host`.
+     '''
+     assert host_or_target in (host, target)
+ 
+     other_c_compiler = () if other_c_compiler is None else (other_c_compiler,)
+ 
+     @depends(host_or_target, target, toolchain_prefix, android_clang_compiler,
+-             developer_options, *other_c_compiler)
++             *other_c_compiler)
+     def default_c_compilers(host_or_target, target, toolchain_prefix,
+-                            android_clang_compiler, developer_options,
+-                            *other_c_compiler):
++                            android_clang_compiler, *other_c_compiler):
+         if host_or_target.kernel == 'WINNT':
+             supported = types = ('clang-cl', 'msvc', 'gcc', 'clang')
+         elif host_or_target.kernel == 'Darwin':
+             types = ('clang',)
+             supported = ('clang', 'gcc')
+-        elif developer_options:
++        else:
+             supported = types = ('clang', 'gcc')
+-        else:
+-            supported = types = ('gcc', 'clang')
+ 
+         info = other_c_compiler[0] if other_c_compiler else None
+         if info and info.type in supported:
+             # When getting default C compilers for the host, we prioritize the
+             # same compiler as the target C compiler.
+             prioritized = info.compiler
+             if info.type == 'gcc':
+                 same_arch = same_arch_different_bits()
+diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
++++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
+@@ -492,36 +492,46 @@ class LinuxToolchainTest(BaseToolchainTe
+         version='4.0.2',
+         type='clang',
+         compiler='/usr/bin/clang++-4.0',
+         language='C++',
+     )
+     DEFAULT_CLANG_RESULT = CLANG_4_0_RESULT + {'compiler': '/usr/bin/clang'}
+     DEFAULT_CLANGXX_RESULT = CLANGXX_4_0_RESULT + {'compiler': '/usr/bin/clang++'}
+ 
++    def test_default(self):
++        # We'll try clang and gcc, and find clang first.
++        self.do_toolchain_test(self.PATHS, {
++            'c_compiler': self.DEFAULT_CLANG_RESULT,
++            'cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
++        })
++
+     def test_gcc(self):
+-        # We'll try gcc and clang, and find gcc first.
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.DEFAULT_GCC_RESULT,
+             'cxx_compiler': self.DEFAULT_GXX_RESULT,
++        }, environ={
++            'CC': 'gcc',
++            'CXX': 'g++',
+         })
+ 
+     def test_unsupported_gcc(self):
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.GCC_4_9_RESULT,
+         }, environ={
+             'CC': 'gcc-4.9',
+             'CXX': 'g++-4.9',
+         })
+ 
+         # Maybe this should be reporting the mismatched version instead.
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.DEFAULT_GCC_RESULT,
+             'cxx_compiler': self.GXX_4_9_RESULT,
+         }, environ={
++            'CC': 'gcc',
+             'CXX': 'g++-4.9',
+         })
+ 
+     def test_overridden_gcc(self):
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.GCC_7_RESULT,
+             'cxx_compiler': self.GXX_7_RESULT,
+         }, environ={
+@@ -541,65 +551,67 @@ class LinuxToolchainTest(BaseToolchainTe
+     def test_mismatched_gcc(self):
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.DEFAULT_GCC_RESULT,
+             'cxx_compiler': (
+                 'The target C compiler is version 6.4.0, while the target '
+                 'C++ compiler is version 7.3.0. Need to use the same compiler '
+                 'version.'),
+         }, environ={
++            'CC': 'gcc',
+             'CXX': 'g++-7',
+         })
+ 
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.DEFAULT_GCC_RESULT,
+             'cxx_compiler': self.DEFAULT_GXX_RESULT,
+             'host_c_compiler': self.DEFAULT_GCC_RESULT,
+             'host_cxx_compiler': (
+                 'The host C compiler is version 6.4.0, while the host '
+                 'C++ compiler is version 7.3.0. Need to use the same compiler '
+                 'version.'),
+         }, environ={
++            'CC': 'gcc',
+             'HOST_CXX': 'g++-7',
+         })
+ 
+     def test_mismatched_compiler(self):
+         self.do_toolchain_test(self.PATHS, {
+-            'c_compiler': self.DEFAULT_GCC_RESULT,
++            'c_compiler': self.DEFAULT_CLANG_RESULT,
+             'cxx_compiler': (
+-                'The target C compiler is gcc, while the target C++ compiler '
+-                'is clang. Need to use the same compiler suite.'),
++                'The target C compiler is clang, while the target C++ compiler '
++                'is gcc. Need to use the same compiler suite.'),
+         }, environ={
+-            'CXX': 'clang++',
++            'CXX': 'g++',
+         })
+ 
+         self.do_toolchain_test(self.PATHS, {
+-            'c_compiler': self.DEFAULT_GCC_RESULT,
+-            'cxx_compiler': self.DEFAULT_GXX_RESULT,
+-            'host_c_compiler': self.DEFAULT_GCC_RESULT,
++            'c_compiler': self.DEFAULT_CLANG_RESULT,
++            'cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
++            'host_c_compiler': self.DEFAULT_CLANG_RESULT,
+             'host_cxx_compiler': (
+-                'The host C compiler is gcc, while the host C++ compiler '
+-                'is clang. Need to use the same compiler suite.'),
++                'The host C compiler is clang, while the host C++ compiler '
++                'is gcc. Need to use the same compiler suite.'),
+         }, environ={
+-            'HOST_CXX': 'clang++',
++            'HOST_CXX': 'g++',
+         })
+ 
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': '`%s` is not a C compiler.'
+             % mozpath.abspath('/usr/bin/g++'),
+         }, environ={
+             'CC': 'g++',
+         })
+ 
+         self.do_toolchain_test(self.PATHS, {
+-            'c_compiler': self.DEFAULT_GCC_RESULT,
++            'c_compiler': self.DEFAULT_CLANG_RESULT,
+             'cxx_compiler': '`%s` is not a C++ compiler.'
+-            % mozpath.abspath('/usr/bin/gcc'),
++            % mozpath.abspath('/usr/bin/clang'),
+         }, environ={
+-            'CXX': 'gcc',
++            'CXX': 'clang',
+         })
+ 
+     def test_clang(self):
+         # We'll try gcc and clang, but since there is no gcc (gcc-x.y doesn't
+         # count), find clang.
+         paths = {
+             k: v for k, v in self.PATHS.iteritems()
+             if os.path.basename(k) not in ('gcc', 'g++')
+@@ -716,30 +728,30 @@ class LinuxSimpleCrossToolchainTest(Base
+             'c_compiler': self.DEFAULT_GCC_RESULT + {
+                 'flags': ['-m32']
+             },
+             'cxx_compiler': self.DEFAULT_GXX_RESULT + {
+                 'flags': ['-m32']
+             },
+             'host_c_compiler': self.DEFAULT_GCC_RESULT,
+             'host_cxx_compiler': self.DEFAULT_GXX_RESULT,
++        }, environ={
++            'CC': 'gcc'
+         })
+ 
+     def test_cross_clang(self):
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.DEFAULT_CLANG_RESULT + {
+                 'flags': ['--target=i686-linux-gnu'],
+             },
+             'cxx_compiler': self.DEFAULT_CLANGXX_RESULT + {
+                 'flags': ['--target=i686-linux-gnu'],
+             },
+             'host_c_compiler': self.DEFAULT_CLANG_RESULT,
+             'host_cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
+-        }, environ={
+-            'CC': 'clang',
+         })
+ 
+ 
+ class LinuxX86_64CrossToolchainTest(BaseToolchainTest):
+     HOST = 'i686-pc-linux-gnu'
+     TARGET = 'x86_64-pc-linux-gnu'
+     PATHS = {
+         '/usr/bin/gcc': DEFAULT_GCC + GCC_PLATFORM_X86_LINUX,
+@@ -757,30 +769,30 @@ class LinuxX86_64CrossToolchainTest(Base
+             'c_compiler': self.DEFAULT_GCC_RESULT + {
+                 'flags': ['-m64']
+             },
+             'cxx_compiler': self.DEFAULT_GXX_RESULT + {
+                 'flags': ['-m64']
+             },
+             'host_c_compiler': self.DEFAULT_GCC_RESULT,
+             'host_cxx_compiler': self.DEFAULT_GXX_RESULT,
++        }, environ={
++            'CC': 'gcc',
+         })
+ 
+     def test_cross_clang(self):
+         self.do_toolchain_test(self.PATHS, {
+             'c_compiler': self.DEFAULT_CLANG_RESULT + {
+                 'flags': ['--target=x86_64-linux-gnu'],
+             },
+             'cxx_compiler': self.DEFAULT_CLANGXX_RESULT + {
+                 'flags': ['--target=x86_64-linux-gnu'],
+             },
+             'host_c_compiler': self.DEFAULT_CLANG_RESULT,
+             'host_cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
+-        }, environ={
+-            'CC': 'clang',
+         })
+ 
+ 
+ class OSXToolchainTest(BaseToolchainTest):
+     HOST = 'x86_64-apple-darwin11.2.0'
+     PATHS = {
+         '/usr/bin/gcc-5': GCC_5 + GCC_PLATFORM_X86_64_OSX,
+         '/usr/bin/g++-5': GXX_5 + GCC_PLATFORM_X86_64_OSX,
+@@ -1428,41 +1440,41 @@ class OSXCrossToolchainTest(BaseToolchai
+                           'match --target kernel (Darwin)',
+         }, environ={
+             'CC': 'gcc',
+         })
+ 
+ 
+ class WindowsCrossToolchainTest(BaseToolchainTest):
+     TARGET = 'x86_64-pc-mingw32'
+-    DEFAULT_GCC_RESULT = LinuxToolchainTest.DEFAULT_GCC_RESULT
+-    DEFAULT_GXX_RESULT = LinuxToolchainTest.DEFAULT_GXX_RESULT
++    DEFAULT_CLANG_RESULT = LinuxToolchainTest.DEFAULT_CLANG_RESULT
++    DEFAULT_CLANGXX_RESULT = LinuxToolchainTest.DEFAULT_CLANGXX_RESULT
+ 
+     def test_wsl_cross(self):
+         paths = {
+             '/usr/bin/cl': VS_2017u6 + VS_PLATFORM_X86_64,
+         }
+         paths.update(LinuxToolchainTest.PATHS)
+         self.do_toolchain_test(paths, {
+             'c_compiler': WindowsToolchainTest.VS_2017u6_RESULT,
+             'cxx_compiler': WindowsToolchainTest.VSXX_2017u6_RESULT,
+-            'host_c_compiler': self.DEFAULT_GCC_RESULT,
+-            'host_cxx_compiler': self.DEFAULT_GXX_RESULT,
++            'host_c_compiler': self.DEFAULT_CLANG_RESULT,
++            'host_cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
+         })
+ 
+     def test_clang_cl_cross(self):
+         paths = {
+             '/usr/bin/clang-cl': CLANG_CL_3_9 + CLANG_CL_PLATFORM_X86_64,
+         }
+         paths.update(LinuxToolchainTest.PATHS)
+         self.do_toolchain_test(paths, {
+             'c_compiler': WindowsToolchainTest.CLANG_CL_3_9_RESULT,
+             'cxx_compiler': WindowsToolchainTest.CLANGXX_CL_3_9_RESULT,
+-            'host_c_compiler': self.DEFAULT_GCC_RESULT,
+-            'host_cxx_compiler': self.DEFAULT_GXX_RESULT,
++            'host_c_compiler': self.DEFAULT_CLANG_RESULT,
++            'host_cxx_compiler': self.DEFAULT_CLANGXX_RESULT,
+         })
+ 
+ 
+ class OpenBSDToolchainTest(BaseToolchainTest):
+     HOST = 'x86_64-unknown-openbsd6.1'
+     TARGET = 'x86_64-unknown-openbsd6.1'
+     PATHS = {
+         '/usr/bin/gcc': DEFAULT_GCC + GCC_PLATFORM_X86_64 + GCC_PLATFORM_OPENBSD,

+ 54 - 0
rel-257/mozilla-esr60/patches/1490549-4-64a1.patch

@@ -0,0 +1,54 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1536974069 0
+# Node ID 2ba4d3d517aacb225e1fdcee0cfb1d74f821210f
+# Parent  24029af886738a048aba369e76cb7eb963687897
+Bug 1490549 - Fix some comments r=froydnj
+
+Differential Revision: https://phabricator.services.mozilla.com/D5916
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -696,17 +696,17 @@ def default_c_compilers(host_or_target, 
+             # When getting default C compilers for the host, we prioritize the
+             # same compiler as the target C compiler.
+             prioritized = info.compiler
+             if info.type == 'gcc':
+                 same_arch = same_arch_different_bits()
+                 if (target.cpu != host_or_target.cpu and
+                         (target.cpu, host_or_target.cpu) not in same_arch and
+                         (host_or_target.cpu, target.cpu) not in same_arch):
+-                    # If the target C compiler if GCC, and it can't be used with
++                    # If the target C compiler is GCC, and it can't be used with
+                     # -m32/-m64 for the host, it's probably toolchain-prefixed,
+                     # so we prioritize a raw 'gcc' instead.
+                     prioritized = info.type
+             elif info.type == 'clang' and android_clang_compiler:
+                 # Android NDK clangs do not function as host compiler, so
+                 # prioritize a raw 'clang' instead.
+                 prioritized = info.type
+ 
+@@ -741,19 +741,19 @@ def default_cxx_compilers(c_compiler, ot
+     target platforms.
+     `c_compiler` is the @depends function returning a Compiler instance for
+     the desired platform.
+ 
+     Because the build system expects the C and C++ compilers to be from the
+     same compiler suite, we derive the default C++ compilers from the C
+     compiler that was found if none was provided.
+ 
+-    We also factor the target C++ compiler when getting the default host
+-    C++ compiler, using the same if the corresponding C compilers are the
+-    same.
++    We also factor in the target C++ compiler when getting the default host
++    C++ compiler, using the target C++ compiler if the host and target C
++    compilers are the same.
+     '''
+ 
+     assert (other_c_compiler is None) == (other_cxx_compiler is None)
+     if other_c_compiler is not None:
+         other_compilers = (other_c_compiler, other_cxx_compiler)
+     else:
+         other_compilers = ()
+ 

+ 37 - 0
rel-257/mozilla-esr60/patches/1494958-64a1.patch

@@ -0,0 +1,37 @@
+# HG changeset patch
+# User Nathan Froyd <froydnj@mozilla.com>
+# Date 1538509266 14400
+# Node ID f9572cfd7bac75d4493f44206cd27958d74269d0
+# Parent  21ce5baa88221fc5ab9656ad66b315255aaed88d
+Bug 1494958 - remove linuxgl/accessibility check in old-configure.in; r=ted.mielczarek
+
+linuxgl is not a widget toolkit we support nowadays.
+
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -2328,24 +2328,16 @@ if test "$ACCESSIBILITY"; then
+             else
+                 AC_MSG_ERROR([You have accessibility enabled, but widl could not be found. Add --disable-accessibility to your mozconfig or install widl. See https://developer.mozilla.org/en-US/docs/Cross_Compile_Mozilla_for_Mingw32 for details.])
+             fi
+         fi
+     esac
+     AC_DEFINE(ACCESSIBILITY)
+ fi
+ 
+-dnl ========================================================
+-dnl Accessibility is required for the linuxgl widget
+-dnl backend
+-dnl ========================================================
+-if test "${MOZ_WIDGET_TOOLKIT}" = "linuxgl" -a "$ACCESSIBILITY" != "1"; then
+-    AC_MSG_ERROR(["Accessibility is required for the linuxgl widget backend"])
+-fi
+-
+ AC_TRY_COMPILE([#include <linux/ethtool.h>],
+                [ struct ethtool_cmd cmd; cmd.speed_hi = 0; ],
+                MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI=1)
+ 
+ AC_SUBST(MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI)
+ 
+ if test -n "$MOZ_WEBRTC"; then
+     MOZ_RAW=1

+ 218 - 0
rel-257/mozilla-esr60/patches/1498450-partial-64a1.patch

@@ -0,0 +1,218 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1539351848 0
+# Node ID a232864e100291f7fe7e7b60745aae2094786b43
+# Parent  b515ce64da652243b5db03e8a8c49d5774eef059
+Bug 1498450 - Avoid the footgun from @depends-function comparison r=froydnj
+
+While we do have some uses of @depends-function comparison in some
+templaces, related to host/target, we ought to be using `is` comparisons
+rather than `==` anyways, so we switch those, and prevent other kinds of
+comparisons being used at all.
+
+This unveils the one noted in
+https://phabricator.services.mozilla.com/D7713?id=21357#inline-30414
+(and surprisingly only that one), that we remove entirely since it was
+doing nothing in practice. Bug 1492305 will have to add it back in a
+proper form.
+
+Differential Revision: https://phabricator.services.mozilla.com/D8501
+
+diff --git a/build/moz.configure/compile-checks.configure b/build/moz.configure/compile-checks.configure
+--- a/build/moz.configure/compile-checks.configure
++++ b/build/moz.configure/compile-checks.configure
+@@ -107,18 +107,18 @@ def check_and_add_flags(flag, flags_coll
+     results = []
+ 
+     if test_flags:
+         flags = test_flags
+     else:
+         flags = [flag]
+ 
+     for c in compilers:
+-        assert c in (c_compiler, cxx_compiler,
+-                     host_c_compiler, host_cxx_compiler)
++        assert c in {c_compiler, cxx_compiler,
++                     host_c_compiler, host_cxx_compiler}
+         lang, list_of_flags = {
+             c_compiler: ('C', flags_collection.cflags),
+             cxx_compiler: ('C++', flags_collection.cxxflags),
+             host_c_compiler: ('host C', flags_collection.host_cflags),
+             host_cxx_compiler: ('host C++', flags_collection.host_cxxflags),
+         }[c]
+ 
+         @depends(c, when)
+diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure
+--- a/build/moz.configure/rust.configure
++++ b/build/moz.configure/rust.configure
+@@ -143,17 +143,17 @@ def rust_supported_targets(rustc):
+ 
+ 
+ @template
+ def rust_triple_alias(host_or_target):
+     """Template defining the alias used for rustc's --target flag.
+     `host_or_target` is either `host` or `target` (the @depends functions
+     from init.configure).
+     """
+-    assert host_or_target in (host, target)
++    assert host_or_target in {host, target}
+ 
+     @depends(rustc, host_or_target, c_compiler, rust_supported_targets,
+              when=rust_compiler)
+     @imports('os')
+     @imports('subprocess')
+     @imports(_from='mozbuild.configure.util', _import='LineIO')
+     @imports(_from='mozbuild.shellutil', _import='quote')
+     @imports(_from='tempfile', _import='mkstemp')
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -670,17 +670,17 @@ def toolchain_search_path(vc_compiler_pa
+ @template
+ def default_c_compilers(host_or_target, other_c_compiler=None):
+     '''Template defining the set of default C compilers for the host and
+     target platforms.
+     `host_or_target` is either `host` or `target` (the @depends functions
+     from init.configure.
+     `other_c_compiler` is the `target` C compiler when `host_or_target` is `host`.
+     '''
+-    assert host_or_target in (host, target)
++    assert host_or_target in {host, target}
+ 
+     other_c_compiler = () if other_c_compiler is None else (other_c_compiler,)
+ 
+     @depends(host_or_target, target, toolchain_prefix, android_clang_compiler,
+              *other_c_compiler)
+     def default_c_compilers(host_or_target, target, toolchain_prefix,
+                             android_clang_compiler, *other_c_compiler):
+         if host_or_target.kernel == 'WINNT':
+@@ -815,21 +815,21 @@ def compiler(language, host_or_target, c
+     When the language is 'C++', `c_compiler` is the result of the `compiler`
+     template for the language 'C' for the same `host_or_target`.
+     When `host_or_target` is `host`, `other_compiler` is the result of the
+     `compiler` template for the same `language` for `target`.
+     When `host_or_target` is `host` and the language is 'C++',
+     `other_c_compiler` is the result of the `compiler` template for the
+     language 'C' for `target`.
+     '''
+-    assert host_or_target in (host, target)
++    assert host_or_target in {host, target}
+     assert language in ('C', 'C++')
+     assert language == 'C' or c_compiler is not None
+-    assert host_or_target == target or other_compiler is not None
+-    assert language == 'C' or host_or_target == target or \
++    assert host_or_target is target or other_compiler is not None
++    assert language == 'C' or host_or_target is target or \
+         other_c_compiler is not None
+ 
+     host_or_target_str = {
+         host: 'host',
+         target: 'target',
+     }[host_or_target]
+ 
+     var = {
+@@ -1027,17 +1027,17 @@ def compiler(language, host_or_target, c
+ 
+     valid_compiler.try_compile(check_msg='%s works' % what,
+                                onerror=compiler_error)
+ 
+     # Set CPP/CXXCPP for both the build system and old-configure. We don't
+     # need to check this works for preprocessing, because we already relied
+     # on $CC -E/$CXX -E doing preprocessing work to validate the compiler
+     # in the first place.
+-    if host_or_target == target:
++    if host_or_target is target:
+         pp_var = {
+             'C': 'CPP',
+             'C++': 'CXXCPP',
+         }[language]
+ 
+         preprocessor = depends_if(valid_compiler)(
+             lambda x: list(x.wrapper) + [x.compiler, '-E'] + list(x.flags))
+ 
+@@ -1056,17 +1056,17 @@ def compiler(language, host_or_target, c
+                 return value[0]
+ 
+         @depends(valid_compiler, linker)
+         def unused_linker(compiler, linker):
+             if linker and compiler.type != 'msvc':
+                 log.warning('The value of %s is not used by this build system.'
+                             % linker_var)
+ 
+-        if host_or_target == target:
++        if host_or_target is target:
+             @depends(valid_compiler)
+             def is_msvc(compiler):
+                 return compiler.type == 'msvc'
+ 
+             imply_option('LINKER', linker, reason='LD', when=is_msvc)
+ 
+     return valid_compiler
+ 
+diff --git a/moz.configure b/moz.configure
+--- a/moz.configure
++++ b/moz.configure
+@@ -157,17 +157,17 @@ option(env='SO_VERSION', nargs=1, defaul
+        help='Shared library version for OpenBSD systems')
+ 
+ @depends('SO_VERSION', when=is_openbsd)
+ def so_version(value):
+     return value
+ 
+ @template
+ def library_name_info_template(host_or_target):
+-    assert host_or_target in (host, target)
++    assert host_or_target in {host, target}
+     compiler = {
+         host: host_c_compiler,
+         target: c_compiler,
+     }[host_or_target]
+ 
+     @depends(host_or_target, compiler, so_version)
+     def library_name_info_impl(host_or_target, compiler, so_version):
+         if host_or_target.kernel == 'WINNT':
+diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py
+--- a/python/mozbuild/mozbuild/configure/__init__.py
++++ b/python/mozbuild/mozbuild/configure/__init__.py
+@@ -61,16 +61,41 @@ class SandboxDependsFunction(object):
+         return self._or(other).sandboxed
+ 
+     def __and__(self, other):
+         if not isinstance(other, SandboxDependsFunction):
+             raise ConfigureError('Can only do binary arithmetic operations '
+                                  'with another @depends function.')
+         return self._and(other).sandboxed
+ 
++    def __cmp__(self, other):
++        raise ConfigureError('Cannot compare @depends functions.')
++
++    def __eq__(self, other):
++        raise ConfigureError('Cannot compare @depends functions.')
++
++    def __ne__(self, other):
++        raise ConfigureError('Cannot compare @depends functions.')
++
++    def __lt__(self, other):
++        raise ConfigureError('Cannot compare @depends functions.')
++
++    def __le__(self, other):
++        raise ConfigureError('Cannot compare @depends functions.')
++
++    def __gt__(self, other):
++        raise ConfigureError('Cannot compare @depends functions.')
++
++    def __ge__(self, other):
++        raise ConfigureError('Cannot compare @depends functions.')
++
++    def __nonzero__(self):
++        raise ConfigureError('Cannot use @depends functions in '
++                             'e.g. conditionals.')
++
+     def __getattr__(self, key):
+         return self._getattr(key).sandboxed
+ 
+     def __nonzero__(self):
+         raise ConfigureError(
+             'Cannot do boolean operations on @depends functions.')
+ 
+ 

+ 62 - 0
rel-257/mozilla-esr60/patches/1514089-66a1.patch

@@ -0,0 +1,62 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1544799364 0
+# Node ID 8d89b44a16de1138fee1ca2ed5737611c4de5097
+# Parent  0b36b93fbfcf7c9fa044d1265f258250746106c7
+Bug 1514089 - Move fxc and wine detection to toolkit/moz.configure. r=froydnj
+
+They are not necessary to build e.g. standalone spidermonkey.
+
+Differential Revision: https://phabricator.services.mozilla.com/D14513
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -1327,25 +1327,16 @@ set_config('PREPROCESS_OPTION', preproce
+ 
+ @depends(target, host)
+ def is_windows(target, host):
+     return host.kernel == 'WINNT' and target.kernel == 'WINNT'
+ 
+ 
+ include('windows.configure', when=is_windows)
+ 
+-# Shader Compiler for Windows (and MinGW Cross Compile)
+-# ==============================================================
+-
+-fxc = check_prog('FXC', ('fxc.exe', 'fxc2.exe'), when=depends(target)
+-                 (lambda t: t.kernel == 'WINNT'))
+-add_old_configure_assignment('FXC', fxc)
+-wine = check_prog('WINE', ['wine'], when=depends(target, host)
+-                  (lambda t, h: t.kernel == 'WINNT' and h.kernel == 'Linux'))
+-
+ # Security Hardening
+ # ==============================================================
+ 
+ js_option('--enable-address-sanitizer', help='Enable Address Sanitizer')
+ 
+ 
+ @depends_if('--enable-address-sanitizer')
+ def asan(value):
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -1307,8 +1307,18 @@ option('--with-unsigned-addon-scopes',
+ def unsigned_addon_scopes(scopes):
+     return namespace(
+         app='app' in scopes or None,
+         system='system' in scopes or None,
+     )
+ 
+ set_config('MOZ_UNSIGNED_APP_SCOPE', unsigned_addon_scopes.app)
+ set_config('MOZ_UNSIGNED_SYSTEM_SCOPE', unsigned_addon_scopes.system)
++
++
++# Shader Compiler for Windows (and MinGW Cross Compile)
++# ==============================================================
++
++fxc = check_prog('FXC', ('fxc.exe', 'fxc2.exe'), when=depends(target)
++                 (lambda t: t.kernel == 'WINNT'))
++add_old_configure_assignment('FXC', fxc)
++wine = check_prog('WINE', ['wine'], when=depends(target, host)
++                  (lambda t, h: t.kernel == 'WINNT' and h.kernel == 'Linux'))

+ 7 - 10
comm-esr60/mozilla-esr60/patches/1515528-66a1.patch → rel-257/mozilla-esr60/patches/1515528-1-66a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1547166026 0
 # Node ID a426ddd23654e1f3b801d864aa1a686fc22d8e4f
-# Parent  abdd58fcfa949e2fd6e75658d7e7d2be599314bb
+# Parent  7e8e0efa9bdeb6b99a89d4e7898536d962e0cdd0
 Bug 1515528 - Prefer link to lld-link when building with msvc rather than clang-cl. r=froydnj
 
 While it was preferable to use lld-link with msvc for performance
@@ -16,7 +16,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D15262
 diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure
 --- a/build/moz.configure/windows.configure
 +++ b/build/moz.configure/windows.configure
-@@ -443,19 +443,38 @@ def valid_mt(path):
+@@ -441,18 +441,34 @@ def valid_mt(path):
      except subprocess.CalledProcessError:
          pass
      raise FatalCheckError('%s is not Microsoft Manifest Tool')
@@ -45,14 +45,11 @@ diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows
 +link = check_prog('LINKER', linker_progs_for(target),
                    paths=toolchain_search_path)
  
-+# -host_link = check_prog('HOST_LINKER', ('lld-link.exe', 'link.exe'),
-+# +host_link = check_prog('HOST_LINKER', linker_progs_for(host),
-+
+-host_link = check_prog('HOST_LINKER', ('lld-link.exe', 'link.exe'),
++host_link = check_prog('HOST_LINKER', linker_progs_for(host),
+                        paths=toolchain_search_path)
+ 
  add_old_configure_assignment('LINKER', link)
  
  
- # Normally, we'd just have CC, etc. set to absolute paths, but the build system
- # doesn't currently handle properly the case where the paths contain spaces.
- # Additionally, there's the issue described in toolchain.configure, in
- # valid_compiler().
- @depends(sdk_bin_path)
+ check_prog('MAKECAB', ('makecab.exe',))

+ 36 - 0
rel-257/mozilla-esr60/patches/1515528-2-66a1.patch

@@ -0,0 +1,36 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1547166029 0
+# Node ID eb83a8375b871fcd39ba97d37509320a2e98a406
+# Parent  5d769c66e02c24e93e2614decf1f86d3ab6f63ab
+Bug 1515528 - Fix VC paths for arm64. r=froydnj
+
+Depends on D15262
+
+Differential Revision: https://phabricator.services.mozilla.com/D15263
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -586,19 +586,19 @@ def get_vc_paths(topsrcdir):
+     for install in vswhere(['-products', '*', '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64']):
+         path = install['installationPath']
+         tools_version = open(os.path.join(
+             path, r'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt'), 'rb').read().strip()
+         tools_path = os.path.join(
+             path, r'VC\Tools\MSVC', tools_version, r'bin\HostX64')
+         yield (Version(install['installationVersion']), {
+             'x64': [os.path.join(tools_path, 'x64')],
+-            # The x64->x86 cross toolchain requires DLLs from the native x64 toolchain.
++            # The cross toolchains require DLLs from the native x64 toolchain.
+             'x86': [os.path.join(tools_path, 'x86'), os.path.join(tools_path, 'x64')],
+-            'arm64': [os.path.join(tools_path, 'x64')],
++            'arm64': [os.path.join(tools_path, 'arm64'), os.path.join(tools_path, 'x64')],
+         })
+ 
+ 
+ js_option('--with-visual-studio-version', nargs=1,
+           choices=('2017',),
+           help='Select a specific Visual Studio version to use')
+ 
+ 

+ 468 - 0
rel-257/mozilla-esr60/patches/1515528-3-66a1.patch

@@ -0,0 +1,468 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1547166031 0
+# Node ID f1ec67ff78066b5a20fab4e1900166b005b46d46
+# Parent  3257bf28d56d199e0e0247c92a27934d4b5f21de
+Bug 1515528 - Detect MSVC paths separately for host and target. r=chmanchester
+
+Because MSVC compilers only support one architecture, we need to search
+"cl" in different toolchain search paths for each of the host and
+target, especially when they are different.
+
+Likewise for the library paths for the linker. Ideally we'd pass
+-LIBPATH both for host and target, but that has implications for rust
+that I don't want to have to figure just now.
+
+Depends on D15263
+
+Differential Revision: https://phabricator.services.mozilla.com/D15264
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -603,89 +603,113 @@ js_option('--with-visual-studio-version'
+ 
+ 
+ @depends('--with-visual-studio-version')
+ def vs_major_version(value):
+     if value:
+         return {'2017': 15}[value[0]]
+ 
+ 
+-@depends(host, target, vs_major_version, check_build_environment, '--with-visual-studio-version')
+-@imports(_from='__builtin__', _import='sorted')
+-@imports(_from='operator', _import='itemgetter')
+-@imports('platform')
+-def vc_compiler_path(host, target, vs_major_version, env, vs_release_name):
+-    if host.kernel != 'WINNT':
+-        return
+-    vc_target = {
+-        'x86': 'x86',
+-        'x86_64': 'x64',
+-        'arm': 'arm',
+-        'aarch64': 'arm64'
+-    }.get(target.cpu)
+-    if vc_target is None:
+-        return
++@template
++def vc_compiler_path_for(host_or_target):
++    @depends(host, host_or_target, vs_major_version, check_build_environment,
++             '--with-visual-studio-version')
++    @imports(_from='__builtin__', _import='sorted')
++    @imports(_from='operator', _import='itemgetter')
++    @imports('platform')
++    def vc_compiler_path(host, target, vs_major_version, env, vs_release_name):
++        if host.kernel != 'WINNT':
++            return
++        vc_target = {
++            'x86': 'x86',
++            'x86_64': 'x64',
++            'arm': 'arm',
++            'aarch64': 'arm64'
++        }.get(target.cpu)
++        if vc_target is None:
++            return
+ 
+-    all_versions = sorted(get_vc_paths(env.topsrcdir), key=itemgetter(0))
+-    if not all_versions:
+-        return
+-    if vs_major_version:
+-        versions = [d for (v, d) in all_versions if v.major ==
+-                    vs_major_version]
+-        if not versions:
+-            die('Visual Studio %s could not be found!' % vs_release_name)
+-        data = versions[0]
+-    else:
+-        # Choose the newest version.
+-        data = all_versions[-1][1]
+-    paths = data.get(vc_target)
+-    if not paths:
+-        return
+-    return paths
++        all_versions = sorted(get_vc_paths(env.topsrcdir), key=itemgetter(0))
++        if not all_versions:
++            return
++        if vs_major_version:
++            versions = [d for (v, d) in all_versions if v.major ==
++                        vs_major_version]
++            if not versions:
++                die('Visual Studio %s could not be found!' % vs_release_name)
++            data = versions[0]
++        else:
++            # Choose the newest version.
++            data = all_versions[-1][1]
++        paths = data.get(vc_target)
++        if not paths:
++            return
++        return paths
++    return vc_compiler_path
++
++
++vc_compiler_path = vc_compiler_path_for(target)
++host_vc_compiler_path = vc_compiler_path_for(host)
+ 
+ 
+ @dependable
+ @imports('os')
+ @imports(_from='os', _import='environ')
+ def original_path():
+     return environ['PATH'].split(os.pathsep)
+ 
+ 
+-@depends(vc_compiler_path, original_path)
+-@imports('os')
+-@imports(_from='os', _import='environ')
+-def toolchain_search_path(vc_compiler_path, original_path):
+-    result = list(original_path)
++@template
++def toolchain_search_path_for(host_or_target):
++    vc_path = {
++        host: host_vc_compiler_path,
++        target: vc_compiler_path,
++    }[host_or_target]
+ 
+-    if vc_compiler_path:
+-        # The second item, if there is one, is necessary to have in $PATH for
+-        # Windows to load the required DLLs from there.
+-        if len(vc_compiler_path) > 1:
+-            environ['PATH'] = os.pathsep.join(result + vc_compiler_path[1:])
++    @depends(vc_path, original_path)
++    @imports('os')
++    @imports(_from='os', _import='environ')
++    def toolchain_search_path(vc_compiler_path, original_path):
++        result = list(original_path)
+ 
+-        # The first item is where the programs are going to be
+-        result.append(vc_compiler_path[0])
++        if vc_compiler_path:
++            # The second item, if there is one, is necessary to have in $PATH for
++            # Windows to load the required DLLs from there.
++            if len(vc_compiler_path) > 1:
++                environ['PATH'] = os.pathsep.join(result + vc_compiler_path[1:])
++
++            # The first item is where the programs are going to be
++            result.append(vc_compiler_path[0])
+ 
+-    # Also add in the location to which `mach bootstrap` or
+-    # `mach artifact toolchain` installs clang.
+-    mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH',
+-                                     os.path.expanduser(os.path.join('~', '.mozbuild')))
+-    bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
+-    result.append(bootstrap_clang_path)
++        # Also add in the location to which `mach bootstrap` or
++        # `mach artifact toolchain` installs clang.
++        mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH',
++                                         os.path.expanduser(os.path.join('~', '.mozbuild')))
++        bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
++        result.append(bootstrap_clang_path)
+ 
+-    return result
++        return result
++    return toolchain_search_path
++
++
++toolchain_search_path = toolchain_search_path_for(target)
++host_toolchain_search_path = toolchain_search_path_for(host)
++
+ 
+ # As a workaround until bug 1516228 and bug 1516253 are fixed, set the PATH
+ # variable for the build to contain the toolchain search path.
+-@depends(toolchain_search_path)
++@depends(toolchain_search_path, host_toolchain_search_path)
+ @imports('os')
+ @imports(_from='os', _import='environ')
+-def altered_path(toolchain_search_path):
++def altered_path(toolchain_search_path, host_toolchain_search_path):
+     path = environ['PATH'].split(os.pathsep)
+     altered_path = list(toolchain_search_path)
++    for p in host_toolchain_search_path:
++        if p not in altered_path:
++            altered_path.append(p)
+     for p in path:
+         if p not in altered_path:
+             altered_path.append(p)
+     return os.pathsep.join(altered_path)
+ 
+ 
+ set_config('PATH', altered_path)
+ 
+@@ -727,16 +751,20 @@ def default_c_compilers(host_or_target, 
+                     # If the target C compiler is GCC, and it can't be used with
+                     # -m32/-m64 for the host, it's probably toolchain-prefixed,
+                     # so we prioritize a raw 'gcc' instead.
+                     prioritized = info.type
+             elif info.type == 'clang' and android_clang_compiler:
+                 # Android NDK clangs do not function as host compiler, so
+                 # prioritize a raw 'clang' instead.
+                 prioritized = info.type
++            elif info.type == 'msvc' and target.cpu != host_or_target.cpu:
++                # MSVC compilers only support one architecture, so we'll
++                # want a cl in another (detected) path.
++                prioritized = 'cl'
+ 
+             types = [prioritized] + [t for t in types if t != info.type]
+ 
+         gcc = ('gcc',)
+         if toolchain_prefix and host_or_target is target:
+             gcc = tuple('%sgcc' % p for p in toolchain_prefix) + gcc
+ 
+         result = []
+@@ -870,23 +898,28 @@ def compiler(language, host_or_target, c
+     what = 'the %s %s compiler' % (host_or_target_str, language)
+ 
+     option(env=var, nargs=1, help='Path to %s' % what)
+ 
+     # Handle the compiler given by the user through one of the CC/CXX/HOST_CC/
+     # HOST_CXX variables.
+     provided_compiler = provided_program(var)
+ 
++    search_path = {
++        host: host_toolchain_search_path,
++        target: toolchain_search_path,
++    }[host_or_target]
++
+     # Normally, we'd use `var` instead of `_var`, but the interaction with
+     # old-configure complicates things, and for now, we a) can't take the plain
+     # result from check_prog as CC/CXX/HOST_CC/HOST_CXX and b) have to let
+     # old-configure AC_SUBST it (because it's autoconf doing it, not us)
+     compiler = check_prog('_%s' % var, what=what, progs=default_compilers,
+                           input=provided_compiler.program,
+-                          paths=toolchain_search_path)
++                          paths=search_path)
+ 
+     @depends(compiler, provided_compiler, compiler_wrapper, host_or_target)
+     @checking('whether %s can be used' % what, lambda x: bool(x))
+     @imports(_from='mozbuild.shellutil', _import='quote')
+     def valid_compiler(compiler, provided_compiler, compiler_wrapper,
+                        host_or_target):
+         wrapper = list(compiler_wrapper or ())
+         if provided_compiler:
+diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure
+--- a/build/moz.configure/windows.configure
++++ b/build/moz.configure/windows.configure
+@@ -329,76 +329,101 @@ def include_path(vc_path, windows_sdk_di
+     includes = os.pathsep.join(includes)
+     os.environ['INCLUDE'] = includes
+     return includes
+ 
+ 
+ set_config('INCLUDE', include_path)
+ 
+ 
+-@depends(target, c_compiler, vc_path, valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_dir)
+-@imports('os')
+-def lib_path(target, c_compiler, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir):
+-    if not vc_path:
+-        return
+-    sdk_target = {
+-        'x86': 'x86',
+-        'x86_64': 'x64',
+-        'arm': 'arm',
+-        'aarch64': 'arm64',
+-    }.get(target.cpu)
++@template
++def lib_path_for(host_or_target):
++    compiler = {
++        host: host_c_compiler,
++        target: c_compiler,
++    }[host_or_target]
++
++    @depends(host_or_target, dependable(host_or_target is host), compiler, vc_path,
++             valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_dir)
++    @imports('os')
++    def lib_path(target, is_host, c_compiler, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir):
++        if not vc_path:
++            return
++        sdk_target = {
++            'x86': 'x86',
++            'x86_64': 'x64',
++            'arm': 'arm',
++            'aarch64': 'arm64',
++        }.get(target.cpu)
+ 
+-    old_target = {
+-        'x86': '',
+-        'x86_64': 'amd64',
+-        'arm': 'arm',
+-        'aarch64': 'arm64'
+-    }.get(target.cpu)
+-    if old_target is None:
+-        return
+-    # As old_target can be '', and os.path.join will happily use the empty
+-    # string, leading to a string ending with a backslash, that Make will
+-    # interpret as a "string continues on next line" indicator, use variable
+-    # args.
+-    old_target = (old_target,) if old_target else ()
+-    if c_compiler.version < '19.10':
+-        # MSVC2015
+-        vc_target = old_target
+-    else:
+-        # MSVC2017 switched to use the same target naming as the sdk.
+-        vc_target = (sdk_target,)
++        old_target = {
++            'x86': '',
++            'x86_64': 'amd64',
++            'arm': 'arm',
++            'aarch64': 'arm64'
++        }.get(target.cpu)
++        if old_target is None:
++            return
++        # As old_target can be '', and os.path.join will happily use the empty
++        # string, leading to a string ending with a backslash, that Make will
++        # interpret as a "string continues on next line" indicator, use variable
++        # args.
++        old_target = (old_target,) if old_target else ()
++        if c_compiler.version < '19.10':
++            # MSVC2015
++            vc_target = old_target
++        else:
++            # MSVC2017 switched to use the same target naming as the sdk.
++            vc_target = (sdk_target,)
+ 
+-    atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'lib', *vc_target)
+-    if not os.path.isdir(atlmfc_dir):
+-        die('Cannot find the ATL/MFC libraries in the Visual C++ directory '
+-            '(%s). Please install them.' % vc_path)
++        atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'lib', *vc_target)
++        if not os.path.isdir(atlmfc_dir):
++            die('Cannot find the ATL/MFC libraries in the Visual C++ directory '
++                '(%s). Please install them.' % vc_path)
+ 
+-    libs = []
+-    lib_env = os.environ.get('LIB')
+-    if lib_env:
+-        libs.append(lib_env)
+-    libs.extend((
+-        os.path.join(vc_path, 'lib', *vc_target),
+-        atlmfc_dir,
+-        os.path.join(windows_sdk_dir.lib, 'um', sdk_target),
+-        os.path.join(ucrt_sdk_dir.lib, 'ucrt', sdk_target),
+-    ))
+-    if dia_sdk_dir:
+-        # For some reason the DIA SDK still uses the old-style targets
+-        # even in a newer MSVC.
+-        libs.append(os.path.join(dia_sdk_dir, 'lib', *old_target))
++        libs = []
++        lib_env = os.environ.get('LIB')
++        if lib_env and not is_host:
++            libs.extend(lib_env.split(os.pathsep))
++        libs.extend((
++            os.path.join(vc_path, 'lib', *vc_target),
++            atlmfc_dir,
++            os.path.join(windows_sdk_dir.lib, 'um', sdk_target),
++            os.path.join(ucrt_sdk_dir.lib, 'ucrt', sdk_target),
++        ))
++        if dia_sdk_dir:
++            # For some reason the DIA SDK still uses the old-style targets
++            # even in a newer MSVC.
++            libs.append(os.path.join(dia_sdk_dir, 'lib', *old_target))
++        return libs
++
++    return lib_path
++
++
++@depends(lib_path_for(target))
++@imports('os')
++def lib_path(libs):
+     # Set in the environment for old-configure
+     libs = os.pathsep.join(libs)
+     os.environ['LIB'] = libs
+     return libs
+ 
+ 
+ set_config('LIB', lib_path)
+ 
+ 
++@depends(lib_path_for(host))
++@imports(_from='mozbuild.shellutil', _import='quote')
++def host_linker_libpaths(libs):
++    return ['-LIBPATH:%s' % quote(l) for l in libs]
++
++
++set_config('HOST_LINKER_LIBPATHS', host_linker_libpaths)
++
++
+ option(env='MT', nargs=1, help='Path to the Microsoft Manifest Tool')
+ 
+ 
+ @depends(valid_windows_sdk_dir, valid_ucrt_sdk_dir)
+ @imports(_from='os', _import='environ')
+ @imports('platform')
+ def sdk_bin_path(valid_windows_sdk_dir, valid_ucrt_sdk_dir):
+     if not valid_windows_sdk_dir:
+@@ -461,14 +486,14 @@ def linker_progs_for(host_or_target):
+             return ('lld-link', 'link')
+     return linker_progs
+ 
+ 
+ link = check_prog('LINKER', linker_progs_for(target),
+                   paths=toolchain_search_path)
+ 
+ host_link = check_prog('HOST_LINKER', linker_progs_for(host),
+-                       paths=toolchain_search_path)
++                       paths=host_toolchain_search_path)
+ 
+ add_old_configure_assignment('LINKER', link)
+ 
+ 
+ check_prog('MAKECAB', ('makecab.exe',))
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -576,17 +576,17 @@ ifdef ENABLE_STRIP
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+ $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
+-	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LINKER_LIBPATHS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		else \
+ 			echo 'Embedding manifest from $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+@@ -635,17 +635,17 @@ ifdef ENABLE_STRIP
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+ $(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
+-	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LINKER_LIBPATHS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
+ 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ 	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+ endif
+ ifndef CROSS_COMPILE
+@@ -667,17 +667,17 @@ ifeq ($(OS_ARCH),WINNT)
+ # See bug 795204.
+ $(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
+ endif
+ 
+ $(HOST_SHARED_LIBRARY): Makefile
+ 	$(REPORT_BUILD)
+ 	$(RM) $@
+ ifdef _MSC_VER
+-	$(HOST_LINKER) -NOLOGO -DLL -OUT:$@ $($(notdir $@)_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -DLL -OUT:$@ $($(notdir $@)_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LINKER_LIBPATHS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $($(notdir $@)_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+ 
+ # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
+ # so instead of deleting .o files after repacking them into a dylib, we make
+ # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
+ # so no need to conditionalize on OS version or debugging format.

+ 37 - 0
rel-257/mozilla-esr60/patches/1515528-4-66a1.patch

@@ -0,0 +1,37 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1547166033 0
+# Node ID c7d7c62b7b11c28bcc44d8a3424dcb419b9d7bce
+# Parent  1701dad51e13079e8ab085256e58fa0ef271b1d7
+Bug 1515528 - Prefer MSVC when building for aarch64 windows. r=froydnj
+
+Depends on D15264
+
+Differential Revision: https://phabricator.services.mozilla.com/D15265
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -726,17 +726,21 @@ def default_c_compilers(host_or_target, 
+ 
+     other_c_compiler = () if other_c_compiler is None else (other_c_compiler,)
+ 
+     @depends(host_or_target, target, toolchain_prefix, android_clang_compiler,
+              *other_c_compiler)
+     def default_c_compilers(host_or_target, target, toolchain_prefix,
+                             android_clang_compiler, *other_c_compiler):
+         if host_or_target.kernel == 'WINNT':
+-            supported = types = ('clang-cl', 'msvc', 'gcc', 'clang')
++            # Prefer MSVC for aarch64 for now.
++            if host_or_target.cpu == 'aarch64':
++                supported = types = ('msvc', 'clang-cl', 'gcc', 'clang')
++            else:
++                supported = types = ('clang-cl', 'msvc', 'gcc', 'clang')
+         elif host_or_target.kernel == 'Darwin':
+             types = ('clang',)
+             supported = ('clang', 'gcc')
+         else:
+             supported = types = ('clang', 'gcc')
+ 
+         info = other_c_compiler[0] if other_c_compiler else None
+         if info and info.type in supported:

+ 44 - 0
rel-257/mozilla-esr60/patches/1515528-5-66a1.patch

@@ -0,0 +1,44 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1547166035 0
+# Node ID 02cd44e39566b22dc5c02f031c02045aca2a4393
+# Parent  a380b93b6b312703f1ea13266eef1898cfa1d7ba
+Bug 1515528 - Disable accessibility on aarch64-windows. r=dmajor,chmanchester
+
+Depends on D15265
+
+Differential Revision: https://phabricator.services.mozilla.com/D15266
+
+diff --git a/toolkit/moz.configure b/toolkit/moz.configure
+--- a/toolkit/moz.configure
++++ b/toolkit/moz.configure
+@@ -1266,19 +1266,27 @@ def midl_flags(c_compiler, target):
+     }[target.cpu]
+ 
+ 
+ set_config('MIDL_FLAGS', midl_flags)
+ 
+ # Accessibility
+ # ==============================================================
+ 
+-option('--disable-accessibility', help='Disable accessibility support')
++@depends(target)
++def a11y_default(target):
++    # Accessibility doesn't work on aarch64-windows yet.
++    if target.kernel == 'WINNT' and target.cpu == 'aarch64':
++        return False
++    return True
+ 
+-@depends('--disable-accessibility', check_for_midl, midl, c_compiler)
++option('--enable-accessibility',
++       default=a11y_default, help='{Enable|Disable} accessibility support')
++
++@depends('--enable-accessibility', check_for_midl, midl, c_compiler)
+ def accessibility(value, check_for_midl, midl, c_compiler):
+     enabled = bool(value)
+ 
+     if not enabled:
+         return
+ 
+     if check_for_midl and not midl:
+         if c_compiler and c_compiler.type in ('gcc', 'clang'):

+ 2 - 2
comm-esr60/mozilla-esr60/patches/1515550-66a1.patch → rel-257/mozilla-esr60/patches/1515550-66a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1545342794 0
 # Node ID 6e20ac702aa4fb6e9e971cc2b82aeab821937e7f
-# Parent  e82ddf572c866559b9447ac174ac663e81e7efa3
+# Parent  c59d03042da2a87b77245059630ac2d32fe89a2e
 Bug 1515550 - Search all MSVC products for the compiler components. r=ted
 
 vswhere only searches in Community, Professional and Enterprise, but one can
@@ -13,7 +13,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D15056
 diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
 --- a/build/moz.configure/toolchain.configure
 +++ b/build/moz.configure/toolchain.configure
-@@ -556,17 +556,17 @@ def get_vc_paths(topsrcdir):
+@@ -574,17 +574,17 @@ def get_vc_paths(topsrcdir):
          encoding = 'mbcs' if sys.platform == 'win32' else 'utf-8'
          return json.loads(
              subprocess.check_output([

+ 200 - 0
rel-257/mozilla-esr60/patches/1515579-2only-66a1.patch

@@ -0,0 +1,200 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1547163466 0
+# Node ID fa8e39feef4389d1ff83fe952c76ffba7c2217d6
+# Parent  0084dab322ad4636701bb031c3c5686cb6b9e5d2
+Bug 1515579 - Use absolute paths for compilers, etc. r=ted
+
+In bug 1259382, some workarounds were added to make the build system
+alter PATH and not use absolute paths for toolchain programs, because
+autoconf and the build system doesn't deal with spaces in those very
+well. But later in bug 1290040, we made find_program return Windows
+short paths (without spaces), which alleviates the need for those
+workarounds.
+
+We still, however, and unfortunately, need to alter PATH to account for
+the fact that MSVC DLLs are not necessarily alongside the compiler
+executables...
+
+Depends on D15181
+
+Differential Revision: https://phabricator.services.mozilla.com/D15182
+
+diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
+--- a/build/moz.configure/toolchain.configure
++++ b/build/moz.configure/toolchain.configure
+@@ -637,39 +637,62 @@ def vc_compiler_path(host, target, vs_ma
+         # Choose the newest version.
+         data = all_versions[-1][1]
+     paths = data.get(vc_target)
+     if not paths:
+         return
+     return paths
+ 
+ 
+-@depends(vc_compiler_path)
++@dependable
++@imports('os')
++@imports(_from='os', _import='environ')
++def original_path():
++    return environ['PATH'].split(os.pathsep)
++
++
++@depends(vc_compiler_path, original_path)
+ @imports('os')
+ @imports(_from='os', _import='environ')
+-def toolchain_search_path(vc_compiler_path):
+-    result = [environ.get('PATH')]
++def toolchain_search_path(vc_compiler_path, original_path):
++    result = list(original_path)
+ 
+     if vc_compiler_path:
+-        result.extend(vc_compiler_path)
++        # The second item, if there is one, is necessary to have in $PATH for
++        # Windows to load the required DLLs from there.
++        if len(vc_compiler_path) > 1:
++            environ['PATH'] = os.pathsep.join(result + vc_compiler_path[1:])
++
++        # The first item is where the programs are going to be
++        result.append(vc_compiler_path[0])
+ 
+     # Also add in the location to which `mach bootstrap` or
+     # `mach artifact toolchain` installs clang.
+     mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH',
+                                      os.path.expanduser(os.path.join('~', '.mozbuild')))
+     bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
+     result.append(bootstrap_clang_path)
+ 
+-    if vc_compiler_path:
+-        # We're going to alter PATH for good in windows.configure, but we also
+-        # need to do it for the valid_compiler() check below. This is only needed
+-        # on Windows, where MSVC needs PATH set to find dlls.
+-        environ['PATH'] = os.pathsep.join(result)
++    return result
+ 
+-    return result
++# As a workaround until bug 1516228 and bug 1516253 are fixed, set the PATH
++# variable for the build to contain the toolchain search path.
++@depends(toolchain_search_path)
++@imports('os')
++@imports(_from='os', _import='environ')
++def altered_path(toolchain_search_path):
++    path = environ['PATH'].split(os.pathsep)
++    altered_path = list(toolchain_search_path)
++    for p in path:
++        if p not in altered_path:
++            altered_path.append(p)
++    return os.pathsep.join(altered_path)
++
++
++set_config('PATH', altered_path)
+ 
+ 
+ @template
+ def default_c_compilers(host_or_target, other_c_compiler=None):
+     '''Template defining the set of default C compilers for the host and
+     target platforms.
+     `host_or_target` is either `host` or `target` (the @depends functions
+     from init.configure.
+@@ -873,36 +896,16 @@ def compiler(language, host_or_target, c
+             # --with-ccache.
+             if provided_wrapper[:len(wrapper)] == wrapper:
+                 provided_wrapper = provided_wrapper[len(wrapper):]
+             wrapper.extend(provided_wrapper)
+             flags = provided_compiler.flags
+         else:
+             flags = []
+ 
+-        # Ideally, we'd always use the absolute path, but unfortunately, on
+-        # Windows, the compiler is very often in a directory containing spaces.
+-        # Unfortunately, due to the way autoconf does its compiler tests with
+-        # eval, that doesn't work out. So in that case, check that the
+-        # compiler can still be found in $PATH, and use the file name instead
+-        # of the full path.
+-        if quote(compiler) != compiler:
+-            full_path = os.path.abspath(compiler)
+-            compiler = os.path.basename(compiler)
+-            found_compiler = find_program(compiler)
+-            if not found_compiler:
+-                die('%s is not in your $PATH'
+-                    % quote(os.path.dirname(full_path)))
+-            if os.path.normcase(find_program(compiler)) != os.path.normcase(
+-                    full_path):
+-                die('Found `%s` before `%s` in your $PATH. '
+-                    'Please reorder your $PATH.',
+-                    quote(os.path.dirname(found_compiler)),
+-                    quote(os.path.dirname(full_path)))
+-
+         info = check_compiler(wrapper + [compiler] + flags, language,
+                               host_or_target)
+ 
+         # Check that the additional flags we got are enough to not require any
+         # more flags. If we get an exception, just ignore it; it's liable to be
+         # invalid command-line flags, which means the compiler we're checking
+         # doesn't support those command-line flags and will fail one or more of
+         # the checks below.
+diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure
+--- a/build/moz.configure/windows.configure
++++ b/build/moz.configure/windows.configure
+@@ -251,33 +251,29 @@ def valid_ucrt_sdk_dir(windows_sdk_dir, 
+     return namespace(
+         path=sdk.path,
+         include=sdk.include,
+         lib=sdk.lib,
+         version=version,
+     )
+ 
+ 
+-@depends(c_compiler)
++@depends(c_compiler, toolchain_search_path)
+ @imports('os')
+-def vc_path(c_compiler):
++def vc_path(c_compiler, toolchain_search_path):
+     if c_compiler.type not in ('msvc', 'clang-cl'):
+         return
+ 
+-    # Normally, we'd start from c_compiler.compiler, but for now, it's not the
+-    # ideal full path to the compiler. At least, we're guaranteed find_program
+-    # will get us the one we found in toolchain.configure.
+     vc_program = c_compiler.compiler
+ 
+     # In clang-cl builds, we use the headers and libraries from an MSVC installation.
+     if c_compiler.type == 'clang-cl':
+-        vc_program = 'cl.exe'
++        vc_program = find_program('cl.exe', paths=toolchain_search_path)
+ 
+-    cl = find_program(vc_program)
+-    result = os.path.dirname(cl)
++    result = os.path.dirname(vc_program)
+     while True:
+         next, p = os.path.split(result)
+         if next == result:
+             die('Cannot determine the Visual C++ directory the compiler (%s) '
+                 'is in' % cl)
+         result = next
+         if p.lower() == 'bin':
+             break
+@@ -454,23 +450,9 @@ link = check_prog('LINKER', ('lld-link.e
+                   paths=toolchain_search_path)
+ 
+ host_link = check_prog('HOST_LINKER', ('lld-link.exe', 'link.exe'),
+                        paths=toolchain_search_path)
+ 
+ add_old_configure_assignment('LINKER', link)
+ 
+ 
+-# Normally, we'd just have CC, etc. set to absolute paths, but the build system
+-# doesn't currently handle properly the case where the paths contain spaces.
+-# Additionally, there's the issue described in toolchain.configure, in
+-# valid_compiler().
+-@depends(sdk_bin_path)
+-@imports('os')
+-def alter_path(sdk_bin_path):
+-    path = os.pathsep.join(sdk_bin_path)
+-    os.environ['PATH'] = path
+-    return path
+-
+-
+-set_config('PATH', alter_path)
+-
+ check_prog('MAKECAB', ('makecab.exe',))

+ 106 - 0
rel-257/mozilla-esr60/patches/1515843-1-64a1.patch

@@ -0,0 +1,106 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1545433187 0
+# Node ID 2fa138ebd75d453d2d9d2a3b36571c5da06f4929
+# Parent  d486f1148a1aed28621245eb99bd3b077f629279
+Bug 1515843 - Use the raw OBJ_SUFFIX for host objects. r=ted
+
+OBJ_SUFFIX is modified during the profile-generation phase to be i_o
+instead of o/obj. _OBJ_SUFFIX is the unmodified value.
+
+We don't actually do PGO for host objects, so we don't need to build the
+objects with a different suffix.
+
+Differential Revision: https://phabricator.services.mozilla.com/D15171
+
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -203,21 +203,21 @@ CMMOBJS = $(notdir $(CMMSRCS:.mm=.$(OBJ_
+ # ASFILES can have different extensions (.s, .asm)
+ ASOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(ASFILES))))
+ RS_STATICLIB_CRATE_OBJ = $(addprefix lib,$(notdir $(RS_STATICLIB_CRATE_SRC:.rs=.$(LIB_SUFFIX))))
+ ifndef OBJS
+ _OBJS = $(COBJS) $(SOBJS) $(CPPOBJS) $(CMOBJS) $(CMMOBJS) $(ASOBJS)
+ OBJS = $(strip $(_OBJS))
+ endif
+ 
+-HOST_COBJS = $(addprefix host_,$(notdir $(HOST_CSRCS:.c=.$(OBJ_SUFFIX))))
++HOST_COBJS = $(addprefix host_,$(notdir $(HOST_CSRCS:.c=.$(_OBJ_SUFFIX))))
+ # HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
+-HOST_CPPOBJS = $(addprefix host_,$(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(HOST_CPPSRCS)))))
+-HOST_CMOBJS = $(addprefix host_,$(notdir $(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))))
+-HOST_CMMOBJS = $(addprefix host_,$(notdir $(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX))))
++HOST_CPPOBJS = $(addprefix host_,$(notdir $(addsuffix .$(_OBJ_SUFFIX),$(basename $(HOST_CPPSRCS)))))
++HOST_CMOBJS = $(addprefix host_,$(notdir $(HOST_CMSRCS:.m=.$(_OBJ_SUFFIX))))
++HOST_CMMOBJS = $(addprefix host_,$(notdir $(HOST_CMMSRCS:.mm=.$(_OBJ_SUFFIX))))
+ ifndef HOST_OBJS
+ _HOST_OBJS = $(HOST_COBJS) $(HOST_CPPOBJS) $(HOST_CMOBJS) $(HOST_CMMOBJS)
+ HOST_OBJS = $(strip $(_HOST_OBJS))
+ endif
+ else
+ LIBRARY :=
+ SHARED_LIBRARY :=
+ IMPORT_LIBRARY :=
+@@ -249,17 +249,17 @@ ifdef QTDIR
+ GARBAGE                 += $(MOCSRCS)
+ endif
+ 
+ ifdef SIMPLE_PROGRAMS
+ GARBAGE			+= $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
+ endif
+ 
+ ifdef HOST_SIMPLE_PROGRAMS
+-GARBAGE			+= $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX))
++GARBAGE			+= $(HOST_SIMPLE_PROGRAMS:%=%.$(_OBJ_SUFFIX))
+ endif
+ 
+ ifdef MACH
+ ifndef NO_BUILDSTATUS_MESSAGES
+ define BUILDSTATUS
+ @echo 'BUILDSTATUS $1'
+ 
+ endef
+@@ -639,17 +639,17 @@ endif # WINNT && !GNU_CC
+ 
+ ifdef ENABLE_STRIP
+ 	$(STRIP) $(STRIP_FLAGS) $@
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+-$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
++$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(_OBJ_SUFFIX) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
+ 	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
+ 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ 	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+@@ -729,20 +729,20 @@ ifdef ENABLE_STRIP
+ endif
+ 
+ # The object file is in the current directory, and the source file can be any
+ # relative path. This macro adds the dependency obj: src for each source file.
+ # This dependency must be first for the $< flag to work correctly, and the
+ # rules that have commands for these targets must not list any other
+ # prerequisites, or they will override the $< variable.
+ define src_objdep
+-$(basename $2$(notdir $1)).$(OBJ_SUFFIX): $1 $$(call mkdir_deps,$$(MDDEPDIR))
++$(basename $3$(notdir $1)).$2: $1 $$(call mkdir_deps,$$(MDDEPDIR))
+ endef
+-$(foreach f,$(CSRCS) $(SSRCS) $(CPPSRCS) $(CMSRCS) $(CMMSRCS) $(ASFILES),$(eval $(call src_objdep,$(f))))
+-$(foreach f,$(HOST_CSRCS) $(HOST_CPPSRCS) $(HOST_CMSRCS) $(HOST_CMMSRCS),$(eval $(call src_objdep,$(f),host_)))
++$(foreach f,$(CSRCS) $(SSRCS) $(CPPSRCS) $(CMSRCS) $(CMMSRCS) $(ASFILES),$(eval $(call src_objdep,$(f),$(OBJ_SUFFIX))))
++$(foreach f,$(HOST_CSRCS) $(HOST_CPPSRCS) $(HOST_CMSRCS) $(HOST_CMMSRCS),$(eval $(call src_objdep,$(f),$(_OBJ_SUFFIX),host_)))
+ 
+ # The Rust compiler only outputs library objects, and so we need different
+ # mangling to generate dependency rules for it.
+ mk_libname = $(basename lib$(notdir $1)).rlib
+ src_libdep = $(call mk_libname,$1): $1 $$(call mkdir_deps,$$(MDDEPDIR))
+ mk_global_crate_libname = $(basename lib$(notdir $1)).$(LIB_SUFFIX)
+ crate_src_libdep = $(call mk_global_crate_libname,$1): $1 $$(call mkdir_deps,$$(MDDEPDIR))
+ $(foreach f,$(RSSRCS),$(eval $(call src_libdep,$(f))))

+ 542 - 0
rel-257/mozilla-esr60/patches/1515843-2-64a1.patch

@@ -0,0 +1,542 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1545433200 0
+# Node ID ec095af21520b791fcfdef6c88a90b48abe32762
+# Parent  ab551912457d860a804141cc31a1ddce2dd42e3e
+Bug 1515843 - Stop building host static libraries. r=ted
+
+The build system has skipped creating target static libraries for very
+long, except in very specific cases.
+
+We can actually do the same for host static libraries, for which we
+don't even need the escape hatch to still allow to create static
+libraries.
+
+Depends on D15171
+
+Differential Revision: https://phabricator.services.mozilla.com/D15172
+
+diff --git a/config/makefiles/debugmake.mk b/config/makefiles/debugmake.mk
+--- a/config/makefiles/debugmake.mk
++++ b/config/makefiles/debugmake.mk
+@@ -33,17 +33,17 @@ define print_var
+ 
+ endef
+ 
+ define print_vars
+ $(foreach var,$1,$(call print_var,$(var)))
+ endef
+ 
+ showtargs:
+-ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
++ifneq (,$(filter $(PROGRAM) $(HOST_PROGRAM) $(SIMPLE_PROGRAMS) $(LIBRARY) $(SHARED_LIBRARY),$(TARGETS)))
+ 	@echo --------------------------------------------------------------------------------
+ 	$(call print_vars,\
+ 		PROGRAM \
+ 		SIMPLE_PROGRAMS \
+ 		LIBRARY \
+ 		SHARED_LIBRARY \
+ 		LIBS \
+ 		DEF_FILE \
+@@ -107,13 +107,12 @@ showhost:
+ 		HOST_CFLAGS \
+ 		HOST_LDFLAGS \
+ 		HOST_LIBS \
+ 		HOST_EXTRA_LIBS \
+ 		HOST_EXTRA_DEPS \
+ 		HOST_PROGRAM \
+ 		HOST_OBJS \
+ 		HOST_PROGOBJS \
+-		HOST_LIBRARY \
+ 	)
+ 
+ INCLUDED_DEBUGMAKE_MK = 1
+ endif #}
+diff --git a/config/rules.mk b/config/rules.mk
+--- a/config/rules.mk
++++ b/config/rules.mk
+@@ -102,22 +102,16 @@ ifndef LIBRARY
+ ifdef REAL_LIBRARY
+ ifdef NO_EXPAND_LIBS
+ # Only build actual library if it is requested.
+ LIBRARY			:= $(REAL_LIBRARY)
+ endif
+ endif
+ endif
+ 
+-ifndef HOST_LIBRARY
+-ifdef HOST_LIBRARY_NAME
+-HOST_LIBRARY		:= $(LIB_PREFIX)$(HOST_LIBRARY_NAME).$(LIB_SUFFIX)
+-endif
+-endif
+-
+ ifdef FORCE_SHARED_LIB
+ ifdef MKSHLIB
+ 
+ ifdef LIB_IS_C_ONLY
+ MKSHLIB			= $(MKCSHLIB)
+ endif
+ 
+ EMBED_MANIFEST_AT=2
+@@ -186,17 +180,17 @@ endif
+ ifdef MOZ_PROFILE_GENERATE
+ $(foreach category,$(INSTALL_TARGETS),\
+   $(eval $(category)_FILES := $(foreach file,$($(category)_FILES),$(if $(filter $(SIMPLE_PROGRAMS),$(notdir $(file))),,$(file)))))
+ SIMPLE_PROGRAMS :=
+ endif
+ 
+ ifdef COMPILE_ENVIRONMENT
+ ifndef TARGETS
+-TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_SHARED_LIBRARY)
++TARGETS			= $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_SHARED_LIBRARY)
+ endif
+ 
+ COBJS = $(notdir $(CSRCS:.c=.$(OBJ_SUFFIX)))
+ SOBJS = $(notdir $(SSRCS:.S=.$(OBJ_SUFFIX)))
+ # CPPSRCS can have different extensions (eg: .cpp, .cc)
+ CPPOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(CPPSRCS))))
+ CMOBJS = $(notdir $(CMSRCS:.m=.$(OBJ_SUFFIX)))
+ CMMOBJS = $(notdir $(CMMSRCS:.mm=.$(OBJ_SUFFIX)))
+@@ -219,17 +213,16 @@ HOST_OBJS = $(strip $(_HOST_OBJS))
+ endif
+ else
+ LIBRARY :=
+ SHARED_LIBRARY :=
+ IMPORT_LIBRARY :=
+ REAL_LIBRARY :=
+ PROGRAM :=
+ SIMPLE_PROGRAMS :=
+-HOST_LIBRARY :=
+ HOST_SHARED_LIBRARY :=
+ HOST_PROGRAM :=
+ HOST_SIMPLE_PROGRAMS :=
+ endif
+ 
+ ALL_TRASH = \
+ 	$(GARBAGE) $(TARGETS) $(OBJS) $(PROGOBJS) LOGS TAGS a.out \
+ 	$(filter-out $(ASFILES),$(OBJS:.$(OBJ_SUFFIX)=.s)) $(OBJS:.$(OBJ_SUFFIX)=.ii) \
+@@ -437,17 +430,17 @@ everything::
+ GLOBAL_DEPS += Makefile $(addprefix $(DEPTH)/config/,$(INCLUDED_AUTOCONF_MK)) $(MOZILLA_DIR)/config/config.mk
+ 
+ ##############################################
+ ifdef COMPILE_ENVIRONMENT
+ OBJ_TARGETS = $(OBJS) $(PROGOBJS) $(HOST_OBJS) $(HOST_PROGOBJS)
+ 
+ compile:: host target
+ 
+-host:: $(HOST_LIBRARY) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_RUST_PROGRAMS) $(HOST_RUST_LIBRARY_FILE) $(HOST_SHARED_LIBRARY)
++host:: $(HOST_OBJS) $(HOST_PROGRAM) $(HOST_SIMPLE_PROGRAMS) $(HOST_RUST_PROGRAMS) $(HOST_RUST_LIBRARY_FILE) $(HOST_SHARED_LIBRARY)
+ 
+ target:: $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) $(SIMPLE_PROGRAMS) $(RUST_LIBRARY_FILE) $(RUST_PROGRAMS)
+ 
+ ifndef LIBRARY
+ ifdef OBJS
+ target:: $(OBJS)
+ endif
+ endif
+@@ -583,36 +576,36 @@ ifdef ENABLE_STRIP
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+ $(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
+-	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ ifdef MSMANIFEST_TOOL
+ 	@if test -f $@.manifest; then \
+ 		if test -f '$(srcdir)/$@.manifest'; then \
+ 			echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		else \
+ 			echo 'Embedding manifest from $@.manifest'; \
+ 			$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
+ 		fi; \
+ 	elif test -f '$(srcdir)/$@.manifest'; then \
+ 		echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
+ 		$(MT) -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
+ 	fi
+ endif	# MSVC with manifest tool
+ else
+ ifeq ($(HOST_CPP_PROG_LINK),1)
+-	$(HOST_CXX) -o $@ $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CXX) -o $@ $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+-	$(HOST_CC) -o $@ $(HOST_C_LDFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CC) -o $@ $(HOST_C_LDFLAGS) $(HOST_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif # HOST_CPP_PROG_LINK
+ endif
+ ifndef CROSS_COMPILE
+ 	$(call py_action,check_binary,--host $@)
+ endif
+ 
+ #
+ # This is an attempt to support generation of multiple binaries
+@@ -639,25 +632,25 @@ endif # WINNT && !GNU_CC
+ 
+ ifdef ENABLE_STRIP
+ 	$(STRIP) $(STRIP_FLAGS) $@
+ endif
+ ifdef MOZ_POST_PROGRAM_COMMAND
+ 	$(MOZ_POST_PROGRAM_COMMAND) $@
+ endif
+ 
+-$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(_OBJ_SUFFIX) $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
++$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): $(HOST_LIBS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+ ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
+-	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $($(notdir $@)_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+ ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
+-	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXX_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+-	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_C_LDFLAGS) $($(notdir $@)_OBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+ endif
+ ifndef CROSS_COMPILE
+ 	$(call py_action,check_binary,--host $@)
+ endif
+ 
+ $(LIBRARY): $(OBJS) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+ 	$(REPORT_BUILD)
+@@ -670,28 +663,23 @@ ifeq ($(OS_ARCH),WINNT)
+ # but make will happily consider the import library before it is refreshed
+ # when rebuilding the corresponding shared library. Defining an empty recipe
+ # for import libraries forces make to wait for the shared library recipe to
+ # have run before considering other targets that depend on the import library.
+ # See bug 795204.
+ $(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
+ endif
+ 
+-$(HOST_LIBRARY): $(HOST_OBJS) Makefile
+-	$(REPORT_BUILD)
+-	$(RM) $@
+-	$(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
+-
+-$(HOST_SHARED_LIBRARY): $(HOST_OBJS) Makefile
++$(HOST_SHARED_LIBRARY): Makefile
+ 	$(REPORT_BUILD)
+ 	$(RM) $@
+ ifdef _MSC_VER
+-	$(HOST_LINKER) -NOLOGO -DLL -OUT:$@ $(HOST_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_LINKER) -NOLOGO -DLL -OUT:$@ $($(notdir $@)_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ else
+-	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
++	$(HOST_CXX) $(HOST_OUTOPTION)$@ $($(notdir $@)_OBJS) $(HOST_CXX_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
+ endif
+ 
+ # On Darwin (Mac OS X), dwarf2 debugging uses debug info left in .o files,
+ # so instead of deleting .o files after repacking them into a dylib, we make
+ # symlinks back to the originals. The symlinks are a no-op for stabs debugging,
+ # so no need to conditionalize on OS version or debugging format.
+ 
+ $(SHARED_LIBRARY): $(OBJS) $(RESFILE) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(STATIC_LIBS) $(EXTRA_DEPS) $(GLOBAL_DEPS)
+diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py
+--- a/python/mozbuild/mozbuild/backend/common.py
++++ b/python/mozbuild/mozbuild/backend/common.py
+@@ -221,18 +221,18 @@ class CommonBackend(BuildBackend):
+                     objs.append(o)
+                     # This is slightly odd, buf for consistency with the
+                     # recursivemake backend we don't replace OBJ_SUFFIX if any
+                     # object in a library has `no_pgo` set.
+                     if lib.no_pgo_objs or lib.no_pgo:
+                         no_pgo_objs.append(o)
+ 
+         def expand(lib, recurse_objs, system_libs):
+-            if isinstance(lib, StaticLibrary):
+-                if lib.no_expand_lib:
++            if isinstance(lib, (HostLibrary, StaticLibrary)):
++                if not isinstance(lib, HostLibrary) and lib.no_expand_lib:
+                     static_libs.append(lib)
+                     recurse_objs = False
+                 elif recurse_objs:
+                     add_objs(lib)
+ 
+                 for l in lib.linked_libraries:
+                     expand(l, recurse_objs, system_libs)
+ 
+@@ -244,38 +244,48 @@ class CommonBackend(BuildBackend):
+ 
+             elif isinstance(lib, SharedLibrary):
+                 if lib not in seen_libs:
+                     seen_libs.add(lib)
+                     shared_libs.append(lib)
+ 
+         add_objs(input_bin)
+ 
+-        system_libs = not isinstance(input_bin, StaticLibrary)
++        system_libs = not isinstance(input_bin, (HostLibrary, StaticLibrary))
+         for lib in input_bin.linked_libraries:
+             if isinstance(lib, RustLibrary):
+                 continue
+-            elif isinstance(lib, StaticLibrary):
++            elif isinstance(lib, (HostLibrary, StaticLibrary)):
+                 expand(lib, True, system_libs)
+             elif isinstance(lib, SharedLibrary):
+                 if lib not in seen_libs:
+                     seen_libs.add(lib)
+                     shared_libs.append(lib)
+ 
+         for lib in input_bin.linked_system_libs:
+             if lib not in seen_libs:
+                 seen_libs.add(lib)
+                 os_libs.append(lib)
+ 
+         return objs, no_pgo_objs, shared_libs, os_libs, static_libs
+ 
+-    def _make_list_file(self, objdir, objs, name):
++    def _make_list_file(self, kind, objdir, objs, name):
+         if not objs:
+             return None
+-        list_style = self.environment.substs.get('EXPAND_LIBS_LIST_STYLE')
++        if kind == 'target':
++            list_style = self.environment.substs.get('EXPAND_LIBS_LIST_STYLE')
++        else:
++            # The host compiler is not necessarily the same kind as the target
++            # compiler, so we can't be sure EXPAND_LIBS_LIST_STYLE is the right
++            # style to use ; however, all compilers support the `list` type, so
++            # use that. That doesn't cause any practical problem because where
++            # it really matters to use something else than `list` is when
++            # linking tons of objects (because of command line argument limits),
++            # which only really happens for libxul.
++            list_style = 'list'
+         list_file_path = mozpath.join(objdir, name)
+         objs = [os.path.relpath(o, objdir) for o in objs]
+         if list_style == 'linkerscript':
+             ref = list_file_path
+             content = '\n'.join('INPUT("%s")' % o for o in objs)
+         elif list_style == 'filelist':
+             ref = "-Wl,-filelist," + list_file_path
+             content = '\n'.join(objs)
+diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py
+--- a/python/mozbuild/mozbuild/backend/recursivemake.py
++++ b/python/mozbuild/mozbuild/backend/recursivemake.py
+@@ -675,17 +675,16 @@ class RecursiveMakeBackend(CommonBackend
+             self._process_linked_libraries(obj, backend_file)
+             self._no_skip['syms'].add(backend_file.relobjdir)
+ 
+         elif isinstance(obj, StaticLibrary):
+             self._process_static_library(obj, backend_file)
+             self._process_linked_libraries(obj, backend_file)
+ 
+         elif isinstance(obj, HostLibrary):
+-            self._process_host_library(obj, backend_file)
+             self._process_linked_libraries(obj, backend_file)
+ 
+         elif isinstance(obj, HostSharedLibrary):
+             self._process_host_shared_library(obj, backend_file)
+             self._process_linked_libraries(obj, backend_file)
+ 
+         elif isinstance(obj, ObjdirFiles):
+             self._process_objdir_files(obj, obj.files, backend_file)
+@@ -1311,19 +1310,16 @@ class RecursiveMakeBackend(CommonBackend
+         # Cargo's dependency calculations don't work as we expect and we wind
+         # up recompiling lots of things.
+         target_dir = mozpath.join(backend_file.objdir, libdef.target_dir)
+         target_dir = mozpath.normpath(target_dir)
+         backend_file.write('CARGO_TARGET_DIR := %s\n' % target_dir)
+         if libdef.features:
+             backend_file.write('%s := %s\n' % (libdef.FEATURES_VAR, ' '.join(libdef.features)))
+ 
+-    def _process_host_library(self, libdef, backend_file):
+-        backend_file.write('HOST_LIBRARY_NAME = %s\n' % libdef.basename)
+-
+     def _process_host_shared_library(self, libdef, backend_file):
+         backend_file.write('HOST_SHARED_LIBRARY = %s\n' % libdef.lib_name)
+ 
+     def _build_target_for_obj(self, obj):
+         return '%s/%s' % (mozpath.relpath(obj.objdir,
+             self.environment.topobjdir), obj.KIND)
+ 
+     def _process_linked_libraries(self, obj, backend_file):
+@@ -1332,76 +1328,77 @@ class RecursiveMakeBackend(CommonBackend
+ 
+         topobjdir = mozpath.normsep(obj.topobjdir)
+         # This will create the node even if there aren't any linked libraries.
+         build_target = self._build_target_for_obj(obj)
+         self._compile_graph[build_target]
+ 
+         objs, no_pgo_objs, shared_libs, os_libs, static_libs = self._expand_libs(obj)
+ 
++        obj_target = obj.name
++        if isinstance(obj, Program):
++            obj_target = self._pretty_path(obj.output_path, backend_file)
++
++        profile_gen_objs = []
++
+         if obj.KIND == 'target':
+-            obj_target = obj.name
+-            if isinstance(obj, Program):
+-                obj_target = self._pretty_path(obj.output_path, backend_file)
+-
+             is_unit_test = isinstance(obj, BaseProgram) and obj.is_unit_test
+-            profile_gen_objs = []
+ 
+             if (self.environment.substs.get('MOZ_PGO') and
+                 self.environment.substs.get('GNU_CC')):
+                 # We use a different OBJ_SUFFIX for the profile generate phase on
+                 # linux. These get picked up via OBJS_VAR_SUFFIX in config.mk.
+                 if not is_unit_test and not isinstance(obj, SimpleProgram):
+                     profile_gen_objs = [o if o in no_pgo_objs else '%s.%s' %
+                                         (mozpath.splitext(o)[0], 'i_o') for o in objs]
+ 
+-            def write_obj_deps(target, objs_ref, pgo_objs_ref):
+-                if pgo_objs_ref:
+-                    backend_file.write('ifdef MOZ_PROFILE_GENERATE\n')
+-                    backend_file.write('%s: %s\n' % (target, pgo_objs_ref))
+-                    backend_file.write('else\n')
+-                    backend_file.write('%s: %s\n' % (target, objs_ref))
+-                    backend_file.write('endif\n')
+-                else:
+-                    backend_file.write('%s: %s\n' % (target, objs_ref))
++        def write_obj_deps(target, objs_ref, pgo_objs_ref):
++            if pgo_objs_ref:
++                backend_file.write('ifdef MOZ_PROFILE_GENERATE\n')
++                backend_file.write('%s: %s\n' % (target, pgo_objs_ref))
++                backend_file.write('else\n')
++                backend_file.write('%s: %s\n' % (target, objs_ref))
++                backend_file.write('endif\n')
++            else:
++                backend_file.write('%s: %s\n' % (target, objs_ref))
+ 
+-            objs_ref = ' \\\n    '.join(os.path.relpath(o, obj.objdir)
+-                                        for o in objs)
+-            pgo_objs_ref = ' \\\n    '.join(os.path.relpath(o, obj.objdir)
+-                                            for o in profile_gen_objs)
+-            # Don't bother with a list file if we're only linking objects built
+-            # in this directory or building a real static library. This
+-            # accommodates clang-plugin, where we would otherwise pass an
+-            # incorrect list file format to the host compiler as well as when
+-            # creating an archive with AR, which doesn't understand list files.
+-            if (objs == obj.objs and not isinstance(obj, StaticLibrary) or
+-              isinstance(obj, StaticLibrary) and obj.no_expand_lib):
+-                backend_file.write_once('%s_OBJS := %s\n' % (obj.name,
+-                                                             objs_ref))
+-                if profile_gen_objs:
+-                    backend_file.write_once('%s_PGO_OBJS := %s\n' % (obj.name,
+-                                                                     pgo_objs_ref))
+-                write_obj_deps(obj_target, objs_ref, pgo_objs_ref)
+-            elif not isinstance(obj, StaticLibrary):
+-                list_file_path = '%s.list' % obj.name.replace('.', '_')
+-                list_file_ref = self._make_list_file(obj.objdir, objs,
+-                                                     list_file_path)
+-                backend_file.write_once('%s_OBJS := %s\n' %
+-                                        (obj.name, list_file_ref))
+-                backend_file.write_once('%s: %s\n' % (obj_target, list_file_path))
+-                if profile_gen_objs:
+-                    pgo_list_file_path = '%s_pgo.list' % obj.name.replace('.', '_')
+-                    pgo_list_file_ref = self._make_list_file(obj.objdir,
+-                                                             profile_gen_objs,
+-                                                             pgo_list_file_path)
+-                    backend_file.write_once('%s_PGO_OBJS := %s\n' %
+-                                            (obj.name, pgo_list_file_ref))
+-                    backend_file.write_once('%s: %s\n' % (obj_target,
+-                                                          pgo_list_file_path))
+-                write_obj_deps(obj_target, objs_ref, pgo_objs_ref)
++        objs_ref = ' \\\n    '.join(os.path.relpath(o, obj.objdir)
++                                    for o in objs)
++        pgo_objs_ref = ' \\\n    '.join(os.path.relpath(o, obj.objdir)
++                                        for o in profile_gen_objs)
++        # Don't bother with a list file if we're only linking objects built
++        # in this directory or building a real static library. This
++        # accommodates clang-plugin, where we would otherwise pass an
++        # incorrect list file format to the host compiler as well as when
++        # creating an archive with AR, which doesn't understand list files.
++        if (objs == obj.objs and not isinstance(obj, (HostLibrary, StaticLibrary)) or
++          isinstance(obj, StaticLibrary) and obj.no_expand_lib):
++            backend_file.write_once('%s_OBJS := %s\n' % (obj.name,
++                                                         objs_ref))
++            if profile_gen_objs:
++                backend_file.write_once('%s_PGO_OBJS := %s\n' % (obj.name,
++                                                                 pgo_objs_ref))
++            write_obj_deps(obj_target, objs_ref, pgo_objs_ref)
++        elif not isinstance(obj, (HostLibrary, StaticLibrary)):
++            list_file_path = '%s.list' % obj.name.replace('.', '_')
++            list_file_ref = self._make_list_file(obj.KIND, obj.objdir, objs,
++                                                 list_file_path)
++            backend_file.write_once('%s_OBJS := %s\n' %
++                                    (obj.name, list_file_ref))
++            backend_file.write_once('%s: %s\n' % (obj_target, list_file_path))
++            if profile_gen_objs:
++                pgo_list_file_path = '%s_pgo.list' % obj.name.replace('.', '_')
++                pgo_list_file_ref = self._make_list_file(obj.KIND, obj.objdir,
++                                                         profile_gen_objs,
++                                                         pgo_list_file_path)
++                backend_file.write_once('%s_PGO_OBJS := %s\n' %
++                                        (obj.name, pgo_list_file_ref))
++                backend_file.write_once('%s: %s\n' % (obj_target,
++                                                      pgo_list_file_path))
++            write_obj_deps(obj_target, objs_ref, pgo_objs_ref)
+ 
+         for lib in shared_libs:
+             backend_file.write_once('SHARED_LIBS += %s/%s\n' %
+                                     (pretty_relpath(lib), lib.import_name))
+         for lib in static_libs:
+             backend_file.write_once('STATIC_LIBS += %s/%s\n' %
+                                     (pretty_relpath(lib), lib.import_name))
+         for lib in os_libs:
+@@ -1409,17 +1406,17 @@ class RecursiveMakeBackend(CommonBackend
+                 backend_file.write_once('OS_LIBS += %s\n' % lib)
+             else:
+                 backend_file.write_once('HOST_EXTRA_LIBS += %s\n' % lib)
+ 
+         for lib in obj.linked_libraries:
+             if not isinstance(lib, ExternalLibrary):
+                 self._compile_graph[build_target].add(
+                     self._build_target_for_obj(lib))
+-            if isinstance(lib, (HostLibrary, HostRustLibrary)):
++            if isinstance(lib, HostRustLibrary):
+                 backend_file.write_once('HOST_LIBS += %s/%s\n' %
+                                         (pretty_relpath(lib), lib.import_name))
+ 
+         # We have to link any Rust libraries after all intermediate static
+         # libraries have been listed to ensure that the Rust libraries are
+         # searched after the C/C++ objects that might reference Rust symbols.
+         if isinstance(obj, SharedLibrary):
+             self._process_rust_libraries(obj, backend_file, pretty_relpath)
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -319,17 +319,17 @@ class TupBackend(CommonBackend):
+             ['-o', shlib.lib_name]
+         )
+ 
+         objs, _, shared_libs, os_libs, static_libs = self._expand_libs(shlib)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
+ 
+         list_file_name = '%s.list' % shlib.name.replace('.', '_')
+-        list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
++        list_file = self._make_list_file(shlib.KIND, backend_file.objdir, objs, list_file_name)
+ 
+         inputs = objs + static_libs + shared_libs
+ 
+         symbols_file = []
+         if shlib.symbols_file:
+             inputs.append(shlib.symbols_file)
+             # TODO: Assumes GNU LD
+             symbols_file = ['-Wl,--version-script,%s' % shlib.symbols_file]
+@@ -364,17 +364,17 @@ class TupBackend(CommonBackend):
+         cc_or_cxx = 'CXX' if prog.cxx_link else 'CC'
+         objs, _, shared_libs, os_libs, static_libs = self._expand_libs(prog)
+         static_libs = self._lib_paths(backend_file.objdir, static_libs)
+         shared_libs = self._lib_paths(backend_file.objdir, shared_libs)
+ 
+         inputs = objs + static_libs + shared_libs
+ 
+         list_file_name = '%s.list' % prog.name.replace('.', '_')
+-        list_file = self._make_list_file(backend_file.objdir, objs, list_file_name)
++        list_file = self._make_list_file(prog.KIND, backend_file.objdir, objs, list_file_name)
+ 
+         if isinstance(prog, SimpleProgram):
+             outputs = [prog.name]
+         else:
+             outputs = [mozpath.relpath(prog.output_path.full_path,
+                                        backend_file.objdir)]
+ 
+         cmd = (

+ 275 - 0
rel-257/mozilla-esr60/patches/1515843-3-64a1.patch

@@ -0,0 +1,275 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1545433217 0
+# Node ID a415ca5d5ffd1c934f1d2d6585535b08d634d2fd
+# Parent  440a28c16b2d03df4e7ab6298a60cde43af16c9d
+Bug 1515843 - Remove HOST_AR/HOST_RANLIB. r=ted
+
+Now that we're not even building host static libraries, we don't need
+variables for the tools used to build them.
+
+Ironically, we weren't even running HOST_RANLIB.
+
+Depends on D15172
+
+Differential Revision: https://phabricator.services.mozilla.com/D15173
+
+diff --git a/build/autoconf/toolchain.m4 b/build/autoconf/toolchain.m4
+--- a/build/autoconf/toolchain.m4
++++ b/build/autoconf/toolchain.m4
+@@ -43,22 +43,16 @@ fi
+ AC_SUBST(CLANG_CXX)
+ AC_SUBST(CLANG_CL)
+ ])
+ 
+ AC_DEFUN([MOZ_CROSS_COMPILER],
+ [
+ echo "cross compiling from $host to $target"
+ 
+-if test -z "$HOST_AR_FLAGS"; then
+-    HOST_AR_FLAGS="$AR_FLAGS"
+-fi
+-AC_CHECK_PROGS(HOST_RANLIB, $HOST_RANLIB ranlib, ranlib, :)
+-AC_CHECK_PROGS(HOST_AR, $HOST_AR ar, ar, :)
+-
+ dnl AC_CHECK_PROGS manually goes through $PATH, and as such fails to handle
+ dnl absolute or relative paths. Relative paths wouldn't work anyways, but
+ dnl absolute paths would. Trick AC_CHECK_PROGS into working in that case by
+ dnl adding / to PATH. This is temporary until this moves to moz.configure
+ dnl (soon).
+ _SAVE_PATH=$PATH
+ case "${TOOLCHAIN_PREFIX}" in
+ /*)
+diff --git a/js/src/old-configure.in b/js/src/old-configure.in
+--- a/js/src/old-configure.in
++++ b/js/src/old-configure.in
+@@ -81,17 +81,16 @@ case "$target" in
+     MOZ_IOS_SDK
+     ;;
+ esac
+ 
+ dnl ========================================================
+ dnl Checks for compilers.
+ dnl ========================================================
+ 
+-dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
+ AR_FLAGS='crs $@'
+ 
+ if test "$COMPILE_ENVIRONMENT"; then
+ 
+ # Note:
+ #   In Mozilla, we use the names $target, $host and $build incorrectly, but are
+ #   too far gone to back out now. See Bug 475488:
+ #     - When we say $target, we mean $host, that is, the system on which
+@@ -111,25 +110,16 @@ else
+     AC_CHECK_PROGS(STRIP, strip, :)
+     AC_CHECK_PROGS(WINDRES, windres, :)
+     if test -z "$HOST_CC"; then
+         HOST_CC='$(CC)'
+     fi
+     if test -z "$HOST_CXX"; then
+         HOST_CXX='$(CXX)'
+     fi
+-    if test -z "$HOST_RANLIB"; then
+-        HOST_RANLIB='$(RANLIB)'
+-    fi
+-    if test -z "$HOST_AR"; then
+-        HOST_AR='$(AR)'
+-    fi
+-    if test -z "$HOST_AR_FLAGS"; then
+-        HOST_AR_FLAGS='$(AR_FLAGS)'
+-    fi
+ fi
+ 
+ MOZ_TOOL_VARIABLES
+ 
+ dnl Special win32 checks
+ dnl ========================================================
+ 
+ # Target the Windows 8.1 SDK by default
+@@ -493,20 +483,17 @@ if test "$GNU_CXX"; then
+ fi
+ 
+ dnl ========================================================
+ dnl System overrides of the defaults for host
+ dnl ========================================================
+ case "$host" in
+ *mingw*)
+     if test -n "$_WIN32_MSVC"; then
+-        HOST_AR=lib
+-        HOST_AR_FLAGS='-NOLOGO -OUT:$@'
+         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
+-        HOST_RANLIB='echo ranlib'
+     else
+         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
+     fi
+     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
+     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
+     HOST_BIN_SUFFIX=.exe
+ 
+     case "${host_cpu}" in
+@@ -1787,19 +1774,16 @@ AC_SUBST(OS_LIBS)
+ 
+ AC_SUBST(HOST_CC)
+ AC_SUBST(HOST_CXX)
+ AC_SUBST_LIST(HOST_CFLAGS)
+ AC_SUBST_LIST(HOST_CPPFLAGS)
+ AC_SUBST_LIST(HOST_CXXFLAGS)
+ AC_SUBST(HOST_LDFLAGS)
+ AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
+-AC_SUBST(HOST_AR)
+-AC_SUBST(HOST_AR_FLAGS)
+-AC_SUBST(HOST_RANLIB)
+ AC_SUBST(HOST_BIN_SUFFIX)
+ 
+ AC_SUBST(TARGET_XPCOM_ABI)
+ 
+ AC_SUBST_LIST(DSO_CFLAGS)
+ AC_SUBST_LIST(DSO_PIC_CFLAGS)
+ AC_SUBST(DSO_LDOPTS)
+ AC_SUBST(BIN_SUFFIX)
+diff --git a/old-configure.in b/old-configure.in
+--- a/old-configure.in
++++ b/old-configure.in
+@@ -100,17 +100,16 @@ esac
+ AC_SUBST(ANDROID_SOURCE)
+ AC_SUBST(ANDROID_PACKAGE_NAME)
+ AC_SUBST(OBJCOPY)
+ 
+ dnl ========================================================
+ dnl Checks for compilers.
+ dnl ========================================================
+ 
+-dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
+ AR_FLAGS='crs $@'
+ 
+ if test "$COMPILE_ENVIRONMENT"; then
+ 
+ if test "$target" != "$host"; then
+     MOZ_CROSS_COMPILER
+ else
+     AC_PROG_CC
+@@ -121,25 +120,16 @@ else
+     esac
+     AC_PROG_CXX
+     AC_PROG_RANLIB
+     MOZ_PATH_PROGS(AS, $AS as, $CC)
+     AC_CHECK_PROGS(AR, ar, :)
+     AC_CHECK_PROGS(STRIP, strip, :)
+     AC_CHECK_PROGS(WINDRES, windres, :)
+     AC_CHECK_PROGS(OTOOL, otool, :)
+-    if test -z "$HOST_RANLIB"; then
+-        HOST_RANLIB="$RANLIB"
+-    fi
+-    if test -z "$HOST_AR"; then
+-        HOST_AR="$AR"
+-    fi
+-    if test -z "$HOST_AR_FLAGS"; then
+-        HOST_AR_FLAGS="$AR_FLAGS"
+-    fi
+ fi
+ 
+ if test -n "$MOZ_WINCONSOLE"; then
+     AC_DEFINE(MOZ_WINCONSOLE)
+ fi
+ 
+ MOZ_TOOL_VARIABLES
+ 
+@@ -641,20 +631,17 @@ if test "$MOZ_DMD"; then
+ fi
+ 
+ dnl ========================================================
+ dnl System overrides of the defaults for host
+ dnl ========================================================
+ case "$host" in
+ *mingw*)
+     if test -n "$_WIN32_MSVC"; then
+-        HOST_AR=lib
+-        HOST_AR_FLAGS='-NOLOGO -OUT:$@'
+         HOST_CFLAGS="$HOST_CFLAGS -TC -nologo"
+-        HOST_RANLIB='echo ranlib'
+     else
+         HOST_CFLAGS="$HOST_CFLAGS -mwindows"
+     fi
+     HOST_CFLAGS="$HOST_CFLAGS -DXP_WIN32 -DXP_WIN -DWIN32 -D_WIN32 -D_CRT_SECURE_NO_WARNINGS"
+     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
+     HOST_BIN_SUFFIX=.exe
+ 
+     case "${host_cpu}" in
+@@ -4314,19 +4301,16 @@ AC_SUBST(OS_LIBS)
+ 
+ AC_SUBST(HOST_CC)
+ AC_SUBST(HOST_CXX)
+ AC_SUBST_LIST(HOST_CFLAGS)
+ AC_SUBST_LIST(HOST_CPPFLAGS)
+ AC_SUBST_LIST(HOST_CXXFLAGS)
+ AC_SUBST(HOST_LDFLAGS)
+ AC_SUBST_LIST(HOST_OPTIMIZE_FLAGS)
+-AC_SUBST(HOST_AR)
+-AC_SUBST(HOST_AR_FLAGS)
+-AC_SUBST(HOST_RANLIB)
+ AC_SUBST(HOST_BIN_SUFFIX)
+ 
+ AC_SUBST(TARGET_XPCOM_ABI)
+ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3)
+ AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1)
+ AC_SUBST(HAVE_X86_AVX2)
+ AC_SUBST(HAVE_ALTIVEC)
+ AC_SUBST(GCC_USE_GNU_LD)
+diff --git a/python/mozbuild/mozbuild/backend/tup.py b/python/mozbuild/mozbuild/backend/tup.py
+--- a/python/mozbuild/mozbuild/backend/tup.py
++++ b/python/mozbuild/mozbuild/backend/tup.py
+@@ -391,33 +391,16 @@ class TupBackend(CommonBackend):
+         backend_file.rule(
+             cmd=cmd,
+             inputs=inputs,
+             outputs=outputs,
+             display='LINK %o'
+         )
+ 
+ 
+-    def _gen_host_library(self, backend_file):
+-        objs = backend_file.host_library.objs
+-        inputs = objs
+-        outputs = [backend_file.host_library.name]
+-        cmd = (
+-            [backend_file.environment.substs['HOST_AR']] +
+-            [backend_file.environment.substs['HOST_AR_FLAGS'].replace('$@', '%o')] +
+-            objs
+-        )
+-        backend_file.rule(
+-            cmd=cmd,
+-            inputs=inputs,
+-            outputs=outputs,
+-            display='AR %o'
+-        )
+-
+-
+     def _gen_host_programs(self, backend_file):
+         for p in backend_file.host_programs:
+             self._gen_host_program(backend_file, p)
+ 
+ 
+     def _gen_host_program(self, backend_file, prog):
+         _, _, _, extra_libs, _ = self._expand_libs(prog)
+         objs = prog.objs
+@@ -552,18 +535,17 @@ class TupBackend(CommonBackend):
+                 fh.write(''.join('%s\n' % e for e in sorted(entries)))
+ 
+         for objdir, backend_file in sorted(self._backend_files.items()):
+             backend_file.gen_sources_rules([self._installed_files])
+             for var, gen_method in ((backend_file.shared_lib, self._gen_shared_library),
+                                     (backend_file.static_lib and backend_file.static_lib.no_expand_lib,
+                                      self._gen_static_library),
+                                     (backend_file.programs, self._gen_programs),
+-                                    (backend_file.host_programs, self._gen_host_programs),
+-                                    (backend_file.host_library, self._gen_host_library)):
++                                    (backend_file.host_programs, self._gen_host_programs)):
+                 if var:
+                     backend_file.export_shell()
+                     gen_method(backend_file)
+             for obj in backend_file.delayed_generated_files:
+                 self._process_generated_file(backend_file, obj)
+             for path, output, output_group in backend_file.delayed_installed_files:
+                 backend_file.symlink_rule(path, output=output, output_group=output_group)
+             with self._write_file(fh=backend_file):

+ 2 - 2
comm-esr60/mozilla-esr60/patches/1522560-66a1.patch → rel-257/mozilla-esr60/patches/1522560-66a1.patch

@@ -2,7 +2,7 @@
 # User Mike Hommey <mh+mozilla@glandium.org>
 # Date 1548712496 0
 # Node ID 715355e248a1be706b6e7ae4cfd838271a4a4334
-# Parent  8feb3ce816dc3b06277668ff328eebd0982265d4
+# Parent  8c2bd73ad1ba0ba5d745db62d3f10a16a65a13a9
 Bug 1522560 - Use system vswhere.exe. r=dmajor
 
 And remove the in-tree one.
@@ -12,7 +12,7 @@ Differential Revision: https://phabricator.services.mozilla.com/D17773
 diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
 --- a/build/moz.configure/toolchain.configure
 +++ b/build/moz.configure/toolchain.configure
-@@ -544,27 +544,33 @@ def check_compiler(compiler, language, t
+@@ -566,27 +566,33 @@ def check_compiler(compiler, language, t
          target_kernel=info.kernel,
          target_endianness=info.endianness,
          flags=flags,

+ 3 - 25
comm-esr60/mozilla-esr60/patches/1523003-67a1.patch → rel-257/mozilla-esr60/patches/1523003-67a1.patch

@@ -2,13 +2,13 @@
 # User Tom Ritter <tom@mozilla.com>
 # Date 1548631197 21600
 # Node ID 9c373e34039b6e4b003e0027b80cf9fe788567ca
-# Parent  e6c42ccdd03a8f46eb89dc4f7af644002dafa3d9
+# Parent  cdd331eaa4e59d36a151ff375237dda21d82e0e8
 Bug 1523003 - Remove the force-ms-compatibility for clang-cl r=glandium
 
 diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
 --- a/build/moz.configure/toolchain.configure
 +++ b/build/moz.configure/toolchain.configure
-@@ -495,23 +495,16 @@ def check_compiler(compiler, language, t
+@@ -521,23 +521,16 @@ def check_compiler(compiler, language, t
      if info.language == 'C++':
          if info.type == 'clang' and info.language_version != cxx14_version:
              append_flag('-std=gnu++14')
@@ -32,28 +32,6 @@ diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolc
          elif info.type == 'clang-cl':
              # Ideally this would share the 'clang' branch above, but on Windows
              # the --target needs additional data like ms-compatibility-version.
-diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml
---- a/layout/style/ServoBindings.toml
-+++ b/layout/style/ServoBindings.toml
-@@ -21,18 +21,16 @@ args = [
- [build."os=linux"]
- args = ["-DOS_LINUX=1"]
- "arch=x86" = ["-m32"]
- "arch=x86_64" = ["-m64"]
- 
- [build."os=windows"."env=msvc"]
- args = [
-     "-DOS_WIN=1", "-DWIN32=1",
--    # For compatibility with MSVC 2015
--    "-fms-compatibility-version=19",
-     # To enable the builtin __builtin_offsetof so that CRT wouldn't
-     # use reinterpret_cast in offsetof() which is not allowed inside
-     # static_assert().
-     "-D_CRT_USE_BUILTIN_OFFSETOF",
-     # Enable hidden attribute (which is not supported by MSVC and
-     # thus not enabled by default with a MSVC-compatibile build)
-     # to exclude hidden symbols from the generated file.
-     "-DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1",
 diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
 +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
@@ -75,7 +53,7 @@ diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
  LIBRARY_NAME_INFOS = {
      'linux-gnu': {
          'DLL_PREFIX': 'lib',
-@@ -900,27 +899,25 @@ class WindowsToolchainTest(BaseToolchain
+@@ -914,27 +913,25 @@ class WindowsToolchainTest(BaseToolchain
      VSXX_2017u8_RESULT = CompilerResult(
          flags=[],
          version='19.15.26726',

+ 35 - 0
rel-257/mozilla-esr60/patches/1556662-69a1.patch

@@ -0,0 +1,35 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1559648384 0
+# Node ID 71d3424191f63751068077270a32f9f3aeb026b8
+# Parent  0f5f2d2cc4f5ff25ed5c098c550d40c0c4c1099e
+Bug 1556662 - Fix a typo in change from bug 1469091. r=dmajor
+
+In a branch for `isinstance(obj, (HostSources, HostGeneratedSources))`,
+`isinstance(obj, GeneratedSources)` is clearly not going to match
+anything. `isinstance(obj, HostGeneratedSources)` is what was intended.
+
+Differential Revision: https://phabricator.services.mozilla.com/D33603
+
+diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py
+--- a/python/mozbuild/mozbuild/backend/recursivemake.py
++++ b/python/mozbuild/mozbuild/backend/recursivemake.py
+@@ -481,17 +481,17 @@ class RecursiveMakeBackend(CommonBackend
+                     backend_file.write('%s += %s\n' % (var, f))
+         elif isinstance(obj, (HostSources, HostGeneratedSources)):
+             suffix_map = {
+                 '.c': 'HOST_CSRCS',
+                 '.mm': 'HOST_CMMSRCS',
+                 '.cpp': 'HOST_CPPSRCS',
+             }
+             variables = [suffix_map[obj.canonical_suffix]]
+-            if isinstance(obj, GeneratedSources):
++            if isinstance(obj, HostGeneratedSources):
+                 variables.append('GARBAGE')
+                 base = backend_file.objdir
+             else:
+                 base = backend_file.srcdir
+             for f in sorted(obj.files):
+                 f = mozpath.relpath(f, base)
+                 for var in variables:
+                     backend_file.write('%s += %s\n' % (var, f))

+ 56 - 0
rel-257/mozilla-esr60/patches/series

@@ -30,3 +30,59 @@
 1557547-69a1.patch
 1429016-67a1.patch
 1591803-1only-72a1.patch
+1445766-61a1.patch
+1515550-66a1.patch
+1429875-1-61a1.patch
+1429875-2-61a1.patch
+1429875-3-61a1.patch
+1429875-4-61a1.patch
+1429875-5-61a1.patch
+1458161-61a1.patch
+1457524-1-61a1.patch
+1457524-2-61a1.patch
+1457524-3-61a1.patch
+1457524-4-61a1.patch
+1457524-5-61a1.patch
+1457524-6-61a1.patch
+1445398-61a1.patch
+1419892-61a1.patch
+1449623-1-61a1.patch
+1449623-2-61a1.patch
+1451529-61a1.patch
+1454825-61a1.patch
+1454771-1-61a1.patch
+1454771-2-61a1.patch
+1372381-1-61a1.patch
+1372381-2-61a1.patch
+1372381-3-61a1.patch
+1372381-4-61a1.patch
+1464161-62a1.patch
+1467327-62a1.patch
+1469091-63a1.patch
+1556662-69a1.patch
+1480553-3only-63a1.patch
+1486905-63a1.patch
+1490549-1-64a1.patch
+1490549-2-64a1.patch
+1490549-3-64a1.patch
+1490549-4-64a1.patch
+1494958-64a1.patch
+1397263-1-64a1.patch
+1397263-2-64a1.patch
+1397263-3-64a1.patch
+1397263-4-64a1.patch
+1397263-5-64a1.patch
+1397263-6-64a1.patch
+1498450-partial-64a1.patch
+1514089-66a1.patch
+1515843-1-64a1.patch
+1515843-2-64a1.patch
+1515843-3-64a1.patch
+1515579-2only-66a1.patch
+1515528-1-66a1.patch
+1515528-2-66a1.patch
+1515528-3-66a1.patch
+1515528-4-66a1.patch
+1515528-5-66a1.patch
+1522560-66a1.patch
+1523003-67a1.patch