Skip to content

Commit 183de5a

Browse files
committed
Add --enable-cross-run configure option to avoid clearing RUNSHARED on cross-compile
1 parent dc62b62 commit 183de5a

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

Doc/using/configure.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,20 @@ the version of the cross compiled host Python.
12101210

12111211
.. versionadded:: 3.11
12121212

1213+
.. option:: --enable-cross-run
1214+
1215+
Enable running the target CPython binary on the build host during
1216+
cross-compilation.
1217+
1218+
By default, the build system assumes that target binaries cannot be executed
1219+
on the build host when cross-compiling which can disable optimizations such
1220+
as PGO.
1221+
1222+
When `--enable-cross-run` is used, the build system may attempt to execute
1223+
the target binaries, which is appropriate for situations where emulated
1224+
execution is transparently available.
1225+
1226+
.. versionadded:: 3.15
12131227

12141228
Cross compiling example::
12151229

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Add ```--enable-cross-run`` to allow execution of the target binary (e.g.,
2+
for PGO) during cross-compilation.

configure

Lines changed: 28 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1630,8 +1630,21 @@ else # shared is disabled
16301630
fi
16311631
AC_MSG_RESULT([$LDLIBRARY])
16321632

1633+
# Check for --enable-cross-run
1634+
AC_ARG_ENABLE([cross-run],
1635+
[AS_HELP_STRING([--enable-cross-run],
1636+
[allow running target binaries during cross-compilation (for PGO, etc.)])
1637+
AS_HELP_STRING([--disable-cross-run],
1638+
[disable running target binaries during cross-compilation (default)])],
1639+
[],
1640+
[enable_cross_run=no])
1641+
16331642
if test "$cross_compiling" = yes; then
1634-
RUNSHARED=
1643+
AC_MSG_CHECKING([whether to keep RUNSHARED for cross build])
1644+
AS_IF([test "$enable_cross_run" = yes],
1645+
[AC_MSG_RESULT([yes (--enable-cross-run)])],
1646+
[RUNSHARED=
1647+
AC_MSG_RESULT([no])])
16351648
fi
16361649

16371650
# HOSTRUNNER - Program to run CPython for the host platform

0 commit comments

Comments
 (0)