Author vstinner
Recipients vstinner
Date 2018-12-18.21:03:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1545167009.74.0.788709270274.issue35499@psf.upfronthosting.co.za>
In-reply-to
Content
Oh wait, "make build_all_generate_profile" and "make profile-opt" have another issue. They modify LDFLAGS, whereas PGO flags seem to be very specific to the compiler, not to the linker.

I reopen the issue.

build_all_generate_profile:
	$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)"

profile-opt: profile-run-stamp
	...
	$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS_NODIST) $(PGO_PROF_USE_FLAG)" LDFLAGS="$(LDFLAGS)"

LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" of "make build_all_generate_profile" looks harmless: passing PGO flags to the linker works since gcc is used as the linker. Except that LDFLAGS is exported and used by distutils, and passing PGO flags to build third party code is not ok: see bpo-35257.

For "make profile-opt", LDFLAGS="$(LDFLAGS)" looks useless.

PGO flags depend on the compiler:

* clang
 
  * PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
  * PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"

* gcc:

 * PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
 * PGO_PROF_USE_FLAG="-fprofile-instr-use=code.profclangd"

* ICC:

  * PGO_PROF_GEN_FLAG="-prof-gen"
  *  PGO_PROF_USE_FLAG="-prof-use"

* Default:

  * PGO_PROF_GEN_FLAG="-fprofile-generate"
  * PGO_PROF_USE_FLAG="-fprofile-use -fprofile-correction"

I don't think that any of these flags should be passed to the LDFLAGS. Passing these flags to CFLAGS should be enough.
History
Date User Action Args
2018-12-18 21:03:29vstinnersetrecipients: + vstinner
2018-12-18 21:03:29vstinnersetmessageid: <1545167009.74.0.788709270274.issue35499@psf.upfronthosting.co.za>
2018-12-18 21:03:29vstinnerlinkissue35499 messages
2018-12-18 21:03:29vstinnercreate