Bug 1429875 - Do not land - hacks to preserve object file order draft
authorChris Manchester <cmanchester@mozilla.com>
Mon, 12 Mar 2018 15:26:03 -0700
changeset 766510 9d2add7a4a4a93c78e615194127bbb69eba520b6
parent 766509 4d193eb49bb7a4f9714805ff4247c684f9f688d4
push id102335
push userbmo:cmanchester@mozilla.com
push dateMon, 12 Mar 2018 22:26:14 +0000
bugs1429875
milestone61.0a1
Bug 1429875 - Do not land - hacks to preserve object file order MozReview-Commit-ID: 4HsX97YyKCL
config/rules.mk
python/mozbuild/mozbuild/frontend/emitter.py
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -675,17 +675,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_VAR_SUFFIX)) $(RESFILE) $(LDFLAGS) $(STATIC_LIBS) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS)
+	$(MKSHLIB) $(if $(OBJS),$($@_$(OBJS_VAR_SUFFIX)),) $(RESFILE) $(LDFLAGS) $(if $(OBJS),,$($@_$(OBJS_VAR_SUFFIX))) $(STATIC_LIBS) $(RUST_STATIC_LIB_FOR_SHARED_LIB) $(SHARED_LIBS) $(EXTRA_DSO_LDOPTS) $(MOZ_GLUE_LDFLAGS) $(OS_LIBS)
 	$(call CHECK_BINARY,$@)
 
 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'; \
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -348,18 +348,21 @@ 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,
-                                BaseRustProgram)) and obj.cxx_link:
+        if ((not isinstance(obj, (StaticLibrary, HostLibrary,
+                                  BaseRustProgram)) or
+             # Also link it in if we happen to have a shared lib in this directory
+             # as well (for compatibility w/ recursivemake).
+             context.get('FORCE_SHARED_LIB')) 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)
 
     def _link_library(self, context, obj, variable, path):