Skip to content

bpo-31354: Fixing a bug related to LTO only build #3110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ profile-opt:
$(MAKE) profile-removal

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

run_profile_task:
@ # FIXME: can't run for a cross build
Expand All @@ -474,7 +474,7 @@ build_all_merge_profile:
$(LLVM_PROF_MERGER)

build_all_use_profile:
$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@"
$(MAKE) @DEF_MAKE_RULE@ CFLAGS_NODIST="$(CFLAGS) $(PGO_PROF_USE_FLAG)" LDFLAGS="$(LDFLAGS)"

# Compile and run with gcov
.PHONY=coverage coverage-lcov coverage-report
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow --with-lto to be used on all builds, not just `make profile-opt`.
8 changes: 4 additions & 4 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,6 @@ LLVM_PROF_FILE
LLVM_PROF_MERGER
PGO_PROF_USE_FLAG
PGO_PROF_GEN_FLAG
LTOFLAGS
DEF_MAKE_RULE
DEF_MAKE_ALL_RULE
ABIFLAGS
Expand Down Expand Up @@ -1516,8 +1515,8 @@ Optional Packages:
--with-suffix=.exe set executable suffix
--with-pydebug build with Py_DEBUG defined
--with-assertions build with C assertions enabled
--with-lto Enable Link Time Optimization in PGO builds.
Disabled by default.
--with-lto Enable Link Time Optimization in any build. Disabled
by default.
--with-hash-algorithm=[fnv|siphash24]
select hash algorithm
--with-address-sanitizer
Expand Down Expand Up @@ -6546,7 +6545,6 @@ else
fi

# Enable LTO flags

{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-lto" >&5
$as_echo_n "checking for --with-lto... " >&6; }

Expand Down Expand Up @@ -6592,6 +6590,8 @@ if test "$Py_LTO" = 'true' ; then
esac
;;
esac
CFLAGS="$CFLAGS $LTOFLAGS"
LDFLAGS="$LDFLAGS $LTOFLAGS"
fi

# Enable PGO flags.
Expand Down
5 changes: 3 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1305,9 +1305,8 @@ else
fi

# Enable LTO flags
AC_SUBST(LTOFLAGS)
AC_MSG_CHECKING(for --with-lto)
AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]),
AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in any build. Disabled by default.]),
[
if test "$withval" != no
then
Expand Down Expand Up @@ -1342,6 +1341,8 @@ if test "$Py_LTO" = 'true' ; then
esac
;;
esac
CFLAGS="$CFLAGS $LTOFLAGS"
LDFLAGS="$LDFLAGS $LTOFLAGS"
fi

# Enable PGO flags.
Expand Down