STINNER Victor <vstin...@redhat.com> added the comment:

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.

----------
resolution: fixed -> 
status: closed -> open

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35499>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to