Bug 783950 - Refresh libffi patches. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 29 Aug 2012 08:55:57 +0200
changeset 105777 4c261d9820f653788df6e9eb044fda7ec7e38044
parent 105776 d405d013746d5c16d288228e83e9545b10282f2c
child 105778 40e82036f9ec298374664fe78e540996126f1983
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersted
bugs783950
milestone18.0a1
Bug 783950 - Refresh libffi patches. r=ted
js/src/ctypes/libffi/aclocal.m4
js/src/ctypes/libffi/configure
js/src/ctypes/libffi/configure.ac
js/src/ctypes/patches-libffi/00-base.patch
js/src/ctypes/patches-libffi/01-bug-670719.patch
js/src/ctypes/patches-libffi/02-bug-682180.patch
js/src/ctypes/patches-libffi/03-bug-712594.patch
js/src/ctypes/patches-libffi/05-bug-644136.patch
--- a/js/src/ctypes/libffi/aclocal.m4
+++ b/js/src/ctypes/libffi/aclocal.m4
@@ -4703,17 +4703,17 @@ dnl Note also adjust exclude_expsyms for
       # Tell ltmain to make .dll files, not .so files.
       shrext_cmds=".dll"
       # FIXME: Setting linknames here is a bad hack.
       _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
       # The linker will automatically build a .lib file if we build a DLL.
       _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
       # FIXME: Should let the user specify the lib program.
       _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_TAGVAR(fix_srcfile_path, $1)=''
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
 
     darwin* | rhapsody*)
       _LT_DARWIN_LINKER_FEATURES($1)
       ;;
 
     dgux*)
--- a/js/src/ctypes/libffi/configure
+++ b/js/src/ctypes/libffi/configure
@@ -5046,23 +5046,23 @@ test -z "$NM" && NM=nm
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
 $as_echo_n "checking the name lister ($NM) interface... " >&6; }
 if test "${lt_cv_nm_interface+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:5053: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:5054: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:5056: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:5057: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:5059: output\"" >&5)
+  (eval echo "\"\$as_me:5060: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
   fi
   rm -f conftest*
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
 $as_echo "$lt_cv_nm_interface" >&6; }
@@ -6258,17 +6258,17 @@ ia64-*-hpux*)
 	HPUX_IA64_MODE="64"
 	;;
     esac
   fi
   rm -rf conftest*
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 6265 "configure"' > conftest.$ac_ext
+  echo '#line 6266 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
     if test "$lt_cv_prog_gnu_ld" = yes; then
       case `/usr/bin/file conftest.$ac_objext` in
 	*32-bit*)
@@ -7784,21 +7784,21 @@ else
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7791: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7792: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7795: \$? = $ac_status" >&5
+   echo "$as_me:7796: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_rtti_exceptions=yes
      fi
@@ -8123,21 +8123,21 @@ else
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    # The option is referenced via a variable to avoid confusing sed.
    lt_compile=`echo "$ac_compile" | $SED \
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8130: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8131: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8134: \$? = $ac_status" >&5
+   echo "$as_me:8135: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_pic_works=yes
      fi
@@ -8228,21 +8228,21 @@ else
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    lt_compile=`echo "$ac_compile" | $SED \
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8235: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8236: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8239: \$? = $ac_status" >&5
+   echo "$as_me:8240: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -8283,21 +8283,21 @@ else
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
    # with a dollar sign (not a hyphen), so the echo should work correctly.
    lt_compile=`echo "$ac_compile" | $SED \
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8290: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8291: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8294: \$? = $ac_status" >&5
+   echo "$as_me:8295: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
        lt_cv_prog_compiler_c_o=yes
@@ -10653,17 +10653,17 @@ if test "${lt_cv_dlopen_self+set}" = set
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self=cross
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10660 "configure"
+#line 10661 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include <dlfcn.h>
 #endif
 
 #include <stdio.h>
 
@@ -10749,17 +10749,17 @@ if test "${lt_cv_dlopen_self_static+set}
   $as_echo_n "(cached) " >&6
 else
   	  if test "$cross_compiling" = yes; then :
   lt_cv_dlopen_self_static=cross
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10756 "configure"
+#line 10757 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
 #include <dlfcn.h>
 #endif
 
 #include <stdio.h>
 
@@ -12358,38 +12358,38 @@ fi
     if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
 
 $as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h
 
     fi
 fi
 
 if test x$TARGET = xX86_WIN64; then
-    { $as_echo "$as_me:$LINENO: checking for _ prefix in compiled symbols" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _ prefix in compiled symbols" >&5
 $as_echo_n "checking for _ prefix in compiled symbols... " >&6; }
-if test "${lt_cv_sys_symbol_underscore+set}" = set; then
+if test "${lt_cv_sys_symbol_underscore+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_sys_symbol_underscore=no
   cat > conftest.$ac_ext <<_LT_EOF
 void nm_test_func(){}
 int main(){nm_test_func;return 0;}
 _LT_EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
     # Now try to grab the symbols.
     ac_nlist=conftest.nm
-    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\"") >&5
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\""; } >&5
   (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s "$ac_nlist"; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$ac_nlist"; then
       # See whether the symbols have a leading underscore.
       if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
         lt_cv_sys_symbol_underscore=yes
       else
         if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
 	  :
         else
 	  echo "configure: cannot find nm_test_func in $ac_nlist" >&5
@@ -12400,31 +12400,30 @@ int main(){nm_test_func;return 0;}
     fi
   else
     echo "configure: failed program was:" >&5
     cat conftest.c >&5
   fi
   rm -rf conftest*
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $lt_cv_sys_symbol_underscore" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_symbol_underscore" >&5
 $as_echo "$lt_cv_sys_symbol_underscore" >&6; }
   sys_symbol_underscore=$lt_cv_sys_symbol_underscore
 
 
     if test "x$sys_symbol_underscore" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define SYMBOL_UNDERSCORE 1
-_ACEOF
+$as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h
 
     fi
 fi
 
 case "$target" in
+     # Darwin 10 (OSX 10.6) and beyond allocate non-executable pages
      *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
 
 $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
 
      ;;
 esac
 
 if test x$TARGET = xX86_64; then
--- a/js/src/ctypes/libffi/configure.ac
+++ b/js/src/ctypes/libffi/configure.ac
@@ -135,17 +135,17 @@ case "$host" in
 	TARGET=POWERPC; TARGETDIR=powerpc
 	;;
   powerpc-*-darwin*)
 	TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
 	;;
   powerpc-*-aix* | rs6000-*-aix*)
 	TARGET=POWERPC_AIX; TARGETDIR=powerpc
 	;;
-  powerpc-*-freebsd*)
+  powerpc-*-freebsd* | powerpc-*-openbsd*)
 	TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
 	;;
   powerpc*-*-rtems*)
 	TARGET=POWERPC; TARGETDIR=powerpc
 	;;
 
   s390-*-* | s390x-*-*)
 	TARGET=S390; TARGETDIR=s390
--- a/js/src/ctypes/patches-libffi/00-base.patch
+++ b/js/src/ctypes/patches-libffi/00-base.patch
@@ -1,15 +1,15 @@
 Patch libffi to fix bug 550602, bug 538216, bug545634, bug 594611, bug 605421
 and bug 631928.
 
 diff --git a/js/src/ctypes/libffi/Makefile.in b/js/src/ctypes/libffi/Makefile.in
 --- a/js/src/ctypes/libffi/Makefile.in
 +++ b/js/src/ctypes/libffi/Makefile.in
-@@ -199,17 +199,17 @@ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+@@ -199,17 +199,17 @@ LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIB
  CCLD = $(CC)
  LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
  	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
  	$(LDFLAGS) -o $@
  SOURCES = $(libffi_la_SOURCES) $(nodist_libffi_la_SOURCES) \
  	$(libffi_convenience_la_SOURCES) \
  	$(nodist_libffi_convenience_la_SOURCES)
  DIST_SOURCES = $(libffi_la_SOURCES) $(libffi_convenience_la_SOURCES)
@@ -82,17 +82,17 @@ diff --git a/js/src/ctypes/libffi/Makefi
  @am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
  @am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
  @am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
  @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
  @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
  @am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
  
  mostlyclean-libtool:
-@@ -1129,17 +1129,17 @@ $(srcdir)/doc/stamp-vti: doc/libffi.texi $(top_srcdir)/configure
+@@ -1129,17 +1129,17 @@ doc/libffi.html: doc/libffi.texi $(srcdi
  	-@rm -f vti.tmp
  	@cp $(srcdir)/doc/version.texi $@
  
  mostlyclean-vti:
  	-rm -f vti.tmp
  
  maintainer-clean-vti:
  @MAINTAINER_MODE_TRUE@	-rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi
@@ -101,20 +101,222 @@ diff --git a/js/src/ctypes/libffi/Makefi
  	TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
  	$(DVIPS) -o $@ $<
  
  uninstall-dvi-am:
  	@$(NORMAL_UNINSTALL)
  	@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
  	for p in $$list; do \
  	  $(am__strip_dir) \
+diff --git a/js/src/ctypes/libffi/aclocal.m4 b/js/src/ctypes/libffi/aclocal.m4
+--- a/js/src/ctypes/libffi/aclocal.m4
++++ b/js/src/ctypes/libffi/aclocal.m4
+@@ -4703,17 +4703,17 @@ dnl Note also adjust exclude_expsyms for
+       # Tell ltmain to make .dll files, not .so files.
+       shrext_cmds=".dll"
+       # FIXME: Setting linknames here is a bad hack.
+       _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+       # The linker will automatically build a .lib file if we build a DLL.
+       _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+       # FIXME: Should let the user specify the lib program.
+       _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+-      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
++      _LT_TAGVAR(fix_srcfile_path, $1)=''
+       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+       ;;
+ 
+     darwin* | rhapsody*)
+       _LT_DARWIN_LINKER_FEATURES($1)
+       ;;
+ 
+     dgux*)
+diff --git a/js/src/ctypes/libffi/config.sub b/js/src/ctypes/libffi/config.sub
+--- a/js/src/ctypes/libffi/config.sub
++++ b/js/src/ctypes/libffi/config.sub
+@@ -1,15 +1,15 @@
+ #! /bin/sh
+ # Configuration validation subroutine script.
+ #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ #   Free Software Foundation, Inc.
+ 
+-timestamp='2009-11-07'
++timestamp='2011-01-03'
+ 
+ # This file is (in principle) common to ALL GNU software.
+ # The presence of a machine in this file suggests that SOME GNU software
+ # can handle that machine.  It does not imply ALL GNU software can.
+ #
+ # This file is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 2 of the License, or
+@@ -121,17 +121,17 @@ esac
+ 
+ # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+ # Here we must recognize all the valid KERNEL-OS combinations.
+ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+ case $maybe_os in
+   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+   kopensolaris*-gnu* | \
+-  storm-chaos* | os2-emx* | rtmk-nova*)
++  storm-chaos* | os2-emx* | rtmk-nova* | wince-winmo*)
+     os=-$maybe_os
+     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+     ;;
+   *)
+     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+     if [ $basic_machine != $1 ]
+     then os=`echo $1 | sed 's/.*-/-/'`
+     else os=; fi
+@@ -282,32 +282,30 @@ case $basic_machine in
+ 	| mt \
+ 	| msp430 \
+ 	| nios | nios2 \
+ 	| ns16k | ns32k \
+ 	| or32 \
+ 	| pdp10 | pdp11 | pj | pjl \
+ 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ 	| pyramid \
+-	| rx \
+ 	| score \
+ 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ 	| sh64 | sh64le \
+ 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ 	| spu | strongarm \
+ 	| tahoe | thumb | tic4x | tic80 | tron \
+-	| ubicom32 \
+ 	| v850 | v850e \
+ 	| we32k \
+ 	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ 	| z8k | z80)
+ 		basic_machine=$basic_machine-unknown
+ 		;;
+-	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
++	m6811 | m68hc11 | m6812 | m68hc12)
+ 		# Motorola 68HC11/12.
+ 		basic_machine=$basic_machine-unknown
+ 		os=-none
+ 		;;
+ 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ 		;;
+ 	ms1)
+ 		basic_machine=mt-unknown
+@@ -368,26 +366,25 @@ case $basic_machine in
+ 	| mt-* \
+ 	| msp430-* \
+ 	| nios-* | nios2-* \
+ 	| none-* | np1-* | ns16k-* | ns32k-* \
+ 	| orion-* \
+ 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ 	| pyramid-* \
+-	| romp-* | rs6000-* | rx-* \
++	| romp-* | rs6000-* \
+ 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ 	| sparclite-* \
+ 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ 	| tahoe-* | thumb-* \
+ 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+ 	| tron-* \
+-	| ubicom32-* \
+ 	| v850-* | v850e-* | vax-* \
+ 	| we32k-* \
+ 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ 	| xstormy16-* | xtensa*-* \
+ 	| ymp-* \
+ 	| z8k-* | z80-*)
+ 		;;
+ 	# Recognize the basic CPU types without company name, with glob match.
+@@ -1294,17 +1291,17 @@ case $os in
+ 	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ 	      | -uxpv* | -beos* | -mpeix* | -udk* \
+ 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
++	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -winmo*)
+ 	# Remember, each alternative MUST END IN *, to match a version number.
+ 		;;
+ 	-qnx*)
+ 		case $basic_machine in
+ 		    x86-* | i*86-*)
+ 			;;
+ 		    *)
+ 			os=-nto$os
+@@ -1336,16 +1333,19 @@ case $os in
+ 		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ 		;;
+ 	-opened*)
+ 		os=-openedition
+ 		;;
+         -os400*)
+ 		os=-os400
+ 		;;
++	-wince-winmo*)
++		os=-wince-winmo
++		;;
+ 	-wince*)
+ 		os=-wince
+ 		;;
+ 	-osfrose*)
+ 		os=-osfrose
+ 		;;
+ 	-osf*)
+ 		os=-osf
+@@ -1427,16 +1427,19 @@ case $os in
+ 		os=-kaos
+ 		;;
+ 	-zvmoe)
+ 		os=-zvmoe
+ 		;;
+ 	-dicos*)
+ 		os=-dicos
+ 		;;
++        -android*)
++	        os=-android
++                ;;
+ 	-none)
+ 		;;
+ 	*)
+ 		# Get rid of the `-' at the beginning of $os.
+ 		os=`echo $os | sed 's/[^-]*-//'`
+ 		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ 		exit 1
+ 		;;
+@@ -1681,16 +1684,19 @@ case $basic_machine in
+ 				vendor=apple
+ 				;;
+ 			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ 				vendor=atari
+ 				;;
+ 			-vos*)
+ 				vendor=stratus
+ 				;;
++			*-android*|*-linuxandroid*)
++				vendor=linux-
++				;;
+ 		esac
+ 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ 		;;
+ esac
+ 
+ echo $basic_machine$os
+ exit
+ 
 diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure
 --- a/js/src/ctypes/libffi/configure
 +++ b/js/src/ctypes/libffi/configure
-@@ -8903,17 +8903,17 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+@@ -8903,17 +8903,17 @@ if test -z "$aix_libpath"; then aix_libp
        # Tell ltmain to make .dll files, not .so files.
        shrext_cmds=".dll"
        # FIXME: Setting linknames here is a bad hack.
        archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
        # The linker will automatically build a .lib file if we build a DLL.
        old_archive_from_new_cmds='true'
        # FIXME: Should let the user specify the lib program.
        old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
@@ -147,71 +349,154 @@ diff --git a/js/src/ctypes/libffi/config
  	fi
  
  fi
  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_pcrel" >&5
  $as_echo "$libffi_cv_as_x86_pcrel" >&6; }
      if test "x$libffi_cv_as_x86_pcrel" = xyes; then
  
  $as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h
-diff --git a/js/src/ctypes/libffi/src/x86/ffi64.c b/js/src/ctypes/libffi/src/x86/ffi64.c
---- a/js/src/ctypes/libffi/src/x86/ffi64.c
-+++ b/js/src/ctypes/libffi/src/x86/ffi64.c
-@@ -373,29 +373,29 @@ ffi_prep_cif_machdep (ffi_cif *cif)
- 	  || gprcount + ngpr > MAX_GPR_REGS
- 	  || ssecount + nsse > MAX_SSE_REGS)
- 	{
- 	  long align = cif->arg_types[i]->alignment;
+diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac
+--- a/js/src/ctypes/libffi/configure.ac
++++ b/js/src/ctypes/libffi/configure.ac
+@@ -272,20 +272,20 @@ if test x$TARGET = xSPARC; then
+        AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
+ 	       [Define if your assembler supports .register.])
+     fi
+ fi
  
- 	  if (align < 8)
- 	    align = 8;
+ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
+     AC_CACHE_CHECK([assembler supports pc related relocs],
+ 	libffi_cv_as_x86_pcrel, [
+-	libffi_cv_as_x86_pcrel=yes
++	libffi_cv_as_x86_pcrel=no
+ 	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
+-	if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
+-	    libffi_cv_as_x86_pcrel=no
++	if $CC $CFLAGS -c conftest.s > /dev/null; then
++	    libffi_cv_as_x86_pcrel=yes
+ 	fi
+ 	])
+     if test "x$libffi_cv_as_x86_pcrel" = xyes; then
+ 	AC_DEFINE(HAVE_AS_X86_PCREL, 1,
+ 		  [Define if your assembler supports PC relative relocs.])
+     fi
+ 
+     AC_CACHE_CHECK([assembler .ascii pseudo-op support],
+diff --git a/js/src/ctypes/libffi/include/ffi.h.in b/js/src/ctypes/libffi/include/ffi.h.in
+--- a/js/src/ctypes/libffi/include/ffi.h.in
++++ b/js/src/ctypes/libffi/include/ffi.h.in
+@@ -72,25 +72,37 @@ extern "C" {
+ #endif
+ 
+ #include <stddef.h>
+ #include <limits.h>
  
--	  bytes = ALIGN(bytes, align);
-+	  bytes = ALIGN (bytes, align);
- 	  bytes += cif->arg_types[i]->size;
- 	}
-       else
- 	{
- 	  gprcount += ngpr;
- 	  ssecount += nsse;
- 	}
-     }
-   if (ssecount)
-     flags |= 1 << 11;
-   cif->flags = flags;
--  cif->bytes = bytes;
-+  cif->bytes = ALIGN (bytes, 8);
+ /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
+    But we can find it either under the correct ANSI name, or under GNU
+    C's internal name.  */
++
++#define FFI_64_BIT_MAX 9223372036854775807
++
+ #ifdef LONG_LONG_MAX
+ # define FFI_LONG_LONG_MAX LONG_LONG_MAX
+ #else
+ # ifdef LLONG_MAX
+ #  define FFI_LONG_LONG_MAX LLONG_MAX
+ # else
+ #  ifdef __GNUC__
+ #   define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
+ #  endif
++#  ifdef _AIX
++#   ifndef __PPC64__
++#    if defined (__IBMC__) || defined (__IBMCPP__)
++#     define FFI_LONG_LONG_MAX LONGLONG_MAX
++#    endif
++#   endif /* __PPC64__ */
++#   undef  FFI_64_BIT_MAX
++#   define FFI_64_BIT_MAX 9223372036854775807LL
++#  endif
+ # endif
+ #endif
+ 
+ /* The closure code assumes that this works on pointers, i.e. a size_t	*/
+ /* can hold a pointer.							*/
+ 
+ typedef struct _ffi_type
+ {
+@@ -127,27 +139,27 @@ typedef struct _ffi_type
+ #elif INT_MAX == 9223372036854775807
+ # define ffi_type_uint         ffi_type_uint64
+ # define ffi_type_sint         ffi_type_sint64
+ #else
+  #error "int size not supported"
+ #endif
  
-   return FFI_OK;
- }
+ #if LONG_MAX == 2147483647
+-# if FFI_LONG_LONG_MAX != 9223372036854775807
++# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
+  #error "no 64-bit data type supported"
+ # endif
+-#elif LONG_MAX != 9223372036854775807
++#elif LONG_MAX != FFI_64_BIT_MAX
+  #error "long size not supported"
+ #endif
+ 
+ #if LONG_MAX == 2147483647
+ # define ffi_type_ulong        ffi_type_uint32
+ # define ffi_type_slong        ffi_type_sint32
+-#elif LONG_MAX == 9223372036854775807
++#elif LONG_MAX == FFI_64_BIT_MAX
+ # define ffi_type_ulong        ffi_type_uint64
+ # define ffi_type_slong        ffi_type_sint64
+ #else
+  #error "long size not supported"
+ #endif
  
- void
- ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
- {
-   enum x86_64_reg_class classes[MAX_CLASSES];
+ /* These are defined in types.c */
+ extern ffi_type ffi_type_void;
+@@ -190,17 +202,17 @@ typedef struct {
+ #endif
+ } ffi_cif;
+ 
+ /* ---- Definitions for the raw API -------------------------------------- */
+ 
+ #ifndef FFI_SIZEOF_ARG
+ # if LONG_MAX == 2147483647
+ #  define FFI_SIZEOF_ARG        4
+-# elif LONG_MAX == 9223372036854775807
++# elif LONG_MAX == FFI_64_BIT_MAX
+ #  define FFI_SIZEOF_ARG        8
+ # endif
+ #endif
+ 
+ #ifndef FFI_SIZEOF_JAVA_RAW
+ #  define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
+ #endif
+ 
 diff --git a/js/src/ctypes/libffi/src/arm/ffi.c b/js/src/ctypes/libffi/src/arm/ffi.c
 --- a/js/src/ctypes/libffi/src/arm/ffi.c
 +++ b/js/src/ctypes/libffi/src/arm/ffi.c
 @@ -24,22 +24,30 @@
     DEALINGS IN THE SOFTWARE.
     ----------------------------------------------------------------------- */
  
  #include <ffi.h>
  #include <ffi_common.h>
  
  #include <stdlib.h>
  
--/* ffi_prep_args is called by the assembly routine once stack space
--   has been allocated for the function's arguments */
 +/* Forward declares. */
 +static int vfp_type_p (ffi_type *);
 +static void layout_vfp_args (ffi_cif *);
- 
++
+ /* ffi_prep_args is called by the assembly routine once stack space
+-   has been allocated for the function's arguments */
+-
 -void ffi_prep_args(char *stack, extended_cif *ecif)
-+/* ffi_prep_args is called by the assembly routine once stack space
 +   has been allocated for the function's arguments
 +   
 +   The vfp_space parameter is the load area for VFP regs, the return
 +   value is cif->vfp_used (word bitset of VFP regs used for passing
 +   arguments). These are only used for the VFP hard-float ABI.
 +*/
 +int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space)
  {
@@ -220,17 +505,17 @@ diff --git a/js/src/ctypes/libffi/src/ar
    register void **p_argv;
    register char *argp;
    register ffi_type **p_arg;
  
    argp = stack;
  
    if ( ecif->cif->flags == FFI_TYPE_STRUCT ) {
      *(void **) argp = ecif->rvalue;
-@@ -49,16 +57,31 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
+@@ -49,16 +57,31 @@ void ffi_prep_args(char *stack, extended
    p_argv = ecif->avalue;
  
    for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
         (i != 0);
         i--, p_arg++)
      {
        size_t z;
  
@@ -252,17 +537,17 @@ diff --git a/js/src/ctypes/libffi/src/ar
        /* Align if necessary */
        if (((*p_arg)->alignment - 1) & (unsigned) argp) {
  	argp = (char *) ALIGN(argp, (*p_arg)->alignment);
        }
  
        if ((*p_arg)->type == FFI_TYPE_STRUCT)
  	argp = (char *) ALIGN(argp, 4);
  
-@@ -98,23 +121,25 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
+@@ -98,23 +121,25 @@ void ffi_prep_args(char *stack, extended
  	    }
  	  else
  	    {
  	      memcpy(argp, *p_argv, z);
  	    }
  	  p_argv++;
  	  argp += z;
      }
@@ -280,17 +565,17 @@ diff --git a/js/src/ctypes/libffi/src/ar
    /* Round the stack up to a multiple of 8 bytes.  This isn't needed 
       everywhere, but it is on some platforms, and it doesn't harm anything
       when it isn't needed.  */
    cif->bytes = (cif->bytes + 7) & ~7;
  
    /* Set the return type flag */
    switch (cif->rtype->type)
      {
-@@ -125,137 +150,176 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
+@@ -125,137 +150,176 @@ ffi_status ffi_prep_cif_machdep(ffi_cif 
        break;
  
      case FFI_TYPE_SINT64:
      case FFI_TYPE_UINT64:
        cif->flags = (unsigned) FFI_TYPE_SINT64;
        break;
  
      case FFI_TYPE_STRUCT:
@@ -449,37 +734,36 @@ diff --git a/js/src/ctypes/libffi/src/ar
      argp += 4;
    }
  
    p_argv = avalue;
  
    for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
      {
        size_t z;
--
--      size_t alignment = (*p_arg)->alignment;
 +      size_t alignment;
 +  
 +      if (cif->abi == FFI_VFP
 +	  && vi < cif->vfp_nargs && vfp_type_p (*p_arg))
 +	{
 +	  *p_argv++ = (void*)(vfp_stack + cif->vfp_args[vi++]);
 +	  continue;
 +	}
-+
+ 
+-      size_t alignment = (*p_arg)->alignment;
 +      alignment = (*p_arg)->alignment;
        if (alignment < 4)
  	alignment = 4;
        /* Align if necessary */
        if ((alignment - 1) & (unsigned) argp) {
  	argp = (char *) ALIGN(argp, alignment);
        }
  
        z = (*p_arg)->size;
-@@ -290,20 +354,147 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
+@@ -290,20 +354,147 @@ ffi_prep_incoming_args_SYSV(char *stack,
  
  ffi_status
  ffi_prep_closure_loc (ffi_closure* closure,
  		      ffi_cif* cif,
  		      void (*fun)(ffi_cif*,void*,void**,void*),
  		      void *user_data,
  		      void *codeloc)
  {
@@ -661,17 +945,17 @@ diff --git a/js/src/ctypes/libffi/src/ar
  #define FFI_TRAMPOLINE_SIZE 20
  #define FFI_NATIVE_RAW_API 0
  
  #endif
  
 diff --git a/js/src/ctypes/libffi/src/arm/sysv.S b/js/src/ctypes/libffi/src/arm/sysv.S
 --- a/js/src/ctypes/libffi/src/arm/sysv.S
 +++ b/js/src/ctypes/libffi/src/arm/sysv.S
-@@ -137,54 +137,52 @@ _L__\name:
+@@ -137,54 +137,52 @@
  	ldr\cond	pc, [sp], #4
  	.else
  	ldm\cond\dirn	sp!, {\regs, pc}
  	.endif
  #endif
  .endm
  
  
@@ -909,16 +1193,51 @@ diff --git a/js/src/ctypes/libffi/src/ar
 +
 +.ffi_closure_VFP_end:
 +	UNWIND .fnend
 +        .size    CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP)
 +
  #if defined __ELF__ && defined __linux__
  	.section	.note.GNU-stack,"",%progbits
  #endif
+diff --git a/js/src/ctypes/libffi/src/x86/ffi64.c b/js/src/ctypes/libffi/src/x86/ffi64.c
+--- a/js/src/ctypes/libffi/src/x86/ffi64.c
++++ b/js/src/ctypes/libffi/src/x86/ffi64.c
+@@ -373,29 +373,29 @@ ffi_prep_cif_machdep (ffi_cif *cif)
+ 	  || gprcount + ngpr > MAX_GPR_REGS
+ 	  || ssecount + nsse > MAX_SSE_REGS)
+ 	{
+ 	  long align = cif->arg_types[i]->alignment;
+ 
+ 	  if (align < 8)
+ 	    align = 8;
+ 
+-	  bytes = ALIGN(bytes, align);
++	  bytes = ALIGN (bytes, align);
+ 	  bytes += cif->arg_types[i]->size;
+ 	}
+       else
+ 	{
+ 	  gprcount += ngpr;
+ 	  ssecount += nsse;
+ 	}
+     }
+   if (ssecount)
+     flags |= 1 << 11;
+   cif->flags = flags;
+-  cif->bytes = bytes;
++  cif->bytes = ALIGN (bytes, 8);
+ 
+   return FFI_OK;
+ }
+ 
+ void
+ ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
+ {
+   enum x86_64_reg_class classes[MAX_CLASSES];
 diff --git a/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp b/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp
 --- a/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp
 +++ b/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp
 @@ -261,16 +261,66 @@ proc dg-xfail-if { args } {
      set args [lreplace $args 0 0]
      set selector "target [join [lindex $args 1]]"
      if { [dg-process-target $selector] == "S" } {
  	global compiler_conditional_xfail_data
@@ -1023,306 +1342,8 @@ diff --git a/js/src/ctypes/libffi/testsu
  #include "ffitest.h"
  
  static void
  cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, 
  		     void** args, void* userdata __UNUSED__)
  {
  	char*		format	= *(char**)args[0];
  	long double	ldValue	= *(long double*)args[1];
-diff --git a/js/src/ctypes/libffi/include/ffi.h.in b/js/src/ctypes/libffi/include/ffi.h.in
---- a/js/src/ctypes/libffi/include/ffi.h.in
-+++ b/js/src/ctypes/libffi/include/ffi.h.in
-@@ -72,25 +72,37 @@ extern "C" {
- #endif
- 
- #include <stddef.h>
- #include <limits.h>
- 
- /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
-    But we can find it either under the correct ANSI name, or under GNU
-    C's internal name.  */
-+
-+#define FFI_64_BIT_MAX 9223372036854775807
-+
- #ifdef LONG_LONG_MAX
- # define FFI_LONG_LONG_MAX LONG_LONG_MAX
- #else
- # ifdef LLONG_MAX
- #  define FFI_LONG_LONG_MAX LLONG_MAX
- # else
- #  ifdef __GNUC__
- #   define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
- #  endif
-+#  ifdef _AIX
-+#   ifndef __PPC64__
-+#    if defined (__IBMC__) || defined (__IBMCPP__)
-+#     define FFI_LONG_LONG_MAX LONGLONG_MAX
-+#    endif
-+#   endif /* __PPC64__ */
-+#   undef  FFI_64_BIT_MAX
-+#   define FFI_64_BIT_MAX 9223372036854775807LL
-+#  endif
- # endif
- #endif
- 
- /* The closure code assumes that this works on pointers, i.e. a size_t	*/
- /* can hold a pointer.							*/
- 
- typedef struct _ffi_type
- {
-@@ -127,27 +139,27 @@ typedef struct _ffi_type
- #elif INT_MAX == 9223372036854775807
- # define ffi_type_uint         ffi_type_uint64
- # define ffi_type_sint         ffi_type_sint64
- #else
-  #error "int size not supported"
- #endif
- 
- #if LONG_MAX == 2147483647
--# if FFI_LONG_LONG_MAX != 9223372036854775807
-+# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
-  #error "no 64-bit data type supported"
- # endif
--#elif LONG_MAX != 9223372036854775807
-+#elif LONG_MAX != FFI_64_BIT_MAX
-  #error "long size not supported"
- #endif
- 
- #if LONG_MAX == 2147483647
- # define ffi_type_ulong        ffi_type_uint32
- # define ffi_type_slong        ffi_type_sint32
--#elif LONG_MAX == 9223372036854775807
-+#elif LONG_MAX == FFI_64_BIT_MAX
- # define ffi_type_ulong        ffi_type_uint64
- # define ffi_type_slong        ffi_type_sint64
- #else
-  #error "long size not supported"
- #endif
- 
- /* These are defined in types.c */
- extern ffi_type ffi_type_void;
-@@ -190,17 +202,17 @@ typedef struct {
- #endif
- } ffi_cif;
- 
- /* ---- Definitions for the raw API -------------------------------------- */
- 
- #ifndef FFI_SIZEOF_ARG
- # if LONG_MAX == 2147483647
- #  define FFI_SIZEOF_ARG        4
--# elif LONG_MAX == 9223372036854775807
-+# elif LONG_MAX == FFI_64_BIT_MAX
- #  define FFI_SIZEOF_ARG        8
- # endif
- #endif
- 
- #ifndef FFI_SIZEOF_JAVA_RAW
- #  define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
- #endif
- 
-diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac
---- a/js/src/ctypes/libffi/configure.ac
-+++ b/js/src/ctypes/libffi/configure.ac
-@@ -272,20 +272,20 @@ if test x$TARGET = xSPARC; then
-        AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1,
- 	       [Define if your assembler supports .register.])
-     fi
- fi
- 
- if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
-     AC_CACHE_CHECK([assembler supports pc related relocs],
- 	libffi_cv_as_x86_pcrel, [
--	libffi_cv_as_x86_pcrel=yes
-+	libffi_cv_as_x86_pcrel=no
- 	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
--	if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
--	    libffi_cv_as_x86_pcrel=no
-+	if $CC $CFLAGS -c conftest.s > /dev/null; then
-+	    libffi_cv_as_x86_pcrel=yes
- 	fi
- 	])
-     if test "x$libffi_cv_as_x86_pcrel" = xyes; then
- 	AC_DEFINE(HAVE_AS_X86_PCREL, 1,
- 		  [Define if your assembler supports PC relative relocs.])
-     fi
- 
-     AC_CACHE_CHECK([assembler .ascii pseudo-op support],
-diff --git a/js/src/ctypes/libffi/config.sub b/js/src/ctypes/libffi/config.sub
---- a/js/src/ctypes/libffi/config.sub
-+++ b/js/src/ctypes/libffi/config.sub
-@@ -1,15 +1,15 @@
- #! /bin/sh
- # Configuration validation subroutine script.
- #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
- #   Free Software Foundation, Inc.
- 
--timestamp='2009-11-07'
-+timestamp='2011-01-03'
- 
- # This file is (in principle) common to ALL GNU software.
- # The presence of a machine in this file suggests that SOME GNU software
- # can handle that machine.  It does not imply ALL GNU software can.
- #
- # This file is free software; you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation; either version 2 of the License, or
-@@ -121,17 +121,17 @@ esac
- 
- # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
- # Here we must recognize all the valid KERNEL-OS combinations.
- maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
- case $maybe_os in
-   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-   kopensolaris*-gnu* | \
--  storm-chaos* | os2-emx* | rtmk-nova*)
-+  storm-chaos* | os2-emx* | rtmk-nova* | wince-winmo*)
-     os=-$maybe_os
-     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-     ;;
-   *)
-     basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-     if [ $basic_machine != $1 ]
-     then os=`echo $1 | sed 's/.*-/-/'`
-     else os=; fi
-@@ -282,32 +282,30 @@ case $basic_machine in
- 	| mt \
- 	| msp430 \
- 	| nios | nios2 \
- 	| ns16k | ns32k \
- 	| or32 \
- 	| pdp10 | pdp11 | pj | pjl \
- 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- 	| pyramid \
--	| rx \
- 	| score \
- 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- 	| sh64 | sh64le \
- 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- 	| spu | strongarm \
- 	| tahoe | thumb | tic4x | tic80 | tron \
--	| ubicom32 \
- 	| v850 | v850e \
- 	| we32k \
- 	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
- 	| z8k | z80)
- 		basic_machine=$basic_machine-unknown
- 		;;
--	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
-+	m6811 | m68hc11 | m6812 | m68hc12)
- 		# Motorola 68HC11/12.
- 		basic_machine=$basic_machine-unknown
- 		os=-none
- 		;;
- 	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- 		;;
- 	ms1)
- 		basic_machine=mt-unknown
-@@ -368,26 +366,25 @@ case $basic_machine in
- 	| mt-* \
- 	| msp430-* \
- 	| nios-* | nios2-* \
- 	| none-* | np1-* | ns16k-* | ns32k-* \
- 	| orion-* \
- 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- 	| pyramid-* \
--	| romp-* | rs6000-* | rx-* \
-+	| romp-* | rs6000-* \
- 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- 	| sparclite-* \
- 	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
- 	| tahoe-* | thumb-* \
- 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
- 	| tron-* \
--	| ubicom32-* \
- 	| v850-* | v850e-* | vax-* \
- 	| we32k-* \
- 	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
- 	| xstormy16-* | xtensa*-* \
- 	| ymp-* \
- 	| z8k-* | z80-*)
- 		;;
- 	# Recognize the basic CPU types without company name, with glob match.
-@@ -1294,17 +1291,17 @@ case $os in
- 	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
- 	      | -uxpv* | -beos* | -mpeix* | -udk* \
- 	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
--	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
-+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -winmo*)
- 	# Remember, each alternative MUST END IN *, to match a version number.
- 		;;
- 	-qnx*)
- 		case $basic_machine in
- 		    x86-* | i*86-*)
- 			;;
- 		    *)
- 			os=-nto$os
-@@ -1336,16 +1333,19 @@ case $os in
- 		os=`echo $os | sed -e 's|sunos6|solaris3|'`
- 		;;
- 	-opened*)
- 		os=-openedition
- 		;;
-         -os400*)
- 		os=-os400
- 		;;
-+	-wince-winmo*)
-+		os=-wince-winmo
-+		;;
- 	-wince*)
- 		os=-wince
- 		;;
- 	-osfrose*)
- 		os=-osfrose
- 		;;
- 	-osf*)
- 		os=-osf
-@@ -1427,16 +1427,19 @@ case $os in
- 		os=-kaos
- 		;;
- 	-zvmoe)
- 		os=-zvmoe
- 		;;
- 	-dicos*)
- 		os=-dicos
- 		;;
-+        -android*)
-+	        os=-android
-+                ;;
- 	-none)
- 		;;
- 	*)
- 		# Get rid of the `-' at the beginning of $os.
- 		os=`echo $os | sed 's/[^-]*-//'`
- 		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- 		exit 1
- 		;;
-@@ -1681,16 +1684,19 @@ case $basic_machine in
- 				vendor=apple
- 				;;
- 			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- 				vendor=atari
- 				;;
- 			-vos*)
- 				vendor=stratus
- 				;;
-+			*-android*|*-linuxandroid*)
-+				vendor=linux-
-+				;;
- 		esac
- 		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- 		;;
- esac
- 
- echo $basic_machine$os
- exit
- 
\ No newline at end of file
--- a/js/src/ctypes/patches-libffi/01-bug-670719.patch
+++ b/js/src/ctypes/patches-libffi/01-bug-670719.patch
@@ -21,8 +21,30 @@ diff --git a/js/src/ctypes/libffi/config
  	TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
  	;;
    powerpc*-*-rtems*)
  	TARGET=POWERPC; TARGETDIR=powerpc
  	;;
  
    s390-*-* | s390x-*-*)
  	TARGET=S390; TARGETDIR=s390
+diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac
+--- a/js/src/ctypes/libffi/configure.ac
++++ b/js/src/ctypes/libffi/configure.ac
+@@ -135,17 +135,17 @@ case "$host" in
+ 	TARGET=POWERPC; TARGETDIR=powerpc
+ 	;;
+   powerpc-*-darwin*)
+ 	TARGET=POWERPC_DARWIN; TARGETDIR=powerpc
+ 	;;
+   powerpc-*-aix* | rs6000-*-aix*)
+ 	TARGET=POWERPC_AIX; TARGETDIR=powerpc
+ 	;;
+-  powerpc-*-freebsd*)
++  powerpc-*-freebsd* | powerpc-*-openbsd*)
+ 	TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
+ 	;;
+   powerpc*-*-rtems*)
+ 	TARGET=POWERPC; TARGETDIR=powerpc
+ 	;;
+ 
+   s390-*-* | s390x-*-*)
+ 	TARGET=S390; TARGETDIR=s390
--- a/js/src/ctypes/patches-libffi/02-bug-682180.patch
+++ b/js/src/ctypes/patches-libffi/02-bug-682180.patch
@@ -1,27 +1,48 @@
+# HG changeset patch
+# Parent 5e5eb679345b4d13b8e9ee40e253a97fd665dad3
 diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure
-index 2c08e1b..37e3055 100755
 --- a/js/src/ctypes/libffi/configure
 +++ b/js/src/ctypes/libffi/configure
-@@ -12362,7 +12362,7 @@ $as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h
+@@ -12357,17 +12357,18 @@ fi
+     if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
+ 
+ $as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h
+ 
+     fi
  fi
  
  case "$target" in
 -     *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
++     # Darwin 10 (OSX 10.6) and beyond allocate non-executable pages
 +     *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
  
  $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
  
+      ;;
+ esac
+ 
+ if test x$TARGET = xX86_64; then
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5
 diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac
-index e85cff1..1db02ce 100644
 --- a/js/src/ctypes/libffi/configure.ac
 +++ b/js/src/ctypes/libffi/configure.ac
-@@ -316,7 +316,8 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
+@@ -311,17 +311,18 @@ if test x$TARGET = xX86 || test x$TARGET
+     ])
+     if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
+        AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1,
+ 	       [Define if your assembler supports .string.])
+     fi
  fi
  
  case "$target" in
 -     *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
 +     # Darwin 10 (OSX 10.6) and beyond allocate non-executable pages
 +     *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
         AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
                   [Cannot use malloc on this target, so, we revert to
                     alternative means])
+      ;;
+ esac
+ 
+ if test x$TARGET = xX86_64; then
+     AC_CACHE_CHECK([assembler supports unwind section type],
--- a/js/src/ctypes/patches-libffi/03-bug-712594.patch
+++ b/js/src/ctypes/patches-libffi/03-bug-712594.patch
@@ -1,19 +1,23 @@
 commit 5b9cd52784339a42e417174a55e310e214d435f9
 Author: Anthony Green <green@moxielogic.com>
 Date:   Mon Nov 22 15:19:57 2010 -0500
 
     win64-underscore patch
 
-diff --git a/aclocal.m4 b/aclocal.m4
-index 0ef4b09..4079f82 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -7364,6 +7364,811 @@ _LT_EOF
+diff --git a/js/src/ctypes/libffi/aclocal.m4 b/js/src/ctypes/libffi/aclocal.m4
+--- a/js/src/ctypes/libffi/aclocal.m4
++++ b/js/src/ctypes/libffi/aclocal.m4
+@@ -7359,16 +7359,821 @@ func_append ()
+   eval "$[1]=\$$[1]\$[2]"
+ }
+ 
+ _LT_EOF
+     ;;
    esac
  ])
  
 +# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*-
 +#
 +#   Copyright (C) 1999-2006, 2007, 2008 Free Software Foundation, Inc.
 +#   Written by Thomas Tanner, 1999
 +#
@@ -815,155 +819,254 @@ index 0ef4b09..4079f82 100644
 +# Old name:
 +AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE])
 +dnl aclocal-1.4 backwards compatibility:
 +dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], [])
 +
  # Helper functions for option handling.                    -*- Autoconf -*-
  #
  #   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-diff --git a/configure b/configure
-index da1cb4d..e086c65 100755
---- a/configure
-+++ b/configure
-@@ -795,6 +795,7 @@ FFI_DEBUG_FALSE
+ #   Written by Gary V. Vaughan, 2004
+ #
+ # This file is free software; the Free Software Foundation gives
+ # unlimited permission to copy and/or distribute it, with or without
+ # modifications, as long as this notice is preserved.
+diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure
+--- a/js/src/ctypes/libffi/configure
++++ b/js/src/ctypes/libffi/configure
+@@ -747,16 +747,17 @@ am__EXEEXT_TRUE
+ LTLIBOBJS
+ LIBOBJS
+ toolexeclibdir
+ toolexecdir
+ FFI_DEBUG_FALSE
  FFI_DEBUG_TRUE
  TARGETDIR
  TARGET
 +sys_symbol_underscore
  HAVE_LONG_DOUBLE
  ALLOCA
  PA64_HPUX_FALSE
-@@ -4782,13 +4783,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
+ PA64_HPUX_TRUE
+ PA_HPUX_FALSE
+ PA_HPUX_TRUE
+ PA_LINUX_FALSE
+ PA_LINUX_TRUE
+@@ -5045,23 +5046,23 @@ test -z "$NM" && NM=nm
+ 
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+ $as_echo_n "checking the name lister ($NM) interface... " >&6; }
+ if test "${lt_cv_nm_interface+set}" = set; then :
+   $as_echo_n "(cached) " >&6
  else
    lt_cv_nm_interface="BSD nm"
    echo "int some_variable = 0;" > conftest.$ac_ext
--  (eval echo "\"\$as_me:4785: $ac_compile\"" >&5)
-+  (eval echo "\"\$as_me:4786: $ac_compile\"" >&5)
+-  (eval echo "\"\$as_me:5053: $ac_compile\"" >&5)
++  (eval echo "\"\$as_me:5054: $ac_compile\"" >&5)
    (eval "$ac_compile" 2>conftest.err)
    cat conftest.err >&5
--  (eval echo "\"\$as_me:4788: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
-+  (eval echo "\"\$as_me:4789: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+-  (eval echo "\"\$as_me:5056: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
++  (eval echo "\"\$as_me:5057: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
    (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
    cat conftest.err >&5
--  (eval echo "\"\$as_me:4791: output\"" >&5)
-+  (eval echo "\"\$as_me:4792: output\"" >&5)
+-  (eval echo "\"\$as_me:5059: output\"" >&5)
++  (eval echo "\"\$as_me:5060: output\"" >&5)
    cat conftest.out >&5
    if $GREP 'External.*some_variable' conftest.out > /dev/null; then
      lt_cv_nm_interface="MS dumpbin"
-@@ -5994,7 +5995,7 @@ ia64-*-hpux*)
+   fi
+   rm -f conftest*
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+ $as_echo "$lt_cv_nm_interface" >&6; }
+@@ -6257,17 +6258,17 @@ ia64-*-hpux*)
+ 	HPUX_IA64_MODE="64"
+ 	;;
+     esac
+   fi
+   rm -rf conftest*
    ;;
  *-*-irix6*)
    # Find out which ABI we are using.
--  echo '#line 5997 "configure"' > conftest.$ac_ext
-+  echo '#line 5998 "configure"' > conftest.$ac_ext
-   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+-  echo '#line 6265 "configure"' > conftest.$ac_ext
++  echo '#line 6266 "configure"' > conftest.$ac_ext
+   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
    (eval $ac_compile) 2>&5
    ac_status=$?
-@@ -7847,11 +7848,11 @@ else
+   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+   test $ac_status = 0; }; then
+     if test "$lt_cv_prog_gnu_ld" = yes; then
+       case `/usr/bin/file conftest.$ac_objext` in
+ 	*32-bit*)
+@@ -7783,21 +7784,21 @@ else
+    # (2) before a word containing "conftest.", or (3) at the end.
+    # Note that $ac_compile itself does not contain backslashes and begins
+    # with a dollar sign (not a hyphen), so the echo should work correctly.
+    # The option is referenced via a variable to avoid confusing sed.
+    lt_compile=`echo "$ac_compile" | $SED \
     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
     -e 's:$: $lt_compiler_flag:'`
--   (eval echo "\"\$as_me:7850: $lt_compile\"" >&5)
-+   (eval echo "\"\$as_me:7851: $lt_compile\"" >&5)
+-   (eval echo "\"\$as_me:7791: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:7792: $lt_compile\"" >&5)
     (eval "$lt_compile" 2>conftest.err)
     ac_status=$?
     cat conftest.err >&5
--   echo "$as_me:7854: \$? = $ac_status" >&5
-+   echo "$as_me:7855: \$? = $ac_status" >&5
+-   echo "$as_me:7795: \$? = $ac_status" >&5
++   echo "$as_me:7796: \$? = $ac_status" >&5
     if (exit $ac_status) && test -s "$ac_outfile"; then
       # The compiler can only warn and ignore the option if not recognized
       # So say no if there are warnings other than the usual output.
-@@ -8186,11 +8187,11 @@ else
+      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+        lt_cv_prog_compiler_rtti_exceptions=yes
+      fi
+@@ -8122,21 +8123,21 @@ else
+    # (2) before a word containing "conftest.", or (3) at the end.
+    # Note that $ac_compile itself does not contain backslashes and begins
+    # with a dollar sign (not a hyphen), so the echo should work correctly.
+    # The option is referenced via a variable to avoid confusing sed.
+    lt_compile=`echo "$ac_compile" | $SED \
     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
     -e 's:$: $lt_compiler_flag:'`
--   (eval echo "\"\$as_me:8189: $lt_compile\"" >&5)
-+   (eval echo "\"\$as_me:8190: $lt_compile\"" >&5)
+-   (eval echo "\"\$as_me:8130: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:8131: $lt_compile\"" >&5)
     (eval "$lt_compile" 2>conftest.err)
     ac_status=$?
     cat conftest.err >&5
--   echo "$as_me:8193: \$? = $ac_status" >&5
-+   echo "$as_me:8194: \$? = $ac_status" >&5
+-   echo "$as_me:8134: \$? = $ac_status" >&5
++   echo "$as_me:8135: \$? = $ac_status" >&5
     if (exit $ac_status) && test -s "$ac_outfile"; then
       # The compiler can only warn and ignore the option if not recognized
       # So say no if there are warnings other than the usual output.
-@@ -8291,11 +8292,11 @@ else
+      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+      $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+      if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+        lt_cv_prog_compiler_pic_works=yes
+      fi
+@@ -8227,21 +8228,21 @@ else
+    # Insert the option either (1) after the last *FLAGS variable, or
+    # (2) before a word containing "conftest.", or (3) at the end.
+    # Note that $ac_compile itself does not contain backslashes and begins
+    # with a dollar sign (not a hyphen), so the echo should work correctly.
+    lt_compile=`echo "$ac_compile" | $SED \
     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
     -e 's:$: $lt_compiler_flag:'`
--   (eval echo "\"\$as_me:8294: $lt_compile\"" >&5)
-+   (eval echo "\"\$as_me:8295: $lt_compile\"" >&5)
+-   (eval echo "\"\$as_me:8235: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:8236: $lt_compile\"" >&5)
     (eval "$lt_compile" 2>out/conftest.err)
     ac_status=$?
     cat out/conftest.err >&5
--   echo "$as_me:8298: \$? = $ac_status" >&5
-+   echo "$as_me:8299: \$? = $ac_status" >&5
+-   echo "$as_me:8239: \$? = $ac_status" >&5
++   echo "$as_me:8240: \$? = $ac_status" >&5
     if (exit $ac_status) && test -s out/conftest2.$ac_objext
     then
       # The compiler can only warn and ignore the option if not recognized
-@@ -8346,11 +8347,11 @@ else
+      # So say no if there are warnings
+      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+        lt_cv_prog_compiler_c_o=yes
+@@ -8282,21 +8283,21 @@ else
+    # Insert the option either (1) after the last *FLAGS variable, or
+    # (2) before a word containing "conftest.", or (3) at the end.
+    # Note that $ac_compile itself does not contain backslashes and begins
+    # with a dollar sign (not a hyphen), so the echo should work correctly.
+    lt_compile=`echo "$ac_compile" | $SED \
     -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
     -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
     -e 's:$: $lt_compiler_flag:'`
--   (eval echo "\"\$as_me:8349: $lt_compile\"" >&5)
-+   (eval echo "\"\$as_me:8350: $lt_compile\"" >&5)
+-   (eval echo "\"\$as_me:8290: $lt_compile\"" >&5)
++   (eval echo "\"\$as_me:8291: $lt_compile\"" >&5)
     (eval "$lt_compile" 2>out/conftest.err)
     ac_status=$?
     cat out/conftest.err >&5
--   echo "$as_me:8353: \$? = $ac_status" >&5
-+   echo "$as_me:8354: \$? = $ac_status" >&5
+-   echo "$as_me:8294: \$? = $ac_status" >&5
++   echo "$as_me:8295: \$? = $ac_status" >&5
     if (exit $ac_status) && test -s out/conftest2.$ac_objext
     then
       # The compiler can only warn and ignore the option if not recognized
-@@ -11149,7 +11150,7 @@ else
+      # So say no if there are warnings
+      $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+      $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+      if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+        lt_cv_prog_compiler_c_o=yes
+@@ -10652,17 +10653,17 @@ if test "${lt_cv_dlopen_self+set}" = set
+   $as_echo_n "(cached) " >&6
+ else
+   	  if test "$cross_compiling" = yes; then :
+   lt_cv_dlopen_self=cross
+ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11152 "configure"
-+#line 11153 "configure"
+-#line 10660 "configure"
++#line 10661 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -11245,7 +11246,7 @@ else
+ #include <dlfcn.h>
+ #endif
+ 
+ #include <stdio.h>
+ 
+@@ -10748,17 +10749,17 @@ if test "${lt_cv_dlopen_self_static+set}
+   $as_echo_n "(cached) " >&6
+ else
+   	  if test "$cross_compiling" = yes; then :
+   lt_cv_dlopen_self_static=cross
+ else
    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
    lt_status=$lt_dlunknown
    cat > conftest.$ac_ext <<_LT_EOF
--#line 11248 "configure"
-+#line 11249 "configure"
+-#line 10756 "configure"
++#line 10757 "configure"
  #include "confdefs.h"
  
  #if HAVE_DLFCN_H
-@@ -14647,6 +14648,63 @@ _ACEOF
+ #include <dlfcn.h>
+ #endif
+ 
+ #include <stdio.h>
+ 
+@@ -12356,16 +12357,71 @@ fi
+ $as_echo "$libffi_cv_as_string_pseudo_op" >&6; }
+     if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
+ 
+ $as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h
+ 
      fi
  fi
  
 +if test x$TARGET = xX86_WIN64; then
-+    { $as_echo "$as_me:$LINENO: checking for _ prefix in compiled symbols" >&5
++    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _ prefix in compiled symbols" >&5
 +$as_echo_n "checking for _ prefix in compiled symbols... " >&6; }
-+if test "${lt_cv_sys_symbol_underscore+set}" = set; then
++if test "${lt_cv_sys_symbol_underscore+set}" = set; then :
 +  $as_echo_n "(cached) " >&6
 +else
 +  lt_cv_sys_symbol_underscore=no
 +  cat > conftest.$ac_ext <<_LT_EOF
 +void nm_test_func(){}
 +int main(){nm_test_func;return 0;}
 +_LT_EOF
-+  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
++  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
 +  (eval $ac_compile) 2>&5
 +  ac_status=$?
-+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); }; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; }; then
 +    # Now try to grab the symbols.
 +    ac_nlist=conftest.nm
-+    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\"") >&5
++    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\""; } >&5
 +  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5
 +  ac_status=$?
-+  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-+  (exit $ac_status); } && test -s "$ac_nlist"; then
++  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
++  test $ac_status = 0; } && test -s "$ac_nlist"; then
 +      # See whether the symbols have a leading underscore.
 +      if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then
 +        lt_cv_sys_symbol_underscore=yes
 +      else
 +        if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then
 +	  :
 +        else
 +	  echo "configure: cannot find nm_test_func in $ac_nlist" >&5
@@ -974,56 +1077,72 @@ index da1cb4d..e086c65 100755
 +    fi
 +  else
 +    echo "configure: failed program was:" >&5
 +    cat conftest.c >&5
 +  fi
 +  rm -rf conftest*
 +
 +fi
-+{ $as_echo "$as_me:$LINENO: result: $lt_cv_sys_symbol_underscore" >&5
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_symbol_underscore" >&5
 +$as_echo "$lt_cv_sys_symbol_underscore" >&6; }
 +  sys_symbol_underscore=$lt_cv_sys_symbol_underscore
 +
 +
 +    if test "x$sys_symbol_underscore" = xyes; then
 +
-+cat >>confdefs.h <<\_ACEOF
-+#define SYMBOL_UNDERSCORE 1
-+_ACEOF
++$as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h
 +
 +    fi
 +fi
 +
  case "$target" in
-      *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+      # Darwin 10 (OSX 10.6) and beyond allocate non-executable pages
+      *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+ 
+ $as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
  
-diff --git a/configure.ac b/configure.ac
-index a94bd26..c7cead8 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -314,6 +314,13 @@ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64
+      ;;
+ esac
+diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac
+--- a/js/src/ctypes/libffi/configure.ac
++++ b/js/src/ctypes/libffi/configure.ac
+@@ -310,16 +310,23 @@ if test x$TARGET = xX86 || test x$TARGET
+ 		       [libffi_cv_as_string_pseudo_op=no])
+     ])
+     if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
+        AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1,
+ 	       [Define if your assembler supports .string.])
      fi
  fi
  
 +if test x$TARGET = xX86_WIN64; then
 +    LT_SYS_SYMBOL_USCORE
 +    if test "x$sys_symbol_underscore" = xyes; then
 +        AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.])
 +    fi
 +fi
 +
  case "$target" in
-      *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
+      # Darwin 10 (OSX 10.6) and beyond allocate non-executable pages
+      *-apple-darwin1* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
         AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
-diff --git a/src/x86/win64.S b/src/x86/win64.S
-index 6e91818..fcdb270 100644
---- a/src/x86/win64.S
-+++ b/src/x86/win64.S
-@@ -232,10 +232,18 @@ ret_void$:
+                  [Cannot use malloc on this target, so, we revert to
+                    alternative means])
+      ;;
+ esac
+diff --git a/js/src/ctypes/libffi/src/x86/win64.S b/js/src/ctypes/libffi/src/x86/win64.S
+--- a/js/src/ctypes/libffi/src/x86/win64.S
++++ b/js/src/ctypes/libffi/src/x86/win64.S
+@@ -227,32 +227,40 @@ ret_void$:
+ 	xor	rax, rax
+ 
+ 	lea	rsp, QWORD PTR [rbp+16]
+ 	pop	rbp
+ 	ret	0
  ffi_call_win64 ENDP
  _TEXT	ENDS
  END
 -#else        
 +
 +#else
 +
 +#ifdef SYMBOL_UNDERSCORE
@@ -1034,39 +1153,58 @@ index 6e91818..fcdb270 100644
 +
  .text
  
 -.extern _ffi_closure_win64_inner
 +.extern SYMBOL_NAME(ffi_closure_win64_inner)
  
  # ffi_closure_win64 will be called with these registers set:
  #    rax points to 'closure'
-@@ -246,8 +254,8 @@ END
+ #    r11 contains a bit mask that specifies which of the
+ #    first four parameters are float or double
+ #
+ # It must move the parameters passed in registers to their stack location,
  # call ffi_closure_win64_inner for the actual work, then return the result.
  # 
  	.balign 16
 -        .globl _ffi_closure_win64	
 -_ffi_closure_win64:     
 +        .globl SYMBOL_NAME(ffi_closure_win64)
 +SYMBOL_NAME(ffi_closure_win64):
  	# copy register arguments onto stack
  	test	$1,%r11
  	jne	.Lfirst_is_float	
-@@ -287,7 +295,7 @@ _ffi_closure_win64:
+ 	mov	%rcx, 8(%rsp)
+ 	jmp	.Lsecond
+ .Lfirst_is_float:
+ 	movlpd	%xmm0, 8(%rsp)
+ 
+@@ -282,27 +290,27 @@ END
+ 
+ .Ldone:
+ #.ALLOCSTACK 40
+ 	sub	$40, %rsp
+ #.ENDPROLOG
  	mov	%rax, %rcx	# context is first parameter
  	mov	%rsp, %rdx	# stack is second parameter
  	add	$48, %rdx	# point to start of arguments
 -	mov	$_ffi_closure_win64_inner, %rax
 +	mov	$SYMBOL_NAME(ffi_closure_win64_inner), %rax
  	callq	*%rax		# call the real closure function
  	add	$40, %rsp
  	movq	%rax, %xmm0	# If the closure returned a float,
-@@ -296,8 +304,8 @@ _ffi_closure_win64:
+                                 # ffi_closure_win64_inner wrote it to rax
+ 	retq
  .ffi_closure_win64_end:
  
  	.balign 16
 -        .globl	_ffi_call_win64
 -_ffi_call_win64:        
 +        .globl	SYMBOL_NAME(ffi_call_win64)
 +SYMBOL_NAME(ffi_call_win64):
          # copy registers onto stack
  	mov	%r9,32(%rsp)
  	mov	%r8,24(%rsp)
+ 	mov	%rdx,16(%rsp)
+ 	mov	%rcx,8(%rsp)
+         #.PUSHREG rbp
+ 	push	%rbp
+         #.ALLOCSTACK 48
new file mode 100644
--- /dev/null
+++ b/js/src/ctypes/patches-libffi/05-bug-644136.patch
@@ -0,0 +1,31 @@
+# HG changeset patch
+# User Siarhei Siamashka <siarhei.siamashka@gmail.com>
+# Date 1314529402 -3600
+# Node ID 0be4a94258c28b97a7e6e87b099359c759941b22
+# Parent  f1cf848b1ff22bad8980b673cc4410a21c8bdf28
+Bug 644136 - Add missing fpu directive to fix libffi build on ARM hardfloat systems; r=bsmedberg
+
+diff --git a/js/src/ctypes/libffi/src/arm/sysv.S b/js/src/ctypes/libffi/src/arm/sysv.S
+--- a/js/src/ctypes/libffi/src/arm/sysv.S
++++ b/js/src/ctypes/libffi/src/arm/sysv.S
+@@ -224,16 +224,20 @@ ARM_FUNC_START ffi_call_SYSV
+ LSYM(Lepilogue):
+ 	RETLDM	"r0-r3,fp"
+ 
+ .ffi_call_SYSV_end:
+ 	UNWIND .fnend
+         .size    CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV)
+ 
+ 
++/* Below are VFP hard-float ABI call and closure implementations.
++   Add VFP FPU directive here. */
++	.fpu	vfp
++
+ 	@ r0:   fn
+ 	@ r1:   &ecif
+ 	@ r2:   cif->bytes
+ 	@ r3:   fig->flags
+ 	@ sp+0: ecif.rvalue
+ 
+ ARM_FUNC_START ffi_call_VFP
+ 	@ Save registers