Backed out changeset 0c800e84c991 (bug 1467039) for Spidermonkey failure. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Tue, 12 Jun 2018 08:29:01 +0300
changeset 479061 81c54e582e07179b34a9e7b8cd424fd210c94a4f
parent 479060 1eada07ecc31d2c5a86c03e105adea23c7b79a4f
child 479062 fc4a67d2aea5879d93232c5639e6d806c9c923f8
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1467039
milestone62.0a1
backs out0c800e84c99172c583b2f818cb45e0bdb34e79a8
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 0c800e84c991 (bug 1467039) for Spidermonkey failure. CLOSED TREE
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1552,76 +1552,84 @@ def is_linker_option_enabled(target):
 option('--enable-gold',
        env='MOZ_FORCE_GOLD',
        help='Enable GNU Gold Linker when it is not already the default',
        when=is_linker_option_enabled)
 
 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, lld, lld-*, other}',
           when=is_linker_option_enabled)
 
 
 @depends('--enable-linker', c_compiler, developer_options,
          extra_toolchain_flags, when=is_linker_option_enabled)
 @checking('for linker', lambda x: x.KIND)
 @imports('os')
 @imports('shutil')
 def select_linker(linker, c_compiler, developer_options, toolchain_flags):
 
-    linker = linker[0] if linker else None
+    linker = linker[0] if linker else 'other'
 
-    if linker not in ('bfd', 'gold', 'lld', None) and not linker.startswith("lld-"):
+    if linker not in ('bfd', 'gold', 'lld', 'other') and not linker.startswith("lld-"):
         # Check that we are trying to use a supported linker
         die('Unsupported linker ' + linker)
 
     # Check the kind of linker
     version_check = ['-Wl,--version']
     cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags
+    # Generate the compiler flag
+    linker_flag = ["-fuse-ld=" + linker] if linker != "other" else []
+    cmd = cmd_base + linker_flag + version_check
+    if toolchain_flags:
+        cmd += toolchain_flags
 
-    def try_linker(linker):
-        # Generate the compiler flag
-        linker_flag = ["-fuse-ld=" + linker] if linker else []
-        cmd = cmd_base + linker_flag + version_check
-        if toolchain_flags:
-            cmd += toolchain_flags
+    if (linker == 'gold' or developer_options) and linker != 'bfd':
+        if 'GNU gold' in check_cmd_output(*cmd).decode('utf-8'):
+            # We have detected gold, will build with -fuse-ld=gold
+            return namespace(
+                KIND='gold',
+                LINKER_FLAG=linker_flag,
+            )
+
+        # gold is only required if --enable-gold is used.
+        if linker == 'gold':
+            die('Could not find gold')
+        # Else fallthrough.
 
-        cmd_output = check_cmd_output(*cmd).decode('utf-8')
-        if 'GNU ld' in cmd_output:
-            # We are using the normal linker
-            kind = 'bfd'
-
-        elif 'GNU gold' in cmd_output:
-            kind = 'gold'
+    cmd_output = check_cmd_output(*cmd).decode('utf-8')
+    # using decode because ld can be localized and python will
+    # have problems with french accent for example
+    if 'GNU ld' in cmd_output:
+        # We are using the normal linker
+        return namespace(
+            KIND='bfd'
+        )
 
-        elif 'LLD' in cmd_output:
-            kind = 'lld'
+    # Special case for Android. In the ndk, it is gold
+    if 'GNU gold' in cmd_output:
+        return namespace(
+            KIND='gold'
+        )
 
-        else:
-            kind = 'unknown'
-
+    if 'LLD' in cmd_output:
         return namespace(
-            KIND=kind,
+            KIND='lld',
             LINKER_FLAG=linker_flag,
         )
-
-    result = try_linker(linker)
-
-    if linker is None and developer_options and result.KIND == 'bfd':
-        gold = try_linker('gold')
-
-        if gold.KIND == 'gold':
-            result = gold
-
-    # If an explicit linker was given, error out if what we found is different.
-    if linker and not linker.startswith(result.KIND):
+    elif linker.startswith('lld'):
+        # We forced the lld linker but could not find the string
+        # when checking, fail the build
         die("Could not use {} as linker".format(linker))
 
-    return result
+    # For other platforms without gold or the GNU linker
+    return namespace(
+        KIND='other'
+    )
 
 
 set_config('LD_IS_BFD', depends(select_linker.KIND)
            (lambda x: x == 'bfd' or None))
 set_config('LINKER_LDFLAGS', select_linker.LINKER_FLAG)
 
 
 js_option('--enable-clang-plugin', env='ENABLE_CLANG_PLUGIN',