--- a/components/python/python27/patches/12-studio-profile.patch Tue Jul 19 15:22:15 2016 +0200
+++ b/components/python/python27/patches/12-studio-profile.patch Thu Jul 21 12:51:35 2016 -0700
@@ -4,26 +4,26 @@
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-2.7.11rc1/Makefile.pre.in.~2~ 2015-12-03 14:13:57.531760204 -0800
-+++ Python-2.7.11rc1/Makefile.pre.in 2015-12-03 14:13:57.632627371 -0800
-@@ -209,7 +209,7 @@
- TCLTK_LIBS= @TCLTK_LIBS@
-
+--- Python-2.7.12/Makefile.pre.in.~2~ 2016-07-07 13:54:04.997344705 -0700
++++ Python-2.7.12/Makefile.pre.in 2016-07-07 14:06:13.325835947 -0700
+@@ -212,7 +212,7 @@
# 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
+ # We exclude unittests with -x that take a rediculious amount of time to
+ # run in the instrumented training build or do not provide much value.
+-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess
++PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
- # === Definitions added by makesetup ===
-
-@@ -447,22 +447,31 @@
+ # report files for gcov / lcov coverage report
+ COVERAGE_INFO= $(abs_builddir)/coverage.info
+@@ -455,24 +455,33 @@
$(MAKE) profile-removal
build_all_generate_profile:
-- $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)"
+- $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)"
+ $(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
-+ CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
-+ LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
-+ BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
++ CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
++ LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
++ BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
run_profile_task:
: # FIXME: can't run for a cross build
@@ -34,30 +34,33 @@
$(LLVM_PROF_MERGER)
build_all_use_profile:
-- $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG)"
+- $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@"
+ $(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
-+ CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
-+ LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
-+ BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
++ CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
++ LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
++ BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
+ # Compile and run with gcov
+ .PHONY=coverage coverage-lcov coverage-report
coverage:
@echo "Building with support for coverage checking:"
- $(MAKE) clean
+ $(MAKE) clean profile-removal
- $(MAKE) all CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
+ $(MAKE) all CC="$(CC) -xprofile=tcov" \
-+ CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
-+ LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
-+ BLDSHARED="$(BLDSHARED) -xprofile=tcov"
++ CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
++ LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
++ BLDSHARED="$(BLDSHARED) -xprofile=tcov"
-
- # Build the interpreter
-@@ -1362,8 +1371,7 @@
+ coverage-lcov:
+ @echo "Creating Coverage HTML report with LCOV:"
+@@ -1422,9 +1431,7 @@
-rm -rf build
profile-removal:
- find . -name '*.gc??' -exec rm -f {} ';'
- find . -name '*.profclang?' -exec rm -f {} ';'
-+ find . -name '.profile' -exec rm -rf {} ';'
+- find . -name '*.dyn' -exec rm -f {} ';'
++ find . -name '.profile' -exec rm -f {} ';'
clobber: clean profile-removal
-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \