aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.7/libffi
diff options
context:
space:
mode:
authorPavel Chupin <pavel.v.chupin@intel.com>2012-11-27 14:09:50 +0400
committerPavel Chupin <pavel.v.chupin@intel.com>2013-04-18 16:50:12 +0400
commit9e1f9b3eacb51a67e675cd1195c472215fb16373 (patch)
treeaf3f97ee1874e13a5fe5ba61058aba045bbad279 /gcc-4.7/libffi
parent5d65342898686feb3faceb3beb10529501d67b48 (diff)
downloadtoolchain_gcc-9e1f9b3eacb51a67e675cd1195c472215fb16373.tar.gz
toolchain_gcc-9e1f9b3eacb51a67e675cd1195c472215fb16373.tar.bz2
toolchain_gcc-9e1f9b3eacb51a67e675cd1195c472215fb16373.zip
[4.7] x32: Backport x32 support into 4.7
This patch contains all gcc changes required to build x32 compiler. They are backported from 4.8/trunk. Change-Id: I923f639c1f0cee5812b0f555a39bab0bd0723865 Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Diffstat (limited to 'gcc-4.7/libffi')
-rw-r--r--gcc-4.7/libffi/ChangeLog.x3227
-rwxr-xr-xgcc-4.7/libffi/configure13
-rw-r--r--gcc-4.7/libffi/src/x86/ffi64.c10
-rw-r--r--gcc-4.7/libffi/src/x86/ffitarget.h7
4 files changed, 50 insertions, 7 deletions
diff --git a/gcc-4.7/libffi/ChangeLog.x32 b/gcc-4.7/libffi/ChangeLog.x32
new file mode 100644
index 000000000..2cbed6487
--- /dev/null
+++ b/gcc-4.7/libffi/ChangeLog.x32
@@ -0,0 +1,27 @@
+2012-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2012-07-18 H.J. Lu <hongjiu.lu@intel.com>
+
+ * src/x86/ffitarget.h: Check __ILP32__ instead of __LP64__ for
+ x32.
+ (FFI_SIZEOF_JAVA_RAW): Defined to 4 for x32.
+
+2012-05-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ Backported from mainline
+ 2012-03-03 H.J. Lu <hongjiu.lu@intel.com>
+
+ * src/x86/ffi64.c (ffi_call): Cast the return value to unsigned
+ long.
+ (ffi_prep_closure_loc): Cast to 64bit address in trampoline.
+ (ffi_closure_unix64_inner): Cast return pointer to unsigned long
+ first.
+
+ * src/x86/ffitarget.h (FFI_SIZEOF_ARG): Defined to 8 for x32.
+ (ffi_arg): Set to unsigned long long for x32.
+ (ffi_sarg): Set to long long for x32.
+
+2012-05-16 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
diff --git a/gcc-4.7/libffi/configure b/gcc-4.7/libffi/configure
index 159149539..28ed5131c 100755
--- a/gcc-4.7/libffi/configure
+++ b/gcc-4.7/libffi/configure
@@ -6282,7 +6282,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
LD="${LD-ld} -m elf_i386_fbsd"
;;
x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
+ case `/usr/bin/file conftest.o` in
+ *x86-64*)
+ LD="${LD-ld} -m elf32_x86_64"
+ ;;
+ *)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ esac
;;
ppc64-*linux*|powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
@@ -10766,7 +10773,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10769 "configure"
+#line 10776 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10872,7 +10879,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10875 "configure"
+#line 10882 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc-4.7/libffi/src/x86/ffi64.c b/gcc-4.7/libffi/src/x86/ffi64.c
index bd907d720..41c4e776b 100644
--- a/gcc-4.7/libffi/src/x86/ffi64.c
+++ b/gcc-4.7/libffi/src/x86/ffi64.c
@@ -426,7 +426,7 @@ ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
/* If the return value is passed in memory, add the pointer as the
first integer argument. */
if (ret_in_memory)
- reg_args->gpr[gprcount++] = (long) rvalue;
+ reg_args->gpr[gprcount++] = (unsigned long) rvalue;
avn = cif->nargs;
arg_types = cif->arg_types;
@@ -501,9 +501,11 @@ ffi_prep_closure_loc (ffi_closure* closure,
tramp = (volatile unsigned short *) &closure->tramp[0];
tramp[0] = 0xbb49; /* mov <code>, %r11 */
- *(void * volatile *) &tramp[1] = ffi_closure_unix64;
+ *((unsigned long long * volatile) &tramp[1])
+ = (unsigned long) ffi_closure_unix64;
tramp[5] = 0xba49; /* mov <data>, %r10 */
- *(void * volatile *) &tramp[6] = codeloc;
+ *((unsigned long long * volatile) &tramp[6])
+ = (unsigned long) codeloc;
/* Set the carry bit iff the function uses any sse registers.
This is clc or stc, together with the first byte of the jmp. */
@@ -542,7 +544,7 @@ ffi_closure_unix64_inner(ffi_closure *closure, void *rvalue,
{
/* The return value goes in memory. Arrange for the closure
return value to go directly back to the original caller. */
- rvalue = (void *) reg_args->gpr[gprcount++];
+ rvalue = (void *) (unsigned long) reg_args->gpr[gprcount++];
/* We don't have to do anything in asm for the return. */
ret = FFI_TYPE_VOID;
}
diff --git a/gcc-4.7/libffi/src/x86/ffitarget.h b/gcc-4.7/libffi/src/x86/ffitarget.h
index dfecd1b3c..f9548c609 100644
--- a/gcc-4.7/libffi/src/x86/ffitarget.h
+++ b/gcc-4.7/libffi/src/x86/ffitarget.h
@@ -53,9 +53,16 @@ typedef unsigned long long ffi_arg;
typedef long long ffi_sarg;
#endif
#else
+#if defined __x86_64__ && defined __ILP32__
+#define FFI_SIZEOF_ARG 8
+#define FFI_SIZEOF_JAVA_RAW 4
+typedef unsigned long long ffi_arg;
+typedef long long ffi_sarg;
+#else
typedef unsigned long ffi_arg;
typedef signed long ffi_sarg;
#endif
+#endif
typedef enum ffi_abi {
FFI_FIRST_ABI = 0,