summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2018-10-31 22:29:00 +0100
committerThomas Deutschmann <whissi@gentoo.org>2018-10-31 22:29:00 +0100
commitd01d14fc67b3a1a4ead16e9235d72971d38ee843 (patch)
tree0f2f665483cbbcb073604303fbf77d7b6b52399f /www-client/firefox/files
parentwww-client/firefox: adjust dev-util/cbindgen dependency (diff)
downloadgentoo-d01d14fc67b3a1a4ead16e9235d72971d38ee843.tar.gz
gentoo-d01d14fc67b3a1a4ead16e9235d72971d38ee843.tar.bz2
gentoo-d01d14fc67b3a1a4ead16e9235d72971d38ee843.zip
www-client/firefox: security cleanup (bug #669430)
Package-Manager: Portage-2.3.51, Repoman-2.3.11 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'www-client/firefox/files')
-rw-r--r--www-client/firefox/files/bug_1461221.patch36
-rw-r--r--www-client/firefox/files/firefox-60.0-blessings-TERM.patch70
-rw-r--r--www-client/firefox/files/firefox-60.0-do-not-force-lld.patch262
-rw-r--r--www-client/firefox/files/firefox-60.0-missing-errno_h-in-SandboxOpenedFiles_cpp.patch27
-rw-r--r--www-client/firefox/files/firefox-60.0-rust-1.29-comp.patch37
-rw-r--r--www-client/firefox/files/firefox-60.0-sandbox-lto.patch13
-rw-r--r--www-client/firefox/files/firefox-60.0-update-cc-to-honor-CC.patch745
7 files changed, 0 insertions, 1190 deletions
diff --git a/www-client/firefox/files/bug_1461221.patch b/www-client/firefox/files/bug_1461221.patch
deleted file mode 100644
index 8ffa42c3eaf7..000000000000
--- a/www-client/firefox/files/bug_1461221.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-
-# HG changeset patch
-# User Gregory Szorc <gps@mozilla.com>
-# Date 1526410966 25200
-# Node ID e4ce7b97291627f2186dc23be0dadd3c56dfe938
-# Parent f288a2c9c4390898a17ad9f964218b52b87d8028
-Bug 1461221 - Account for psutil.disk_io_counters() returning None; r=mshal
-
-Apparently it can do this.
-
-MozReview-Commit-ID: 6gMTGtcRAw6
-
-diff --git a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
---- a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
-+++ b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
-@@ -60,16 +60,19 @@ except Exception:
- psutil = None
-
- have_psutil = False
-
-
- def get_disk_io_counters():
- try:
- io_counters = psutil.disk_io_counters()
-+
-+ if io_counters is None:
-+ return PsutilStub().disk_io_counters()
- except RuntimeError:
- io_counters = PsutilStub().disk_io_counters()
-
- return io_counters
-
-
- def _collect(pipe, poll_interval):
- """Collects system metrics.
-
diff --git a/www-client/firefox/files/firefox-60.0-blessings-TERM.patch b/www-client/firefox/files/firefox-60.0-blessings-TERM.patch
deleted file mode 100644
index 975e0cf6fe7b..000000000000
--- a/www-client/firefox/files/firefox-60.0-blessings-TERM.patch
+++ /dev/null
@@ -1,70 +0,0 @@
-https://github.com/erikrose/blessings/pull/137
-
-Fixes: https://bugs.gentoo.org/654316
-
-From 5fefc65c306cf9ec492e7b422d6bb4842385afbc Mon Sep 17 00:00:00 2001
-From: Jay Kamat <jaygkamat@gmail.com>
-Date: Fri, 24 Aug 2018 11:11:57 -0700
-Subject: [PATCH 1/2] Fix error when TERM is unset or improperly set
-
----
- blessings/__init__.py | 9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/blessings/__init__.py b/blessings/__init__.py
-index 98b75c3..3872b5f 100644
---- a/third_party/python/blessings/blessings/__init__.py
-+++ b/third_party/python/blessings/blessings/__init__.py
-@@ -94,8 +94,13 @@ def __init__(self, kind=None, stream=None, force_styling=False):
- # init sequences to the stream if it has a file descriptor, and
- # send them to stdout as a fallback, since they have to go
- # somewhere.
-- setupterm(kind or environ.get('TERM', 'unknown'),
-- self._init_descriptor)
-+ try:
-+ setupterm(kind or environ.get('TERM', 'dumb') or 'dumb',
-+ self._init_descriptor)
-+ except:
-+ # There was an error setting up the terminal, either curses is
-+ # not supported or TERM is incorrectly set. Fall back to dumb.
-+ self._does_styling = False
-
- self.stream = stream
-
-
-From d885df78c6f931abf3259343aaaa897e16c8cba1 Mon Sep 17 00:00:00 2001
-From: Jay Kamat <jaygkamat@gmail.com>
-Date: Sat, 1 Sep 2018 13:20:32 -0700
-Subject: [PATCH 2/2] Explicitly catch curses.error
-
----
- blessings/__init__.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/blessings/__init__.py b/blessings/__init__.py
-index 3872b5f..fdceb09 100644
---- a/third_party/python/blessings/blessings/__init__.py
-+++ b/third_party/python/blessings/blessings/__init__.py
-@@ -97,7 +97,7 @@ def __init__(self, kind=None, stream=None, force_styling=False):
- try:
- setupterm(kind or environ.get('TERM', 'dumb'),
- self._init_descriptor)
-- except:
-+ except curses.error:
- # There was an error setting up the terminal, either curses is
- # not supported or TERM is incorrectly set. Fall back to dumb.
- self._does_styling = False
-
-
---- a/python/mach/mach/logging.py
-+++ b/python/mach/mach/logging.py
-@@ -93,7 +93,7 @@
-
- def set_terminal(self, terminal):
- self.terminal = terminal
-- self._sgr0 = blessings.tigetstr('sgr0') or '' if terminal and blessings else ''
-+ self._sgr0 = terminal.normal if terminal and blessings else ''
-
- def format(self, record):
- f = record.msg.format(**record.params)
-
diff --git a/www-client/firefox/files/firefox-60.0-do-not-force-lld.patch b/www-client/firefox/files/firefox-60.0-do-not-force-lld.patch
deleted file mode 100644
index a8325bc745b2..000000000000
--- a/www-client/firefox/files/firefox-60.0-do-not-force-lld.patch
+++ /dev/null
@@ -1,262 +0,0 @@
-https://hg.mozilla.org/mozilla-central/rev/e8c173a632a4
-https://hg.mozilla.org/mozilla-central/rev/dbeb248015cc
-https://hg.mozilla.org/mozilla-central/rev/de7abe2c2b3e
-
---- a/build/moz.configure/toolchain.configure
-+++ b/build/moz.configure/toolchain.configure
-@@ -1331,10 +1331,6 @@ def lto(value, c_compiler):
-
- # clang and clang-cl
- if c_compiler.type in ('clang', 'clang-cl'):
-- # Until Bug 1457168 is fixed, we have to hardcode -fuse-ld=lld here
-- if c_compiler.type == 'clang':
-- flags.append("-fuse-ld=lld")
--
- if len(value) and value[0].lower() == 'full':
- flags.append("-flto")
- ldflags.append("-flto")
-@@ -1362,8 +1358,6 @@ add_old_configure_assignment('MOZ_LTO', lto.enabled)
- add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.flags)
- add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags)
-
--imply_option('--enable-linker', 'lld', when='--enable-lto')
--
- # ASAN
- # ==============================================================
-
-@@ -1566,7 +1560,7 @@ set_config('CARGO_INCREMENTAL', cargo_incremental)
-
- @depends(target)
- def is_linker_option_enabled(target):
-- if target.kernel not in ('Darwin', 'WINNT', 'SunOS'):
-+ if target.kernel not in ('WINNT', 'SunOS'):
- return True
-
-
-@@ -1578,21 +1572,40 @@ option('--enable-gold',
- imply_option('--enable-linker', 'gold', when='--enable-gold')
-
- js_option('--enable-linker', nargs=1,
-- help='Select the linker {bfd, gold, lld, lld-*}',
-+ help='Select the linker {bfd, gold, ld64, lld, lld-*}',
- when=is_linker_option_enabled)
-
-
- @depends('--enable-linker', c_compiler, developer_options, '--enable-gold',
-- extra_toolchain_flags, when=is_linker_option_enabled)
-+ extra_toolchain_flags, target, lto.enabled,
-+ when=is_linker_option_enabled)
- @checking('for linker', lambda x: x.KIND)
- @imports('os')
- @imports('shutil')
- def select_linker(linker, c_compiler, developer_options, enable_gold,
-- toolchain_flags):
--
-- linker = linker[0] if linker else None
-+ toolchain_flags, target, lto):
-+
-+ if linker:
-+ linker = linker[0]
-+ elif lto and c_compiler.type == 'clang' and target.kernel != 'Darwin':
-+ # If no linker was explicitly given, and building with clang for non-macOS,
-+ # prefer lld. For macOS, we prefer ld64, or whatever the default linker is.
-+ linker = 'lld'
-+ else:
-+ linker = None
-
-- if linker not in ('bfd', 'gold', 'lld', None) and not linker.startswith("lld-"):
-+ def is_valid_linker(linker):
-+ if target.kernel == 'Darwin':
-+ valid_linkers = ('ld64', 'lld')
-+ else:
-+ valid_linkers = ('bfd', 'gold', 'lld')
-+ if linker in valid_linkers:
-+ return True
-+ if 'lld' in valid_linkers and linker.startswith('lld-'):
-+ return True
-+ return False
-+
-+ if linker and not is_valid_linker(linker):
- # Check that we are trying to use a supported linker
- die('Unsupported linker ' + linker)
-
-@@ -1602,13 +1615,34 @@ def select_linker(linker, c_compiler, developer_options, enable_gold,
-
- def try_linker(linker):
- # Generate the compiler flag
-- linker_flag = ["-fuse-ld=" + linker] if linker else []
-+ if linker == 'ld64':
-+ linker_flag = ['-fuse-ld=ld']
-+ elif linker:
-+ linker_flag = ["-fuse-ld=" + linker]
-+ else:
-+ linker_flag = []
- cmd = cmd_base + linker_flag + version_check
- if toolchain_flags:
- cmd += toolchain_flags
-
-- cmd_output = check_cmd_output(*cmd).decode('utf-8')
-- if 'GNU ld' in cmd_output:
-+ # ld64 doesn't have anything to print out a version. It does print out
-+ # "ld64: For information on command line options please use 'man ld'."
-+ # but that would require doing two attempts, one with --version, that
-+ # would fail, and another with --help.
-+ # Instead, abuse its LD_PRINT_OPTIONS feature to detect a message
-+ # specific to it on stderr when it fails to process --version.
-+ env = dict(os.environ)
-+ env['LD_PRINT_OPTIONS'] = '1'
-+ retcode, stdout, stderr = get_cmd_output(*cmd, env=env)
-+ cmd_output = stdout.decode('utf-8')
-+ stderr = stderr.decode('utf-8')
-+ if retcode == 1 and 'Logging ld64 options' in stderr:
-+ kind = 'ld64'
-+
-+ elif retcode != 0:
-+ return None
-+
-+ elif 'GNU ld' in cmd_output:
- # We are using the normal linker
- kind = 'bfd'
-
-@@ -1627,13 +1661,21 @@ def select_linker(linker, c_compiler, developer_options, enable_gold,
- )
-
- result = try_linker(linker)
-+ if result is None:
-+ if linker:
-+ die("Could not use {} as linker".format(linker))
-+ die("Failed to find a linker")
-
- if (linker is None and enable_gold.origin == 'default' and
- developer_options and result.KIND == 'bfd'):
-- gold = try_linker('gold')
--
-- if gold.KIND == 'gold':
-- result = gold
-+ # try and use lld if available.
-+ tried = try_linker('lld')
-+ if tried is None or tried.KIND != 'lld':
-+ tried = try_linker('gold')
-+ if tried is None or tried.KIND != 'gold':
-+ tried = None
-+ if tried:
-+ result = tried
-
- # If an explicit linker was given, error out if what we found is different.
- if linker and not linker.startswith(result.KIND):
-@@ -1644,7 +1686,7 @@ def select_linker(linker, c_compiler, developer_options, enable_gold,
-
- set_config('LD_IS_BFD', depends(select_linker.KIND)
- (lambda x: x == 'bfd' or None))
--set_config('LINKER_LDFLAGS', select_linker.LINKER_FLAG)
-+add_old_configure_assignment('LINKER_LDFLAGS', select_linker.LINKER_FLAG)
-
-
- js_option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN',
---- a/build/moz.configure/util.configure
-+++ b/build/moz.configure/util.configure
-@@ -19,20 +19,13 @@ def configure_error(message):
- their inputs from moz.configure usage.'''
- raise ConfigureError(message)
-
--# A wrapper to obtain a process' output that returns the output generated
--# by running the given command if it exits normally, and streams that
--# output to log.debug and calls die or the given error callback if it
--# does not.
--
-
-+# A wrapper to obtain a process' output and return code.
-+# Returns a tuple (retcode, stdout, stderr).
- @imports(_from='__builtin__', _import='unicode')
- @imports('subprocess')
--@imports('sys')
--@imports(_from='mozbuild.configure.util', _import='LineIO')
- @imports(_from='mozbuild.shellutil', _import='quote')
--def check_cmd_output(*args, **kwargs):
-- onerror = kwargs.pop('onerror', None)
--
-+def get_cmd_output(*args, **kwargs):
- # subprocess on older Pythons can't handle unicode keys or values in
- # environment dicts. Normalize automagically so callers don't have to
- # deal with this.
-@@ -49,12 +42,24 @@ def check_cmd_output(*args, **kwargs):
-
- kwargs['env'] = normalized_env
-
-+ log.debug('Executing: `%s`', quote(*args))
-+ proc = subprocess.Popen(args, stdout=subprocess.PIPE,
-+ stderr=subprocess.PIPE, **kwargs)
-+ stdout, stderr = proc.communicate()
-+ return proc.wait(), stdout, stderr
-+
-+
-+# A wrapper to obtain a process' output that returns the output generated
-+# by running the given command if it exits normally, and streams that
-+# output to log.debug and calls die or the given error callback if it
-+# does not.
-+@imports(_from='mozbuild.configure.util', _import='LineIO')
-+@imports(_from='mozbuild.shellutil', _import='quote')
-+def check_cmd_output(*args, **kwargs):
-+ onerror = kwargs.pop('onerror', None)
-+
- with log.queue_debug():
-- log.debug('Executing: `%s`', quote(*args))
-- proc = subprocess.Popen(args, stdout=subprocess.PIPE,
-- stderr=subprocess.PIPE, **kwargs)
-- stdout, stderr = proc.communicate()
-- retcode = proc.wait()
-+ retcode, stdout, stderr = get_cmd_output(*args, **kwargs)
- if retcode == 0:
- return stdout
-
---- a/js/src/old-configure.in
-+++ b/js/src/old-configure.in
-@@ -63,6 +63,8 @@ dnl ========================================================
- USE_PTHREADS=
- _PTHREAD_LDFLAGS=""
-
-+LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
-+
- MOZ_DEFAULT_COMPILER
-
- if test -z "$JS_STANDALONE"; then
---- a/old-configure.in
-+++ b/old-configure.in
-@@ -78,6 +78,8 @@ dnl ========================================================
- MOZ_USE_PTHREADS=
- _PTHREAD_LDFLAGS=""
-
-+LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
-+
- MOZ_DEFAULT_COMPILER
-
- if test "$COMPILE_ENVIRONMENT"; then
---- a/python/mozbuild/mozbuild/frontend/context.py
-+++ b/python/mozbuild/mozbuild/frontend/context.py
-@@ -384,8 +384,6 @@ class LinkFlags(BaseCompileFlags):
-
- self.flag_variables = (
- ('OS', self._os_ldflags(), ('LDFLAGS',)),
-- ('LINKER', context.config.substs.get('LINKER_LDFLAGS'),
-- ('LDFLAGS',)),
- ('DEFFILE', None, ('LDFLAGS',)),
- ('MOZBUILD', None, ('LDFLAGS',)),
- ('FIX_LINK_PATHS', context.config.substs.get('MOZ_FIX_LINK_PATHS'),
---- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
-+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
-@@ -242,7 +242,6 @@ class TestEmitterBasic(unittest.TestCase):
- def test_link_flags(self):
- reader = self.reader('link-flags', extra_substs={
- 'OS_LDFLAGS': ['-Wl,rpath-link=/usr/lib'],
-- 'LINKER_LDFLAGS': ['-fuse-ld=gold'],
- 'MOZ_OPTIMIZE': '',
- 'MOZ_OPTIMIZE_LDFLAGS': ['-Wl,-dead_strip'],
- 'MOZ_DEBUG_LDFLAGS': ['-framework ExceptionHandling'],
-@@ -250,7 +249,6 @@ class TestEmitterBasic(unittest.TestCase):
- sources, ldflags, lib, compile_flags = self.read_topsrcdir(reader)
- self.assertIsInstance(ldflags, ComputedFlags)
- self.assertEqual(ldflags.flags['OS'], reader.config.substs['OS_LDFLAGS'])
-- self.assertEqual(ldflags.flags['LINKER'], reader.config.substs['LINKER_LDFLAGS'])
- self.assertEqual(ldflags.flags['MOZBUILD'], ['-Wl,-U_foo', '-framework Foo', '-x'])
- self.assertEqual(ldflags.flags['OPTIMIZE'], [])
-
diff --git a/www-client/firefox/files/firefox-60.0-missing-errno_h-in-SandboxOpenedFiles_cpp.patch b/www-client/firefox/files/firefox-60.0-missing-errno_h-in-SandboxOpenedFiles_cpp.patch
deleted file mode 100644
index c746c73940ef..000000000000
--- a/www-client/firefox/files/firefox-60.0-missing-errno_h-in-SandboxOpenedFiles_cpp.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-https://bugs.gentoo.org/667096
-
-https://bugzilla.mozilla.org/show_bug.cgi?id=1480554
---- a/security/sandbox/linux/SandboxOpenedFiles.cpp
-+++ b/security/sandbox/linux/SandboxOpenedFiles.cpp
-@@ -4,16 +4,17 @@
- * 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 "SandboxOpenedFiles.h"
-
- #include "mozilla/Move.h"
- #include "SandboxLogging.h"
-
-+#include <errno.h>
- #include <fcntl.h>
- #include <unistd.h>
-
- namespace mozilla {
-
- // The default move constructor almost works, but Atomic isn't
- // move-constructable and the fd needs some special handling.
- SandboxOpenedFile::SandboxOpenedFile(SandboxOpenedFile&& aMoved)
-
-
-
-
diff --git a/www-client/firefox/files/firefox-60.0-rust-1.29-comp.patch b/www-client/firefox/files/firefox-60.0-rust-1.29-comp.patch
deleted file mode 100644
index 6fbd13fe639a..000000000000
--- a/www-client/firefox/files/firefox-60.0-rust-1.29-comp.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-https://bugs.gentoo.org/666898
-
-https://bugzilla.mozilla.org/show_bug.cgi?id=1479540
---- a/build/moz.configure/init.configure
-+++ b/build/moz.configure/init.configure
-@@ -572,17 +572,26 @@ option('--target', nargs=1,
- @imports(_from='__builtin__', _import='KeyError')
- @imports(_from='__builtin__', _import='ValueError')
- def split_triplet(triplet, allow_unknown=False):
- # The standard triplet is defined as
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
- # There is also a quartet form:
- # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
- # But we can consider the "KERNEL-OPERATING_SYSTEM" as one.
-- cpu, manufacturer, os = triplet.split('-', 2)
-+ # Additionally, some may omit "unknown" when the manufacturer
-+ # is not specified and emit
-+ # CPU_TYPE-OPERATING_SYSTEM
-+ parts = triplet.split('-', 2)
-+ if len(parts) == 3:
-+ cpu, _, os = parts
-+ elif len(parts) == 2:
-+ cpu, os = parts
-+ else:
-+ die("Unexpected triplet string: %s" % triplet)
-
- # Autoconf uses config.sub to validate and canonicalize those triplets,
- # but the granularity of its results has never been satisfying to our
- # use, so we've had our own, different, canonicalization. We've also
- # historically not been very consistent with how we use the canonicalized
- # values. Hopefully, this will help us make things better.
- # The tests are inherited from our decades-old autoconf-based configure,
- # which can probably be improved/cleaned up because they are based on a
-
-
-
-
diff --git a/www-client/firefox/files/firefox-60.0-sandbox-lto.patch b/www-client/firefox/files/firefox-60.0-sandbox-lto.patch
deleted file mode 100644
index 990cb4fbee77..000000000000
--- a/www-client/firefox/files/firefox-60.0-sandbox-lto.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-https://bugs.gentoo.org/666580
-
---- a/security/sandbox/linux/moz.build
-+++ b/security/sandbox/linux/moz.build
-@@ -101,7 +101,7 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
- # forcing there to be only one partition.
- for f in CONFIG['OS_CXXFLAGS']:
- if f.startswith('-flto') and CONFIG['CC_TYPE'] != 'clang':
-- LDFLAGS += ['--param lto-partitions=1']
-+ LDFLAGS += ['--param=lto-partitions=1']
-
- DEFINES['NS_NO_XPCOM'] = True
- DisableStlWrapping()
diff --git a/www-client/firefox/files/firefox-60.0-update-cc-to-honor-CC.patch b/www-client/firefox/files/firefox-60.0-update-cc-to-honor-CC.patch
deleted file mode 100644
index 9bca3f57a0ab..000000000000
--- a/www-client/firefox/files/firefox-60.0-update-cc-to-honor-CC.patch
+++ /dev/null
@@ -1,745 +0,0 @@
-https://bugzilla.mozilla.org/show_bug.cgi?id=1496270
-https://bugzilla.mozilla.org/show_bug.cgi?id=1445528
-
---- a/third_party/rust/cc/.cargo-checksum.json
-+++ b/third_party/rust/cc/.cargo-checksum.json
-@@ -1 +1 @@
--{"files":{".travis.yml":"1a4a3f7f90349924378e93acbb524b9127e37c02cfbc6dc59fd904bbdc1c8d0b","Cargo.toml":"623dd06a83bcbf2f292ab51af93e9b79b689e3be06a62968b79f4e36f1bb769f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"186c5c8a62520cb7a3d90d77161c954b52ae8456fca0e0669bc3a5b889592a43","appveyor.yml":"ab45bfdcf2596f357225a54e730c34d518a8f3ad56c2ed33af682cfd45bddc02","src/bin/gcc-shim.rs":"d6be9137cb48b86891e7b263adbf492e1193ffe682db9ba4a88eb1079b874b58","src/com.rs":"0cb06f5db0fb70d27db0e5917ca337de6e7032119e6aabfea1bad9c719f5f34b","src/lib.rs":"996b650e19d5ccd6e64e741789427017c913644e980862a7286ec4ed53c14a17","src/registry.rs":"3876ef9573e3bbc050aef41a684b9a510cc1a91b15ae874fe032cf4377b4d116","src/setup_config.rs":"1a3eeb11c6847c31f2a4685b62ab35c76f0b6d5a17f7ed99e9df164283a771f7","src/winapi.rs":"cb5e6cab3eb570b0f97c660ca448ccfb5024262c0c7b245c181daad91a79f211","src/windows_registry.rs":"6de548aa94215e449f0e58e9a3b1702939d7c2f7b63a9040901c948bf138201d","tests/cc_env.rs":"7402315eea7ffa23b29b393c1de8e236294ede9de562ff0a562704a157135341","tests/support/mod.rs":"092551f9f6e3a999fa0aa02f93314aac0bda2b09268f948c423df56a43575e0b","tests/test.rs":"b1164258714e13173f3861126e97bedf1e29aa24618993c4eb0edd57c431dcc7"},"package":"deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"}
-\ No newline at end of file
-+{"files":{".travis.yml":"1a4a3f7f90349924378e93acbb524b9127e37c02cfbc6dc59fd904bbdc1c8d0b","Cargo.toml":"623dd06a83bcbf2f292ab51af93e9b79b689e3be06a62968b79f4e36f1bb769f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"186c5c8a62520cb7a3d90d77161c954b52ae8456fca0e0669bc3a5b889592a43","appveyor.yml":"ab45bfdcf2596f357225a54e730c34d518a8f3ad56c2ed33af682cfd45bddc02","src/bin/gcc-shim.rs":"d6be9137cb48b86891e7b263adbf492e1193ffe682db9ba4a88eb1079b874b58","src/com.rs":"0cb06f5db0fb70d27db0e5917ca337de6e7032119e6aabfea1bad9c719f5f34b","src/lib.rs":"6e8cea99f5fc8e5982b1ea9a336ee2f9a6158a9498c8f0c36f1e8cee8c99716e","src/registry.rs":"3876ef9573e3bbc050aef41a684b9a510cc1a91b15ae874fe032cf4377b4d116","src/setup_config.rs":"1a3eeb11c6847c31f2a4685b62ab35c76f0b6d5a17f7ed99e9df164283a771f7","src/winapi.rs":"cb5e6cab3eb570b0f97c660ca448ccfb5024262c0c7b245c181daad91a79f211","src/windows_registry.rs":"6de548aa94215e449f0e58e9a3b1702939d7c2f7b63a9040901c948bf138201d","tests/cc_env.rs":"7402315eea7ffa23b29b393c1de8e236294ede9de562ff0a562704a157135341","tests/support/mod.rs":"092551f9f6e3a999fa0aa02f93314aac0bda2b09268f948c423df56a43575e0b","tests/test.rs":"b1164258714e13173f3861126e97bedf1e29aa24618993c4eb0edd57c431dcc7"},"package":"deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"}
-\ No newline at end of file
---- a/third_party/rust/cc/src/lib.rs
-+++ b/third_party/rust/cc/src/lib.rs
-@@ -61,15 +61,14 @@
- extern crate rayon;
-
- use std::env;
--use std::ffi::{OsString, OsStr};
-+use std::ffi::{OsStr, OsString};
- use std::fs;
--use std::path::{PathBuf, Path};
--use std::process::{Command, Stdio, Child};
--use std::io::{self, BufReader, BufRead, Read, Write};
-+use std::path::{Path, PathBuf};
-+use std::process::{Child, Command, Stdio};
-+use std::io::{self, BufRead, BufReader, Read, Write};
- use std::thread::{self, JoinHandle};
--
--#[cfg(feature = "parallel")]
--use std::sync::Mutex;
-+use std::collections::HashMap;
-+use std::sync::{Arc, Mutex};
-
- // These modules are all glue to support reading the MSVC version from
- // the registry and from COM interfaces
-@@ -97,6 +96,7 @@ pub struct Build {
- objects: Vec<PathBuf>,
- flags: Vec<String>,
- flags_supported: Vec<String>,
-+ known_flag_support_status: Arc<Mutex<HashMap<String, bool>>>,
- files: Vec<PathBuf>,
- cpp: bool,
- cpp_link_stdlib: Option<Option<String>>,
-@@ -241,8 +241,7 @@ impl ToolFamily {
- fn nvcc_debug_flag(&self) -> &'static str {
- match *self {
- ToolFamily::Msvc => unimplemented!(),
-- ToolFamily::Gnu |
-- ToolFamily::Clang => "-G",
-+ ToolFamily::Gnu | ToolFamily::Clang => "-G",
- }
- }
-
-@@ -251,8 +250,7 @@ impl ToolFamily {
- fn nvcc_redirect_flag(&self) -> &'static str {
- match *self {
- ToolFamily::Msvc => unimplemented!(),
-- ToolFamily::Gnu |
-- ToolFamily::Clang => "-Xcompiler",
-+ ToolFamily::Gnu | ToolFamily::Clang => "-Xcompiler",
- }
- }
- }
-@@ -269,10 +267,7 @@ struct Object {
- impl Object {
- /// Create a new source file -> object file pair.
- fn new(src: PathBuf, dst: PathBuf) -> Object {
-- Object {
-- src: src,
-- dst: dst,
-- }
-+ Object { src: src, dst: dst }
- }
- }
-
-@@ -289,6 +284,7 @@ impl Build {
- objects: Vec::new(),
- flags: Vec::new(),
- flags_supported: Vec::new(),
-+ known_flag_support_status: Arc::new(Mutex::new(HashMap::new())),
- files: Vec::new(),
- shared_flag: None,
- static_flag: None,
-@@ -344,10 +340,8 @@ impl Build {
- /// .compile("foo");
- /// ```
- pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) -> &mut Build {
-- self.definitions.push((
-- var.to_string(),
-- val.into().map(|s| s.to_string()),
-- ));
-+ self.definitions
-+ .push((var.to_string(), val.into().map(|s| s.to_string())));
- self
- }
-
-@@ -398,7 +392,16 @@ impl Build {
- ///
- /// It may return error if it's unable to run the compilier with a test file
- /// (e.g. the compiler is missing or a write to the `out_dir` failed).
-+ ///
-+ /// Note: Once computed, the result of this call is stored in the
-+ /// `known_flag_support` field. If `is_flag_supported(flag)`
-+ /// is called again, the result will be read from the hash table.
- pub fn is_flag_supported(&self, flag: &str) -> Result<bool, Error> {
-+ let mut known_status = self.known_flag_support_status.lock().unwrap();
-+ if let Some(is_supported) = known_status.get(flag).cloned() {
-+ return Ok(is_supported);
-+ }
-+
- let out_dir = self.get_out_dir()?;
- let src = self.ensure_check_file()?;
- let obj = out_dir.join("flag_check");
-@@ -413,7 +416,8 @@ impl Build {
- .cuda(self.cuda);
- let compiler = cfg.try_get_compiler()?;
- let mut cmd = compiler.to_command();
-- command_add_output_file(&mut cmd, &obj, target.contains("msvc"), false);
-+ let is_arm = target.contains("aarch64") || target.contains("arm");
-+ command_add_output_file(&mut cmd, &obj, target.contains("msvc"), false, is_arm);
-
- // We need to explicitly tell msvc not to link and create an exe
- // in the root directory of the crate
-@@ -424,7 +428,10 @@ impl Build {
- cmd.arg(&src);
-
- let output = cmd.output()?;
-- Ok(output.stderr.is_empty())
-+ let is_supported = output.stderr.is_empty();
-+
-+ known_status.insert(flag.to_owned(), is_supported);
-+ Ok(is_supported)
- }
-
- /// Add an arbitrary flag to the invocation of the compiler if it supports it
-@@ -777,9 +784,8 @@ impl Build {
- A: AsRef<OsStr>,
- B: AsRef<OsStr>,
- {
-- self.env.push(
-- (a.as_ref().to_owned(), b.as_ref().to_owned()),
-- );
-+ self.env
-+ .push((a.as_ref().to_owned(), b.as_ref().to_owned()));
- self
- }
-
-@@ -880,31 +886,19 @@ impl Build {
- fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> {
- use self::rayon::prelude::*;
-
-- let mut cfg = rayon::Configuration::new();
- if let Ok(amt) = env::var("NUM_JOBS") {
- if let Ok(amt) = amt.parse() {
-- cfg = cfg.num_threads(amt);
-+ let _ = rayon::ThreadPoolBuilder::new()
-+ .num_threads(amt)
-+ .build_global();
- }
- }
-- drop(rayon::initialize(cfg));
--
-- let results: Mutex<Vec<Result<(), Error>>> = Mutex::new(Vec::new());
--
-- objs.par_iter().with_max_len(1).for_each(
-- |obj| {
-- let res = self.compile_object(obj);
-- results.lock().unwrap().push(res)
-- },
-- );
-
- // Check for any errors and return the first one found.
-- for result in results.into_inner().unwrap().iter() {
-- if result.is_err() {
-- return result.clone();
-- }
-- }
--
-- Ok(())
-+ objs.par_iter()
-+ .with_max_len(1)
-+ .map(|obj| self.compile_object(obj))
-+ .collect()
- }
-
- #[cfg(not(feature = "parallel"))]
-@@ -917,7 +911,8 @@ impl Build {
-
- fn compile_object(&self, obj: &Object) -> Result<(), Error> {
- let is_asm = obj.src.extension().and_then(|s| s.to_str()) == Some("asm");
-- let msvc = self.get_target()?.contains("msvc");
-+ let target = self.get_target()?;
-+ let msvc = target.contains("msvc");
- let (mut cmd, name) = if msvc && is_asm {
- self.msvc_macro_assembler()?
- } else {
-@@ -931,15 +926,17 @@ impl Build {
- compiler
- .path
- .file_name()
-- .ok_or_else(|| {
-- Error::new(ErrorKind::IOError, "Failed to get compiler path.")
-- })?
-+ .ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))?
- .to_string_lossy()
- .into_owned(),
- )
- };
-- command_add_output_file(&mut cmd, &obj.dst, msvc, is_asm);
-- cmd.arg(if msvc { "/c" } else { "-c" });
-+ let is_arm = target.contains("aarch64") || target.contains("arm");
-+ command_add_output_file(&mut cmd, &obj.dst, msvc, is_asm, is_arm);
-+ // armasm and armasm64 don't requrie -c option
-+ if !msvc || !is_asm || !is_arm {
-+ cmd.arg(if msvc { "/c" } else { "-c" });
-+ }
- cmd.arg(&obj.src);
-
- run(&mut cmd, &name)?;
-@@ -967,9 +964,7 @@ impl Build {
- let name = compiler
- .path
- .file_name()
-- .ok_or_else(|| {
-- Error::new(ErrorKind::IOError, "Failed to get compiler path.")
-- })?
-+ .ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))?
- .to_string_lossy()
- .into_owned();
-
-@@ -1054,8 +1049,8 @@ impl Build {
- cmd.args.push(crt_flag.into());
-
- match &opt_level[..] {
-- "z" | "s" => cmd.args.push("/Os".into()),
-- "1" => cmd.args.push("/O1".into()),
-+ // Msvc uses /O1 to enable all optimizations that minimize code size.
-+ "z" | "s" | "1" => cmd.args.push("/O1".into()),
- // -O3 is a valid value for gcc and clang compilers, but not msvc. Cap to /O2.
- "2" | "3" => cmd.args.push("/O2".into()),
- _ => {}
-@@ -1070,8 +1065,10 @@ impl Build {
- cmd.args.push(format!("-O{}", opt_level).into());
- }
-
-- cmd.push_cc_arg("-ffunction-sections".into());
-- cmd.push_cc_arg("-fdata-sections".into());
-+ if !target.contains("-ios") {
-+ cmd.push_cc_arg("-ffunction-sections".into());
-+ cmd.push_cc_arg("-fdata-sections".into());
-+ }
- if self.pic.unwrap_or(!target.contains("windows-gnu")) {
- cmd.push_cc_arg("-fPIC".into());
- }
-@@ -1169,7 +1166,7 @@ impl Build {
- // linker that we're generating 32-bit executables as well. This'll
- // typically only be used for build scripts which transitively use
- // these flags that try to compile executables.
-- if target == "i686-unknown-linux-musl" {
-+ if target == "i686-unknown-linux-musl" || target == "i586-unknown-linux-musl" {
- cmd.args.push("-Wl,-melf_i386".into());
- }
-
-@@ -1212,14 +1209,13 @@ impl Build {
- if self.cpp {
- match (self.cpp_set_stdlib.as_ref(), cmd.family) {
- (None, _) => {}
-- (Some(stdlib), ToolFamily::Gnu) |
-- (Some(stdlib), ToolFamily::Clang) => {
-+ (Some(stdlib), ToolFamily::Gnu) | (Some(stdlib), ToolFamily::Clang) => {
- cmd.push_cc_arg(format!("-stdlib=lib{}", stdlib).into());
- }
- _ => {
- println!(
- "cargo:warning=cpp_set_stdlib is specified, but the {:?} compiler \
-- does not support this option, ignored",
-+ does not support this option, ignored",
- cmd.family
- );
- }
-@@ -1272,6 +1268,10 @@ impl Build {
- let target = self.get_target()?;
- let tool = if target.contains("x86_64") {
- "ml64.exe"
-+ } else if target.contains("arm") {
-+ "armasm.exe"
-+ } else if target.contains("aarch64") {
-+ "armasm64.exe"
- } else {
- "ml.exe"
- };
-@@ -1307,20 +1307,55 @@ impl Build {
- if target.contains("msvc") {
- let mut cmd = match self.archiver {
- Some(ref s) => self.cmd(s),
-- None => {
-- windows_registry::find(&target, "lib.exe").unwrap_or_else(
-- || {
-- self.cmd("lib.exe")
-- },
-- )
-- }
-+ None => windows_registry::find(&target, "lib.exe")
-+ .unwrap_or_else(|| self.cmd("lib.exe")),
- };
-+
- let mut out = OsString::from("/OUT:");
- out.push(dst);
-- run(
-- cmd.arg(out).arg("/nologo").args(&objects).args(&self.objects),
-- "lib.exe",
-- )?;
-+ cmd.arg(out).arg("/nologo");
-+
-+ // Similar to https://github.com/rust-lang/rust/pull/47507
-+ // and https://github.com/rust-lang/rust/pull/48548
-+ let estimated_command_line_len = objects
-+ .iter()
-+ .chain(&self.objects)
-+ .map(|a| a.as_os_str().len())
-+ .sum::<usize>();
-+ if estimated_command_line_len > 1024 * 6 {
-+ let mut args = String::from("\u{FEFF}"); // BOM
-+ for arg in objects.iter().chain(&self.objects) {
-+ args.push('"');
-+ for c in arg.to_str().unwrap().chars() {
-+ if c == '"' {
-+ args.push('\\')
-+ }
-+ args.push(c)
-+ }
-+ args.push('"');
-+ args.push('\n');
-+ }
-+
-+ let mut utf16le = Vec::new();
-+ for code_unit in args.encode_utf16() {
-+ utf16le.push(code_unit as u8);
-+ utf16le.push((code_unit >> 8) as u8);
-+ }
-+
-+ let mut args_file = OsString::from(dst);
-+ args_file.push(".args");
-+ fs::File::create(&args_file)
-+ .unwrap()
-+ .write_all(&utf16le)
-+ .unwrap();
-+
-+ let mut args_file_arg = OsString::from("@");
-+ args_file_arg.push(args_file);
-+ cmd.arg(args_file_arg);
-+ } else {
-+ cmd.args(&objects).args(&self.objects);
-+ }
-+ run(&mut cmd, "lib.exe")?;
-
- // The Rust compiler will look for libfoo.a and foo.lib, but the
- // MSVC linker will also be passed foo.lib, so be sure that both
-@@ -1412,6 +1447,18 @@ impl Build {
-
- cmd.args.push("-isysroot".into());
- cmd.args.push(sdk_path.trim().into());
-+ cmd.args.push("-fembed-bitcode".into());
-+ /*
-+ * TODO we probably ultimatedly want the -fembed-bitcode-marker flag
-+ * but can't have it now because of an issue in LLVM:
-+ * https://github.com/alexcrichton/cc-rs/issues/301
-+ * https://github.com/rust-lang/rust/pull/48896#comment-372192660
-+ */
-+ /*
-+ if self.get_opt_level()? == "0" {
-+ cmd.args.push("-fembed-bitcode-marker".into());
-+ }
-+ */
-
- Ok(())
- }
-@@ -1437,37 +1484,44 @@ impl Build {
- };
-
- // On Solaris, c++/cc unlikely to exist or be correct.
-- let default = if host.contains("solaris") { gnu } else { traditional };
--
-- let tool_opt: Option<Tool> =
-- self.env_tool(env)
-- .map(|(tool, cc, args)| {
-- let mut t = Tool::new(PathBuf::from(tool));
-- if let Some(cc) = cc {
-- t.cc_wrapper_path = Some(PathBuf::from(cc));
-- }
-- for arg in args {
-- t.cc_wrapper_args.push(arg.into());
-- }
-- t
-- })
-- .or_else(|| {
-- if target.contains("emscripten") {
-- let tool = if self.cpp { "em++" } else { "emcc" };
-- // Windows uses bat file so we have to be a bit more specific
-- if cfg!(windows) {
-- let mut t = Tool::new(PathBuf::from("cmd"));
-- t.args.push("/c".into());
-- t.args.push(format!("{}.bat", tool).into());
-- Some(t)
-- } else {
-- Some(Tool::new(PathBuf::from(tool)))
-- }
-+ let default = if host.contains("solaris") {
-+ gnu
-+ } else {
-+ traditional
-+ };
-+
-+ let tool_opt: Option<Tool> = self.env_tool(env)
-+ .map(|(tool, cc, args)| {
-+ // chop off leading/trailing whitespace to work around
-+ // semi-buggy build scripts which are shared in
-+ // makefiles/configure scripts (where spaces are far more
-+ // lenient)
-+ let mut t = Tool::new(PathBuf::from(tool.trim()));
-+ if let Some(cc) = cc {
-+ t.cc_wrapper_path = Some(PathBuf::from(cc));
-+ }
-+ for arg in args {
-+ t.cc_wrapper_args.push(arg.into());
-+ }
-+ t
-+ })
-+ .or_else(|| {
-+ if target.contains("emscripten") {
-+ let tool = if self.cpp { "em++" } else { "emcc" };
-+ // Windows uses bat file so we have to be a bit more specific
-+ if cfg!(windows) {
-+ let mut t = Tool::new(PathBuf::from("cmd"));
-+ t.args.push("/c".into());
-+ t.args.push(format!("{}.bat", tool).into());
-+ Some(t)
- } else {
-- None
-+ Some(Tool::new(PathBuf::from(tool)))
- }
-- })
-- .or_else(|| windows_registry::find_tool(&target, "cl.exe"));
-+ } else {
-+ None
-+ }
-+ })
-+ .or_else(|| windows_registry::find_tool(&target, "cl.exe"));
-
- let tool = match tool_opt {
- Some(t) => t,
-@@ -1501,6 +1555,7 @@ impl Build {
- "armv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"),
- "armv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"),
- "armv7-unknown-netbsd-eabihf" => Some("armv7--netbsdelf-eabihf"),
-+ "i586-unknown-linux-musl" => Some("musl"),
- "i686-pc-windows-gnu" => Some("i686-w64-mingw32"),
- "i686-unknown-linux-musl" => Some("musl"),
- "i686-unknown-netbsd" => Some("i486--netbsdelf"),
-@@ -1509,10 +1564,12 @@ impl Build {
- "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"),
- "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"),
- "powerpc-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
-+ "powerpc-unknown-linux-gnuspe" => Some("powerpc-linux-gnuspe"),
- "powerpc-unknown-netbsd" => Some("powerpc--netbsd"),
- "powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
- "powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"),
- "s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"),
-+ "sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"),
- "sparc64-unknown-linux-gnu" => Some("sparc64-linux-gnu"),
- "sparc64-unknown-netbsd" => Some("sparc64--netbsd"),
- "sparcv9-sun-solaris" => Some("sparcv9-sun-solaris"),
-@@ -1538,14 +1595,18 @@ impl Build {
- };
-
- let tool = if self.cuda {
-- assert!(tool.args.is_empty(),
-- "CUDA compilation currently assumes empty pre-existing args");
-+ assert!(
-+ tool.args.is_empty(),
-+ "CUDA compilation currently assumes empty pre-existing args"
-+ );
- let nvcc = match self.get_var("NVCC") {
- Err(_) => "nvcc".into(),
- Ok(nvcc) => nvcc,
- };
- let mut nvcc_tool = Tool::with_features(PathBuf::from(nvcc), self.cuda);
-- nvcc_tool.args.push(format!("-ccbin={}", tool.path.display()).into());
-+ nvcc_tool
-+ .args
-+ .push(format!("-ccbin={}", tool.path.display()).into());
- nvcc_tool
- } else {
- tool
-@@ -1568,10 +1629,7 @@ impl Build {
- Some(res) => Ok(res),
- None => Err(Error::new(
- ErrorKind::EnvVarNotFound,
-- &format!(
-- "Could not find environment variable {}.",
-- var_base
-- ),
-+ &format!("Could not find environment variable {}.", var_base),
- )),
- }
- }
-@@ -1585,21 +1643,68 @@ impl Build {
- .collect()
- }
-
--
- /// Returns compiler path, optional modifier name from whitelist, and arguments vec
- fn env_tool(&self, name: &str) -> Option<(String, Option<String>, Vec<String>)> {
-- self.get_var(name).ok().map(|tool| {
-- let whitelist = ["ccache", "distcc", "sccache"];
-+ let tool = match self.get_var(name) {
-+ Ok(tool) => tool,
-+ Err(_) => return None,
-+ };
-
-- for t in whitelist.iter() {
-- if tool.starts_with(t) && tool[t.len()..].starts_with(' ') {
-- let args = tool.split_whitespace().collect::<Vec<_>>();
-+ // If this is an exact path on the filesystem we don't want to do any
-+ // interpretation at all, just pass it on through. This'll hopefully get
-+ // us to support spaces-in-paths.
-+ if Path::new(&tool).exists() {
-+ return Some((tool, None, Vec::new()));
-+ }
-+
-+ // Ok now we want to handle a couple of scenarios. We'll assume from
-+ // here on out that spaces are splitting separate arguments. Two major
-+ // features we want to support are:
-+ //
-+ // CC='sccache cc'
-+ //
-+ // aka using `sccache` or any other wrapper/caching-like-thing for
-+ // compilations. We want to know what the actual compiler is still,
-+ // though, because our `Tool` API support introspection of it to see
-+ // what compiler is in use.
-+ //
-+ // additionally we want to support
-+ //
-+ // CC='cc -flag'
-+ //
-+ // where the CC env var is used to also pass default flags to the C
-+ // compiler.
-+ //
-+ // It's true that everything here is a bit of a pain, but apparently if
-+ // you're not literally make or bash then you get a lot of bug reports.
-+ let known_wrappers = ["ccache", "distcc", "sccache", "icecc"];
-+
-+ let mut parts = tool.split_whitespace();
-+ let maybe_wrapper = match parts.next() {
-+ Some(s) => s,
-+ None => return None,
-+ };
-
-- return (args[1].to_string(), Some(t.to_string()), args[2..].iter().map(|s| s.to_string()).collect());
-- }
-+ let file_stem = Path::new(maybe_wrapper)
-+ .file_stem()
-+ .unwrap()
-+ .to_str()
-+ .unwrap();
-+ if known_wrappers.contains(&file_stem) {
-+ if let Some(compiler) = parts.next() {
-+ return Some((
-+ compiler.to_string(),
-+ Some(maybe_wrapper.to_string()),
-+ parts.map(|s| s.to_string()).collect(),
-+ ));
- }
-- (tool, None, Vec::new())
-- })
-+ }
-+
-+ Some((
-+ maybe_wrapper.to_string(),
-+ None,
-+ parts.map(|s| s.to_string()).collect(),
-+ ))
- }
-
- /// Returns the default C++ standard library for the current target: `libc++`
-@@ -1611,7 +1716,7 @@ impl Build {
- let target = self.get_target()?;
- if target.contains("msvc") {
- Ok(None)
-- } else if target.contains("darwin") {
-+ } else if target.contains("apple") {
- Ok(Some("c++".to_string()))
- } else if target.contains("freebsd") {
- Ok(Some("c++".to_string()))
-@@ -1700,10 +1805,7 @@ impl Build {
- Some(s) => Ok(s),
- None => Err(Error::new(
- ErrorKind::EnvVarNotFound,
-- &format!(
-- "Environment variable {} not defined.",
-- v.to_string()
-- ),
-+ &format!("Environment variable {} not defined.", v.to_string()),
- )),
- }
- }
-@@ -1731,8 +1833,9 @@ impl Tool {
- let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
- if fname.contains("clang") {
- ToolFamily::Clang
-- } else if fname.contains("cl") && !fname.contains("cloudabi") &&
-- !fname.contains("uclibc") {
-+ } else if fname.contains("cl") && !fname.contains("cloudabi")
-+ && !fname.contains("uclibc")
-+ {
- ToolFamily::Msvc
- } else {
- ToolFamily::Gnu
-@@ -1775,8 +1878,8 @@ impl Tool {
- cmd.arg(&self.path);
- cmd.args(&self.cc_wrapper_args);
- cmd
-- },
-- None => Command::new(&self.path)
-+ }
-+ None => Command::new(&self.path),
- };
- cmd.args(&self.args);
- for &(ref k, ref v) in self.env.iter() {
-@@ -1822,10 +1925,8 @@ impl Tool {
- cc_env.push(arg);
- }
- cc_env
-- },
-- None => {
-- OsString::from("")
- }
-+ None => OsString::from(""),
- }
- }
-
-@@ -1868,8 +1969,7 @@ fn run(cmd: &mut Command, program: &str) -> Result<(), Error> {
- ErrorKind::ToolExecError,
- &format!(
- "Failed to wait on spawned child process, command {:?} with args {:?}.",
-- cmd,
-- program
-+ cmd, program
- ),
- ))
- }
-@@ -1884,9 +1984,7 @@ fn run(cmd: &mut Command, program: &str) -> Result<(), Error> {
- ErrorKind::ToolExecError,
- &format!(
- "Command {:?} with args {:?} did not execute successfully (status code {}).",
-- cmd,
-- program,
-- status
-+ cmd, program, status
- ),
- ))
- }
-@@ -1909,8 +2007,7 @@ fn run_output(cmd: &mut Command, program: &str) -> Result<Vec<u8>, Error> {
- ErrorKind::ToolExecError,
- &format!(
- "Failed to wait on spawned child process, command {:?} with args {:?}.",
-- cmd,
-- program
-+ cmd, program
- ),
- ))
- }
-@@ -1925,9 +2022,7 @@ fn run_output(cmd: &mut Command, program: &str) -> Result<Vec<u8>, Error> {
- ErrorKind::ToolExecError,
- &format!(
- "Command {:?} with args {:?} did not execute successfully (status code {}).",
-- cmd,
-- program,
-- status
-+ cmd, program, status
- ),
- ))
- }
-@@ -1943,39 +2038,30 @@ fn spawn(cmd: &mut Command, program: &str) -> Result<(Child, JoinHandle<()>), Er
- match cmd.stderr(Stdio::piped()).spawn() {
- Ok(mut child) => {
- let stderr = BufReader::new(child.stderr.take().unwrap());
-- let print = thread::spawn(move || for line in stderr.split(b'\n').filter_map(
-- |l| l.ok(),
-- )
-- {
-- print!("cargo:warning=");
-- std::io::stdout().write_all(&line).unwrap();
-- println!("");
-+ let print = thread::spawn(move || {
-+ for line in stderr.split(b'\n').filter_map(|l| l.ok()) {
-+ print!("cargo:warning=");
-+ std::io::stdout().write_all(&line).unwrap();
-+ println!("");
-+ }
- });
- Ok((child, print))
- }
- Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
- let extra = if cfg!(windows) {
- " (see https://github.com/alexcrichton/cc-rs#compile-time-requirements \
-- for help)"
-+ for help)"
- } else {
- ""
- };
- Err(Error::new(
- ErrorKind::ToolNotFound,
-- &format!(
-- "Failed to find tool. Is `{}` installed?{}",
-- program,
-- extra
-- ),
-+ &format!("Failed to find tool. Is `{}` installed?{}", program, extra),
- ))
- }
- Err(_) => Err(Error::new(
- ErrorKind::ToolExecError,
-- &format!(
-- "Command {:?} with args {:?} failed to start.",
-- cmd,
-- program
-- ),
-+ &format!("Command {:?} with args {:?} failed to start.", cmd, program),
- )),
- }
- }
-@@ -1984,9 +2070,10 @@ fn fail(s: &str) -> ! {
- panic!("\n\nInternal error occurred: {}\n\n", s)
- }
-
--
--fn command_add_output_file(cmd: &mut Command, dst: &Path, msvc: bool, is_asm: bool) {
-- if msvc && is_asm {
-+fn command_add_output_file(cmd: &mut Command, dst: &Path, msvc: bool, is_asm: bool, is_arm: bool) {
-+ if msvc && is_asm && is_arm {
-+ cmd.arg("-o").arg(&dst);
-+ } else if msvc && is_asm {
- cmd.arg("/Fo").arg(dst);
- } else if msvc {
- let mut s = OsString::from("/Fo");