Skip to content

Commit 1751423

Browse files
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 f92c7aa) Co-authored-by: stratakis <[email protected]>
1 parent 12735c1 commit 1751423

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
When building Python with clang and LTO, LTO flags are no longer passed into
2+
CFLAGS to build third-party C extensions through distutils.

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6670,7 +6670,7 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
66706670
LTOFLAGS="$LTOFLAGS -g"
66716671
fi
66726672

6673-
BASECFLAGS="$BASECFLAGS $LTOFLAGS"
6673+
CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
66746674
LDFLAGS="$LDFLAGS $LTOFLAGS"
66756675
fi
66766676

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ if test "$Py_LTO" = 'true' ; then
13941394
LTOFLAGS="$LTOFLAGS -g"
13951395
fi
13961396

1397-
BASECFLAGS="$BASECFLAGS $LTOFLAGS"
1397+
CFLAGS_NODIST="$CFLAGS_NODIST $LTOFLAGS"
13981398
LDFLAGS="$LDFLAGS $LTOFLAGS"
13991399
fi
14001400

0 commit comments

Comments
 (0)