bpo-44340: Add support for building with clang thin lto via --with-lto=thin by holmanb · Pull Request #26585 · python/cpython · GitHub
Skip to content
Closed
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
33 changes: 20 additions & 13 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1545,7 +1545,7 @@ Optional Packages:
--with-trace-refs enable tracing references for debugging purpose
(default is no)
--with-assertions build with C assertions enabled (default is no)
--with-lto enable Link-Time-Optimization in any build (default
--with-lto[=no|thin] enable Link-Time-Optimization in any build (default

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

--with-lto[=full|thin] enable Link-Time-Optimization in any build (default is full)

is no)

@corona10 corona10 Jul 18, 2021

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@holmanb

the current no means that whether we apply LTO or not.
So the configure should be updated if we also provide the thin LTO option.

Following options should be available.
A. no LTO (by default) ./configure
B. with LTO (default=full) ./configure --with-lto
C. with LTO (full LTO designated) ./configure --with-lto=full
D. with LTO (thin LTO designated) ./configure --with-lto=thin

--with-hash-algorithm=[fnv|siphash24]
select hash algorithm for use in Python/pyhash.c
Expand Down Expand Up @@ -6585,16 +6585,23 @@ $as_echo_n "checking for --with-lto... " >&6; }
# Check whether --with-lto was given.
if test "${with_lto+set}" = set; then :
withval=$with_lto;
if test "$withval" != no
then
Py_LTO='true'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; };
else
Py_LTO='false'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
LTO_ARG=''
if test "$withval" = no
then
Py_LTO='false'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; };
fi
elif test "$withval" = yes
then
Py_LTO='true'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; };
else
Py_LTO='true'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"$withval\"" >&5
$as_echo "\"$withval\"" >&6; };
LTO_ARG="=$withval"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
Expand Down Expand Up @@ -6732,11 +6739,11 @@ $as_echo "$as_me: llvm-ar found via xcrun: ${LLVM_AR}" >&6;}
case $ac_sys_system in
Darwin*)
# Any changes made here should be reflected in the GCC+Darwin case below
LTOFLAGS="-flto -Wl,-export_dynamic"
LTOCFLAGS="-flto"
LTOFLAGS="-flto$LTO_ARG -Wl,-export_dynamic"
LTOCFLAGS="-flto$LTO_ARG"
;;
*)
LTOFLAGS="-flto"
LTOFLAGS="-flto$LTO_ARG"
;;
esac
;;
Expand Down
31 changes: 19 additions & 12 deletions configure.ac