summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS.d/next/Build/2023-01-15-11-22-15.gh-issue-101060.0mYk9E.rst3
-rwxr-xr-xconfigure41
-rw-r--r--configure.ac7
3 files changed, 49 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Build/2023-01-15-11-22-15.gh-issue-101060.0mYk9E.rst b/Misc/NEWS.d/next/Build/2023-01-15-11-22-15.gh-issue-101060.0mYk9E.rst
new file mode 100644
index 0000000..bebbf8c
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2023-01-15-11-22-15.gh-issue-101060.0mYk9E.rst
@@ -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.
diff --git a/configure b/configure
index e4ec5c4..709913d 100755
--- a/configure
+++ b/configure
@@ -7914,8 +7914,47 @@ if test "$Py_BOLT" = 'true' ; then
DEF_MAKE_ALL_RULE="bolt-opt"
DEF_MAKE_RULE="build_all"
+ # -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:
- CFLAGS_NODIST="$CFLAGS_NODIST -fno-reorder-blocks-and-partition"
LDFLAGS_NODIST="$LDFLAGS_NODIST -Wl,--emit-relocs"
# These flags are required to get good performance from bolt:
diff --git a/configure.ac b/configure.ac
index 1541205..12249b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1939,8 +1939,13 @@ if test "$Py_BOLT" = 'true' ; then
DEF_MAKE_ALL_RULE="bolt-opt"
DEF_MAKE_RULE="build_all"
+ # -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:
- CFLAGS_NODIST="$CFLAGS_NODIST -fno-reorder-blocks-and-partition"
LDFLAGS_NODIST="$LDFLAGS_NODIST -Wl,--emit-relocs"
# These flags are required to get good performance from bolt: