Skip to content

Commit d512b29

Browse files
committed
gh-128884: Update BOLT optimization option to prevent crash
1 parent 231311c commit d512b29

3 files changed

Lines changed: 72 additions & 2 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix ``--enable-bolt`` build failures on AArch64 with recent LLVM: pass
2+
``-frame-opt=hot`` only on x86 and link with ``-mno-fix-cortex-a53-843419``
3+
when supported. Patch by Donghee Na.

‎configure‎

Lines changed: 55 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
@@ -2212,6 +2212,13 @@ if test "$Py_BOLT" = 'true' ; then
22122212
CFLAGS_NODIST="$CFLAGS_NODIST -fno-reorder-blocks-and-partition"
22132213
])
22142214

2215+
# BOLT rejects binaries with Cortex-A53 erratum 843419 workaround veneers,
2216+
# see https://github.com/llvm/llvm-project/pull/187955
2217+
# GCC only: Clang neither accepts the flag nor adds the workaround on Linux.
2218+
AX_CHECK_COMPILE_FLAG([-mno-fix-cortex-a53-843419],[
2219+
LDFLAGS_NODIST="$LDFLAGS_NODIST -mno-fix-cortex-a53-843419"
2220+
], [], [-Werror])
2221+
22152222
# These flags are required for bolt to work:
22162223
LDFLAGS_NODIST="$LDFLAGS_NODIST -Wl,--emit-relocs"
22172224

@@ -2288,6 +2295,12 @@ AC_ARG_VAR(
22882295
AC_MSG_CHECKING([BOLT_APPLY_FLAGS])
22892296
if test -z "${BOLT_APPLY_FLAGS}"
22902297
then
2298+
dnl The frame optimizer is only implemented for x86. BOLT 22 and newer
2299+
dnl refuse to run it on other architectures.
2300+
AS_CASE([$host_cpu],
2301+
[x86_64], [bolt_frame_opt_flags="-frame-opt=hot"],
2302+
[bolt_frame_opt_flags=""]
2303+
)
22912304
AS_VAR_SET(
22922305
[BOLT_APPLY_FLAGS],
22932306
[m4_normalize("
@@ -2305,7 +2318,7 @@ then
23052318
-indirect-call-promotion=all
23062319
-dyno-stats
23072320
-use-gnu-stack
2308-
-frame-opt=hot
2321+
${bolt_frame_opt_flags}
23092322
")]
23102323
)
23112324
fi

0 commit comments

Comments
 (0)