diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure index 63567a8847f9..ffdf96cee3dc 100755 --- a/js/src/ctypes/libffi/configure +++ b/js/src/ctypes/libffi/configure @@ -12427,16 +12427,32 @@ $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 -$as_echo_n "checking assembler supports unwind section type... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking toolchain supports unwind section type" >&5 +$as_echo_n "checking toolchain supports unwind section type... " >&6; } if test "${libffi_cv_as_x86_64_unwind_section_type+set}" = set; then : $as_echo_n "(cached) " >&6 else - libffi_cv_as_x86_64_unwind_section_type=yes - echo '.section .eh_frame,"a",@unwind' > conftest.s - if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then - libffi_cv_as_x86_64_unwind_section_type=no + cat > conftest1.s << EOF +.text +.globl foo +foo: +jmp bar +.section .eh_frame,"a",@unwind +bar: +EOF + + cat > conftest2.c << EOF +extern void foo(); +int main(){foo();} +EOF + + libffi_cv_as_x86_64_unwind_section_type=no + # we ensure that we can compile _and_ link an assembly file containing an @unwind section + # since the compiler can support it and not the linker (ie old binutils) + if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \ + $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then + libffi_cv_as_x86_64_unwind_section_type=yes fi fi diff --git a/js/src/ctypes/libffi/configure.ac b/js/src/ctypes/libffi/configure.ac index 6694ac3b62fc..6f6a13fd1ac5 100644 --- a/js/src/ctypes/libffi/configure.ac +++ b/js/src/ctypes/libffi/configure.ac @@ -332,12 +332,28 @@ case "$target" in esac if test x$TARGET = xX86_64; then - AC_CACHE_CHECK([assembler supports unwind section type], + AC_CACHE_CHECK([toolchain supports unwind section type], libffi_cv_as_x86_64_unwind_section_type, [ - libffi_cv_as_x86_64_unwind_section_type=yes - echo '.section .eh_frame,"a",@unwind' > conftest.s - if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then - libffi_cv_as_x86_64_unwind_section_type=no + cat > conftest1.s << EOF +.text +.globl foo +foo: +jmp bar +.section .eh_frame,"a",@unwind +bar: +EOF + + cat > conftest2.c << EOF +extern void foo(); +int main(){foo();} +EOF + + libffi_cv_as_x86_64_unwind_section_type=no + # we ensure that we can compile _and_ link an assembly file containing an @unwind section + # since the compiler can support it and not the linker (ie old binutils) + if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \ + $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then + libffi_cv_as_x86_64_unwind_section_type=yes fi ]) if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then diff --git a/js/src/ctypes/patches-libffi/06-bug-778414.patch b/js/src/ctypes/patches-libffi/06-bug-778414.patch new file mode 100644 index 000000000000..f40164631dc5 --- /dev/null +++ b/js/src/ctypes/patches-libffi/06-bug-778414.patch @@ -0,0 +1,99 @@ +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 +@@ -12422,26 +12422,42 @@ case "$target" in + *-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 +-$as_echo_n "checking assembler supports unwind section type... " >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking toolchain supports unwind section type" >&5 ++$as_echo_n "checking toolchain supports unwind section type... " >&6; } + if test "${libffi_cv_as_x86_64_unwind_section_type+set}" = set; then : + $as_echo_n "(cached) " >&6 + else + +- libffi_cv_as_x86_64_unwind_section_type=yes +- echo '.section .eh_frame,"a",@unwind' > conftest.s +- if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then +- libffi_cv_as_x86_64_unwind_section_type=no ++ cat > conftest1.s << EOF ++.text ++.globl foo ++foo: ++jmp bar ++.section .eh_frame,"a",@unwind ++bar: ++EOF ++ ++ cat > conftest2.c << EOF ++extern void foo(); ++int main(){foo();} ++EOF ++ ++ libffi_cv_as_x86_64_unwind_section_type=no ++ # we ensure that we can compile _and_ link an assembly file containing an @unwind section ++ # since the compiler can support it and not the linker (ie old binutils) ++ if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \ ++ $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then ++ libffi_cv_as_x86_64_unwind_section_type=yes + fi + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_64_unwind_section_type" >&5 + $as_echo "$libffi_cv_as_x86_64_unwind_section_type" >&6; } + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + + $as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h +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 +@@ -327,22 +327,38 @@ case "$target" in + *-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], ++ AC_CACHE_CHECK([toolchain supports unwind section type], + libffi_cv_as_x86_64_unwind_section_type, [ +- libffi_cv_as_x86_64_unwind_section_type=yes +- echo '.section .eh_frame,"a",@unwind' > conftest.s +- if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then +- libffi_cv_as_x86_64_unwind_section_type=no ++ cat > conftest1.s << EOF ++.text ++.globl foo ++foo: ++jmp bar ++.section .eh_frame,"a",@unwind ++bar: ++EOF ++ ++ cat > conftest2.c << EOF ++extern void foo(); ++int main(){foo();} ++EOF ++ ++ libffi_cv_as_x86_64_unwind_section_type=no ++ # we ensure that we can compile _and_ link an assembly file containing an @unwind section ++ # since the compiler can support it and not the linker (ie old binutils) ++ if $CC -Wa,--fatal-warnings $CFLAGS -c conftest1.s > /dev/null 2>&1 && \ ++ $CC conftest2.c conftest1.o > /dev/null 2>&1 ; then ++ libffi_cv_as_x86_64_unwind_section_type=yes + fi + ]) + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, + [Define if your assembler supports unwind section type.]) + fi + fi +