diff options
author | ted.mielczarek%gmail.com <devnull@localhost> | 2011-05-03 18:59:07 +0000 |
---|---|---|
committer | ted.mielczarek%gmail.com <devnull@localhost> | 2011-05-03 18:59:07 +0000 |
commit | a3523a20955df09395629023a097b466a59bf97d (patch) | |
tree | 43638e71dbe32731e86bd21e1942967e9f14f8ac /config | |
parent | bdead222b8396c0ef04be8fe970e7e2c597c8c72 (diff) | |
download | nspr-hg-a3523a20955df09395629023a097b466a59bf97d.tar.gz |
bug 564851 - Add support for MSVC PGO. Patch by Tetsuro Kato <tete009+bugzilla@gmail.com>, r=wtcNSPR_HEAD_20110503
Diffstat (limited to 'config')
-rw-r--r-- | config/config.mk | 2 | ||||
-rw-r--r-- | config/rules.mk | 37 |
2 files changed, 39 insertions, 0 deletions
diff --git a/config/config.mk b/config/config.mk index f47d8fee..cfb9f3f2 100644 --- a/config/config.mk +++ b/config/config.mk @@ -78,11 +78,13 @@ LDFLAGS = $(OS_LDFLAGS) ifdef MOZ_PROFILE_GENERATE CFLAGS += $(PROFILE_GEN_CFLAGS) LDFLAGS += $(PROFILE_GEN_LDFLAGS) +DLLFLAGS += $(PROFILE_GEN_LDFLAGS) endif # MOZ_PROFILE_GENERATE ifdef MOZ_PROFILE_USE CFLAGS += $(PROFILE_USE_CFLAGS) LDFLAGS += $(PROFILE_USE_LDFLAGS) +DLLFLAGS += $(PROFILE_USE_LDFLAGS) endif # MOZ_PROFILE_USE define MAKE_OBJDIR diff --git a/config/rules.mk b/config/rules.mk index 344ad2e5..a8ee1954 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -280,6 +280,13 @@ $(NFSPWD): $(PROGRAM): $(OBJS) @$(MAKE_OBJDIR) ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) +ifdef MOZ_PROFILE_USE +# In the second pass, we need to merge the pgc files into the pgd file. +# The compiler would do this for us automatically if they were in the right +# place, but they're in dist/bin. + python $(topsrcdir)/build/win32/pgomerge.py \ + $(notdir $(PROGRAM:.exe=)) $(DIST)/bin +endif # MOZ_PROFILE_USE $(CC) $(OBJS) -Fe$@ -link $(LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) ifdef MT @if test -f $@.manifest; then \ @@ -287,6 +294,11 @@ ifdef MT rm -f $@.manifest; \ fi endif # MSVC with manifest tool +ifdef MOZ_PROFILE_GENERATE +# touch it a few seconds into the future to work around FAT's +# 2-second granularity + touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink +endif # MOZ_PROFILE_GENERATE else # WINNT && !GCC $(CC) -o $@ $(CFLAGS) $(OBJS) $(LDFLAGS) endif # WINNT && !GCC @@ -326,6 +338,10 @@ ifeq ($(OS_ARCH)$(OS_RELEASE), AIX4.1) -bM:SRE -bnoentry $(OS_LIBS) $(EXTRA_LIBS) else # AIX 4.1 ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) +ifdef MOZ_PROFILE_USE + python $(topsrcdir)/build/win32/pgomerge.py \ + $(notdir $(SHARED_LIBRARY:.$(DLL_SUFFIX)=)) $(DIST)/bin +endif # MOZ_PROFILE_USE $(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES) ifdef MT @if test -f $@.manifest; then \ @@ -333,6 +349,9 @@ ifdef MT rm -f $@.manifest; \ fi endif # MSVC with manifest tool +ifdef MOZ_PROFILE_GENERATE + touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink +endif # MOZ_PROFILE_GENERATE else # WINNT && !GCC $(MKSHLIB) $(OBJS) $(RES) $(LDFLAGS) $(EXTRA_LIBS) endif # WINNT && !GCC @@ -341,6 +360,24 @@ ifdef ENABLE_STRIP $(STRIP) $@ endif +################################################################################ + +ifdef MOZ_PROFILE_USE +ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT) +# When building with PGO, we have to make sure to re-link +# in the MOZ_PROFILE_USE phase if we linked in the +# MOZ_PROFILE_GENERATE phase. We'll touch this pgo.relink +# file in the link rule in the GENERATE phase to indicate +# that we need a relink. +$(SHARED_LIBRARY): pgo.relink + +$(PROGRAM): pgo.relink + +endif # WINNT && !GCC +endif # MOZ_PROFILE_USE + +################################################################################ + ifeq ($(OS_ARCH),WINNT) $(RES): $(RESNAME) @$(MAKE_OBJDIR) |