From f92c7aa1ae81efa475b5aecf66e4711ef0f52c4c Mon Sep 17 00:00:00 2001 From: stratakis Date: Tue, 4 Dec 2018 15:54:01 +0100 Subject: [PATCH] bpo-35351: Pass link time optimization flags to CFLAGS_NODIST (GH-10797) When using link time optimizations, the -flto flag is passed to BASECFLAGS, which makes it propagate to distutils. Those flags should be reserved for the interpreter and the stdlib extension modules only, thus moving those flags to CFLAGS_NODIST. --- Misc/NEWS.d/next/Build/2018-12-04-15-33-28.bpo-35351.ZhhBfT.rst | 2 ++ configure | 2 +- configure.ac | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2018-12-04-15-33-28.bpo-35351.ZhhBfT.rst diff --git a/Misc/NEWS.d/next/Build/2018-12-04-15-33-28.bpo-35351.ZhhBfT.rst b/Misc/NEWS.d/next/Build/2018-12-04-15-33-28.bpo-35351.ZhhBfT.rst new file mode 100644 index 00000000000..ee6c870b060 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-12-04-15-33-28.bpo-35351.ZhhBfT.rst @@ -0,0 +1,2 @@ +When building Python with clang and LTO, LTO flags are no longer passed into +CFLAGS to build third-party C extensions through distutils. diff --git a/configure b/configure index e9e33b3715d..8d3336387c3 100755 --- a/configure +++ b/configure @@ -6626,7 +6626,7 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;} LTOFLAGS="$LTOFLAGS -g" fi - BASECFLAGS="$BASECFLAGS $LTOFLAGS" + CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS" LDFLAGS="$LDFLAGS $LTOFLAGS" fi diff --git a/configure.ac b/configure.ac index 15d03ba3812..5c1c0219208 100644 --- a/configure.ac +++ b/configure.ac @@ -1357,7 +1357,7 @@ if test "$Py_LTO" = 'true' ; then LTOFLAGS="$LTOFLAGS -g" fi - BASECFLAGS="$BASECFLAGS $LTOFLAGS" + CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS" LDFLAGS="$LDFLAGS $LTOFLAGS" fi