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.
(cherry picked from commit f92c7aa1ae)

Co-authored-by: stratakis <cstratak@redhat.com>
This commit is contained in:
Miss Islington (bot) 2018-12-04 07:06:16 -08:00 committed by GitHub
parent 12735c1413
commit 1751423686
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

View file

@ -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.

2
configure vendored
View file

@ -6670,7 +6670,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

View file

@ -1394,7 +1394,7 @@ if test "$Py_LTO" = 'true' ; then
LTOFLAGS="$LTOFLAGS -g"
fi
BASECFLAGS="$BASECFLAGS $LTOFLAGS"
CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
LDFLAGS="$LDFLAGS $LTOFLAGS"
fi