Skip to content

Commit

Permalink
Bug 1641674 - Don't use --gc-sections during profile generation r=fro…
Browse files Browse the repository at this point in the history
…ydnj

For not-well-understood reasons, ld's `--gc-sections` discards a large number of the PGO bookkeeping structures that enable us to keep track of function counters, and the effect gets worse in object files generated by clang-10.

As much as I'd like to understand this better, the investigations take way too much time. As a path of least resistance, we can disable `--gc-sections` for the instrumentation phase of PGO builds. It won't harm anything since users never see those builds, and it will improve the performance of the optimized phase greatly.

Differential Revision: https://phabricator.services.mozilla.com/D78112
  • Loading branch information
David Major committed Aug 28, 2020
1 parent 16b168d commit 1b886df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build/autoconf/compiler-opts.m4
Expand Up @@ -109,7 +109,7 @@ dnl ========================================================
dnl = Automatically remove dead symbols
dnl ========================================================
if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$DEVELOPER_OPTIONS"; then
if test "$GNU_CC" -a "$GCC_USE_GNU_LD" -a -z "$DEVELOPER_OPTIONS" -a -z "$MOZ_PROFILE_GENERATE"; then
if test -n "$MOZ_DEBUG_FLAGS"; then
dnl See bug 670659
AC_CACHE_CHECK([whether removing dead symbols breaks debugging],
Expand Down
3 changes: 3 additions & 0 deletions build/moz.configure/lto-pgo.configure
Expand Up @@ -25,6 +25,9 @@ set_config('MOZ_PROFILE_GENERATE',
set_define('MOZ_PROFILE_GENERATE',
depends_if('--enable-profile-generate')(lambda _: True))

add_old_configure_assignment('MOZ_PROFILE_GENERATE', 1,
when='--enable-profile-generate')

js_option('--enable-profile-use',
env='MOZ_PROFILE_USE',
nargs='?',
Expand Down

0 comments on commit 1b886df

Please sign in to comment.