Bug 1457168 - Make configure tests use LINKER_LDFLAGS. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 04 Jul 2018 16:18:48 +0900
changeset 480361 de7abe2c2b3e8713aef98947b8cb784e4628c009
parent 480360 ddb29b481834c16a608ff6e4dd8382155239a94f
child 480362 bf4739550b9ddd556dd0f606496b31fbfcdb5954
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1457168
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457168 - Make configure tests use LINKER_LDFLAGS. r=chmanchester Because we have no linking configure test in python configure (yet), we just make old-configure tests use LINKER_LDFLAGS, and make those flags added to LDFLAGS by old-configure at the same time.
build/moz.configure/toolchain.configure
js/src/old-configure.in
old-configure.in
python/mozbuild/mozbuild/frontend/context.py
python/mozbuild/mozbuild/test/frontend/test_emitter.py
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1326,20 +1326,16 @@ js_option('--enable-lto',
 @depends('--enable-lto', c_compiler)
 @imports('multiprocessing')
 def lto(value, c_compiler):
     flags = []
     ldflags = []
 
     # 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")
         elif value:
             flags.append("-flto=thin")
             ldflags.append("-flto=thin")
 
     # gcc and other compilers
@@ -1639,17 +1635,17 @@ def select_linker(linker, c_compiler, de
     if linker and not linker.startswith(result.KIND):
         die("Could not use {} as linker".format(linker))
 
     return result
 
 
 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',
           help="Enable building with the mozilla clang plugin")
 
 add_old_configure_assignment('ENABLE_CLANG_PLUGIN',
                              depends_if('--enable-clang-plugin')(lambda _: True))
 
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -58,16 +58,18 @@ dnl ====================================
 MISSING_X=
 
 dnl Initialize the Pthread test variables early so they can be
 dnl  overridden by each platform.
 dnl ========================================================
 USE_PTHREADS=
 _PTHREAD_LDFLAGS=""
 
+LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
+
 MOZ_DEFAULT_COMPILER
 
 if test -z "$JS_STANDALONE"; then
   autoconfmk=autoconf-js.mk
 fi
 AC_SUBST(autoconfmk)
 
 if test -n "$JS_STANDALONE"; then
--- a/old-configure.in
+++ b/old-configure.in
@@ -73,16 +73,18 @@ 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=""
 
+LDFLAGS="$LDFLAGS $LINKER_LDFLAGS"
+
 MOZ_DEFAULT_COMPILER
 
 if test "$COMPILE_ENVIRONMENT"; then
     MOZ_ANDROID_NDK
 fi # COMPILE_ENVIRONMENT
 
 case "$target" in
 *-android*|*-linuxandroid*)
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -379,18 +379,16 @@ class AsmFlags(BaseCompileFlags):
 
 
 class LinkFlags(BaseCompileFlags):
     def __init__(self, context):
         self._context = context
 
         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'),
              ('LDFLAGS',)),
             ('OPTIMIZE', (context.config.substs.get('MOZ_OPTIMIZE_LDFLAGS', []) if
                           context.config.substs.get('MOZ_OPTIMIZE') else []),
              ('LDFLAGS',)),
         )
--- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py
+++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py
@@ -237,25 +237,23 @@ class TestEmitterBasic(unittest.TestCase
         })
         sources, ldflags, lib, flags = self.read_topsrcdir(reader)
         self.assertIsInstance(flags, ComputedFlags)
         self.assertEqual(flags.flags['DEBUG'], [])
 
     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'],
         })
         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'], [])
 
     def test_debug_ldflags(self):
         reader = self.reader('link-flags', extra_substs={
             'MOZ_DEBUG_SYMBOLS': '1',
             'MOZ_DEBUG_LDFLAGS': ['-framework ExceptionHandling'],
         })