Bug 1231764 - part 0 - only link librul once; r=chmanchester
authorNathan Froyd <froydnj@gmail.com>
Sat, 06 Aug 2016 00:49:26 -0400
changeset 397537 e983e50e47fbe203ccdb3476deed0294a2e56792
parent 397536 c7cb28cfd0b5ae1f79cd6218d1c2a45885f6b218
child 397538 66d5d4c28e8d5b748289bc463a09e58aa31c0533
push id25332
push usermaglione.k@gmail.com
push dateSat, 06 Aug 2016 21:21:51 +0000
Bug 1231764 - part 0 - only link librul once; r=chmanchester Through an oversight, we listed librul.a twice when linking libxul: once as part of the "objects" we were linking, and once as a static library. This duplication is unnecessary and would cause problems later when we try to generate librul.a via cargo, as cargo will put it someplace different from where we expect and the two names will conflict. Let's have rules.mk be the single source of truth for how librul.a is named, and then the code to link libxul can simply refer to that name.
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -238,17 +238,17 @@ SOBJS = $(notdir $(SSRCS:.S=.$(OBJ_SUFFI
 CPPOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(CPPSRCS))))
 CMOBJS = $(notdir $(CMSRCS:.m=.$(OBJ_SUFFIX)))
 CMMOBJS = $(notdir $(CMMSRCS:.mm=.$(OBJ_SUFFIX)))
 # ASFILES can have different extensions (.s, .asm)
 ASOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(ASFILES))))
 RSOBJS = $(addprefix lib,$(notdir $(RSSRCS:.rs=.rlib)))
 RS_STATICLIB_CRATE_OBJ = $(addprefix lib,$(notdir $(RS_STATICLIB_CRATE_SRC:.rs=.$(LIB_SUFFIX))))
 ifndef OBJS
 OBJS = $(strip $(_OBJS))
 HOST_COBJS = $(addprefix host_,$(notdir $(HOST_CSRCS:.c=.$(OBJ_SUFFIX))))
 # HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
 HOST_CPPOBJS = $(addprefix host_,$(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(HOST_CPPSRCS)))))
 HOST_CMOBJS = $(addprefix host_,$(notdir $(HOST_CMSRCS:.m=.$(OBJ_SUFFIX))))
 HOST_CMMOBJS = $(addprefix host_,$(notdir $(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX))))
--- a/python/mozbuild/mozbuild/backend/recursivemake.py
+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
@@ -1241,17 +1241,17 @@ class RecursiveMakeBackend(CommonBackend
                                    % (relpath, lib.import_name))
         # We have to link the Rust super-crate after all intermediate static
         # libraries have been listed to ensure that the Rust objects are
         # searched after the C/C++ objects that might reference Rust symbols.
         # Building the Rust super-crate will take care of Rust->Rust linkage.
         if isinstance(obj, SharedLibrary) and any(isinstance(o, RustRlibLibrary)
                                                   for o in obj.linked_libraries):
-            backend_file.write('STATIC_LIBS += librul.$(LIB_SUFFIX)\n')
+            backend_file.write('STATIC_LIBS += $(RS_STATICLIB_CRATE_OBJ)\n')
         for lib in obj.linked_system_libs:
             if obj.KIND == 'target':
                 backend_file.write_once('OS_LIBS += %s\n' % lib)
                 backend_file.write_once('HOST_EXTRA_LIBS += %s\n' % lib)
         # Process library-based defines