components/python/python27/patches/12-studio-profile.patch
changeset 5183 3a048793fc91
parent 3555 76f4672c5e4b
child 6445 0edecb568b2e
equal deleted inserted replaced
5182:78cc8a5782fa 5183:3a048793fc91
     2 Studio instead of gcc.  The unfortunate repetition of options seen below
     2 Studio instead of gcc.  The unfortunate repetition of options seen below
     3 is a workaround for build peculiarities and to meet Studio's requirement
     3 is a workaround for build peculiarities and to meet Studio's requirement
     4 that the profiling options be used at all steps of the build -- not just
     4 that the profiling options be used at all steps of the build -- not just
     5 compilation.  As it is Solaris-specific, it is not suitable for upstream.
     5 compilation.  As it is Solaris-specific, it is not suitable for upstream.
     6 
     6 
     7 --- Python-2.7.9/Makefile.pre.in.~2~	2014-12-11 09:26:43.160400840 -0800
     7 --- Python-2.7.11rc1/Makefile.pre.in.~2~	2015-12-03 14:13:57.531760204 -0800
     8 +++ Python-2.7.9/Makefile.pre.in	2014-12-11 09:26:43.287536256 -0800
     8 +++ Python-2.7.11rc1/Makefile.pre.in	2015-12-03 14:13:57.632627371 -0800
     9 @@ -416,28 +416,37 @@
     9 @@ -209,7 +209,7 @@
    10  profile-opt:
    10  TCLTK_LIBS=	@TCLTK_LIBS@
    11  	@echo "Building with support for profile generation:"
    11  
    12  	$(MAKE) clean
    12  # The task to run while instrument when building the profile-opt target
    13 +	$(MAKE) profile-removal
    13 -PROFILE_TASK=-m test.regrtest --pgo
    14  	$(MAKE) build_all_generate_profile
    14 +PROFILE_TASK=	$(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
    15  	@echo "Running benchmark to generate profile data:"
    15  
    16 -	$(MAKE) profile-removal
    16  # === Definitions added by makesetup ===
    17  	$(MAKE) run_profile_task
    17  
    18  	@echo "Rebuilding with profile guided optimizations:"
    18 @@ -447,22 +447,31 @@
    19  	$(MAKE) clean
    19  	$(MAKE) profile-removal
    20  	$(MAKE) build_all_use_profile
       
    21  
    20  
    22  build_all_generate_profile:
    21  build_all_generate_profile:
    23 -	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
    22 -	$(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)"
    24 +	$(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
    23 +	$(MAKE) all CC="$(CC) -xprofile=collect:$(XPROFILE_DIR)" \
    25 +	    CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
    24 +	    CFLAGS="$(CFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
    26 +	    LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
    25 +	    LDFLAGS="$(LDFLAGS) -xprofile=collect:$(XPROFILE_DIR)" \
    27 +	    BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
    26 +	    BLDSHARED="$(BLDSHARED) -xprofile=collect:$(XPROFILE_DIR)"
    28  
    27  
    29  run_profile_task:
    28  run_profile_task:
    30  	: # FIXME: can't run for a cross build
    29  	: # FIXME: can't run for a cross build
    31 -	./$(BUILDPYTHON) $(PROFILE_TASK)
    30 -	$(LLVM_PROF_FILE) ./$(BUILDPYTHON) $(PROFILE_TASK) || true
    32 +	LD_LIBRARY_PATH=. ./$(BUILDPYTHON) $(PROFILE_TASK)
    31 +	LD_LIBRARY_PATH=. ./$(BUILDPYTHON) $(PROFILE_TASK)
    33  
    32  
       
    33  build_all_merge_profile:
       
    34  	$(LLVM_PROF_MERGER)
       
    35  
    34  build_all_use_profile:
    36  build_all_use_profile:
    35 -	$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-use"
    37 -	$(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG)"
    36 +	$(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
    38 +	$(MAKE) all CC="$(CC) -xprofile=use:$(XPROFILE_DIR)" \
    37 +	    CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
    39 +	    CFLAGS="$(CFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
    38 +	    LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
    40 +	    LDFLAGS="$(LDFLAGS) -xprofile=use:$(XPROFILE_DIR)" \
    39 +	    BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
    41 +	    BLDSHARED="$(BLDSHARED) -xprofile=use:$(XPROFILE_DIR)"
    40  
    42  
    47 +	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
    49 +	    LDFLAGS="$(LDFLAGS) -xprofile=tcov" \
    48 +	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
    50 +	    BLDSHARED="$(BLDSHARED) -xprofile=tcov"
    49  
    51  
    50  
    52  
    51  # Build the interpreter
    53  # Build the interpreter
    52 @@ -1331,7 +1340,7 @@
    54 @@ -1362,8 +1371,7 @@
    53  	-rm -f Lib/lib2to3/*Grammar*.pickle
    55  	-rm -rf build
    54  
    56  
    55  profile-removal:
    57  profile-removal:
    56 -	find . -name '*.gc??' -exec rm -f {} ';'
    58 -	find . -name '*.gc??' -exec rm -f {} ';'
       
    59 -	find . -name '*.profclang?' -exec rm -f {} ';'
    57 +	find . -name '.profile' -exec rm -rf {} ';'
    60 +	find . -name '.profile' -exec rm -rf {} ';'
    58  
    61  
    59  clobber: clean profile-removal
    62  clobber: clean profile-removal
    60  	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
    63  	-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \