gh-101060: conditionally add `-fno-reorder-blocks-and-partition` (gh-101061)

This commit is contained in:
Gregory Szorc 2023-01-24 01:34:44 -08:00 committed by GitHub
parent 7f95ec3e74
commit 7589d713a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,3 @@
Conditionally add ``-fno-reorder-blocks-and-partition`` in configure.
Effectively fixes ``--enable-bolt`` when using Clang, as this appears to be
a GCC-only flag.

41
configure generated vendored
View File

@ -7914,8 +7914,47 @@ if test "$Py_BOLT" = 'true' ; then
DEF_MAKE_ALL_RULE="bolt-opt"
DEF_MAKE_RULE="build_all"
# These flags are required for bolt to work:
# -fno-reorder-blocks-and-partition is required for bolt to work.
# Possibly GCC only.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fno-reorder-blocks-and-partition" >&5
$as_echo_n "checking whether C compiler accepts -fno-reorder-blocks-and-partition... " >&6; }
if ${ax_cv_check_cflags___fno_reorder_blocks_and_partition+:} false; then :
$as_echo_n "(cached) " >&6
else
ax_check_save_flags=$CFLAGS
CFLAGS="$CFLAGS -fno-reorder-blocks-and-partition"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ax_cv_check_cflags___fno_reorder_blocks_and_partition=yes
else
ax_cv_check_cflags___fno_reorder_blocks_and_partition=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$ax_check_save_flags
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fno_reorder_blocks_and_partition" >&5
$as_echo "$ax_cv_check_cflags___fno_reorder_blocks_and_partition" >&6; }
if test "x$ax_cv_check_cflags___fno_reorder_blocks_and_partition" = xyes; then :
CFLAGS_NODIST="$CFLAGS_NODIST -fno-reorder-blocks-and-partition"
else
:
fi
# These flags are required for bolt to work:
LDFLAGS_NODIST="$LDFLAGS_NODIST -Wl,--emit-relocs"
# These flags are required to get good performance from bolt:

View File

@ -1939,8 +1939,13 @@ if test "$Py_BOLT" = 'true' ; then
DEF_MAKE_ALL_RULE="bolt-opt"
DEF_MAKE_RULE="build_all"
# These flags are required for bolt to work:
# -fno-reorder-blocks-and-partition is required for bolt to work.
# Possibly GCC only.
AX_CHECK_COMPILE_FLAG([-fno-reorder-blocks-and-partition],[
CFLAGS_NODIST="$CFLAGS_NODIST -fno-reorder-blocks-and-partition"
])
# These flags are required for bolt to work:
LDFLAGS_NODIST="$LDFLAGS_NODIST -Wl,--emit-relocs"
# These flags are required to get good performance from bolt: