diff --git a/src/foreign/gcc/config/override.m4 b/src/foreign/gcc/config/override.m4 index 9bb149620c..0607594f50 100644 --- a/src/foreign/gcc/config/override.m4 +++ b/src/foreign/gcc/config/override.m4 @@ -30,7 +30,7 @@ m4_copy([_AC_PREREQ], [AC_PREREQ]) dnl Ensure exactly this Autoconf version is used m4_ifndef([_GCC_AUTOCONF_VERSION], - [m4_define([_GCC_AUTOCONF_VERSION], [2.59])]) + [m4_define([_GCC_AUTOCONF_VERSION], [2.61])]) dnl Test for the exact version when AC_INIT is expanded. dnl This allows to update the tree in steps (for testing) diff --git a/src/foreign/gcc/libffi/configure b/src/foreign/gcc/libffi/configure index 1d51dad5c4..f52eea347a 100755 --- a/src/foreign/gcc/libffi/configure +++ b/src/foreign/gcc/libffi/configure @@ -3862,7 +3862,7 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 else eval ac_cv_prog_cc_${ac_cc}_c_o=no fi -rm -f core conftest* +rm -f -r core conftest* fi if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then @@ -6275,7 +6275,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_header_stdc=no fi -rm -f conftest* +rm -f -r conftest* fi @@ -6296,7 +6296,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_header_stdc=no fi -rm -f conftest* +rm -f -r conftest* fi @@ -11528,7 +11528,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_header_stdc=no fi -rm -f conftest* +rm -f -r conftest* fi @@ -11549,7 +11549,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_header_stdc=no fi -rm -f conftest* +rm -f -r conftest* fi @@ -11906,7 +11906,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_os_cray=no fi -rm -f conftest* +rm -f -r conftest* fi { echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5 @@ -13349,6 +13349,31 @@ _ACEOF fi fi +if test x$TARGET = xX86 || test x$TARGET = xX86_64; then + { echo "$as_me:$LINENO: checking assembler supports pc rel relocs" >&5 +echo $ECHO_N "checking assembler supports pc rel relocs... $ECHO_C" >&6; } +if test "${libffi_cv_as_x86_atrel+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + libffi_cv_as_x86_atrel=yes + echo '.text; foo: nop; .data; .long foo at rel; .text' > conftest.s + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_atrel=no + fi + +fi +{ echo "$as_me:$LINENO: result: $libffi_cv_as_x86_atrel" >&5 +echo "${ECHO_T}$libffi_cv_as_x86_atrel" >&6; } + if test "x$libffi_cv_as_x86_atrel" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AS_X86_ATREL 1 +_ACEOF + + fi +fi + { echo "$as_me:$LINENO: checking whether .eh_frame section should be read-only" >&5 echo $ECHO_N "checking whether .eh_frame section should be read-only... $ECHO_C" >&6; } if test "${libffi_cv_ro_eh_frame+set}" = set; then diff --git a/src/foreign/gcc/libffi/configure.ac b/src/foreign/gcc/libffi/configure.ac index 88e410de96..93d3ec82e9 100644 --- a/src/foreign/gcc/libffi/configure.ac +++ b/src/foreign/gcc/libffi/configure.ac @@ -240,6 +240,21 @@ if test x$TARGET = xSPARC; then fi fi +if test x$TARGET = xX86 || test x$TARGET = xX86_64; then + AC_CACHE_CHECK([assembler supports pc rel relocs], + libffi_cv_as_x86_atrel, [ + libffi_cv_as_x86_atrel=no + echo '.text; foo: nop; .data; .long foo at rel; .text' > conftest.s + if $CC $CFLAGS -c conftest.s >/dev/null 2>&1; then + libffi_cv_as_x86_atrel=yes + fi + ]) + if test "x$libffi_cv_as_x86_atrel" = xyes; then + AC_DEFINE(HAVE_AS_X86_ATREL, 1, + [Define if your assembler supports "at rel" addresses.]) + fi +fi + AC_CACHE_CHECK([whether .eh_frame section should be read-only], libffi_cv_ro_eh_frame, [ libffi_cv_ro_eh_frame=no diff --git a/src/foreign/gcc/libffi/fficonfig.h.in b/src/foreign/gcc/libffi/fficonfig.h.in index e93cf8ae77..ee274a3007 100644 --- a/src/foreign/gcc/libffi/fficonfig.h.in +++ b/src/foreign/gcc/libffi/fficonfig.h.in @@ -37,6 +37,9 @@ */ #undef HAVE_AS_SPARC_UA_PCREL +/* Define if your assemble uses "at rel" for PIC */ +#undef HAVE_AS_X86_ATREL + /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H diff --git a/src/foreign/gcc/libffi/src/x86/sysv.S b/src/foreign/gcc/libffi/src/x86/sysv.S index 4e652207ed..18aaea2248 100644 --- a/src/foreign/gcc/libffi/src/x86/sysv.S +++ b/src/foreign/gcc/libffi/src/x86/sysv.S @@ -241,9 +241,20 @@ ffi_closure_SYSV: #if !FFI_NO_RAW_API +/* Precalculate for e.g. the Solaris 10/x86 assembler. */ +#if FFI_TRAMPOLINE_SIZE == 10 +#define RAW_CLOSURE_CIF_OFFSET 12 +#define RAW_CLOSURE_FUN_OFFSET 16 +#define RAW_CLOSURE_USER_DATA_OFFSET 20 +#elif FFI_TRAMPOLINE_SIZE == 24 +#define RAW_CLOSURE_CIF_OFFSET 24 +#define RAW_CLOSURE_FUN_OFFSET 28 +#define RAW_CLOSURE_USER_DATA_OFFSET 32 +#else #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#endif #define CIF_FLAGS_OFFSET 20 .align 4 @@ -342,7 +353,9 @@ ffi_closure_raw_SYSV: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ -#ifdef __PIC__ +#if defined HAVE_AS_X86_ATREL + .long .LFB1 at rel /* FDE initial location */ +#elif defined __PIC__ .long .LFB1-. /* FDE initial location */ #else .long .LFB1 /* FDE initial location */ @@ -367,7 +380,9 @@ ffi_closure_raw_SYSV: .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ -#ifdef __PIC__ +#if defined HAVE_AS_X86_ATREL + .long .LFB2 at rel /* FDE initial location */ +#elif defined __PIC__ .long .LFB2-. /* FDE initial location */ #else .long .LFB2 @@ -401,7 +416,9 @@ ffi_closure_raw_SYSV: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ -#ifdef __PIC__ +#if defined HAVE_AS_X86_ATREL + .long .LFB3 at rel /* FDE initial location */ +#elif defined __PIC__ .long .LFB3-. /* FDE initial location */ #else .long .LFB3 diff --git a/src/foreign/gcc/libffi/src/x86/unix64.S b/src/foreign/gcc/libffi/src/x86/unix64.S index a33888180b..3ee0991876 100644 --- a/src/foreign/gcc/libffi/src/x86/unix64.S +++ b/src/foreign/gcc/libffi/src/x86/unix64.S @@ -87,7 +87,6 @@ ffi_call_unix64: addq %r11, %r10 jmp *%r10 - .section .rodata .Lstore_table: .long .Lst_void-.Lstore_table /* FFI_TYPE_VOID */ .long .Lst_sint32-.Lstore_table /* FFI_TYPE_INT */ @@ -105,7 +104,6 @@ ffi_call_unix64: .long .Lst_struct-.Lstore_table /* FFI_TYPE_STRUCT */ .long .Lst_int64-.Lstore_table /* FFI_TYPE_POINTER */ - .text .align 2 .Lst_void: ret @@ -238,7 +236,6 @@ ffi_closure_unix64: addq %r11, %r10 jmp *%r10 - .section .rodata .Lload_table: .long .Lld_void-.Lload_table /* FFI_TYPE_VOID */ .long .Lld_int32-.Lload_table /* FFI_TYPE_INT */ @@ -256,7 +253,6 @@ ffi_closure_unix64: .long .Lld_struct-.Lload_table /* FFI_TYPE_STRUCT */ .long .Lld_int64-.Lload_table /* FFI_TYPE_POINTER */ - .text .align 2 .Lld_void: ret @@ -349,7 +345,11 @@ ffi_closure_unix64: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#if defined HAVE_AS_X86_ATREL + .long .LUW0 at rel /* FDE initial location */ +#else .long .LUW0-. /* FDE initial location */ +#endif .long .LUW4-.LUW0 /* FDE address range */ .uleb128 0x0 /* Augmentation size */ @@ -387,7 +387,11 @@ ffi_closure_unix64: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ +#if defined HAVE_AS_X86_ATREL + .long .LUW5 at rel /* FDE initial location */ +#else .long .LUW5-. /* FDE initial location */ +#endif .long .LUW9-.LUW5 /* FDE address range */ .uleb128 0x0 /* Augmentation size */