[PATCH 3/3] Support the PGO build for binutils+gdb
authorMatthias Klose <doko@debian.org>
Wed, 6 Jan 2021 10:57:25 +0000 (10:57 +0000)
committerMatthias Klose <doko@debian.org>
Wed, 6 Jan 2021 10:57:25 +0000 (10:57 +0000)
commit9ac9f900b2df5e5d6d22cf8f519b5c1f20ae5f36
treec9e2648b8c8838bd0315a5bc9d48b66a98424be1
parentc18205d09997703cbaef0a9447206b5078238696
[PATCH 3/3] Support the PGO build for binutils+gdb

Add the --enable-pgo-build[=lto] configure option.  When binutils+gdb
is not built together with GCC, --enable-pgo-build enables the PGO build:

1. First build with -fprofile-generate.
2. Use "make maybe-check-*" to generate profiling data.
3. Use "make clean" to remove the previous build.
4. Rebuild with -fprofile-use.

With --enable-pgo-build=lto, -flto=jobserver is used together with
-fprofile-generate and -fprofile-use.  Add '+' to the command line for
recursive make to support -flto=jobserver.

NB: --enable-pgo-build=lto enables the PGO build with LTO while
--enable-lto enables LTO support in toolchain.

PR binutils/26766
* Makefile.tpl (BUILD_CFLAGS): New.
(CFLAGS): Append $(BUILD_CFLAGS).
(CXXFLAGS): Likewise.
(PGO_BUILD_GEN_FLAGS_TO_PASS): New.
(PGO_BUILD_TRAINING_CFLAGS): Likewise.
(PGO_BUILD_TRAINING_CXXFLAGS): Likewise.
(PGO_BUILD_TRAINING_FLAGS_TO_PASS): Likewise.
(PGO_BUILD_USE_FLAGS_TO_PASS): Likewise.
(PGO-TRAINING-TARGETS): Likewise.
(PGO_BUILD_TRAINING): Likewise.
(all): Add '+' to the command line for recursive make.  Support
the PGO build.
* configure.ac: Add --enable-pgo-build[=lto].
AC_SUBST PGO_BUILD_GEN_CFLAGS, PGO_BUILD_USE_CFLAGS and
PGO_BUILD_LTO_CFLAGS.  Enable the PGO build in Makefile.
* Makefile.in: Regenerated.
* configure: Likewise.

Gbp-Pq: Name pgo+lto-3.diff
Makefile.in
Makefile.tpl
configure
configure.ac