--- a/components/python/python35/patches/05-studio-profile.patch Mon Dec 07 13:01:04 2015 -0800
+++ b/components/python/python35/patches/05-studio-profile.patch Mon Dec 07 13:19:23 2015 -0800
@@ -4,23 +4,22 @@
that the profiling options be used at all steps of the build -- not just
compilation. As it is Solaris-specific, it is not suitable for upstream.
---- Python-3.5.0rc2/Makefile.pre.in.~2~ 2015-09-02 11:35:43.321886346 -0700
-+++ Python-3.5.0rc2/Makefile.pre.in 2015-09-02 11:35:43.430843102 -0700
-@@ -488,30 +488,39 @@
- profile-opt:
- @echo "Building with support for profile generation:"
- $(MAKE) clean
-+ $(MAKE) profile-removal
- $(MAKE) build_all_generate_profile
- @echo "Running benchmark to generate profile data:"
-- $(MAKE) profile-removal
- $(MAKE) run_profile_task
- @echo "Rebuilding with profile guided optimizations:"
- $(MAKE) clean
- $(MAKE) build_all_use_profile
+--- Python-3.5.1rc1/Makefile.pre.in.~2~ 2015-12-04 07:50:01.643727127 -0800
++++ Python-3.5.1rc1/Makefile.pre.in 2015-12-04 07:52:18.287953768 -0800
+@@ -238,7 +238,7 @@
+ TCLTK_LIBS= @TCLTK_LIBS@
+
+ # The task to run while instrument when building the profile-opt target
+-PROFILE_TASK=-m test.regrtest --pgo
++PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
+
+ # report files for gcov / lcov coverage report
+ COVERAGE_INFO= $(abs_builddir)/coverage.info
+@@ -509,24 +509,33 @@
+ $(MAKE) profile-removal
build_all_generate_profile:
-- $(MAKE) all CFLAGS_NODIST="$(CFLAGS) -fprofile-generate" LDFLAGS="-fprofile-generate" LIBS="$(LIBS) -lgcov"
+- $(MAKE) all CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)"
+ $(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
+ CFLAGS_NODIST="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
+ LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
@@ -28,11 +27,14 @@
run_profile_task:
: # FIXME: can't run for a cross build
-- $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
+- $(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true
+ LD_LIBRARY_PATH=. $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
+ build_all_merge_profile:
+ $(LLVM_PROF_MERGER)
+
build_all_use_profile:
-- $(MAKE) all CFLAGS_NODIST="$(CFLAGS) -fprofile-use -fprofile-correction"
+- $(MAKE) all CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG)"
+ $(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
+ CFLAGS_NODIST="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
+ LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
@@ -51,7 +53,7 @@
coverage-lcov:
@echo "Creating Coverage HTML report with LCOV:"
-@@ -583,13 +592,9 @@
+@@ -598,13 +607,9 @@
# -s, --silent or --quiet is always the first char.
# Under BSD make, MAKEFLAGS might be " -s -v x=y".
sharedmods: $(BUILDPYTHON) pybuilddir.txt
@@ -66,11 +68,12 @@
# Build static library
# avoid long command lines, same as LIBRARY_OBJS
-@@ -1627,7 +1632,7 @@
- -rm -f Programs/_testembed Programs/_freeze_importlib
+@@ -1643,8 +1648,7 @@
+ -rm -rf build
profile-removal:
- find . -name '*.gc??' -exec rm -f {} ';'
+- find . -name '*.profclang?' -exec rm -f {} ';'
+ find . -name '*profile' -exec rm -f {} ';'
rm -f $(COVERAGE_INFO)
rm -rf $(COVERAGE_REPORT)