-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
bpo-35351: Pass link time optimization flags to CFLAGS_NODIST. #10797
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
Conversation
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.
@@ -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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LDFLAGS are not forwarded like BASECFLAGS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They actually are, this PR fixes the issue partially. In order to separate the LDFLAGS as well I plan to introduce LDFLAGS_NODIST, on a different PR if that one is merged, but it will require bigger scoping.
ok, makes sense. I'll run an lto based build with clang this morning to confirm it's still valid.
|
@stratakis build works fine on my config with lto + clang |
Please add a NEWS entry in the Build category. Say something like "When building Python with clang and LTO, LTO flags are no longer passed into CFLAGS to build third-party C extensions." |
I tested manually the change:
Output without the change:
I confirm that "-flto" is gone from "./python-config --cflags" output. |
Thanks @stratakis for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7. |
GH-10893 is a backport of this pull request to the 3.7 branch. |
…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 f92c7aa) Co-authored-by: stratakis <[email protected]>
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 f92c7aa) Co-authored-by: stratakis <[email protected]>
Thanks @stratakis for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6. |
…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 f92c7aa) Co-authored-by: stratakis <[email protected]>
GH-11046 is a backport of this pull request to the 3.6 branch. |
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 f92c7aa) Co-authored-by: stratakis <[email protected]>
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.
https://bugs.python.org/issue35351