bug 1318370 - stop using -Z7 for MSVC compilation with sccache. r=glandium

We've been using -Z7 to make MSVC emit CodeView debug info directly in
the object files instead of in PDB files because sccache can't cache
PDB files if the same one is written to by multiple compiles, which
was previously happening in our build system, and was hard to override
in the NSS build. Now that those are fixed this should work fine.

This adds a bit to the compile rule to remove the PDB file before
compilation, since sccache won't cache a compilation if the PDB file
it is supposed to generate already exists (for the aforementioned reason).

MozReview-Commit-ID: rFlX0XfTGw

--HG--
extra : rebase_source : 8f991ce72115537466f5720c20dc53083f3b2b35
This commit is contained in:
Ted Mielczarek 2016-12-14 14:58:26 -05:00
parent ab52060726
commit 5d759be63f
2 changed files with 12 additions and 5 deletions

View File

@ -131,11 +131,6 @@ else
# Windows builds have a default wrapper that needs to be overridden
mk_add_options "export CC_WRAPPER="
mk_add_options "export CXX_WRAPPER="
# For now, sccache doesn't support separate PDBs so force debug info to be
# in object files.
mk_add_options "export COMPILE_PDB_FLAG="
mk_add_options "export HOST_PDB_FLAG="
mk_add_options "export MOZ_DEBUG_FLAGS=-Z7"
;;
esac
fi

View File

@ -156,6 +156,10 @@ ifndef GNU_CC
COMPILE_PDB_FLAG ?= -Fd$(basename $(@F)).pdb
COMPILE_CFLAGS += $(COMPILE_PDB_FLAG)
COMPILE_CXXFLAGS += $(COMPILE_PDB_FLAG)
ifdef MOZ_USING_SCCACHE
# We remove the PDB file before compilation so that sccache knows it's safe to cache.
RM_PDB_FILE = -$(RM) $(basename $(@F)).pdb
endif
LINK_PDBFILE ?= $(basename $(@F)).pdb
ifdef MOZ_DEBUG
@ -850,23 +854,28 @@ $(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
# Rules for building native targets must come first because of the host_ prefix
$(HOST_COBJS):
$(REPORT_BUILD_VERBOSE)
$(RM_PDB_FILE)
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(HOST_CPPOBJS):
$(REPORT_BUILD_VERBOSE)
$(call BUILDSTATUS,OBJECT_FILE $@)
$(RM_PDB_FILE)
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(HOST_CMOBJS):
$(REPORT_BUILD_VERBOSE)
$(RM_PDB_FILE)
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(HOST_CMMOBJS):
$(REPORT_BUILD_VERBOSE)
$(RM_PDB_FILE)
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
$(COBJS):
$(REPORT_BUILD_VERBOSE)
$(RM_PDB_FILE)
$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
# DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
@ -998,14 +1007,17 @@ $(SOBJS):
$(CPPOBJS):
$(REPORT_BUILD_VERBOSE)
$(call BUILDSTATUS,OBJECT_FILE $@)
$(RM_PDB_FILE)
$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CMMOBJS):
$(REPORT_BUILD_VERBOSE)
$(RM_PDB_FILE)
$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(CMOBJS):
$(REPORT_BUILD_VERBOSE)
$(RM_PDB_FILE)
$(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
$(filter %.s,$(CPPSRCS:%.cpp=%.s)): %.s: %.cpp $(call mkdir_deps,$(MDDEPDIR))