Bug 1475278 - Link a HostRustLibrary to a HostProgram where necessary in the Tup backend. draft
authorChris Manchester <cmanchester@mozilla.com>
Thu, 12 Jul 2018 16:31:54 -0700
changeset 817584 600cba485c89c16b0c0f1f4cff965c12c08818e0
parent 817583 96c61b1dd0a1ecbc37fd4e257ff0bdff6f56df8b
push id116119
push userbmo:cmanchester@mozilla.com
push dateFri, 13 Jul 2018 00:16:13 +0000
bugs1475278
milestone63.0a1
Bug 1475278 - Link a HostRustLibrary to a HostProgram where necessary in the Tup backend. MozReview-Commit-ID: qghHI02Bfs
python/mozbuild/mozbuild/backend/tup.py
toolkit/crashreporter/google-breakpad/src/common/moz.build
--- a/python/mozbuild/mozbuild/backend/tup.py
+++ b/python/mozbuild/mozbuild/backend/tup.py
@@ -39,16 +39,17 @@ from ..frontend.data import (
     HostDefines,
     HostSources,
     JARManifest,
     ObjdirFiles,
     PerSourceFlag,
     Program,
     SimpleProgram,
     HostLibrary,
+    HostRustLibrary,
     HostProgram,
     HostSimpleProgram,
     RustLibrary,
     SharedLibrary,
     Sources,
     StaticLibrary,
     VariablePassthru,
 )
@@ -479,36 +480,43 @@ class TupBackend(CommonBackend):
         _, _, _, _, extra_libs, _ = self._expand_libs(prog)
         objs = prog.objs
 
         if isinstance(prog, HostSimpleProgram):
             outputs = [prog.name]
         else:
             outputs = [mozpath.relpath(prog.output_path.full_path,
                                        backend_file.objdir)]
-        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)
+        host_libs = self._lib_paths(backend_file.objdir,
+                                    (lib for lib in prog.linked_libraries
+                                     if isinstance(lib, HostLibrary)))
+        inputs = objs + host_libs
 
-        inputs = objs + host_libs
+        rust_linked = self._lib_paths(backend_file.objdir,
+                                      (lib for lib in prog.linked_libraries
+                                       if isinstance(lib, HostRustLibrary)))
+        extra_inputs = []
+        if rust_linked:
+            extra_inputs += [self._rust_libs]
+            host_libs += rust_linked
+
         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,
+            extra_inputs=extra_inputs,
             outputs=outputs,
             display='LINK %o'
         )
 
 
     def _gen_static_library(self, backend_file):
         ar = [
             backend_file.environment.substs['AR'],
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -47,19 +47,17 @@ if CONFIG['OS_ARCH'] != 'WINNT':
     if CONFIG['OS_ARCH'] == 'Darwin':
         HOST_CXXFLAGS += [
             '-stdlib=libc++',
         ]
     HOST_CXXFLAGS += [
         '-O2',
         '-g',
     ]
-    # The tup build doesn't currently link this properly: bug 1475278
-    if 'Tup' not in CONFIG['BUILD_BACKENDS']:
-        HOST_DEFINES['HAVE_RUST_DEMANGLE'] = True
+    HOST_DEFINES['HAVE_RUST_DEMANGLE'] = True
     LOCAL_INCLUDES += [
         '/toolkit/crashreporter/rust',
     ]
     HostLibrary('host_breakpad_common_s')
 
 if CONFIG['OS_TARGET'] == 'Android':
     # We don't support unifying assembly files.
     SOURCES += [