Disable YJIT if objcopy command is old

Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
This commit is contained in:
Nobuyoshi Nakada 2023-07-06 21:16:00 +09:00 committed by GitHub
parent 20478cafe1
commit 75f8781c08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-07-06 12:16:19 +00:00
Merged: https://github.com/ruby/ruby/pull/8034

Merged-By: nobu <nobu@ruby-lang.org>
2 changed files with 19 additions and 7 deletions

View File

@ -93,11 +93,10 @@ jobs:
- { name: clang-12, env: { default_cc: clang-12 } } - { name: clang-12, env: { default_cc: clang-12 } }
- { name: clang-11, env: { default_cc: clang-11 } } - { name: clang-11, env: { default_cc: clang-11 } }
- { name: clang-10, env: { default_cc: clang-10 } } - { name: clang-10, env: { default_cc: clang-10 } }
# llvm-objcopy<=9 doesn't have --wildcard. It compiles, but leaves Rust symbols in libyjit.o. - { name: clang-9, env: { default_cc: clang-9 } }
- { name: clang-9, env: { default_cc: clang-9, append_configure: '--disable-yjit' } } - { name: clang-8, env: { default_cc: clang-8 } }
- { name: clang-8, env: { default_cc: clang-8, append_configure: '--disable-yjit' } } - { name: clang-7, env: { default_cc: clang-7 } }
- { name: clang-7, env: { default_cc: clang-7, append_configure: '--disable-yjit' } } - { name: clang-6.0, env: { default_cc: clang-6.0 } }
- { name: clang-6.0, env: { default_cc: clang-6.0, append_configure: '--disable-yjit' } }
- name: 'clang-16 LTO' - name: 'clang-16 LTO'
container: clang-16 container: clang-16
env: env:

View File

@ -3790,13 +3790,23 @@ AS_IF([test "$cross_compiling" = no],
) )
) )
dnl Needs newer objcopy in order to localize symbols added by rustc
YJIT_OBJCOPY_OK=no
AS_CASE(["$OBJCOPY"], [""|:], [], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [
AS_IF([$OBJCOPY --wildcard --keep-global-symbol='*main' --localize-symbol='__*' conftest.$OBJEXT 2>/dev/null], [
YJIT_OBJCOPY_OK=yes
])
])
])
dnl build YJIT in release mode if rustc >= 1.58.0 is present and we are on a supported platform dnl build YJIT in release mode if rustc >= 1.58.0 is present and we are on a supported platform
AC_ARG_ENABLE(yjit, AC_ARG_ENABLE(yjit,
AS_HELP_STRING([--enable-yjit], AS_HELP_STRING([--enable-yjit],
[enable in-process JIT compiler that requires Rust build tools. enabled by default on supported platforms if rustc 1.58.0+ is available]), [enable in-process JIT compiler that requires Rust build tools. enabled by default on supported platforms if rustc 1.58.0+ is available]),
[YJIT_SUPPORT=$enableval], [YJIT_SUPPORT=$enableval],
[AS_CASE(["$YJIT_TARGET_OK:$YJIT_RUSTC_OK"], [AS_CASE(["$YJIT_TARGET_OK:$YJIT_RUSTC_OK:$YJIT_OBJCOPY_OK"],
[yes:yes], [ [yes:yes:yes], [
YJIT_SUPPORT=yes YJIT_SUPPORT=yes
], ],
[YJIT_SUPPORT=no] [YJIT_SUPPORT=no]
@ -3811,6 +3821,9 @@ AS_CASE(["${YJIT_SUPPORT}"],
AS_IF([test x"$RUSTC" = "xno"], AS_IF([test x"$RUSTC" = "xno"],
AC_MSG_ERROR([rustc is required. Installation instructions available at https://www.rust-lang.org/tools/install]) AC_MSG_ERROR([rustc is required. Installation instructions available at https://www.rust-lang.org/tools/install])
) )
AS_IF([test x"$YJIT_OBJCOPY_OK" = yno],
AC_MSG_ERROR([$OBJCOPY does not recognize --wildcard option or something])
)
AS_CASE(["${YJIT_SUPPORT}"], AS_CASE(["${YJIT_SUPPORT}"],
[yes], [ [yes], [