Merge pull request #141056 from helsinki-systems/upd/spidermonkey

spidermonkey_*: updates and cleanup
This commit is contained in:
Janne Heß 2021-11-07 11:31:53 +01:00 committed by GitHub
commit 666ab8ab67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 122 additions and 363 deletions

View File

@ -1,342 +0,0 @@
From: Mike Hommey <mh@glandium.org>
Date: Wed, 27 Apr 2011 08:58:01 +0200
Subject: Bug 626035 - Modify the way arm compiler flags are set in configure
---
configure.in | 292 ++++++++++++++++++++++++++++++++-------------------
js/src/configure.in | 284 ++++++++++++++++++++++++++++++++-----------------
2 files changed, 372 insertions(+), 204 deletions(-)
Index: mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in
===================================================================
--- mozjs-1.8.5-1.0.0+dfsg.orig/js/src/configure.in 2012-01-21 15:57:37.507703219 +0100
+++ mozjs-1.8.5-1.0.0+dfsg/js/src/configure.in 2012-01-21 15:58:04.951703302 +0100
@@ -3535,34 +3535,6 @@
AC_CHECK_LIB(socket, socket)
esac
-AC_MSG_CHECKING(for ARM SIMD support in compiler)
-AC_TRY_COMPILE([],
- [asm("uqadd8 r1, r1, r2");],
- result="yes", result="no")
-AC_MSG_RESULT("$result")
-if test "$result" = "yes"; then
- AC_DEFINE(HAVE_ARM_SIMD)
- HAVE_ARM_SIMD=1
-fi
-AC_SUBST(HAVE_ARM_SIMD)
-
-AC_MSG_CHECKING(for ARM NEON support in compiler)
-_SAVE_CFLAGS="$CFLAGS"
-if test "$GNU_CC"; then
- # gcc needs -mfpu=neon to recognize NEON instructions
- CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
-fi
-AC_TRY_COMPILE([],
- [asm("vadd.i8 d0, d0, d0");],
- result="yes", result="no")
-AC_MSG_RESULT("$result")
-if test "$result" = "yes"; then
- AC_DEFINE(HAVE_ARM_NEON)
- HAVE_ARM_NEON=1
-fi
-CFLAGS="$_SAVE_CFLAGS"
-AC_SUBST(HAVE_ARM_NEON)
-
dnl ========================================================
dnl = pthread support
dnl = Start by checking whether the system support pthreads
@@ -4614,13 +4586,11 @@
BUILD_STATIC_LIBS=
ENABLE_TESTS=1
-MOZ_THUMB2=
USE_ARM_KUSER=
case "${target}" in
arm-android-eabi)
USE_ARM_KUSER=1
- MOZ_THUMB2=1
;;
esac
@@ -4666,80 +4636,204 @@
dnl ========================================================
MOZ_ARG_HEADER(Individual module options)
-dnl Setup default CPU arch for arm target
-case "$target_cpu" in
- arm*)
- MOZ_ARM_ARCH=armv7
- ;;
-esac
dnl ========================================================
-dnl = Enable building the Thumb2 instruction set
+dnl = ARM toolchain tweaks
dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(thumb2,
- [ --enable-thumb2 Enable Thumb2 instruction set (implies ARMv7)],
- MOZ_THUMB2=1,
- MOZ_THUMB2=)
-if test -n "$MOZ_THUMB2"; then
- MOZ_ARM_ARCH=armv7
+
+dnl Defaults
+case "${target}" in
+arm-android-eabi)
+ MOZ_THUMB=yes
+ MOZ_ARCH=armv7-a
+ MOZ_FPU=vfp
+ MOZ_FLOAT_ABI=softfp
+ ;;
+arm*-*)
+ if test -n "$MOZ_PLATFORM_MAEMO"; then
+ MOZ_THUMB=no
+ MOZ_ARCH=armv7-a
+ MOZ_FLOAT_ABI=softfp
+ fi
+ if test "$MOZ_PLATFORM_MAEMO" = 6; then
+ MOZ_THUMB=yes
+ fi
+ ;;
+esac
+
+dnl Kept for compatibility with some buildbot mozconfig
+MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
+
+MOZ_ARG_WITH_STRING(thumb,
+[ --with-thumb[[=yes|no|toolchain]]]
+[ Use Thumb instruction set (-mthumb)],
+ if test -z "$GNU_CC"; then
+ AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
+ fi
+ MOZ_THUMB=$withval)
+
+MOZ_ARG_WITH_STRING(thumb-interwork,
+[ --with-thumb-interwork[[=yes|no|toolchain]]
+ Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
+ if test -z "$GNU_CC"; then
+ AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
+ fi
+ MOZ_THUMB_INTERWORK=$withval)
+
+MOZ_ARG_WITH_STRING(arch,
+[ --with-arch=[[type|toolchain]]
+ Use specific CPU features (-march=type)],
+ if test -z "$GNU_CC"; then
+ AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
+ fi
+ MOZ_ARCH=$withval)
+
+MOZ_ARG_WITH_STRING(fpu,
+[ --with-fpu=[[type|toolchain]]
+ Use specific FPU type (-mfpu=type)],
+ if test -z "$GNU_CC"; then
+ AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
+ fi
+ MOZ_FPU=$withval)
+
+MOZ_ARG_WITH_STRING(float-abi,
+[ --with-float-abi=[[type|toolchain]]
+ Use specific arm float ABI (-mfloat-abi=type)],
+ if test -z "$GNU_CC"; then
+ AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
+ fi
+ MOZ_FLOAT_ABI=$withval)
+
+MOZ_ARG_WITH_STRING(soft-float,
+[ --with-soft-float[[=yes|no|toolchain]]
+ Use soft float library (-msoft-float)],
+ if test -z "$GNU_CC"; then
+ AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
+ fi
+ MOZ_SOFT_FLOAT=$withval)
+
+case "$MOZ_ARCH" in
+toolchain|"")
+ arch_flag=""
+ ;;
+*)
+ arch_flag="-march=$MOZ_ARCH"
+ ;;
+esac
+
+case "$MOZ_THUMB" in
+yes)
+ MOZ_THUMB2=1
+ thumb_flag="-mthumb"
+ ;;
+no)
+ MOZ_THUMB2=
+ thumb_flag="-marm"
+ ;;
+*)
+ _SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$arch_flag"
+ AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
+ MOZ_THUMB2=1,
+ MOZ_THUMB2=)
+ CFLAGS="$_SAVE_CFLAGS"
+ thumb_flag=""
+ ;;
+esac
+
+if test "$MOZ_THUMB2" = 1; then
+ AC_DEFINE(MOZ_THUMB2)
fi
-dnl ========================================================
-dnl = Enable building for ARM specific CPU features
-dnl ========================================================
-MOZ_ARG_WITH_STRING(cpu-arch,
-[ --with-cpu-arch=arch Use specific arm architecture CPU features, default armv7],
- MOZ_ARM_ARCH=$withval)
+case "$MOZ_THUMB_INTERWORK" in
+yes)
+ thumb_interwork_flag="-mthumb-interwork"
+ ;;
+no)
+ thumb_interwork_flag="-mno-thumb-interwork"
+ ;;
+*) # toolchain
+ thumb_interwork_flag=""
+ ;;
+esac
-if test -n "$MOZ_THUMB2"; then
- case "$target_cpu" in
- arm*)
- if test "$MOZ_ARM_ARCH" != "armv7"; then
- AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
- fi
- if test "$GNU_CC"; then
- AC_DEFINE(MOZ_THUMB2)
- AC_DEFINE(MOZ_ARM_ARCH)
- CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
- CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
- ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
- else
- AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
- fi
+case "$MOZ_FPU" in
+toolchain|"")
+ fpu_flag=""
;;
- *)
- AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
+*)
+ fpu_flag="-mfpu=$MOZ_FPU"
;;
- esac
-elif test "$MOZ_ARM_ARCH" = "armv7"; then
- case "$target_cpu" in
- arm*)
- if test "$GNU_CC"; then
- AC_DEFINE(MOZ_ARM_ARCH)
- CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
- CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
- ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
- else
- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
- fi
+esac
+
+case "$MOZ_FLOAT_ABI" in
+toolchain|"")
+ float_abi_flag=""
;;
- *)
- AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
+*)
+ float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
;;
- esac
-else
- case "$target_cpu" in
- arm*)
- if test "$GNU_CC"; then
- CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
- CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
- ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
- fi
- ;;
- esac
+esac
+
+case "$MOZ_SOFT_FLOAT" in
+yes)
+ soft_float_flag="-msoft-float"
+ ;;
+no)
+ soft_float_flag="-mno-soft-float"
+ ;;
+*) # toolchain
+ soft_float_flag=""
+ ;;
+esac
+
+dnl Use echo to avoid accumulating space characters
+all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
+if test -n "$all_flags"; then
+ _SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$all_flags"
+ AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
+ AC_TRY_COMPILE([],[return 0;],
+ AC_MSG_RESULT([yes]),
+ AC_MSG_ERROR([no]))
+
+ CFLAGS="$_SAVE_CFLAGS $all_flags"
+ CXXFLAGS="$CXXFLAGS $all_flags"
+ ASFLAGS="$ASFLAGS $all_flags"
+ if test -n "$thumb_flag"; then
+ LDFLAGS="$LDFLAGS $thumb_flag"
+ fi
fi
AC_SUBST(MOZ_THUMB2)
-AC_SUBST(MOZ_ARM_ARCH)
+
+if test "$CPU_ARCH" = "arm"; then
+ AC_MSG_CHECKING(for ARM SIMD support in compiler)
+ # We try to link so that this also fails when
+ # building with LTO.
+ AC_TRY_LINK([],
+ [asm("uqadd8 r1, r1, r2");],
+ result="yes", result="no")
+ AC_MSG_RESULT("$result")
+ if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_ARM_SIMD)
+ HAVE_ARM_SIMD=1
+ fi
+
+ AC_MSG_CHECKING(for ARM NEON support in compiler)
+ # We try to link so that this also fails when
+ # building with LTO.
+ AC_TRY_LINK([],
+ [asm(".fpu neon\n vadd.i8 d0, d0, d0");],
+ result="yes", result="no")
+ AC_MSG_RESULT("$result")
+ if test "$result" = "yes"; then
+ AC_DEFINE(HAVE_ARM_NEON)
+ HAVE_ARM_NEON=1
+ fi
+fi # CPU_ARCH = arm
+
+AC_SUBST(HAVE_ARM_SIMD)
+AC_SUBST(HAVE_ARM_NEON)
dnl ========================================================
dnl =
@@ -6147,12 +6241,6 @@
if test "$OS_ARCH" = "OS2"; then
ac_configure_args="$ac_configure_args CFLAGS=-Zomf AR=emxomfar"
fi
- if test -n "$MOZ_THUMB2"; then
- ac_configure_args="$ac_configure_args --enable-thumb2"
- fi
- if test -n "$MOZ_ARM_ARCH"; then
- ac_configure_args="$ac_configure_args --with-cpu-arch=$MOZ_ARM_ARCH"
- fi
# Use a separate cache file for libffi, since it does things differently
# from our configure.

View File

@ -1,19 +0,0 @@
diff --git a/js/src/Makefile.in b/js/src/Makefile.in
index a85e055..92ef441 100644
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -580,14 +580,6 @@ check-valgrind::
$(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build
endif
-# The "find any vanilla new/new[] calls" script is tailored to Linux, so
-# only run it there. That should be enough to catch any such calls that
-# creep in.
-ifeq ($(OS_ARCH),Linux)
-check::
- $(srcdir)/config/find_vanilla_new_calls $(LIBRARY)
-endif
-
ifdef ENABLE_TRACEJIT
ifndef WINCE
JITFLAGS = ,m,j,mj,mjp,am,amj,amjp,amd

View File

@ -7,11 +7,11 @@ let
python3Env = buildPackages.python3.withPackages (p: [p.six]);
in stdenv.mkDerivation rec {
pname = "spidermonkey";
version = "68.10.0";
version = "68.12.0";
src = fetchurl {
url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
sha256 = "0azdinwqjfv2q37gqpxmfvzsk86pvsi6cjaq1310zs26gric5j1f";
sha256 = "1k17pi4zh9hrvkzbw4rzzw879a15hpvwriylp75wl22rl7r2nsdf";
};
patches = [

View File

@ -0,0 +1,119 @@
{ lib, stdenv
, fetchurl
, pkg-config
, perl
, python3
, zip
, buildPackages
, which
, readline
, zlib
, icu69
, cargo
, rustc
, rust-cbindgen
, yasm
, llvmPackages_latest
, nspr
, m4
}:
stdenv.mkDerivation rec {
pname = "spidermonkey";
version = "91.3.0";
src = fetchurl {
url = "mirror://mozilla/firefox/releases/${version}esr/source/firefox-${version}esr.source.tar.xz";
sha256 = "0v79c435vfbhsx7pqyq4jm5rv8iysig69wwqhvys1n0jy54m72qj";
};
outputs = [ "out" "dev" ];
setOutputFlags = false; # Configure script only understands --includedir
nativeBuildInputs = [
cargo
llvmPackages_latest.llvm # for llvm-objdump
perl
pkg-config
python3
rust-cbindgen
rustc
which
yasm # to buid icu? seems weird
zip
m4
];
buildInputs = [
icu69
nspr
readline
zlib
];
preConfigure = ''
export LIBXUL_DIST=$out
export PYTHON="${buildPackages.python3.interpreter}"
export M4=m4
export AWK=awk
export AC_MACRODIR=$PWD/build/autoconf/
pushd js/src
sh ../../build/autoconf/autoconf.sh --localdir=$PWD configure.in > configure
chmod +x configure
popd
# We can't build in js/src/, so create a build dir
mkdir obj
cd obj/
configureScript=../js/src/configure
'';
configureFlags = [
"--with-intl-api"
"--with-system-icu"
"--with-system-nspr"
"--with-system-zlib"
"--enable-optimize"
"--enable-readline"
"--enable-release"
"--enable-shared-js"
"--disable-debug"
"--disable-jemalloc"
"--disable-strip"
"--disable-tests"
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
# Spidermonkey seems to use different host/build terminology for cross
# compilation here.
"--host=${stdenv.buildPlatform.config}"
"--target=${stdenv.hostPlatform.config}"
];
depsBuildBuild = [ buildPackages.stdenv.cc ];
# Remove unnecessary static lib
preFixup = ''
moveToOutput bin/js91-config "$dev"
rm $out/lib/libjs_static.ajs
ln -s $out/bin/js91 $out/bin/js
'';
enableParallelBuilding = true;
postPatch = ''
# This patch is a manually applied fix of
# https://bugzilla.mozilla.org/show_bug.cgi?id=1644600
# Once that bug is fixed, this can be removed.
# This is needed in, for example, `zeroad`.
substituteInPlace js/public/StructuredClone.h \
--replace "class SharedArrayRawBufferRefs {" \
"class JS_PUBLIC_API SharedArrayRawBufferRefs {"
'';
meta = with lib; {
description = "Mozilla's JavaScript engine written in C/C++";
homepage = "https://spidermonkey.dev/";
license = licenses.mpl20;
maintainers = with maintainers; [ lostnet ];
platforms = platforms.linux;
};
}

View File

@ -13607,6 +13607,7 @@ with pkgs;
spidermonkey_68 = callPackage ../development/interpreters/spidermonkey/68.nix { };
spidermonkey_78 = callPackage ../development/interpreters/spidermonkey/78.nix { };
spidermonkey_91 = callPackage ../development/interpreters/spidermonkey/91.nix { };
ssm-agent = callPackage ../applications/networking/cluster/ssm-agent { };
ssm-session-manager-plugin = callPackage ../applications/networking/cluster/ssm-session-manager-plugin { };