components/python/python35/patches/05-studio-profile.patch
author John Beck <John.Beck@Oracle.COM>
Mon, 06 Feb 2017 13:54:36 -0800
changeset 7648 20e09cf3cfaa
parent 6447 56a2f066191a
permissions -rw-r--r--
25429083 Upgrade Python 3.5 line to 3.5.3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     1
This changes Python's standard profile-guided build target to work with
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     2
Studio instead of gcc.  The unfortunate repetition of options seen below
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     3
is a workaround for build peculiarities and to meet Studio's requirement
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     4
that the profiling options be used at all steps of the build -- not just
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     5
compilation.  As it is Solaris-specific, it is not suitable for upstream.
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
     6
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
     7
--- Python-3.5.3/Makefile.pre.in.~2~	2017-01-17 11:10:49.856824159 +0000
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
     8
+++ Python-3.5.3/Makefile.pre.in	2017-01-17 11:10:49.919768587 +0000
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
     9
@@ -242,7 +242,7 @@
6447
56a2f066191a 23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents: 5184
diff changeset
    10
 # The task to run while instrumented when building the profile-opt target.
56a2f066191a 23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents: 5184
diff changeset
    11
 # We exclude unittests with -x that take a rediculious amount of time to
56a2f066191a 23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents: 5184
diff changeset
    12
 # run in the instrumented training build or do not provide much value.
56a2f066191a 23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents: 5184
diff changeset
    13
-PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing_fork test_multiprocessing_forkserver test_multiprocessing_main_handling test_multiprocessing_spawn test_subprocess
5184
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    14
+PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    15
 
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    16
 # report files for gcov / lcov coverage report
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    17
 COVERAGE_INFO=	$(abs_builddir)/coverage.info
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    18
@@ -513,24 +513,33 @@
5184
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    19
 	$(MAKE) profile-removal
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    20
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    21
 build_all_generate_profile:
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    22
-	$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)"
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    23
+	$(MAKE) @DEF_MAKE_RULE@ CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    24
+	    CFLAGS_NODIST="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    25
+	    LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    26
+	    BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    27
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    28
 run_profile_task:
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    29
 	: # FIXME: can't run for a cross build
5184
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    30
-	$(LLVM_PROF_FILE) $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK) || true
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    31
+	LD_LIBRARY_PATH=. $(RUNSHARED) ./$(BUILDPYTHON) $(PROFILE_TASK)
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    32
 
5184
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    33
 build_all_merge_profile:
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    34
 	$(LLVM_PROF_MERGER)
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    35
 
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    36
 build_all_use_profile:
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    37
-	$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@"
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    38
+	$(MAKE) @DEF_MAKE_RULE@ CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    39
+	    CFLAGS_NODIST="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    40
+	    LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    41
+	    BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    42
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    43
 # Compile and run with gcov
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    44
 .PHONY=coverage coverage-lcov coverage-report
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    45
 coverage:
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    46
 	@echo "Building with support for coverage checking:"
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    47
 	$(MAKE) clean profile-removal
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    48
-	$(MAKE) @DEF_MAKE_RULE@ CFLAGS="$(CFLAGS) -O0 -pg -fprofile-arcs -ftest-coverage" LIBS="$(LIBS) -lgcov"
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    49
+	$(MAKE) @DEF_MAKE_RULE@ CC="$(CC) -xprofile=tcov" \
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    50
+	    CFLAGS="$(CFLAGS) -xO1 -xprofile=tcov" \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    51
+	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    52
+	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    53
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    54
 coverage-lcov:
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    55
 	@echo "Creating Coverage HTML report with LCOV:"
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    56
@@ -606,13 +615,9 @@
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    57
 # -s, --silent or --quiet is always the first char.
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    58
 # Under BSD make, MAKEFLAGS might be " -s -v x=y".
6447
56a2f066191a 23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents: 5184
diff changeset
    59
 sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    60
-	@case "$$MAKEFLAGS" in \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    61
-	    *\ -s*|s*) quiet="-q";; \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    62
-	    *) quiet="";; \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    63
-	esac; \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    64
 	$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    65
 		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    66
-		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    67
+		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py build
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    68
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    69
 # Build static library
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    70
 # avoid long command lines, same as LIBRARY_OBJS
7648
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    71
@@ -1656,9 +1661,7 @@
20e09cf3cfaa 25429083 Upgrade Python 3.5 line to 3.5.3
John Beck <John.Beck@Oracle.COM>
parents: 6447
diff changeset
    72
 	-find build -type f -a ! -name '*.gc??' -exec rm -f {} ';'
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    73
 
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    74
 profile-removal:
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    75
-	find . -name '*.gc??' -exec rm -f {} ';'
5184
6c2a9525f3a4 22332010 upgrade Python to 3.5.1
John Beck <John.Beck@Oracle.COM>
parents: 4912
diff changeset
    76
-	find . -name '*.profclang?' -exec rm -f {} ';'
6447
56a2f066191a 23858083 Upgrade Python to 3.5.2
John Beck <John.Beck@Oracle.COM>
parents: 5184
diff changeset
    77
-	find . -name '*.dyn' -exec rm -f {} ';'
4912
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    78
+	find . -name '*profile' -exec rm -f {} ';'
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    79
 	rm -f $(COVERAGE_INFO)
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    80
 	rm -rf $(COVERAGE_REPORT)
0b79e9575718 PSARC 2015/414 Python 3.5
John Beck <John.Beck@Oracle.COM>
parents:
diff changeset
    81