ctypes-commit Mailing List for ctypes (Page 52)
Brought to you by:
theller
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(8) |
May
(90) |
Jun
(143) |
Jul
(106) |
Aug
(94) |
Sep
(84) |
Oct
(163) |
Nov
(60) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(128) |
Feb
(79) |
Mar
(227) |
Apr
(192) |
May
(179) |
Jun
(41) |
Jul
(53) |
Aug
(103) |
Sep
(28) |
Oct
(38) |
Nov
(81) |
Dec
(17) |
2006 |
Jan
(184) |
Feb
(111) |
Mar
(188) |
Apr
(67) |
May
(58) |
Jun
(123) |
Jul
(73) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:56
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/CVS.gcc Added Files: Root Repository Entries.Log Entries Log Message: update from gcc cvs --- NEW FILE: Entries.Log --- A D/config//// A D/lib//// A D/libffi.call//// A D/libffi.special//// --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/testsuite --- NEW FILE: Entries --- /Makefile.am/1.1/Thu Sep 4 14:49:22 2003// /Makefile.in/1.12/Mon Apr 18 17:08:58 2005// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:49
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/config/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/config/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/testsuite/config --- NEW FILE: Entries --- /default.exp/1.1/Thu Sep 4 14:47:47 2003// D |
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.call In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/libffi.call Added Files: struct9.c struct8.c struct7.c struct6.c struct5.c struct4.c struct3.c struct2.c struct1.c strlen_win32.c strlen.c return_uc.c return_sc.c return_ll1.c return_ll.c pyobjc-tc.c promotion.c problem1.c nested_struct3.c nested_struct2.c nested_struct1.c nested_struct.c negint.c many_win32.c many.c float3.c float2.c float1.c float.c ffitest.h cls_ushort.c cls_ulonglong.c cls_uint.c cls_uchar.c cls_sshort.c cls_sint.c cls_schar.c cls_multi_ushortchar.c cls_multi_ushort.c cls_multi_uchar.c cls_multi_sshortchar.c cls_multi_sshort.c cls_multi_schar.c cls_float.c cls_double.c cls_align_uint64.c cls_align_uint32.c cls_align_uint16.c cls_align_sint64.c cls_align_sint32.c cls_align_sint16.c cls_align_pointer.c cls_align_longdouble.c cls_align_float.c cls_align_double.c cls_9byte2.c cls_9byte1.c cls_8byte.c cls_7byte.c cls_6byte.c cls_64byte.c cls_5byte.c cls_4byte.c cls_4_1byte.c cls_3byte2.c cls_3byte1.c cls_3_1byte.c cls_2byte.c cls_24byte.c cls_20byte1.c cls_20byte.c cls_1_1byte.c cls_19byte.c cls_18byte.c cls_16byte.c cls_12byte.c closure_fn5.c closure_fn4.c closure_fn3.c closure_fn2.c closure_fn1.c closure_fn0.c call.exp Log Message: update from gcc cvs --- NEW FILE: struct3.c --- /* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { int si; } test_structure_3; static test_structure_3 struct3(test_structure_3 ts) { ts.si = -(ts.si*2); return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; int compare_value; ffi_type ts3_type; ffi_type *ts3_type_elements[2]; ts3_type.size = 0; ts3_type.alignment = 0; ts3_type.type = FFI_TYPE_STRUCT; ts3_type.elements = ts3_type_elements; ts3_type_elements[0] = &ffi_type_sint; ts3_type_elements[1] = NULL; test_structure_3 ts3_arg; test_structure_3 *ts3_result = (test_structure_3 *) malloc (sizeof(test_structure_3)); args[0] = &ts3_type; values[0] = &ts3_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts3_type, args) == FFI_OK); ts3_arg.si = -123; compare_value = ts3_arg.si; ffi_call(&cif, FFI_FN(struct3), ts3_result, values); printf ("%d %d\n", ts3_result->si, -(compare_value*2)); CHECK(ts3_result->si == -(compare_value*2)); free (ts3_result); exit(0); } --- NEW FILE: struct4.c --- /* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { unsigned ui1; unsigned ui2; unsigned ui3; } test_structure_4; static test_structure_4 struct4(test_structure_4 ts) { ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts4_type; ffi_type *ts4_type_elements[4]; ts4_type.size = 0; ts4_type.alignment = 0; ts4_type.type = FFI_TYPE_STRUCT; test_structure_4 ts4_arg; ts4_type.elements = ts4_type_elements; ts4_type_elements[0] = &ffi_type_uint; ts4_type_elements[1] = &ffi_type_uint; ts4_type_elements[2] = &ffi_type_uint; ts4_type_elements[3] = NULL; /* This is a hack to get a properly aligned result buffer */ test_structure_4 *ts4_result = (test_structure_4 *) malloc (sizeof(test_structure_4)); args[0] = &ts4_type; values[0] = &ts4_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK); ts4_arg.ui1 = 2; ts4_arg.ui2 = 3; ts4_arg.ui3 = 4; ffi_call (&cif, FFI_FN(struct4), ts4_result, values); CHECK(ts4_result->ui3 == 2U * 3U * 4U); free (ts4_result); exit(0); } --- NEW FILE: cls_3byte2.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_3byte_1 { unsigned char a; unsigned short b; } cls_struct_3byte_1; cls_struct_3byte_1 cls_struct_3byte_fn1(struct cls_struct_3byte_1 a1, struct cls_struct_3byte_1 a2) { struct cls_struct_3byte_1 result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_3byte_gn1(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_3byte_1 a1, a2; a1 = *(struct cls_struct_3byte_1*)(args[0]); a2 = *(struct cls_struct_3byte_1*)(args[1]); *(cls_struct_3byte_1*)resp = cls_struct_3byte_fn1(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3byte_1 g_dbl = { 15, 125 }; struct cls_struct_3byte_1 f_dbl = { 9, 19 }; struct cls_struct_3byte_1 res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3byte_fn1), &res_dbl, args_dbl); /* { dg-output "15 125 9 19: 24 144" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn1, NULL) == FFI_OK); res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(pcl))(g_dbl, f_dbl); /* { dg-output "\n15 125 9 19: 24 144" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ exit(0); } --- NEW FILE: struct5.c --- /* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { char c1; char c2; } test_structure_5; static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2) { ts1.c1 += ts2.c1; ts1.c2 -= ts2.c2; return ts1; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts5_type; ffi_type *ts5_type_elements[3]; ts5_type.size = 0; ts5_type.alignment = 0; ts5_type.type = FFI_TYPE_STRUCT; ts5_type.elements = ts5_type_elements; ts5_type_elements[0] = &ffi_type_schar; ts5_type_elements[1] = &ffi_type_schar; ts5_type_elements[2] = NULL; test_structure_5 ts5_arg1, ts5_arg2; /* This is a hack to get a properly aligned result buffer */ test_structure_5 *ts5_result = (test_structure_5 *) malloc (sizeof(test_structure_5)); args[0] = &ts5_type; args[1] = &ts5_type; values[0] = &ts5_arg1; values[1] = &ts5_arg2; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK); ts5_arg1.c1 = 2; ts5_arg1.c2 = 6; ts5_arg2.c1 = 5; ts5_arg2.c2 = 3; ffi_call (&cif, FFI_FN(struct5), ts5_result, values); CHECK(ts5_result->c1 == 7); CHECK(ts5_result->c2 == 3); free (ts5_result); exit(0); } --- NEW FILE: cls_sshort.c --- /* Area: closure_call Purpose: Check return value sshort. Limitations: none. PR: none. Originator: <and...@gc...> 20031108 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static void cls_ret_sshort_fn(ffi_cif* cif,void* resp,void** args, void* userdata) { *(ffi_arg*)resp = *(signed short *)args[0]; printf("%d: %d\n",*(signed short *)args[0], *(ffi_arg*)resp); } typedef signed short (*cls_ret_sshort)(signed short); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; ffi_type * cl_arg_types[2]; signed short res; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cl_arg_types[0] = &ffi_type_sint16; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint16, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, cls_ret_sshort_fn, NULL) == FFI_OK); res = (*((cls_ret_sshort)pcl))(255); /* { dg-output "255: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } --- NEW FILE: return_uc.c --- /* Area: ffi_call Purpose: Check return value unsigned char. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static unsigned char return_uc(unsigned char uc) { return uc; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; unsigned char uc; args[0] = &ffi_type_uchar; values[0] = &uc; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uchar, args) == FFI_OK); for (uc = (unsigned char) '\x00'; uc < (unsigned char) '\xff'; uc++) { ffi_call(&cif, FFI_FN(return_uc), &rint, values); CHECK(rint == (signed int) uc); } exit(0); } --- NEW FILE: cls_align_sint16.c --- /* Area: ffi_call, closure_call Purpose: Check structure alignment of sint16. Limitations: none. PR: none. Originator: <ho...@ta...> 20031203 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; signed short b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint16; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } --- NEW FILE: cls_align_longdouble.c --- /* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: <ho...@ta...> 20031203 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; long double b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_align_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(pcl))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } --- NEW FILE: cls_multi_sshort.c --- /* Area: ffi_call, closure_call Purpose: Check passing of multiple signed short values. Limitations: none. PR: PR13221. Originator: <and...@gc...> 20031129 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" signed short test_func_fn(signed short a1, signed short a2) { signed short result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif, void *rval, void **avals, void *data) { signed short a1, a2; a1 = *(signed short *)avals[0]; a2 = *(signed short *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef signed short (*test_type)(signed short, signed short); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif a = 2; b = 32765; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_sshort; cl_arg_types[1] = &ffi_type_sshort; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sshort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 32765: 32767" } */ printf("res: %d\n", res_call); /* { dg-output "\nres: 32767" } */ CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); res_closure = (*((test_type)pcl))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ exit(0); } --- NEW FILE: cls_2byte.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_2byte { unsigned char a; unsigned char b; } cls_struct_2byte; cls_struct_2byte cls_struct_2byte_fn(struct cls_struct_2byte a1, struct cls_struct_2byte a2) { struct cls_struct_2byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_2byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_2byte a1, a2; a1 = *(struct cls_struct_2byte*)(args[0]); a2 = *(struct cls_struct_2byte*)(args[1]); *(cls_struct_2byte*)resp = cls_struct_2byte_fn(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_2byte g_dbl = { 12, 127 }; struct cls_struct_2byte f_dbl = { 1, 13 }; struct cls_struct_2byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_2byte_fn), &res_dbl, args_dbl); /* { dg-output "12 127 1 13: 13 140" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_2byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(pcl))(g_dbl, f_dbl); /* { dg-output "\n12 127 1 13: 13 140" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ exit(0); } --- NEW FILE: many.c --- /* Area: ffi_call Purpose: Check return value float, with many arguments Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include <float.h> static float many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) { #if 0 printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, (double) f11, (double) f12, (double) f13); #endif return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); } int main (void) { ffi_cif cif; ffi_type *args[13]; void *values[13]; float fa[13]; float f, ff; int i; for (i = 0; i < 13; i++) { args[i] = &ffi_type_float; values[i] = &fa[i]; fa[i] = (float) i; } /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, &ffi_type_float, args) == FFI_OK); ffi_call(&cif, FFI_FN(many), &f, values); ff = many(fa[0], fa[1], fa[2], fa[3], fa[4], fa[5], fa[6], fa[7], fa[8], fa[9], fa[10],fa[11],fa[12]); if (f - ff < FLT_EPSILON) exit(0); else abort(); } --- NEW FILE: cls_4byte.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_4byte { unsigned short a; unsigned short b; } cls_struct_4byte; cls_struct_4byte cls_struct_4byte_fn(struct cls_struct_4byte a1, struct cls_struct_4byte a2) { struct cls_struct_4byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_4byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_4byte a1, a2; a1 = *(struct cls_struct_4byte*)(args[0]); a2 = *(struct cls_struct_4byte*)(args[1]); *(cls_struct_4byte*)resp = cls_struct_4byte_fn(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_4byte g_dbl = { 127, 120 }; struct cls_struct_4byte f_dbl = { 12, 128 }; struct cls_struct_4byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_4byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 12 128: 139 248" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_4byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(pcl))(g_dbl, f_dbl); /* { dg-output "\n127 120 12 128: 139 248" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ exit(0); } --- NEW FILE: cls_64byte.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_64byte { double a; double b; double c; double d; double e; double f; double g; double h; } cls_struct_64byte; cls_struct_64byte cls_struct_64byte_fn(struct cls_struct_64byte b0, struct cls_struct_64byte b1, struct cls_struct_64byte b2, struct cls_struct_64byte b3) { struct cls_struct_64byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; printf("%g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h); return result; } static void cls_struct_64byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_64byte b0, b1, b2, b3; b0 = *(struct cls_struct_64byte*)(args[0]); b1 = *(struct cls_struct_64byte*)(args[1]); b2 = *(struct cls_struct_64byte*)(args[2]); b3 = *(struct cls_struct_64byte*)(args[3]); *(cls_struct_64byte*)resp = cls_struct_64byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[9]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; struct cls_struct_64byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_64byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_64byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte, cls_struct_64byte, cls_struct_64byte, cls_struct_64byte)) (pcl))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ exit(0); } --- NEW FILE: cls_3byte1.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_3byte { unsigned short a; unsigned char b; } cls_struct_3byte; cls_struct_3byte cls_struct_3byte_fn(struct cls_struct_3byte a1, struct cls_struct_3byte a2) { struct cls_struct_3byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_3byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_3byte a1, a2; a1 = *(struct cls_struct_3byte*)(args[0]); a2 = *(struct cls_struct_3byte*)(args[1]); *(cls_struct_3byte*)resp = cls_struct_3byte_fn(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3byte g_dbl = { 12, 119 }; struct cls_struct_3byte f_dbl = { 1, 15 }; struct cls_struct_3byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3byte_fn), &res_dbl, args_dbl); /* { dg-output "12 119 1 15: 13 134" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_3byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(pcl))(g_dbl, f_dbl); /* { dg-output "\n12 119 1 15: 13 134" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ exit(0); } --- NEW FILE: cls_schar.c --- /* Area: closure_call Purpose: Check return value schar. Limitations: none. PR: none. Originator: <and...@gc...> 20031108 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static void cls_ret_schar_fn(ffi_cif* cif,void* resp,void** args, void* userdata) { *(ffi_arg*)resp = *(signed char *)args[0]; printf("%d: %d\n",*(signed char *)args[0], *(ffi_arg*)resp); } typedef signed char (*cls_ret_schar)(signed char); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; ffi_type * cl_arg_types[2]; signed char res; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_schar, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, cls_ret_schar_fn, NULL) == FFI_OK); res = (*((cls_ret_schar)pcl))(127); /* { dg-output "127: 127" } */ printf("res: %d\n", res); /* { dg-output "\nres: 127" } */ exit(0); } --- NEW FILE: float1.c --- /* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include "float.h" static double dblit(float f) { return f/3.0; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float f; double d; args[0] = &ffi_type_float; values[0] = &f; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); f = 3.14159; ffi_call(&cif, FFI_FN(dblit), &d, values); /* These are not always the same!! Check for a reasonable delta */ CHECK(d - dblit(f) < DBL_EPSILON); exit(0); } --- NEW FILE: struct2.c --- /* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { double d1; double d2; } test_structure_2; static test_structure_2 struct2(test_structure_2 ts) { ts.d1--; ts.d2--; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; test_structure_2 ts2_arg; ffi_type ts2_type; ffi_type *ts2_type_elements[3]; ts2_type.size = 0; ts2_type.alignment = 0; ts2_type.type = FFI_TYPE_STRUCT; ts2_type.elements = ts2_type_elements; ts2_type_elements[0] = &ffi_type_double; ts2_type_elements[1] = &ffi_type_double; ts2_type_elements[2] = NULL; /* This is a hack to get a properly aligned result buffer */ test_structure_2 *ts2_result = (test_structure_2 *) malloc (sizeof(test_structure_2)); args[0] = &ts2_type; values[0] = &ts2_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK); ts2_arg.d1 = 5.55; ts2_arg.d2 = 6.66; printf ("%g\n", ts2_arg.d1); printf ("%g\n", ts2_arg.d2); ffi_call(&cif, FFI_FN(struct2), ts2_result, values); printf ("%g\n", ts2_result->d1); printf ("%g\n", ts2_result->d2); CHECK(ts2_result->d1 == 5.55 - 1); CHECK(ts2_result->d2 == 6.66 - 1); free (ts2_result); exit(0); } --- NEW FILE: cls_20byte.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_20byte { double a; double b; int c; } cls_struct_20byte; cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, struct cls_struct_20byte a2) { struct cls_struct_20byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%g %g %d %g %g %d: %g %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_20byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_20byte a1, a2; a1 = *(struct cls_struct_20byte*)(args[0]); a2 = *(struct cls_struct_20byte*)(args[1]); *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; struct cls_struct_20byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_uint32; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_20byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(pcl))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ exit(0); } --- NEW FILE: cls_9byte1.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Darwin/AIX do double-word alignment of the struct if the first element is a double. Check that it does not here. Limitations: none. PR: none. Originator: <and...@gc...> 20030914 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_9byte { int a; double b; } cls_struct_9byte; cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, struct cls_struct_9byte b2) { struct cls_struct_9byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; printf("%d %g %d %g: %d %g\n", b1.a, b1.b, b2.a, b2.b, result.a, result.b); return result; } static void cls_struct_9byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_9byte b1, b2; b1 = *(struct cls_struct_9byte*)(args[0]); b2 = *(struct cls_struct_9byte*)(args[1]); *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_9byte h_dbl = { 7, 8.0}; struct cls_struct_9byte j_dbl = { 1, 9.0}; struct cls_struct_9byte res_dbl; cls_struct_fields[0] = &ffi_type_uint32; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); /* { dg-output "7 8 1 9: 8 17" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_9byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(pcl))(h_dbl, j_dbl); /* { dg-output "\n7 8 1 9: 8 17" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ exit(0); } --- NEW FILE: cls_24byte.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_24byte { double a; double b; int c; float d; } cls_struct_24byte; cls_struct_24byte cls_struct_24byte_fn(struct cls_struct_24byte b0, struct cls_struct_24byte b1, struct cls_struct_24byte b2, struct cls_struct_24byte b3) { struct cls_struct_24byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; printf("%g %g %d %g %g %g %d %g %g %g %d %g %g %g %d %g: %g %g %d %g\n", b0.a, b0.b, b0.c, b0.d, b1.a, b1.b, b1.c, b1.d, b2.a, b2.b, b2.c, b2.d, b3.a, b3.b, b3.c, b2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_24byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_24byte b0, b1, b2, b3; b0 = *(struct cls_struct_24byte*)(args[0]); b1 = *(struct cls_struct_24byte*)(args[1]); b2 = *(struct cls_struct_24byte*)(args[2]); b3 = *(struct cls_struct_24byte*)(args[3]); *(cls_struct_24byte*)resp = cls_struct_24byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 }; struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 }; struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 }; struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 }; struct cls_struct_24byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_uint32; cls_struct_fields[3] = &ffi_type_float; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_24byte_fn), &res_dbl, args_dbl); /* { dg-output "9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ CHECK(ffi_prep_closure(pcl, &cif, cls_struct_24byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte, cls_struct_24byte, cls_struct_24byte, cls_struct_24byte)) (pcl))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ exit(0); } --- NEW FILE: closure_fn5.c --- /* Area: closure_call Purpose: Check multiple long long values passing. Exceed the limit of gpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: <and...@gc...> 20031026 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static void closure_test_fn5(ffi_cif* cif,void* resp,void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + (int)*(int *)args[10] + (int)*(unsigned long long *)args[11] + (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + *(int *)args[15] + (int)(long)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)*(unsigned long long *)args[1], (int)*(unsigned long long *)args[2], (int)*(unsigned long long *)args[3], (int)*(unsigned long long *)args[4], (int)*(unsigned long long *)args[5], (int)*(unsigned long long *)args[6], (int)*(unsigned long long *)args[7], (int)*(unsigned long long *)args[8], (int)*(unsigned long long *)args[9], (int)*(int *)args[10], (int)*(unsigned long long *)args[11], (int)*(unsigned long long *)args[12], (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], (int)(long)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; ffi_type * cl_arg_types[17]; int i, res; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif for (i = 0; i < 10; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[10] = &ffi_type_uint; for (i = 11; i < 15; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[15] = &ffi_type_uint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn5, (void *) 3 /* userdata */) == FFI_OK); res = (*((closure_test_type0)pcl)) (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL, 13LL, 19LL, 21LL, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } --- NEW FILE: cls_5byte.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_5byte { unsigned short a; unsigned short b; unsigned char c; } cls_struct_5byte; cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, struct cls_struct_5byte a2) { struct cls_struct_5byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_5byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_5byte a1, a2; a1 = *(struct cls_struct_5byte*)(args[0]); a2 = *(struct cls_struct_5byte*)(args[1]); *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); } int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_5byte g_dbl = { 127, 120, 1 }; struct cls_struct_5byte f_dbl = { 12, 128, 9 }; struct cls_struct_5byte res_dbl = { 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 12 128 9: 139 248 10" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 139 248 10" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; CHECK(ffi_prep_closure(pcl, &cif, cls_struct_5byte_gn, NULL) == FFI_OK); res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(pcl))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 139 248 10" } */ exit(0); } --- NEW FILE: cls_ulonglong.c --- /* Area: closure_call Purpose: Check return value long long. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static void cls_ret_ulonglong_fn(ffi_cif* cif,void* resp,void** args, void* userdata) { *(unsigned long long *)resp= *(unsigned long long *)args[0]; printf("%llu: %llu\n",*(unsigned long long *)args[0], *(unsigned long long *)resp); } typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; ffi_type * cl_arg_types[2]; unsigned long long res; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint64, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, cls_ret_ulonglong_fn, NULL) == FFI_OK); res = (*((cls_ret_ulonglong)pcl))(214LL); /* { dg-output "214: 214" } */ printf("res: %lld\n", res); /* { dg-output "\nres: 214" } */ res = (*((cls_ret_ulonglong)pcl))(9223372035854775808LL); /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ printf("res: %lld\n", res); /* { dg-output "\nres: 9223372035854775808" } */ exit(0); } --- NEW FILE: closure_fn2.c --- /* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static void closure_test_fn2(ffi_cif* cif,void* resp,void** args, void* userdata) { *(ffi_arg*)resp = (int)*(double *)args[0] +(int)(*(double *)args[1]) + (int)(*(double *)args[2]) + (int)*(double *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(double *)args[5]) + (int)*(double *)args[6] + (int)(*(int *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(float *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(double *)args[0], (int)(*(double *)args[1]), (int)(*(double *)args[2]), (int)*(double *)args[3], (int)(*(signed short *)args[4]), (int)(*(double *)args[5]), (int)*(double *)args[6], (int)(*(int *)args[7]), (int)(*(double*)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(float *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(long)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type2)(double, double, double, double, signed short, double, double, int, double, int, int, float, int, float, int, int); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = &ffi_type_double; cl_arg_types[2] = &ffi_type_double; cl_arg_types[3] = &ffi_type_double; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_double; cl_arg_types[6] = &ffi_type_double; cl_arg_types[7] = &ffi_type_uint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_uint; cl_arg_types[10] = &ffi_type_uint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_uint; cl_arg_types[13] = &ffi_type_float; cl_arg_types[14] = &ffi_type_uint; cl_arg_types[15] = &ffi_type_uint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn2, (void *) 3 /* userdata */) == FFI_OK); res = (*((closure_test_type2)pcl)) (1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13, 19.0, 21, 1); /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } --- NEW FILE: struct8.c --- /* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f1; float f2; float f3; float f4; } test_structure_8; static test_structure_8 struct8 (test_structure_8 ts) { ts.f1 += 1; ts.f2 += 1; ts.f3 += 1; ts.f4 += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts8_type; ffi_type *ts8_type_elements[5]; ts8_type.size = 0; ts8_type.alignment = 0; ts8_type.type = FFI_TYPE_STRUCT; ts8_type.elements = ts8_type_elements; ts8_type_elements[0] = &ffi_type_float; ts8_type_elements[1] = &ffi_type_float; ts8_type_elements[2] = &ffi_type_float; ts8_type_elements[3] = &ffi_type_float; ts8_type_elements[4] = NULL; test_structure_8 ts8_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_8 *ts8_result = (test_structure_8 *) malloc (sizeof(test_structure_8)); args[0] = &ts8_type; values[0] = &ts8_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts8_type, args) == FFI_OK); ts8_arg.f1 = 5.55f; ts8_arg.f2 = 55.5f; ts8_arg.f3 = -5.55f; ts8_arg.f4 = -55.5f; printf ("%g\n", ts8_arg.f1); printf ("%g\n", ts8_arg.f2); printf ("%g\n", ts8_arg.f3); printf ("%g\n", ts8_arg.f4); ffi_call(&cif, FFI_FN(struct8), ts8_result, values); printf ("%g\n", ts8_result->f1); printf ("%g\n", ts8_result->f2); printf ("%g\n", ts8_result->f3); printf ("%g\n", ts8_result->f4); CHECK(ts8_result->f1 == 5.55f + 1); CHECK(ts8_result->f2 == 55.5f + 1); CHECK(ts8_result->f3 == -5.55f + 1); CHECK(ts8_result->f4 == -55.5f + 1); free (ts8_result); exit(0); } --- NEW FILE: cls_multi_ushort.c --- /* Area: ffi_call, closure_call Purpose: Check passing of multiple unsigned short values. Limitations: none. PR: PR13221. Originator: <and...@gc...> 20031129 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" unsigned short test_func_fn(unsigned short a1, unsigned short a2) { unsigned short result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif, void *rval, void **avals, void *data) { unsigned short a1, a2; a1 = *(unsigned short *)avals[0]; a2 = *(unsigned short *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef unsigned short (*test_type)(unsigned short, unsigned short); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif a = 2; b = 32765; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_ushort; cl_arg_types[1] = &ffi_type_ushort; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_ushort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 32765: 32767" } */ printf("res: %d\n", res_call); /* { dg-output "\nres: 32767" } */ CHECK(ffi_prep_closure(pcl, &cif, test_func_gn, NULL) == FFI_OK); res_closure = (*((test_type)pcl))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ exit(0); } --- NEW FILE: closure_fn3.c --- /* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: <and...@gc...> 20030828 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static void closure_test_fn3(ffi_cif* cif,void* resp,void** args, void* userdata) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(float *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(float *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(float *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(float *)args[13]) + (int)(*(float *)args[14]) + *(int *)args[15] + (int)(long)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(float *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(float *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(float *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(float *)args[13]), (int)(*(float *)args[14]), *(int *)args[15], (int)(long)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type3)(float, float, float, float, float, float, float, float, double, int, float, float, int, float, float, int); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; #ifdef USING_MMAP pcl = allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_float; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_float; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_uint; cl_arg_types[10] = &ffi_type_float; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_uint; cl_arg_types[13] = &ffi_type_float; cl_arg_types[14] = &ffi_type_float; cl_arg_types[15] = &ffi_type_uint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn3, (void *) 3 /* userdata */) == FFI_OK); res = (*((closure_test_type3)pcl)) (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13, 19.19, 21.21, 1); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */ printf("res: %d\n",res); /* { dg-output "\nres: 135" } */ exit(0); } --- NEW FILE: cls_18byte.c --- /* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Double alignment check on darwin. Limitations: none. PR: none. Originator: <and...@gc...> 20030915 */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct cls_struct_18byte { double a; unsigned char b; unsigned char c; double d; } cls_struct_18byte; cls_struct_18byte cls_struct_18byte_fn(struct cls_struct_18byte a1, struct cls_struct_18byte a2) { struct cls_struct_18byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%g %d %d %g %g %d %d %g: %g %d %d %g\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_18byte_gn(ffi_cif* cif, void* resp, void** args, void* userdata) { struct cls_struct_18byte a1, a2; a1 = *(struct cls_struct_18byte*)(args[0]); a2 = *(struc... [truncated message content] |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:48
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/lib/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/lib/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/testsuite/lib --- NEW FILE: Entries --- /libffi-dg.exp/1.13/Wed Apr 20 10:59:26 2005// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:48
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.special In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/libffi.special Added Files: unwindtest.cc special.exp ffitestcxx.h Log Message: update from gcc cvs --- NEW FILE: unwindtest.cc --- /* Area: ffi_closure, unwind info Purpose: Check if the unwind information is passed correctly. Limitations: none. PR: none. Originator: Jeff Sturm <js...@on...> */ /* { dg-do run { xfail mips64*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */ #include "ffitestcxx.h" void closure_test_fn(ffi_cif* cif, void* resp, void** args, void* userdata) { throw 9; } typedef void (*closure_test_type)(); void closure_test_fn1(ffi_cif* cif,void* resp,void** args, void* userdata) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(int *)args[7]) + (int)(*(double*)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(long)userdata, (int)*(ffi_arg*)resp); throw (int)*(ffi_arg*)resp; } typedef int (*closure_test_type1)(float, float, float, float, signed short, float, float, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; #ifndef USING_MMAP static ffi_closure cl; #endif ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; #ifdef USING_MMAP pcl = (ffi_closure *) allocate_mmap (sizeof(ffi_closure)); #else pcl = &cl; #endif { cl_arg_types[1] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn, NULL) == FFI_OK); try { (*((closure_test_type)(pcl)))(); } catch (int exception_code) { CHECK(exception_code == 9); } printf("part one OK\n"); /* { dg-output "part one OK" } */ } { cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_uint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_uint; cl_arg_types[10] = &ffi_type_uint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_uint; cl_arg_types[13] = &ffi_type_uint; cl_arg_types[14] = &ffi_type_uint; cl_arg_types[15] = &ffi_type_uint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1, (void *) 3 /* userdata */) == FFI_OK); try { (*((closure_test_type1)pcl)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ } catch (int exception_code) { CHECK(exception_code == 255); } printf("part two OK\n"); /* { dg-output "\npart two OK" } */ } exit(0); } --- NEW FILE: special.exp --- # Copyright (C) 2003 Free Software Foundation, Inc. # This program 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 # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # libffi testsuite that uses the 'dg.exp' driver. load_lib libffi-dg.exp dg-init libffi-init global srcdir subdir global cxx_options set cxx_options " -shared-libgcc -lstdc++" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "" dg-finish # Local Variables: # tcl-indent-level:4 # End: --- NEW FILE: ffitestcxx.h --- #include <stdlib.h> #include <stdio.h> #include <fcntl.h> #include <ffi.h> #include "fficonfig.h" #define MAX_ARGS 256 #define CHECK(x) (!(x) ? abort() : (void)0) /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a file open. */ #ifdef HAVE_MMAP_ANON # undef HAVE_MMAP_DEV_ZERO # include <sys/mman.h> # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) # define MAP_ANONYMOUS MAP_ANON # endif # define USING_MMAP #endif #ifdef HAVE_MMAP_DEV_ZERO # include <sys/mman.h> # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # define USING_MMAP #endif #ifdef USING_MMAP static inline void * allocate_mmap (size_t size) { void *page; #if defined (HAVE_MMAP_DEV_ZERO) static int dev_zero_fd = -1; #endif #ifdef HAVE_MMAP_DEV_ZERO if (dev_zero_fd == -1) { dev_zero_fd = open ("/dev/zero", O_RDONLY); if (dev_zero_fd == -1) { perror ("open /dev/zero: %m"); exit (1); } } #endif #ifdef HAVE_MMAP_ANON page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #endif #ifdef HAVE_MMAP_DEV_ZERO page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero_fd, 0); #endif if (page == MAP_FAILED) { perror ("virtual memory exhausted"); exit (1); } return page; } #endif |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:47
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.call/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/libffi.call/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/testsuite/libffi.call --- NEW FILE: Entries --- /call.exp/1.1/Thu Sep 4 14:47:48 2003// /closure_fn0.c/1.5/Wed Aug 25 05:06:54 2004// /closure_fn1.c/1.5/Wed Aug 25 05:06:54 2004// /closure_fn2.c/1.5/Wed Aug 25 05:06:54 2004// /closure_fn3.c/1.5/Wed Aug 25 05:06:54 2004// /closure_fn4.c/1.4/Wed Aug 25 05:06:54 2004// /closure_fn5.c/1.4/Wed Aug 25 05:06:54 2004// /cls_12byte.c/1.5/Wed Aug 25 05:06:54 2004// /cls_16byte.c/1.5/Wed Aug 25 05:06:54 2004// /cls_18byte.c/1.4/Wed Aug 25 05:06:54 2004// /cls_19byte.c/1.4/Wed Aug 25 05:06:54 2004// /cls_1_1byte.c/1.5/Wed Aug 25 05:06:54 2004// /cls_20byte.c/1.5/Wed Aug 25 05:06:54 2004// /cls_20byte1.c/1.4/Wed Aug 25 05:06:54 2004// /cls_24byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_2byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_3_1byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_3byte1.c/1.5/Wed Aug 25 05:06:55 2004// /cls_3byte2.c/1.5/Wed Aug 25 05:06:55 2004// /cls_4_1byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_4byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_5byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_64byte.c/1.4/Wed Aug 25 05:06:55 2004// /cls_6byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_7byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_8byte.c/1.5/Wed Aug 25 05:06:55 2004// /cls_9byte1.c/1.4/Wed Aug 25 05:06:55 2004// /cls_9byte2.c/1.4/Wed Aug 25 05:06:55 2004// /cls_align_double.c/1.2/Wed Aug 25 05:06:55 2004// /cls_align_float.c/1.2/Wed Aug 25 05:06:55 2004// /cls_align_longdouble.c/1.4/Fri Feb 11 22:33:16 2005// /cls_align_pointer.c/1.3/Wed Aug 25 05:06:55 2004// /cls_align_sint16.c/1.2/Wed Aug 25 05:06:55 2004// /cls_align_sint32.c/1.2/Wed Aug 25 05:06:55 2004// /cls_align_sint64.c/1.2/Wed Aug 25 05:06:55 2004// /cls_align_uint16.c/1.2/Wed Aug 25 05:06:55 2004// /cls_align_uint32.c/1.2/Wed Aug 25 05:06:55 2004// /cls_align_uint64.c/1.2/Wed Aug 25 05:06:55 2004// /cls_double.c/1.6/Wed Aug 25 05:06:55 2004// /cls_float.c/1.5/Wed Aug 25 05:06:55 2004// /cls_multi_schar.c/1.3/Wed Aug 25 05:06:55 2004// /cls_multi_sshort.c/1.3/Wed Aug 25 05:06:55 2004// /cls_multi_sshortchar.c/1.2/Wed Aug 25 05:06:55 2004// /cls_multi_uchar.c/1.2/Wed Aug 25 05:06:55 2004// /cls_multi_ushort.c/1.3/Wed Aug 25 05:06:55 2004// /cls_multi_ushortchar.c/1.2/Wed Aug 25 05:06:55 2004// /cls_schar.c/1.4/Wed Aug 25 05:06:55 2004// /cls_sint.c/1.4/Wed Aug 25 05:06:55 2004// /cls_sshort.c/1.4/Wed Aug 25 05:06:55 2004// /cls_uchar.c/1.6/Wed Aug 25 05:06:55 2004// /cls_uint.c/1.7/Wed Aug 25 05:06:55 2004// /cls_ulonglong.c/1.6/Wed Aug 25 05:06:55 2004// /cls_ushort.c/1.6/Wed Aug 25 05:06:55 2004// /ffitest.h/1.4/Thu Jan 8 12:15:17 2004// /float.c/1.3/Fri Feb 11 22:33:16 2005// /float1.c/1.1/Thu Sep 4 14:47:48 2003// /float2.c/1.3/Fri Feb 11 22:33:16 2005// /float3.c/1.2/Fri Feb 11 22:33:16 2005// /many.c/1.1/Thu Sep 4 14:47:48 2003// /many_win32.c/1.3/Sat Sep 4 22:41:53 2004// /negint.c/1.1/Sat Oct 2 07:02:41 2004// /nested_struct.c/1.4/Wed Aug 25 05:06:55 2004// /nested_struct1.c/1.4/Wed Aug 25 05:06:55 2004// /nested_struct2.c/1.3/Wed Aug 25 05:06:55 2004// /nested_struct3.c/1.3/Wed Aug 25 05:06:55 2004// /problem1.c/1.5/Wed Aug 25 05:06:55 2004// /promotion.c/1.2/Sat Sep 4 22:41:53 2004// /pyobjc-tc.c/1.3/Sat Jan 24 16:13:48 2004// /return_ll.c/1.2/Sat Sep 4 22:41:53 2004// /return_ll1.c/1.1/Wed Feb 23 13:56:01 2005// /return_sc.c/1.3/Sat Sep 4 22:41:53 2004// /return_uc.c/1.2/Sat Sep 4 22:41:53 2004// /strlen.c/1.1/Thu Sep 4 14:47:48 2003// /strlen_win32.c/1.1/Thu Sep 4 14:47:48 2003// /struct1.c/1.1/Thu Sep 4 14:47:48 2003// /struct2.c/1.1/Thu Sep 4 14:47:48 2003// /struct3.c/1.2/Sat Jan 24 16:13:48 2004// /struct4.c/1.1/Thu Sep 4 14:47:48 2003// /struct5.c/1.1/Thu Sep 4 14:47:48 2003// /struct6.c/1.1/Thu Sep 4 14:47:48 2003// /struct7.c/1.1/Thu Sep 4 14:47:48 2003// /struct8.c/1.1/Thu Sep 4 14:47:48 2003// /struct9.c/1.1/Thu Sep 4 14:47:48 2003// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:05:47
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.special/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3502/gcc/libffi/testsuite/libffi.special/CVS.gcc Added Files: Root Repository Entries Log Message: update from gcc cvs --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi/testsuite/libffi.special --- NEW FILE: Entries --- /ffitestcxx.h/1.3/Wed Nov 26 13:46:10 2003// /special.exp/1.2/Wed Jan 12 09:06:52 2005// /unwindtest.cc/1.8/Wed Aug 25 05:06:55 2004// D |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:28
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src Modified Files: types.c prep_cif.c Log Message: updated with new version from gcc cvs Index: types.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/types.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** types.c 18 Jun 2004 20:07:08 -0000 1.1 --- types.c 14 May 2005 11:00:49 -0000 1.2 *************** *** 29,108 **** /* Type definitions */ ! #define FFI_INTEGRAL_TYPEDEF(n, s, a, t) ffi_type ffi_type_##n = { s, a, t, NULL } ! #define FFI_AGGREGATE_TYPEDEF(n, e) ffi_type ffi_type_##n = { 0, 0, FFI_TYPE_STRUCT, e } /* Size and alignment are fake here. They must not be 0. */ ! FFI_INTEGRAL_TYPEDEF(void, 1, 1, FFI_TYPE_VOID); ! ! FFI_INTEGRAL_TYPEDEF(uint8, 1, 1, FFI_TYPE_UINT8); ! FFI_INTEGRAL_TYPEDEF(sint8, 1, 1, FFI_TYPE_SINT8); ! FFI_INTEGRAL_TYPEDEF(uint16, 2, 2, FFI_TYPE_UINT16); ! FFI_INTEGRAL_TYPEDEF(sint16, 2, 2, FFI_TYPE_SINT16); ! FFI_INTEGRAL_TYPEDEF(uint32, 4, 4, FFI_TYPE_UINT32); ! FFI_INTEGRAL_TYPEDEF(sint32, 4, 4, FFI_TYPE_SINT32); ! FFI_INTEGRAL_TYPEDEF(float, 4, 4, FFI_TYPE_FLOAT); ! ! #if defined ALPHA || defined SPARC64 || defined X86_64 || defined S390X \ ! || defined IA64 || defined POWERPC64 ! ! FFI_INTEGRAL_TYPEDEF(pointer, 8, 8, FFI_TYPE_POINTER); ! ! #else ! ! FFI_INTEGRAL_TYPEDEF(pointer, 4, 4, FFI_TYPE_POINTER); ! ! #endif ! ! #if defined X86 || defined ARM || defined M68K ! ! FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); ! FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); ! ! #elif defined SH ! ! FFI_INTEGRAL_TYPEDEF(uint64, 8, 4, FFI_TYPE_UINT64); ! FFI_INTEGRAL_TYPEDEF(sint64, 8, 4, FFI_TYPE_SINT64); ! ! #else ! ! FFI_INTEGRAL_TYPEDEF(uint64, 8, 8, FFI_TYPE_UINT64); ! FFI_INTEGRAL_TYPEDEF(sint64, 8, 8, FFI_TYPE_SINT64); ! ! #endif ! ! ! #if defined X86 || defined X86_WIN32 || defined M68K ! ! #ifdef X86_WIN32 ! FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); ! #else ! FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); ! #endif ! FFI_INTEGRAL_TYPEDEF(longdouble, 12, 4, FFI_TYPE_LONGDOUBLE); ! ! #elif defined ARM || defined SH || defined POWERPC_AIX || defined POWERPC_DARWIN ! ! FFI_INTEGRAL_TYPEDEF(double, 8, 4, FFI_TYPE_DOUBLE); ! FFI_INTEGRAL_TYPEDEF(longdouble, 8, 4, FFI_TYPE_LONGDOUBLE); ! ! #elif defined SPARC ! ! FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); ! #ifdef SPARC64 ! FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); ! #else ! FFI_INTEGRAL_TYPEDEF(longdouble, 16, 8, FFI_TYPE_LONGDOUBLE); ! #endif ! ! #elif defined X86_64 || defined POWERPC64 ! ! FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); ! FFI_INTEGRAL_TYPEDEF(longdouble, 16, 16, FFI_TYPE_LONGDOUBLE); ! ! #else ! FFI_INTEGRAL_TYPEDEF(double, 8, 8, FFI_TYPE_DOUBLE); ! FFI_INTEGRAL_TYPEDEF(longdouble, 8, 8, FFI_TYPE_LONGDOUBLE); ! #endif --- 29,60 ---- /* Type definitions */ ! #define FFI_TYPEDEF(name, type, id) \ ! struct struct_align_##name { \ ! char c; \ ! type x; \ ! }; \ ! ffi_type ffi_type_##name = { \ ! sizeof(type), \ ! offsetof(struct struct_align_##name, x), \ ! id, NULL \ ! } /* Size and alignment are fake here. They must not be 0. */ ! ffi_type ffi_type_void = { ! 1, 1, FFI_TYPE_VOID, NULL ! }; ! FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); ! FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); ! FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); ! FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); ! FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); ! FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); ! FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); ! FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); ! FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); + FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); + FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); + FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); Index: prep_cif.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/prep_cif.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** prep_cif.c 18 Jun 2004 20:07:08 -0000 1.1 --- prep_cif.c 14 May 2005 11:00:49 -0000 1.2 *************** *** 82,85 **** --- 82,90 ---- } + #ifndef __CRIS__ + /* The CRIS ABI specifies structure elements to have byte + alignment only, so it completely overrides this functions, + which assumes "natural" alignment and padding. */ + /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ *************** *** 159,160 **** --- 164,166 ---- return ffi_prep_cif_machdep(cif); } + #endif /* not __CRIS__ */ |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:28
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/alpha In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/alpha Modified Files: osf.S Log Message: updated with new version from gcc cvs Index: osf.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/alpha/osf.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** osf.S 18 Jun 2004 20:07:09 -0000 1.1 --- osf.S 14 May 2005 11:00:48 -0000 1.2 *************** *** 50,59 **** mov $16, $30 stq $26, 0($1) - $LCFI0: stq $15, 8($1) - $LCFI1: stq $18, 16($1) mov $1, $15 ! $LCFI2: .prologue 0 --- 50,57 ---- mov $16, $30 stq $26, 0($1) stq $15, 8($1) stq $18, 16($1) mov $1, $15 ! $LCFI1: .prologue 0 *************** *** 85,88 **** --- 83,87 ---- ldq $18, 16($15) ldq $26, 0($15) + $LCFI2: beq $19, $noretval *************** *** 95,102 **** --- 94,103 ---- bne $3, $retdouble + .align 3 $noretval: ldq $15, 8($15) ret + .align 4 $retint: stq $0, 0($19) *************** *** 105,108 **** --- 106,110 ---- ret + .align 4 $retfloat: sts $f0, 0($19) *************** *** 111,114 **** --- 113,117 ---- ret + .align 4 $retdouble: stt $f0, 0($19) *************** *** 296,354 **** .section .eh_frame,EH_FRAME_FLAGS,@progbits __FRAME_BEGIN__: ! .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: ! .4byte 0x0 # CIE Identifier Tag ! .byte 0x1 # CIE Version ! .ascii "zR\0" # CIE Augmentation ! .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor ! .byte 0x78 # sleb128 -8; CIE Data Alignment Factor ! .byte 0x1a # CIE RA Column ! .byte 0x1 # uleb128 0x1; Augmentation size ! .byte 0x1b # FDE Encoding (pcrel sdata4) ! .byte 0xc # DW_CFA_def_cfa ! .byte 0x1e # uleb128 0x1e ! .byte 0x0 # uleb128 0x0 .align 3 $LECIE1: $LSFDE1: ! .4byte $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: ! .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset ! .4byte $LFB1-. # FDE initial location ! .4byte $LFE1-$LFB1 # FDE address range ! .byte 0x0 # uleb128 0x0; Augmentation size ! .byte 0x4 # DW_CFA_advance_loc4 ! .4byte $LCFI0-$LFB1 ! .byte 0xe # DW_CFA_def_cfa_offset ! .byte 0x30 # uleb128 0x30 ! .byte 0x4 # DW_CFA_advance_loc4 ! .4byte $LCFI1-$LCFI0 ! .byte 0x9a # DW_CFA_offset, column 0x1a ! .byte 0x6 # uleb128 0x6 ! .byte 0x8f # DW_CFA_offset, column 0xf ! .byte 0x5 # uleb128 0x5 ! .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI2-$LCFI1 ! .byte 0xc # DW_CFA_def_cfa ! .byte 0xf # uleb128 0xf ! .byte 0x30 # uleb128 0x30 .align 3 $LEFDE1: $LSFDE3: ! .4byte $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: ! .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset ! .4byte $LFB2-. # FDE initial location ! .4byte $LFE2-$LFB2 # FDE address range ! .byte 0x0 # uleb128 0x0; Augmentation size ! .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI5-$LFB2 ! .byte 0xe # DW_CFA_def_cfa_offset ! .byte 0x90,0x1 # uleb128 0x90 ! .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI6-$LCFI5 ! .byte 0x9a # DW_CFA_offset, column 0x1a ! .byte 0x12 # uleb128 0x12 .align 3 $LEFDE3: --- 299,358 ---- .section .eh_frame,EH_FRAME_FLAGS,@progbits __FRAME_BEGIN__: ! .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: ! .4byte 0x0 # CIE Identifier Tag ! .byte 0x1 # CIE Version ! .ascii "zR\0" # CIE Augmentation ! .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor ! .byte 0x78 # sleb128 -8; CIE Data Alignment Factor ! .byte 26 # CIE RA Column ! .byte 0x1 # uleb128 0x1; Augmentation size ! .byte 0x1b # FDE Encoding (pcrel sdata4) ! .byte 0xc # DW_CFA_def_cfa ! .byte 30 # uleb128 column 30 ! .byte 0 # uleb128 offset 0 .align 3 $LECIE1: $LSFDE1: ! .4byte $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: ! .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset ! .4byte $LFB1-. # FDE initial location ! .4byte $LFE1-$LFB1 # FDE address range ! .byte 0x0 # uleb128 0x0; Augmentation size ! ! .byte 0x4 # DW_CFA_advance_loc4 ! .4byte $LCFI1-$LFB1 ! .byte 0x9a # DW_CFA_offset, column 26 ! .byte 4 # uleb128 4*-8 ! .byte 0x8f # DW_CFA_offset, column 15 ! .byte 0x3 # uleb128 3*-8 ! .byte 0xc # DW_CFA_def_cfa ! .byte 15 # uleb128 column 15 ! .byte 32 # uleb128 offset 32 ! ! .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI2-$LCFI1 ! .byte 0xda # DW_CFA_restore, column 26 .align 3 $LEFDE1: $LSFDE3: ! .4byte $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: ! .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset ! .4byte $LFB2-. # FDE initial location ! .4byte $LFE2-$LFB2 # FDE address range ! .byte 0x0 # uleb128 0x0; Augmentation size ! ! .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI5-$LFB2 ! .byte 0xe # DW_CFA_def_cfa_offset ! .byte 0x80,0x1 # uleb128 128 ! ! .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI6-$LCFI5 ! .byte 0x9a # DW_CFA_offset, column 26 ! .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:28
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/include Modified Files: ffi_common.h ffi.h.in Makefile.in Makefile.am Log Message: updated with new version from gcc cvs Index: Makefile.in =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/include/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.in 18 Jun 2004 20:07:08 -0000 1.1 --- Makefile.in 14 May 2005 11:00:49 -0000 1.2 *************** *** 1,3 **** ! # Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ --- 1,3 ---- ! # Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ *************** *** 43,48 **** $(srcdir)/ffi.h.in $(toollibffi_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ! am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ ! $(top_srcdir)/../libtool.m4 $(top_srcdir)/../config/accross.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ --- 43,48 ---- $(srcdir)/ffi.h.in $(toollibffi_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ! am__aclocal_m4_deps = $(top_srcdir)/../config/accross.m4 \ ! $(top_srcdir)/../libtool.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ *************** *** 53,56 **** --- 53,62 ---- SOURCES = DIST_SOURCES = + am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; + am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; + am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(hackdir)" "$(DESTDIR)$(toollibffidir)" hackDATA_INSTALL = $(INSTALL_DATA) *************** *** 90,93 **** --- 96,101 ---- EGREP = @EGREP@ EXEEXT = @EXEEXT@ + FRV_FALSE = @FRV_FALSE@ + FRV_TRUE = @FRV_TRUE@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ IA64_FALSE = @IA64_FALSE@ *************** *** 97,100 **** --- 105,110 ---- INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LIBFFI_CRIS_FALSE = @LIBFFI_CRIS_FALSE@ + LIBFFI_CRIS_TRUE = @LIBFFI_CRIS_TRUE@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ *************** *** 102,105 **** --- 112,117 ---- LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ + M32R_FALSE = @M32R_FALSE@ + M32R_TRUE = @M32R_TRUE@ M68K_FALSE = @M68K_FALSE@ M68K_TRUE = @M68K_TRUE@ *************** *** 159,162 **** --- 171,176 ---- am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ + am__tar = @am__tar@ + am__untar = @am__untar@ bindir = @bindir@ build = @build@ *************** *** 167,171 **** datadir = @datadir@ exec_prefix = @exec_prefix@ - gcc_version = @gcc_version@ host = @host@ host_alias = @host_alias@ --- 181,184 ---- *************** *** 193,197 **** target_os = @target_os@ target_vendor = @target_vendor@ - tool_include_dir = @tool_include_dir@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ --- 206,209 ---- *************** *** 201,205 **** hackdir = $(includedir) hack_DATA = ffi.h ! toollibffidir = @tool_include_dir@/libffi toollibffi_HEADERS = ffitarget.h all: all-am --- 213,219 ---- hackdir = $(includedir) hack_DATA = ffi.h ! ! # Where generated headers like ffitarget.h get installed. ! toollibffidir := $(libdir)/gcc/include/libffi toollibffi_HEADERS = ffitarget.h all: all-am *************** *** 252,256 **** @list='$(hack_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ ! f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(hackDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(hackdir)/$$f'"; \ $(hackDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(hackdir)/$$f"; \ --- 266,270 ---- @list='$(hack_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ ! f=$(am__strip_dir) \ echo " $(hackDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(hackdir)/$$f'"; \ $(hackDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(hackdir)/$$f"; \ *************** *** 260,264 **** @$(NORMAL_UNINSTALL) @list='$(hack_DATA)'; for p in $$list; do \ ! f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(hackdir)/$$f'"; \ rm -f "$(DESTDIR)$(hackdir)/$$f"; \ --- 274,278 ---- @$(NORMAL_UNINSTALL) @list='$(hack_DATA)'; for p in $$list; do \ ! f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(hackdir)/$$f'"; \ rm -f "$(DESTDIR)$(hackdir)/$$f"; \ *************** *** 269,273 **** @list='$(toollibffi_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ ! f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(toollibffiHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(toollibffidir)/$$f'"; \ $(toollibffiHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(toollibffidir)/$$f"; \ --- 283,287 ---- @list='$(toollibffi_HEADERS)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ ! f=$(am__strip_dir) \ echo " $(toollibffiHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(toollibffidir)/$$f'"; \ $(toollibffiHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(toollibffidir)/$$f"; \ *************** *** 277,281 **** @$(NORMAL_UNINSTALL) @list='$(toollibffi_HEADERS)'; for p in $$list; do \ ! f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f '$(DESTDIR)$(toollibffidir)/$$f'"; \ rm -f "$(DESTDIR)$(toollibffidir)/$$f"; \ --- 291,295 ---- @$(NORMAL_UNINSTALL) @list='$(toollibffi_HEADERS)'; for p in $$list; do \ ! f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(toollibffidir)/$$f'"; \ rm -f "$(DESTDIR)$(toollibffidir)/$$f"; \ *************** *** 383,387 **** distclean-generic: ! -rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) --- 397,401 ---- distclean-generic: ! -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) Index: ffi_common.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/include/ffi_common.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi_common.h 18 Jun 2004 20:07:08 -0000 1.1 --- ffi_common.h 14 May 2005 11:00:49 -0000 1.2 *************** *** 61,64 **** --- 61,65 ---- #define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) + #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) /* Perform machine dependent cif processing */ Index: ffi.h.in =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/include/ffi.h.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.h.in 18 Jun 2004 20:07:08 -0000 1.1 --- ffi.h.in 14 May 2005 11:00:49 -0000 1.2 *************** *** 219,223 **** void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; ! } ffi_closure; ffi_status --- 219,223 ---- void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; ! } ffi_closure __attribute__((aligned (8))); ffi_status Index: Makefile.am =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/include/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.am 18 Jun 2004 20:07:08 -0000 1.1 --- Makefile.am 14 May 2005 11:00:49 -0000 1.2 *************** *** 10,13 **** hack_DATA= ffi.h ! toollibffidir = @tool_include_dir@/libffi toollibffi_HEADERS = ffitarget.h --- 10,15 ---- hack_DATA= ffi.h ! # Where generated headers like ffitarget.h get installed. ! toollibffidir := $(libdir)/gcc/include/libffi ! toollibffi_HEADERS = ffitarget.h |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:27
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/ia64 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/ia64 Modified Files: unix.S ia64_flags.h ffitarget.h ffi.c Log Message: updated with new version from gcc cvs Index: unix.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/ia64/unix.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** unix.S 18 Jun 2004 20:07:10 -0000 1.1 --- unix.S 14 May 2005 11:00:48 -0000 1.2 *************** *** 34,327 **** #include "ia64_flags.h" - /* parameters: */ - #define callback in0 - #define ecifp in1 - #define bytes in2 - #define flags in3 - #define raddr in4 - #define fn in5 - - #define FLOAT_SZ 8 /* in-memory size of fp operands */ - - /* Allocate an ia64_args structure on the stack; call ffi_prep_args */ - /* to fill it in with argument values; copy those to the real */ - /* registers, leaving overflow arguments on the stack. Then call fn */ - /* and move the result from registers into *raddr. */ .pred.safe_across_calls p1-p5,p16-p63 .text .align 16 ! .global ffi_call_unix ! .proc ffi_call_unix ffi_call_unix: .prologue ! .save ar.pfs,r38 /* loc0 */ ! alloc loc0=ar.pfs,6,6,8,0 ! .save rp,loc1 ! mov loc1=b0; ! .vframe loc5 ! mov loc5=sp; .body ! sub sp=sp,bytes ! mov loc4=r1 /* Save gp */ ! ld8 r8=[callback],8 /* code address of callback */ ;; ! mov out0=sp ! mov out1=ecifp ! mov out2=bytes ! ld8 r1=[callback] /* Set up gp for callback. Unnecessary? */ ! mov b6=r8 ;; ! br.call.sptk.many b0 = b6 /* call ffi_prep_args */ ! cmp.eq p6,p0=0,r8 /* r8 nonzero ==> need fp regs */ ! ;; ! (p6) add loc2=32+8*FLOAT_SZ,sp ! (p6) br.cond.dptk.many fp_done ! ;; /* Quiets warning; needed? */ ! add loc2=32,sp ! add loc3=32+FLOAT_SZ,sp ;; ! ldfd f8=[loc2],2*FLOAT_SZ ! ldfd f9=[loc3],2*FLOAT_SZ ;; ! ldfd f10=[loc2],2*FLOAT_SZ ! ldfd f11=[loc3],2*FLOAT_SZ ;; ! ldfd f12=[loc2],2*FLOAT_SZ ! ldfd f13=[loc3],2*FLOAT_SZ ;; ! ldfd f14=[loc2],2*FLOAT_SZ ! ldfd f15=[loc3] ;; ! fp_done: ! add r9=16,sp /* Pointer to r8_contents */ ! /* loc2 points at first integer register value. */ ! add loc3=8,loc2 ;; ! ld8 r8=[r9] /* Just in case we return large struct */ ! ld8 out0=[loc2],16 ! ld8 out1=[loc3],16 ;; ! ld8 out2=[loc2],16 ! ld8 out3=[loc3],16 ;; ! ld8 out4=[loc2],16 ! ld8 out5=[loc3],16 ;; ! ld8 out6=[loc2] ! ld8 out7=[loc3] ! /* Set sp to 16 bytes below the first stack parameter. This */ ! /* is the value currently in loc2. */ ! mov sp=loc2 ! ! ld8 r8=[fn],8 ;; ! ld8 r1=[fn] /* Set up gp */ ! mov b6=r8;; ! br.call.sptk.many b0 = b6 /* call fn */ ! ! /* Handle return value. */ ! cmp.eq p6,p0=0,raddr ! cmp.eq p7,p0=FFI_TYPE_INT,flags ! cmp.eq p10,p0=FFI_IS_SMALL_STRUCT2,flags ! cmp.eq p11,p0=FFI_IS_SMALL_STRUCT3,flags ! cmp.eq p12,p0=FFI_IS_SMALL_STRUCT4,flags ;; ! (p6) br.cond.dpnt.few done /* Dont copy ret values if raddr = 0 */ ! (p7) br.cond.dptk.few copy1 ! (p10) br.cond.dpnt.few copy2 ! (p11) br.cond.dpnt.few copy3 ! (p12) br.cond.dpnt.few copy4 ! cmp.eq p8,p0=FFI_TYPE_FLOAT,flags ! cmp.eq p9,p0=FFI_TYPE_DOUBLE,flags ! tbit.nz p6,p0=flags,FLOAT_FP_AGGREGATE_BIT ! tbit.nz p7,p0=flags,DOUBLE_FP_AGGREGATE_BIT ;; ! (p8) stfs [raddr]=f8 ! (p9) stfd [raddr]=f8 ;; - .label_state 1 - (p6) br.cond.dpnt.few handle_float_hfa - (p7) br.cond.dpnt.few handle_double_hfa - br done ! copy4: ! add loc3=24,raddr ;; ! st8 [loc3]=r11 ! copy3: ! add loc3=16,raddr ;; ! st8 [loc3]=r10 ! copy2: ! add loc3=8,raddr ;; - st8 [loc3]=r9 - copy1: - st8 [raddr]=r8 - /* In the big struct case, raddr was passed as an argument. */ - /* In the void case there was nothing to do. */ ! done: ! mov r1=loc4 /* Restore gp */ mov ar.pfs = loc0 mov b0 = loc1 ! .restore sp ! mov sp = loc5 br.ret.sptk.many b0 ! handle_double_hfa: ! .body ! .copy_state 1 ! /* Homogeneous floating point array of doubles is returned in */ ! /* registers f8-f15. Save one at a time to return area. */ ! and flags=0xf,flags /* Retrieve size */ ;; ! cmp.eq p6,p0=2,flags ! cmp.eq p7,p0=3,flags ! cmp.eq p8,p0=4,flags ! cmp.eq p9,p0=5,flags ! cmp.eq p10,p0=6,flags ! cmp.eq p11,p0=7,flags ! cmp.eq p12,p0=8,flags ;; ! (p6) br.cond.dptk.few dhfa2 ! (p7) br.cond.dptk.few dhfa3 ! (p8) br.cond.dptk.few dhfa4 ! (p9) br.cond.dptk.few dhfa5 ! (p10) br.cond.dptk.few dhfa6 ! (p11) br.cond.dptk.few dhfa7 ! dhfa8: add loc3=7*8,raddr ;; ! stfd [loc3]=f15 ! dhfa7: add loc3=6*8,raddr ;; ! stfd [loc3]=f14 ! dhfa6: add loc3=5*8,raddr ;; ! stfd [loc3]=f13 ! dhfa5: add loc3=4*8,raddr ;; ! stfd [loc3]=f12 ! dhfa4: add loc3=3*8,raddr ;; ! stfd [loc3]=f11 ! dhfa3: add loc3=2*8,raddr ;; ! stfd [loc3]=f10 ! dhfa2: add loc3=1*8,raddr ;; - stfd [loc3]=f9 - stfd [raddr]=f8 - br done ! handle_float_hfa: ! /* Homogeneous floating point array of floats is returned in */ ! /* registers f8-f15. Save one at a time to return area. */ ! and flags=0xf,flags /* Retrieve size */ ;; ! cmp.eq p6,p0=2,flags ! cmp.eq p7,p0=3,flags ! cmp.eq p8,p0=4,flags ! cmp.eq p9,p0=5,flags ! cmp.eq p10,p0=6,flags ! cmp.eq p11,p0=7,flags ! cmp.eq p12,p0=8,flags ;; ! (p6) br.cond.dptk.few shfa2 ! (p7) br.cond.dptk.few shfa3 ! (p8) br.cond.dptk.few shfa4 ! (p9) br.cond.dptk.few shfa5 ! (p10) br.cond.dptk.few shfa6 ! (p11) br.cond.dptk.few shfa7 ! shfa8: add loc3=7*4,raddr ;; ! stfd [loc3]=f15 ! shfa7: add loc3=6*4,raddr ;; ! stfd [loc3]=f14 ! shfa6: add loc3=5*4,raddr ;; ! stfd [loc3]=f13 ! shfa5: add loc3=4*4,raddr ;; ! stfd [loc3]=f12 ! shfa4: add loc3=3*4,raddr ;; ! stfd [loc3]=f11 ! shfa3: add loc3=2*4,raddr ;; ! stfd [loc3]=f10 ! shfa2: add loc3=1*4,raddr ;; ! stfd [loc3]=f9 ! stfd [raddr]=f8 ! br done ! .endp ffi_call_unix ! .pred.safe_across_calls p1-p5,p16-p63 ! .text ! .align 16 ! .global ffi_closure_UNIX ! .proc ffi_closure_UNIX ! ffi_closure_UNIX: ! .prologue ! .save ar.pfs,r40 /* loc0 */ ! alloc loc0=ar.pfs,8,3,2,0 ! .save rp,loc1 ! mov loc1=b0 ! .vframe loc2 ! mov loc2=sp ! /* Retrieve closure pointer and real gp. */ ! mov out0=gp ! add gp=16,gp ;; ! ld8 gp=[gp] ! /* Reserve a structia64_args on the stack such that arguments */ ! /* past the first 8 are automatically placed in the right */ ! /* slot. Note that when we start the sp points at 2 8-byte */ ! /* scratch words, followed by the extra arguments. */ ! # define BASIC_ARGS_SZ (8*FLOAT_SZ+8*8+2*8) ! # define FIRST_FP_OFFSET (4*8) ! add r14=-(BASIC_ARGS_SZ-FIRST_FP_OFFSET),sp ! add r15=-(BASIC_ARGS_SZ-FIRST_FP_OFFSET-FLOAT_SZ),sp ! add sp=-BASIC_ARGS_SZ,sp ! /* r14 points to fp_regs[0], r15 points to fp_regs[1] */ ;; ! stfd [r14]=f8,2*FLOAT_SZ ! stfd [r15]=f9,2*FLOAT_SZ ;; ! stfd [r14]=f10,2*FLOAT_SZ ! stfd [r15]=f11,2*FLOAT_SZ ;; ! stfd [r14]=f12,2*FLOAT_SZ ! stfd [r15]=f13,2*FLOAT_SZ ;; ! stfd [r14]=f14,2*FLOAT_SZ ! stfd [r15]=f15,FLOAT_SZ+8 ;; ! /* r14 points to first parameter register area, r15 to second. */ ! st8 [r14]=in0,2*8 ! st8 [r15]=in1,2*8 ;; ! st8 [r14]=in2,2*8 ! st8 [r15]=in3,2*8 ;; ! st8 [r14]=in4,2*8 ! st8 [r15]=in5,2*8 ;; ! st8 [r14]=in6,2*8 ! st8 [r15]=in7,2*8 ! /* Call ffi_closure_UNIX_inner */ ! mov out1=sp ! br.call.sptk.many b0=ffi_closure_UNIX_inner ;; ! mov b0=loc1 ! mov ar.pfs=loc0 .restore sp ! mov sp=loc2 br.ret.sptk.many b0 ! .endp ffi_closure_UNIX ! --- 34,555 ---- #include "ia64_flags.h" .pred.safe_across_calls p1-p5,p16-p63 .text + + /* int ffi_call_unix (struct ia64_args *stack, PTR64 rvalue, + void (*fn)(), int flags); + */ + .align 16 ! .global ffi_call_unix ! .proc ffi_call_unix ffi_call_unix: .prologue ! /* Bit o trickiness. We actually share a stack frame with ffi_call. ! Rely on the fact that ffi_call uses a vframe and don't bother ! tracking one here at all. */ ! .fframe 0 ! .save ar.pfs, r36 // loc0 ! alloc loc0 = ar.pfs, 4, 3, 8, 0 ! .save rp, loc1 ! mov loc1 = b0 .body ! add r16 = 16, in0 ! mov loc2 = gp ! mov r8 = in1 ;; ! ! /* Load up all of the argument registers. */ ! ldf.fill f8 = [in0], 32 ! ldf.fill f9 = [r16], 32 ;; ! ldf.fill f10 = [in0], 32 ! ldf.fill f11 = [r16], 32 ;; ! ldf.fill f12 = [in0], 32 ! ldf.fill f13 = [r16], 32 ;; ! ldf.fill f14 = [in0], 32 ! ldf.fill f15 = [r16], 24 ;; ! ld8 out0 = [in0], 16 ! ld8 out1 = [r16], 16 ;; ! ld8 out2 = [in0], 16 ! ld8 out3 = [r16], 16 ;; ! ld8 out4 = [in0], 16 ! ld8 out5 = [r16], 16 ;; ! ld8 out6 = [in0] ! ld8 out7 = [r16] ;; ! ! /* Deallocate the register save area from the stack frame. */ ! mov sp = in0 ! ! /* Call the target function. */ ! ld8 r16 = [in2], 8 ;; ! ld8 gp = [in2] ! mov b6 = r16 ! br.call.sptk.many b0 = b6 ;; ! ! /* Dispatch to handle return value. */ ! mov gp = loc2 ! zxt1 r16 = in3 ;; ! mov ar.pfs = loc0 ! addl r18 = @ltoffx(.Lst_table), gp ;; ! ld8.mov r18 = [r18], .Lst_table ! mov b0 = loc1 ;; ! shladd r18 = r16, 3, r18 ! ;; ! ld8 r17 = [r18] ! shr in3 = in3, 8 ! ;; ! add r17 = r17, r18 ! ;; ! mov b6 = r17 ! br b6 ;; ! .Lst_void: ! br.ret.sptk.many b0 ;; ! .Lst_uint8: ! zxt1 r8 = r8 ;; ! st8 [in1] = r8 ! br.ret.sptk.many b0 ! ;; ! .Lst_sint8: ! sxt1 r8 = r8 ! ;; ! st8 [in1] = r8 ! br.ret.sptk.many b0 ! ;; ! .Lst_uint16: ! zxt2 r8 = r8 ! ;; ! st8 [in1] = r8 ! br.ret.sptk.many b0 ! ;; ! .Lst_sint16: ! sxt2 r8 = r8 ! ;; ! st8 [in1] = r8 ! br.ret.sptk.many b0 ! ;; ! .Lst_uint32: ! zxt4 r8 = r8 ! ;; ! st8 [in1] = r8 ! br.ret.sptk.many b0 ! ;; ! .Lst_sint32: ! sxt4 r8 = r8 ! ;; ! st8 [in1] = r8 ! br.ret.sptk.many b0 ! ;; ! .Lst_int64: ! st8 [in1] = r8 ! br.ret.sptk.many b0 ! ;; ! .Lst_float: ! stfs [in1] = f8 ! br.ret.sptk.many b0 ! ;; ! .Lst_double: ! stfd [in1] = f8 ! br.ret.sptk.many b0 ! ;; ! .Lst_ldouble: ! stfe [in1] = f8 ! br.ret.sptk.many b0 ;; ! .Lst_small_struct: ! add sp = -16, sp ! cmp.lt p6, p0 = 8, in3 ! cmp.lt p7, p0 = 16, in3 ! cmp.lt p8, p0 = 24, in3 ! ;; ! add r16 = 8, sp ! add r17 = 16, sp ! add r18 = 24, sp ! ;; ! st8 [sp] = r8 ! (p6) st8 [r16] = r9 ! mov out0 = in1 ! (p7) st8 [r17] = r10 ! (p8) st8 [r18] = r11 ! mov out1 = sp ! mov out2 = in3 ! br.call.sptk.many b0 = memcpy# ! ;; mov ar.pfs = loc0 mov b0 = loc1 ! mov gp = loc2 br.ret.sptk.many b0 ! .Lst_hfa_float: ! add r16 = 4, in1 ! cmp.lt p6, p0 = 4, in3 ;; ! stfs [in1] = f8, 8 ! (p6) stfs [r16] = f9, 8 ! cmp.lt p7, p0 = 8, in3 ! cmp.lt p8, p0 = 12, in3 ;; ! (p7) stfs [in1] = f10, 8 ! (p8) stfs [r16] = f11, 8 ! cmp.lt p9, p0 = 16, in3 ! cmp.lt p10, p0 = 20, in3 ;; ! (p9) stfs [in1] = f12, 8 ! (p10) stfs [r16] = f13, 8 ! cmp.lt p6, p0 = 24, in3 ! cmp.lt p7, p0 = 28, in3 ;; ! (p6) stfs [in1] = f14 ! (p7) stfs [r16] = f15 ! br.ret.sptk.many b0 ;; ! ! .Lst_hfa_double: ! add r16 = 8, in1 ! cmp.lt p6, p0 = 8, in3 ;; ! stfd [in1] = f8, 16 ! (p6) stfd [r16] = f9, 16 ! cmp.lt p7, p0 = 16, in3 ! cmp.lt p8, p0 = 24, in3 ;; ! (p7) stfd [in1] = f10, 16 ! (p8) stfd [r16] = f11, 16 ! cmp.lt p9, p0 = 32, in3 ! cmp.lt p10, p0 = 40, in3 ;; ! (p9) stfd [in1] = f12, 16 ! (p10) stfd [r16] = f13, 16 ! cmp.lt p6, p0 = 48, in3 ! cmp.lt p7, p0 = 56, in3 ! ;; ! (p6) stfd [in1] = f14 ! (p7) stfd [r16] = f15 ! br.ret.sptk.many b0 ;; ! .Lst_hfa_ldouble: ! add r16 = 16, in1 ! cmp.lt p6, p0 = 16, in3 ;; ! stfe [in1] = f8, 32 ! (p6) stfe [r16] = f9, 32 ! cmp.lt p7, p0 = 32, in3 ! cmp.lt p8, p0 = 48, in3 ;; ! (p7) stfe [in1] = f10, 32 ! (p8) stfe [r16] = f11, 32 ! cmp.lt p9, p0 = 64, in3 ! cmp.lt p10, p0 = 80, in3 ;; ! (p9) stfe [in1] = f12, 32 ! (p10) stfe [r16] = f13, 32 ! cmp.lt p6, p0 = 96, in3 ! cmp.lt p7, p0 = 112, in3 ;; ! (p6) stfe [in1] = f14 ! (p7) stfe [r16] = f15 ! br.ret.sptk.many b0 ;; ! ! .endp ffi_call_unix ! ! .align 16 ! .global ffi_closure_unix ! .proc ffi_closure_unix ! ! #define FRAME_SIZE (8*16 + 8*8 + 8*16) ! ! ffi_closure_unix: ! .prologue ! .save ar.pfs, r40 // loc0 ! alloc loc0 = ar.pfs, 8, 4, 4, 0 ! .fframe FRAME_SIZE ! add r12 = -FRAME_SIZE, r12 ! .save rp, loc1 ! mov loc1 = b0 ! .save ar.unat, loc2 ! mov loc2 = ar.unat ! .body ! ! /* Retrieve closure pointer and real gp. */ ! #ifdef _ILP32 ! addp4 out0 = 0, gp ! addp4 gp = 16, gp ! #else ! mov out0 = gp ! add gp = 16, gp ! #endif ;; ! ld8 gp = [gp] ! ! /* Spill all of the possible argument registers. */ ! add r16 = 16 + 8*16, sp ! add r17 = 16 + 8*16 + 16, sp ;; ! stf.spill [r16] = f8, 32 ! stf.spill [r17] = f9, 32 ! mov loc3 = gp ;; ! stf.spill [r16] = f10, 32 ! stf.spill [r17] = f11, 32 ;; ! stf.spill [r16] = f12, 32 ! stf.spill [r17] = f13, 32 ! ;; ! stf.spill [r16] = f14, 32 ! stf.spill [r17] = f15, 24 ! ;; ! .mem.offset 0, 0 ! st8.spill [r16] = in0, 16 ! .mem.offset 8, 0 ! st8.spill [r17] = in1, 16 ! add out1 = 16 + 8*16, sp ! ;; ! .mem.offset 0, 0 ! st8.spill [r16] = in2, 16 ! .mem.offset 8, 0 ! st8.spill [r17] = in3, 16 ! add out2 = 16, sp ! ;; ! .mem.offset 0, 0 ! st8.spill [r16] = in4, 16 ! .mem.offset 8, 0 ! st8.spill [r17] = in5, 16 ! mov out3 = r8 ! ;; ! .mem.offset 0, 0 ! st8.spill [r16] = in6 ! .mem.offset 8, 0 ! st8.spill [r17] = in7 ! /* Invoke ffi_closure_unix_inner for the hard work. */ ! br.call.sptk.many b0 = ffi_closure_unix_inner ! ;; + /* Dispatch to handle return value. */ + mov gp = loc3 + zxt1 r16 = r8 + ;; + addl r18 = @ltoffx(.Lld_table), gp + mov ar.pfs = loc0 + ;; + ld8.mov r18 = [r18], .Lld_table + mov b0 = loc1 + ;; + shladd r18 = r16, 3, r18 + mov ar.unat = loc2 + ;; + ld8 r17 = [r18] + shr r8 = r8, 8 + ;; + add r17 = r17, r18 + add r16 = 16, sp + ;; + mov b6 = r17 + br b6 + ;; + .label_state 1 ! .Lld_void: ! .restore sp ! add sp = FRAME_SIZE, sp ! br.ret.sptk.many b0 ;; ! .Lld_int: ! .body ! .copy_state 1 ! ld8 r8 = [r16] ! .restore sp ! add sp = FRAME_SIZE, sp ! br.ret.sptk.many b0 ;; ! .Lld_float: ! .body ! .copy_state 1 ! ldfs f8 = [r16] ! .restore sp ! add sp = FRAME_SIZE, sp ! br.ret.sptk.many b0 ;; ! .Lld_double: ! .body ! .copy_state 1 ! ldfd f8 = [r16] ! .restore sp ! add sp = FRAME_SIZE, sp ! br.ret.sptk.many b0 ;; ! .Lld_ldouble: ! .body ! .copy_state 1 ! ldfe f8 = [r16] ! .restore sp ! add sp = FRAME_SIZE, sp ! br.ret.sptk.many b0 ;; ! ! .Lld_small_struct: ! .body ! .copy_state 1 ! add r17 = 8, r16 ! cmp.lt p6, p0 = 8, r8 ! cmp.lt p7, p0 = 16, r8 ! cmp.lt p8, p0 = 24, r8 ;; ! ld8 r8 = [r16], 16 ! (p6) ld8 r9 = [r17], 16 ;; ! (p7) ld8 r10 = [r16] ! (p8) ld8 r11 = [r17] ! .restore sp ! add sp = FRAME_SIZE, sp ! br.ret.sptk.many b0 ;; ! ! .Lld_hfa_float: ! .body ! .copy_state 1 ! add r17 = 4, r16 ! cmp.lt p6, p0 = 4, r8 ;; ! ldfs f8 = [r16], 8 ! (p6) ldfs f9 = [r17], 8 ! cmp.lt p7, p0 = 8, r8 ! cmp.lt p8, p0 = 12, r8 ;; ! (p7) ldfs f10 = [r16], 8 ! (p8) ldfs f11 = [r17], 8 ! cmp.lt p9, p0 = 16, r8 ! cmp.lt p10, p0 = 20, r8 ! ;; ! (p9) ldfs f12 = [r16], 8 ! (p10) ldfs f13 = [r17], 8 ! cmp.lt p6, p0 = 24, r8 ! cmp.lt p7, p0 = 28, r8 ! ;; ! (p6) ldfs f14 = [r16] ! (p7) ldfs f15 = [r17] .restore sp ! add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ! ;; ! ! .Lld_hfa_double: ! .body ! .copy_state 1 ! add r17 = 8, r16 ! cmp.lt p6, p0 = 8, r8 ! ;; ! ldfd f8 = [r16], 16 ! (p6) ldfd f9 = [r17], 16 ! cmp.lt p7, p0 = 16, r8 ! cmp.lt p8, p0 = 24, r8 ! ;; ! (p7) ldfd f10 = [r16], 16 ! (p8) ldfd f11 = [r17], 16 ! cmp.lt p9, p0 = 32, r8 ! cmp.lt p10, p0 = 40, r8 ! ;; ! (p9) ldfd f12 = [r16], 16 ! (p10) ldfd f13 = [r17], 16 ! cmp.lt p6, p0 = 48, r8 ! cmp.lt p7, p0 = 56, r8 ! ;; ! (p6) ldfd f14 = [r16] ! (p7) ldfd f15 = [r17] ! .restore sp ! add sp = FRAME_SIZE, sp ! br.ret.sptk.many b0 ! ;; + .Lld_hfa_ldouble: + .body + .copy_state 1 + add r17 = 16, r16 + cmp.lt p6, p0 = 16, r8 + ;; + ldfe f8 = [r16], 32 + (p6) ldfe f9 = [r17], 32 + cmp.lt p7, p0 = 32, r8 + cmp.lt p8, p0 = 48, r8 + ;; + (p7) ldfe f10 = [r16], 32 + (p8) ldfe f11 = [r17], 32 + cmp.lt p9, p0 = 64, r8 + cmp.lt p10, p0 = 80, r8 + ;; + (p9) ldfe f12 = [r16], 32 + (p10) ldfe f13 = [r17], 32 + cmp.lt p6, p0 = 96, r8 + cmp.lt p7, p0 = 112, r8 + ;; + (p6) ldfe f14 = [r16] + (p7) ldfe f15 = [r17] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; + + .endp ffi_closure_unix + + .section .rodata + .align 8 + .Lst_table: + data8 @pcrel(.Lst_void) // FFI_TYPE_VOID + data8 @pcrel(.Lst_sint32) // FFI_TYPE_INT + data8 @pcrel(.Lst_float) // FFI_TYPE_FLOAT + data8 @pcrel(.Lst_double) // FFI_TYPE_DOUBLE + data8 @pcrel(.Lst_ldouble) // FFI_TYPE_LONGDOUBLE + data8 @pcrel(.Lst_uint8) // FFI_TYPE_UINT8 + data8 @pcrel(.Lst_sint8) // FFI_TYPE_SINT8 + data8 @pcrel(.Lst_uint16) // FFI_TYPE_UINT16 + data8 @pcrel(.Lst_sint16) // FFI_TYPE_SINT16 + data8 @pcrel(.Lst_uint32) // FFI_TYPE_UINT32 + data8 @pcrel(.Lst_sint32) // FFI_TYPE_SINT32 + data8 @pcrel(.Lst_int64) // FFI_TYPE_UINT64 + data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64 + data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT + data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER + data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT + data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT + data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE + data8 @pcrel(.Lst_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE + + .Lld_table: + data8 @pcrel(.Lld_void) // FFI_TYPE_VOID + data8 @pcrel(.Lld_int) // FFI_TYPE_INT + data8 @pcrel(.Lld_float) // FFI_TYPE_FLOAT + data8 @pcrel(.Lld_double) // FFI_TYPE_DOUBLE + data8 @pcrel(.Lld_ldouble) // FFI_TYPE_LONGDOUBLE + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT8 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT8 + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT16 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT16 + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT32 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT32 + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT64 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64 + data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT + data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER + data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT + data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT + data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE + data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/ia64/ffi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.c 18 Jun 2004 20:07:10 -0000 1.1 --- ffi.c 14 May 2005 11:00:48 -0000 1.2 *************** *** 30,671 **** #include <stdlib.h> #include <stdbool.h> #include "ia64_flags.h" ! /* Memory image of fp register contents. Should eventually be an fp */ ! /* type long enough to hold an entire register. For now we use double. */ ! typedef double float80; ! /* The stack layout at call to ffi_prep_args. Other_args will remain */ [...1146 lines suppressed...] ! if (offset < size) ! memcpy (addr + offset, (char *)stack->gp_regs + gp_offset, ! size - offset); } + else + avalue[i] = &stack->gp_regs[gpcount]; + + gpcount += (size + 7) / 8; } break; default: ! abort (); } } ! closure->fun (cif, rvalue, avalue, closure->user_data); ! return cif->flags; } Index: ia64_flags.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/ia64/ia64_flags.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ia64_flags.h 18 Jun 2004 20:07:10 -0000 1.1 --- ia64_flags.h 14 May 2005 11:00:48 -0000 1.2 *************** *** 26,62 **** ----------------------------------------------------------------------- */ ! /* Homogeneous Floating Point Aggregates (HFAs) which are returned */ ! /* in FP registers. The least significant bits specify the size in */ ! /* words. */ ! #define FFI_IS_FLOAT_FP_AGGREGATE 0x1000 ! #define FFI_IS_DOUBLE_FP_AGGREGATE 0x0800 ! #define FLOAT_FP_AGGREGATE_BIT 12 ! #define DOUBLE_FP_AGGREGATE_BIT 11 ! ! /* Small structures containing N words. If N=1, they are returned */ ! /* as though they were integers. */ ! #define FFI_IS_SMALL_STRUCT2 0x40 /* Struct > 8, <=16 bytes */ ! #define FFI_IS_SMALL_STRUCT3 0x41 /* Struct > 16 <= 24 bytes */ ! #define FFI_IS_SMALL_STRUCT4 0x42 /* Struct > 24, <=32 bytes */ ! ! /* Flag values identifying particularly simple cases, which are */ ! /* handled specially. We treat functions as simple if they take all */ ! /* arguments can be passed as 32 or 64 bit integer quantities, there is */ ! /* either no return value or it can be treated as a 64bit integer, and */ ! /* if there are at most 2 arguments. */ ! /* This is OR'ed with the normal flag values. */ ! #define FFI_SIMPLE_V 0x10000 /* () -> X */ ! #define FFI_SIMPLE_I 0x20000 /* (int) -> X */ ! #define FFI_SIMPLE_L 0x30000 /* (long) -> X */ ! #define FFI_SIMPLE_II 0x40000 /* (int,int) -> X */ ! #define FFI_SIMPLE_IL 0x50000 /* (int,long) -> X */ ! #define FFI_SIMPLE_LI 0x60000 /* (long,int) -> X */ ! #define FFI_SIMPLE_LL 0x70000 /* (long,long) -> X */ ! ! /* Mask for all of the FFI_SIMPLE bits: */ ! #define FFI_SIMPLE 0xf0000 ! /* An easy way to build FFI_SIMPLE flags from FFI_SIMPLE_V: */ ! #define FFI_ADD_LONG_ARG(flag) (((flag) << 1) | 0x10000) ! #define FFI_ADD_INT_ARG(flag) ((flag) << 1) --- 26,39 ---- ----------------------------------------------------------------------- */ + /* "Type" codes used between assembly and C. When used as a part of + a cfi->flags value, the low byte will be these extra type codes, + and bits 8-31 will be the actual size of the type. */ ! /* Small structures containing N words in integer registers. */ ! #define FFI_IA64_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 1) ! /* Homogeneous Floating Point Aggregates (HFAs) which are returned ! in FP registers. */ ! #define FFI_IA64_TYPE_HFA_FLOAT (FFI_TYPE_LAST + 2) ! #define FFI_IA64_TYPE_HFA_DOUBLE (FFI_TYPE_LAST + 3) ! #define FFI_IA64_TYPE_HFA_LDOUBLE (FFI_TYPE_LAST + 4) Index: ffitarget.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/ia64/ffitarget.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffitarget.h 18 Jun 2004 20:07:10 -0000 1.1 --- ffitarget.h 14 May 2005 11:00:48 -0000 1.2 *************** *** 28,33 **** #ifndef LIBFFI_ASM ! typedef unsigned long ffi_arg; ! typedef signed long ffi_sarg; typedef enum ffi_abi { --- 28,33 ---- #ifndef LIBFFI_ASM ! typedef unsigned long long ffi_arg; ! typedef signed long long ffi_sarg; typedef enum ffi_abi { *************** *** 46,58 **** /* descriptor: */ - #ifndef LIBFFI_ASM - struct ffi_ia64_trampoline_struct { - void * code_pointer; /* Pointer to ffi_closure_UNIX */ - void * fake_gp; /* Pointer to closure, installed as gp */ - void * real_gp; /* Real gp value, reinstalled by */ - /* ffi_closure_UNIX. */ - }; - #endif - #endif --- 46,49 ---- |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:27
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/powerpc Modified Files: sysv.S ppc_closure.S linux64_closure.S linux64.S ffitarget.h ffi_darwin.c ffi.c darwin_closure.S darwin.S asm.h aix_closure.S aix.S Log Message: updated with new version from gcc cvs Index: aix.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/aix.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** aix.S 18 Jun 2004 20:07:12 -0000 1.1 --- aix.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 25,84 **** ----------------------------------------------------------------------- */ ! .set r0,0 ! .set r1,1 ! .set r2,2 ! .set r3,3 ! .set r4,4 ! .set r5,5 ! .set r6,6 ! .set r7,7 ! .set r8,8 ! .set r9,9 ! .set r10,10 ! .set r11,11 ! .set r12,12 ! .set r13,13 ! .set r14,14 ! .set r15,15 ! .set r16,16 ! .set r17,17 ! .set r18,18 ! .set r19,19 ! .set r20,20 ! .set r21,21 ! .set r22,22 ! .set r23,23 ! .set r24,24 ! .set r25,25 ! .set r26,26 ! .set r27,27 ! .set r28,28 ! .set r29,29 ! .set r30,30 ! .set r31,31 ! .set f0,0 ! .set f1,1 ! .set f2,2 ! .set f3,3 ! .set f4,4 ! .set f5,5 ! .set f6,6 ! .set f7,7 ! .set f8,8 ! .set f9,9 ! .set f10,10 ! .set f11,11 ! .set f12,12 ! .set f13,13 ! .set f14,14 ! .set f15,15 ! .set f16,16 ! .set f17,17 ! .set f18,18 ! .set f19,19 ! .set f20,20 ! .set f21,21 ! #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> --- 25,84 ---- ----------------------------------------------------------------------- */ ! .set r0,0 ! .set r1,1 ! .set r2,2 ! .set r3,3 ! .set r4,4 ! .set r5,5 ! .set r6,6 ! .set r7,7 ! .set r8,8 ! .set r9,9 ! .set r10,10 ! .set r11,11 ! .set r12,12 ! .set r13,13 ! .set r14,14 ! .set r15,15 ! .set r16,16 ! .set r17,17 ! .set r18,18 ! .set r19,19 ! .set r20,20 ! .set r21,21 ! .set r22,22 ! .set r23,23 ! .set r24,24 ! .set r25,25 ! .set r26,26 ! .set r27,27 ! .set r28,28 ! .set r29,29 ! .set r30,30 ! .set r31,31 ! .set f0,0 ! .set f1,1 ! .set f2,2 ! .set f3,3 ! .set f4,4 ! .set f5,5 ! .set f6,6 ! .set f7,7 ! .set f8,8 ! .set f9,9 ! .set f10,10 ! .set f11,11 ! .set f12,12 ! .set f13,13 ! .set f14,14 ! .set f15,15 ! .set f16,16 ! .set f17,17 ! .set f18,18 ! .set f19,19 ! .set f20,20 ! .set f21,21 ! #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> *************** *** 105,109 **** /* Allocate the stack space we need. */ ! stwux r1,r1,r4 /* Save registers we use. */ --- 105,109 ---- /* Allocate the stack space we need. */ ! stwux r1,r1,r4 /* Save registers we use. */ *************** *** 131,135 **** lwz r12,0(r12) mtctr r12 // r12 holds address of _ffi_prep_args ! bctrl lwz r2,20(r1) --- 131,135 ---- lwz r12,0(r12) mtctr r12 // r12 holds address of _ffi_prep_args ! bctrl lwz r2,20(r1) Index: ffi_darwin.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/ffi_darwin.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi_darwin.c 18 Jun 2004 20:07:12 -0000 1.1 --- ffi_darwin.c 14 May 2005 11:00:47 -0000 1.2 *************** *** 39,42 **** --- 39,43 ---- FLAG_RETURNS_FP = 1 << (31-29), FLAG_RETURNS_64BITS = 1 << (31-28), + FLAG_RETURNS_128BITS = 1 << (31-31), FLAG_ARG_NEEDS_COPY = 1 << (31- 7), *************** *** 87,91 **** /* 'stacktop' points at the previous backchain pointer. */ ! unsigned *const stacktop = stack + (ecif->cif->bytes / sizeof(unsigned)); /* 'fpr_base' points at the space for fpr1, and grows upwards as --- 88,92 ---- /* 'stacktop' points at the previous backchain pointer. */ ! unsigned *const stacktop = stack + (bytes / sizeof(unsigned)); /* 'fpr_base' points at the space for fpr1, and grows upwards as *************** *** 96,100 **** /* 'next_arg' grows up as we put parameters in it. */ ! unsigned *next_arg = stack + 6; /* 6 reserved posistions. */ int i = ecif->cif->nargs; --- 97,101 ---- /* 'next_arg' grows up as we put parameters in it. */ ! unsigned *next_arg = stack + 6; /* 6 reserved positions. */ int i = ecif->cif->nargs; *************** *** 138,141 **** --- 139,143 ---- FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; + case FFI_TYPE_DOUBLE: double_tmp = *(double *)*p_argv; *************** *** 149,152 **** --- 151,174 ---- break; + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + + case FFI_TYPE_LONGDOUBLE: + double_tmp = ((double *)*p_argv)[0]; + if (fparg_count >= NUM_FPR_ARG_REGISTERS) + *(double *)next_arg = double_tmp; + else + *fpr_base++ = double_tmp; + next_arg += 2; + fparg_count++; + double_tmp = ((double *)*p_argv)[1]; + if (fparg_count >= NUM_FPR_ARG_REGISTERS) + *(double *)next_arg = double_tmp; + else + *fpr_base++ = double_tmp; + next_arg += 2; + fparg_count++; + FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); + break; + #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: *************** *** 168,175 **** case FFI_TYPE_STRUCT: - - #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - #endif dest_cpy = (char *) next_arg; --- 190,193 ---- *************** *** 241,248 **** switch (cif->rtype->type) { #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif ! /* Fall through. */ case FFI_TYPE_DOUBLE: flags |= FLAG_RETURNS_64BITS; --- 259,270 ---- switch (cif->rtype->type) { + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: + flags |= FLAG_RETURNS_128BITS; + flags |= FLAG_RETURNS_FP; + break; #endif ! case FFI_TYPE_DOUBLE: flags |= FLAG_RETURNS_64BITS; *************** *** 273,279 **** /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest ! goes on the stack. Structures and long doubles (if not equivalent ! to double) are passed as a pointer to a copy of the structure. ! Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { --- 295,300 ---- /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest ! goes on the stack. Structures are passed as a pointer to a copy of ! the structure. Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { *************** *** 290,293 **** --- 311,327 ---- break; + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + + case FFI_TYPE_LONGDOUBLE: + fparg_count += 2; + /* If this FP arg is going on the stack, it must be + 8-byte-aligned. */ + if (fparg_count > NUM_FPR_ARG_REGISTERS + && intarg_count%2 != 0) + intarg_count++; + intarg_count +=2; + break; + #endif + case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: *************** *** 303,309 **** case FFI_TYPE_STRUCT: - #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE - case FFI_TYPE_LONGDOUBLE: - #endif size_al = (*ptr)->size; /* If the first member of the struct is a double, then align --- 337,340 ---- *************** *** 410,415 **** typedef struct aix_fd_struct { ! void *code_pointer; ! void *toc; } aix_fd; --- 441,446 ---- typedef struct aix_fd_struct { ! void *code_pointer; ! void *toc; } aix_fd; *************** *** 531,539 **** #ifndef _AIX __asm__ volatile ( ! "dcbf 0,%0;" ! "sync;" ! "icbi 0,%0;" ! "sync;" ! "isync;" : : "r"(addr) : "memory"); #endif --- 562,570 ---- #ifndef _AIX __asm__ volatile ( ! "dcbf 0,%0\n" ! "\tsync\n" ! "\ticbi 0,%0\n" ! "\tsync\n" ! "\tisync" : : "r"(addr) : "memory"); #endif *************** *** 573,576 **** --- 604,614 ---- pfr is the pointer to where f1-f13 are stored in ffi_closure_ASM. */ + typedef double ldbits[2]; + + union ldu + { + ldbits lb; + long double ld; + }; void ** avalue; *************** *** 582,585 **** --- 620,624 ---- double temp; unsigned size_al; + union ldu temp_ld; cif = closure->cif; *************** *** 690,693 **** --- 729,760 ---- break; + #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + + case FFI_TYPE_LONGDOUBLE: + /* A long double value consumes four GPRs and two FPRs. + There are 13 64bit floating point registers. */ + if (nf < NUM_FPR_ARG_REGISTERS - 1) + { + avalue[i] = pfr; + pfr += 2; + } + /* Here we have the situation where one part of the long double + is stored in fpr13 and the other part is already on the stack. + We use a union to pass the long double to avalue[i]. */ + else if (nf == NUM_FPR_ARG_REGISTERS - 1) + { + memcpy (&temp_ld.lb[0], pfr, sizeof(ldbits)); + memcpy (&temp_ld.lb[1], pgr + 2, sizeof(ldbits)); + avalue[i] = &temp_ld.ld; + } + else + { + avalue[i] = pgr; + } + nf += 2; + ng += 4; + pgr += 4; + break; + #endif default: FFI_ASSERT(0); Index: asm.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/asm.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** asm.h 18 Jun 2004 20:07:12 -0000 1.1 --- asm.h 14 May 2005 11:00:47 -0000 1.2 *************** *** 1,8 **** /* ----------------------------------------------------------------------- asm.h - Copyright (c) 1998 Geoffrey Keating - - PowerPC Assembly glue. ! $Id$ Permission is hereby granted, free of charge, to any person obtaining --- 1,6 ---- /* ----------------------------------------------------------------------- asm.h - Copyright (c) 1998 Geoffrey Keating ! PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining *************** *** 51,60 **** #define CALL_MCOUNT \ .pushsection; \ ! .section ".data"; \ .align ALIGNARG(2); \ 0:.long 0; \ .previous; \ mflr %r0; \ ! stw %r0,4(%r1); \ bl _GLOBAL_OFFSET_TABLE_@local-4; \ mflr %r11; \ --- 49,58 ---- #define CALL_MCOUNT \ .pushsection; \ ! .section ".data"; \ .align ALIGNARG(2); \ 0:.long 0; \ .previous; \ mflr %r0; \ ! stw %r0,4(%r1); \ bl _GLOBAL_OFFSET_TABLE_@local-4; \ mflr %r11; \ *************** *** 68,73 **** .previous; \ mflr %r0; \ ! lis %r11,0b@ha; \ ! stw %r0,4(%r1); \ addi %r0,%r11,0b@l; \ bl JUMPTARGET(_mcount); --- 66,71 ---- .previous; \ mflr %r0; \ ! lis %r11,0b@ha; \ ! stw %r0,4(%r1); \ addi %r0,%r11,0b@l; \ bl JUMPTARGET(_mcount); *************** *** 126,128 **** /* Local labels stripped out by the linker. */ #define L(x) .L##x - --- 124,125 ---- Index: ffitarget.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/ffitarget.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffitarget.h 18 Jun 2004 20:07:12 -0000 1.1 --- ffitarget.h 14 May 2005 11:00:47 -0000 1.2 *************** *** 89,91 **** #endif - --- 89,90 ---- Index: aix_closure.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/aix_closure.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** aix_closure.S 18 Jun 2004 20:07:12 -0000 1.1 --- aix_closure.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 1,5 **** /* ----------------------------------------------------------------------- aix_closure.S - Copyright (c) 2002 2003 Free Software Foundation, Inc. ! based on darwin_closure.S PowerPC Assembly glue. --- 1,5 ---- /* ----------------------------------------------------------------------- aix_closure.S - Copyright (c) 2002 2003 Free Software Foundation, Inc. ! based on darwin_closure.S PowerPC Assembly glue. *************** *** 120,127 **** stw r3, 200(r1) stw r4, 204(r1) ! stw r5, 208(r1) stw r6, 212(r1) stw r7, 216(r1) ! stw r8, 220(r1) stw r9, 224(r1) stw r10, 228(r1) --- 120,127 ---- stw r3, 200(r1) stw r4, 204(r1) ! stw r5, 208(r1) stw r6, 212(r1) stw r7, 216(r1) ! stw r8, 220(r1) stw r9, 224(r1) stw r10, 228(r1) *************** *** 136,144 **** stfd f7, 104(r1) stfd f8, 112(r1) ! stfd f9, 120(r1) ! stfd f10, 128(r1) ! stfd f11, 136(r1) ! stfd f12, 144(r1) ! stfd f13, 152(r1) /* set up registers for the routine that actually does the work */ --- 136,144 ---- stfd f7, 104(r1) stfd f8, 112(r1) ! stfd f9, 120(r1) ! stfd f10, 128(r1) ! stfd f11, 136(r1) ! stfd f12, 144(r1) ! stfd f13, 152(r1) /* set up registers for the routine that actually does the work */ *************** *** 192,196 **** /* case double */ ! L..46: lfd f1,0(r5) b L..44 --- 192,196 ---- /* case double */ ! L..46: lfd f1,0(r5) b L..44 *************** *** 234,238 **** /* case unsigned int16 */ ! L..58: addi r5,r5,2 lhz r3,0(r5) --- 234,238 ---- /* case unsigned int16 */ ! L..58: addi r5,r5,2 lhz r3,0(r5) Index: linux64.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/linux64.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** linux64.S 18 Jun 2004 20:07:12 -0000 1.1 --- linux64.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 1,5 **** /* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek <ja...@re...> ! PowerPC64 Assembly glue. --- 1,5 ---- /* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek <ja...@re...> ! PowerPC64 Assembly glue. *************** *** 24,28 **** ----------------------------------------------------------------------- */ ! #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> --- 24,28 ---- ----------------------------------------------------------------------- */ ! #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> Index: darwin.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/darwin.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** darwin.S 18 Jun 2004 20:07:12 -0000 1.1 --- darwin.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 1,4 **** --- 1,5 ---- /* ----------------------------------------------------------------------- darwin.S - Copyright (c) 2000 John Hornkvist + Copyright (c) 2004 Free Software Foundation, Inc. PowerPC Assembly glue. *************** *** 24,27 **** --- 25,38 ---- ----------------------------------------------------------------------- */ + #if defined(__ppc64__) + #define MODE_CHOICE(x, y) y + #else + #define MODE_CHOICE(x, y) x + #endif + + #define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + + #define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ + #define LIBFFI_ASM #include <fficonfig.h> *************** *** 40,45 **** _ffi_call_DARWIN: LFB0: ! mr r12,r8 /* We only need r12 until the call, ! so it doesn't have to be saved... */ LFB1: /* Save the old stack pointer as AP. */ --- 51,56 ---- _ffi_call_DARWIN: LFB0: ! mr r12,r8 /* We only need r12 until the call, ! so it doesn't have to be saved. */ LFB1: /* Save the old stack pointer as AP. */ *************** *** 52,65 **** mflr r9 ! stw r28,-16(r8) stw r29,-12(r8) ! stw r30, -8(r8) ! stw r31, -4(r8) ! stw r9, 8(r8) ! stw r2, 20(r1) LCFI1: ! /* Save arguments over call... */ mr r31,r5 /* flags, */ mr r30,r6 /* rvalue, */ --- 63,76 ---- mflr r9 ! stw r28,-16(r8) stw r29,-12(r8) ! stw r30,-8(r8) ! stw r31,-4(r8) ! stw r9,8(r8) ! stw r2,20(r1) LCFI1: ! /* Save arguments over call. */ mr r31,r5 /* flags, */ mr r30,r6 /* rvalue, */ *************** *** 71,75 **** li r9,0 ! mtctr r12 // r12 holds address of _ffi_prep_args bctrl lwz r2,20(r1) --- 82,86 ---- li r9,0 ! mtctr r12 /* r12 holds address of _ffi_prep_args. */ bctrl lwz r2,20(r1) *************** *** 82,98 **** /* Load all those argument registers. We have set up a nice stack frame, just load it into registers. */ ! lwz r3, 20+(1*4)(r1) ! lwz r4, 20+(2*4)(r1) ! lwz r5, 20+(3*4)(r1) ! lwz r6, 20+(4*4)(r1) nop ! lwz r7, 20+(5*4)(r1) ! lwz r8, 20+(6*4)(r1) ! lwz r9, 20+(7*4)(r1) lwz r10,20+(8*4)(r1) L1: /* Load all the FP registers. */ ! bf 6,L2 // 2f + 0x18 lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) --- 93,109 ---- /* Load all those argument registers. We have set up a nice stack frame, just load it into registers. */ ! lwz r3,20+(1*4)(r1) ! lwz r4,20+(2*4)(r1) ! lwz r5,20+(3*4)(r1) ! lwz r6,20+(4*4)(r1) nop ! lwz r7,20+(5*4)(r1) ! lwz r8,20+(6*4)(r1) ! lwz r9,20+(7*4)(r1) lwz r10,20+(8*4)(r1) L1: /* Load all the FP registers. */ ! bf 6,L2 /* No floats to load. */ lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) *************** *** 113,118 **** L2: ! mr r12,r29 /* Put the target address in r12 as specified. */ ! mtctr r12 nop nop --- 124,129 ---- L2: ! mr r12,r29 /* Put the target address in r12 as specified. */ ! mtctr r12 nop nop *************** *** 129,140 **** stw r4,4(r30) ! /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ ! lwz r9, 8(r28) ! lwz r31, -4(r28) mtlr r9 ! lwz r30, -8(r28) lwz r29,-12(r28) lwz r28,-16(r28) --- 140,151 ---- stw r4,4(r30) ! /* Fall through. */ L(done_return_value): /* Restore the registers we used and return. */ ! lwz r9,8(r28) ! lwz r31,-4(r28) mtlr r9 ! lwz r30,-8(r28) lwz r29,-12(r28) lwz r28,-16(r28) *************** *** 143,152 **** --- 154,174 ---- L(fp_return_value): + /* Do we have long double to store? */ + bf 31,L(fd_return_value) + stfd f1,0(r30) + stfd f2,8(r30) + b L(done_return_value) + + L(fd_return_value): + /* Do we have double to store? */ bf 28,L(float_return_value) stfd f1,0(r30) b L(done_return_value) + L(float_return_value): + /* We only have a float to store. */ stfs f1,0(r30) b L(done_return_value) + LFE1: /* END(_ffi_call_DARWIN) */ *************** *** 179,183 **** .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 ! .align 2 LECIE1: .globl _ffi_call_DARWIN.eh --- 201,205 ---- .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 ! .align LOG2_GPR_BYTES LECIE1: .globl _ffi_call_DARWIN.eh *************** *** 188,194 **** LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset ! .long LLFB0$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB0 ! .long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 --- 210,216 ---- LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset ! .g_long LLFB0$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB0 ! .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 *************** *** 216,223 **** .byte 0xd ; DW_CFA_def_cfa_register .byte 0x1c ; uleb128 0x1c ! .align 2 LEFDE1: .data ! .align 2 LLFB0$non_lazy_ptr: ! .long LFB0 --- 238,245 ---- .byte 0xd ; DW_CFA_def_cfa_register .byte 0x1c ; uleb128 0x1c ! .align LOG2_GPR_BYTES LEFDE1: .data ! .align LOG2_GPR_BYTES LLFB0$non_lazy_ptr: ! .g_long LFB0 Index: linux64_closure.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/linux64_closure.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** linux64_closure.S 18 Jun 2004 20:07:12 -0000 1.1 --- linux64_closure.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 6,18 **** #ifdef __powerpc64__ ! .hidden ffi_closure_LINUX64, .ffi_closure_LINUX64 ! .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 ! .section ".opd","aw" ! .align 3 ffi_closure_LINUX64: ! .quad .ffi_closure_LINUX64,.TOC.@tocbase,0 ! .size ffi_closure_LINUX64,24 ! .type .ffi_closure_LINUX64,@function ! .text .ffi_closure_LINUX64: .LFB1: --- 6,18 ---- #ifdef __powerpc64__ ! .hidden ffi_closure_LINUX64, .ffi_closure_LINUX64 ! .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 ! .section ".opd","aw" ! .align 3 ffi_closure_LINUX64: ! .quad .ffi_closure_LINUX64,.TOC.@tocbase,0 ! .size ffi_closure_LINUX64,24 ! .type .ffi_closure_LINUX64,@function ! .text .ffi_closure_LINUX64: .LFB1: *************** *** 72,76 **** # so we know how to deal with each type ! # look up the proper starting point in table # by using return type as offset mflr %r4 # move address of .Lret to r4 --- 72,76 ---- # so we know how to deal with each type ! # look up the proper starting point in table # by using return type as offset mflr %r4 # move address of .Lret to r4 Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/ffi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.c 18 Jun 2004 20:07:12 -0000 1.1 --- ffi.c 14 May 2005 11:00:47 -0000 1.2 *************** *** 1,8 **** /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Geoffrey Keating - - PowerPC Foreign Function Interface ! $Id$ Permission is hereby granted, free of charge, to any person obtaining --- 1,6 ---- /* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Geoffrey Keating ! PowerPC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining *************** *** 68,72 **** | Return address from ffi_call_SYSV 4bytes | higher addresses |--------------------------------------------| ! | Previous backchain pointer 4 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*4 | | ffi_call_SYSV --- 66,70 ---- | Return address from ffi_call_SYSV 4bytes | higher addresses |--------------------------------------------| ! | Previous backchain pointer 4 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*4 | | ffi_call_SYSV *************** *** 85,89 **** |--------------------------------------------| <<< ffi_call_SYSV ! */ /*@-exportheader@*/ --- 83,87 ---- |--------------------------------------------| <<< ffi_call_SYSV ! */ /*@-exportheader@*/ *************** *** 93,97 **** const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; ! /* 'stacktop' points at the previous backchain pointer. */ unsigned *const stacktop = stack + (bytes / sizeof(unsigned)); --- 91,95 ---- const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; ! /* 'stacktop' points at the previous backchain pointer. */ unsigned *const stacktop = stack + (bytes / sizeof(unsigned)); *************** *** 132,139 **** /* Deal with return values that are actually pass-by-reference. */ if (flags & FLAG_RETVAL_REFERENCE) ! { ! *gpr_base++ = (unsigned long)(char *)ecif->rvalue; ! intarg_count++; ! } /* Now for the arguments. */ --- 130,137 ---- /* Deal with return values that are actually pass-by-reference. */ if (flags & FLAG_RETVAL_REFERENCE) ! { ! *gpr_base++ = (unsigned long)(char *)ecif->rvalue; ! intarg_count++; ! } /* Now for the arguments. */ *************** *** 193,208 **** else { ! /* whoops: abi states only certain register pairs ! * can be used for passing long long int ! * specifically (r3,r4), (r5,r6), (r7,r8), ! * (r9,r10) and if next arg is long long but ! * not correct starting register of pair then skip ! * until the proper starting register */ ! if (intarg_count%2 != 0) ! { ! intarg_count ++; ! gpr_base++; ! } *(long long *)gpr_base = *(long long *)*p_argv; gpr_base += 2; --- 191,206 ---- else { ! /* whoops: abi states only certain register pairs ! * can be used for passing long long int ! * specifically (r3,r4), (r5,r6), (r7,r8), ! * (r9,r10) and if next arg is long long but ! * not correct starting register of pair then skip ! * until the proper starting register */ ! if (intarg_count%2 != 0) ! { ! intarg_count ++; ! gpr_base++; ! } *(long long *)gpr_base = *(long long *)*p_argv; gpr_base += 2; *************** *** 218,222 **** copy_space -= struct_copy_size; memcpy(copy_space, (char *)*p_argv, (*ptr)->size); ! gprvalue = (unsigned long)copy_space; --- 216,220 ---- copy_space -= struct_copy_size; memcpy(copy_space, (char *)*p_argv, (*ptr)->size); ! gprvalue = (unsigned long)copy_space; *************** *** 277,281 **** | CR save area 8bytes | |--------------------------------------------| ! | Previous backchain pointer 8 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*8 | | ffi_call_LINUX64 --- 275,279 ---- | CR save area 8bytes | |--------------------------------------------| ! | Previous backchain pointer 8 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*8 | | ffi_call_LINUX64 *************** *** 300,304 **** |--------------------------------------------| <<< ffi_call_LINUX64 ! */ /*@-exportheader@*/ --- 298,302 ---- |--------------------------------------------| <<< ffi_call_LINUX64 ! */ /*@-exportheader@*/ *************** *** 315,319 **** we use GPR registers, then continues at rest. */ unsigned long *const gpr_base = stacktop - ASM_NEEDS_REGISTERS64 ! - NUM_GPR_ARG_REGISTERS64; unsigned long *const gpr_end = gpr_base + NUM_GPR_ARG_REGISTERS64; unsigned long *const rest = stack + 6 + NUM_GPR_ARG_REGISTERS64; --- 313,317 ---- we use GPR registers, then continues at rest. */ unsigned long *const gpr_base = stacktop - ASM_NEEDS_REGISTERS64 ! - NUM_GPR_ARG_REGISTERS64; unsigned long *const gpr_end = gpr_base + NUM_GPR_ARG_REGISTERS64; unsigned long *const rest = stack + 6 + NUM_GPR_ARG_REGISTERS64; *************** *** 435,439 **** gprvalue = *(signed int *)*p_argv; goto putgpr; ! case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: --- 433,437 ---- gprvalue = *(signed int *)*p_argv; goto putgpr; ! case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: *************** *** 467,471 **** if (cif->abi != FFI_LINUX64) ! { /* All the machine-independent calculation of cif->bytes will be wrong. Redo the calculation for SYSV. */ --- 465,469 ---- if (cif->abi != FFI_LINUX64) ! { /* All the machine-independent calculation of cif->bytes will be wrong. Redo the calculation for SYSV. */ *************** *** 498,505 **** - Structures of size <= 4 bytes also returned in gpr3; - 64-bit integer values and structures between 5 and 8 bytes are returned ! in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Larger structures and long double (if not equivalent to double) values ! are allocated space and a pointer is passed as the first argument. For LINUX64: - integer values in gpr3; --- 496,503 ---- - Structures of size <= 4 bytes also returned in gpr3; - 64-bit integer values and structures between 5 and 8 bytes are returned ! in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Larger structures and long double (if not equivalent to double) values ! are allocated space and a pointer is passed as the first argument. For LINUX64: - integer values in gpr3; *************** *** 576,583 **** either both words must fit in registers or both go on the stack. If they go on the stack, they must ! be 8-byte-aligned. */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 ! || (intarg_count >= NUM_GPR_ARG_REGISTERS ! && intarg_count%2 != 0)) intarg_count++; intarg_count += 2; --- 574,585 ---- either both words must fit in registers or both go on the stack. If they go on the stack, they must ! be 8-byte-aligned. ! ! Also, only certain register pairs can be used for ! passing long long int -- specifically (r3,r4), (r5,r6), ! (r7,r8), (r9,r10). ! */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 ! || intarg_count%2 != 0) intarg_count++; intarg_count += 2; *************** *** 675,692 **** /*@-declundef@*/ /*@-exportheader@*/ ! extern void ffi_call_SYSV(/*@out@*/ extended_cif *, ! unsigned, unsigned, ! /*@out@*/ unsigned *, void (*fn)()); ! extern void hidden ffi_call_LINUX64(/*@out@*/ extended_cif *, unsigned long, unsigned long, ! /*@out@*/ unsigned long *, void (*fn)()); /*@=declundef@*/ /*@=exportheader@*/ ! void ffi_call(/*@dependent@*/ ffi_cif *cif, ! void (*fn)(), ! /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { --- 677,694 ---- /*@-declundef@*/ /*@-exportheader@*/ ! extern void ffi_call_SYSV(/*@out@*/ extended_cif *, ! unsigned, unsigned, ! /*@out@*/ unsigned *, void (*fn)()); ! extern void hidden ffi_call_LINUX64(/*@out@*/ extended_cif *, unsigned long, unsigned long, ! /*@out@*/ unsigned long *, void (*fn)()); /*@=declundef@*/ /*@=exportheader@*/ ! void ffi_call(/*@dependent@*/ ffi_cif *cif, ! void (*fn)(), ! /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { *************** *** 695,703 **** ecif.cif = cif; ecif.avalue = avalue; ! /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ ! if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { --- 697,705 ---- ecif.cif = cif; ecif.avalue = avalue; ! /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ ! if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { *************** *** 708,714 **** else ecif.rvalue = rvalue; ! ! ! switch (cif->abi) { #ifndef POWERPC64 --- 710,716 ---- else ecif.rvalue = rvalue; ! ! ! switch (cif->abi) { #ifndef POWERPC64 *************** *** 716,720 **** case FFI_GCC_SYSV: /*@-usedef@*/ ! ffi_call_SYSV(&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); /*@=usedef@*/ --- 718,722 ---- case FFI_GCC_SYSV: /*@-usedef@*/ ! ffi_call_SYSV(&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); /*@=usedef@*/ *************** *** 745,750 **** char * addr; for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) { ! addr = addr1 + i; ! __asm__ volatile ("icbi 0,%0;" "dcbf 0,%0;" : : "r"(addr) : "memory"); } addr = addr1 + size - 1; --- 747,752 ---- char * addr; for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) { ! addr = addr1 + i; ! __asm__ volatile ("icbi 0,%0;" "dcbf 0,%0;" : : "r"(addr) : "memory"); } addr = addr1 + size - 1; *************** *** 800,818 **** } ffi_dblfl; ! int ffi_closure_helper_SYSV (ffi_closure*, void*, unsigned long*, ffi_dblfl*, unsigned long*); ! /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r11 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting ! * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work */ int ! ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue, ! unsigned long * pgr, ffi_dblfl * pfr, ! unsigned long * pst) { /* rvalue is the pointer to space for return value in closure assembly */ --- 802,820 ---- } ffi_dblfl; ! int ffi_closure_helper_SYSV (ffi_closure*, void*, unsigned long*, ffi_dblfl*, unsigned long*); ! /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r11 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting ! * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work */ int ! ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue, ! unsigned long * pgr, ffi_dblfl * pfr, ! unsigned long * pst) { /* rvalue is the pointer to space for return value in closure assembly */ *************** *** 826,831 **** long nf; /* number of floating registers already used */ long ng; /* number of general registers already used */ ! ffi_cif * cif; ! double temp; cif = closure->cif; --- 828,833 ---- long nf; /* number of floating registers already used */ long ng; /* number of general registers already used */ ! ffi_cif * cif; ! double temp; cif = closure->cif; *************** *** 847,851 **** avn = cif->nargs; arg_types = cif->arg_types; ! /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) --- 849,853 ---- avn = cif->nargs; arg_types = cif->arg_types; ! /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) *************** *** 855,880 **** case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: ! /* there are 8 gpr registers used to pass values */ ! if (ng < 8) { ! avalue[i] = (((char *)pgr)+3); ! ng++; ! pgr++; ! } else { ! avalue[i] = (((char *)pst)+3); ! pst++; ! } break; ! case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: ! /* there are 8 gpr registers used to pass values */ ! if (ng < 8) { ! avalue[i] = (((char *)pgr)+2); ! ng++; ! pgr++; ! } else { ! avalue[i] = (((char *)pst)+2); ! pst++; ! } break; --- 857,882 ---- case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: ! /* there are 8 gpr registers used to pass values */ ! if (ng < 8) { ! avalue[i] = (((char *)pgr)+3); ! ng++; ! pgr++; ! } else { ! avalue[i] = (((char *)pst)+3); ! pst++; ! } break; ! case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: ! /* there are 8 gpr registers used to pass values */ ! if (ng < 8) { ! avalue[i] = (((char *)pgr)+2); ! ng++; ! pgr++; ! } else { ! avalue[i] = (((char *)pst)+2); ! pst++; ! } break; *************** *** 883,907 **** case FFI_TYPE_POINTER: /* there are 8 gpr registers used to pass values */ ! if (ng < 8) { ! avalue[i] = pgr; ! ng++; ! pgr++; ! } else { ! avalue[i] = pst; ! pst++; ! } break; case FFI_TYPE_STRUCT: ! /* Structs are passed by reference. The address will appear in a gpr if it is one of the first 8 arguments. */ ! if (ng < 8) { ! avalue[i] = (void *) *pgr; ! ng++; ! pgr++; ! } else { ! avalue[i] = (void *) *pst; ! pst++; ! } break; --- 885,909 ---- case FFI_TYPE_POINTER: /* there are 8 gpr registers used to pass values */ ! if (ng < 8) { ! avalue[i] = pgr; ! ng++; ! pgr++; ! } else { ! avalue[i] = pst; ! pst++; ! } break; case FFI_TYPE_STRUCT: ! /* Structs are passed by reference. The address will appear in a gpr if it is one of the first 8 arguments. */ ! if (ng < 8) { ! avalue[i] = (void *) *pgr; ! ng++; ! pgr++; ! } else { ! avalue[i] = (void *) *pst; ! pst++; ! } break; *************** *** 909,976 **** case FFI_TYPE_UINT64: /* passing long long ints are complex, they must ! * be passed in suitable register pairs such as ! * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) ! * and if the entire pair aren't available then the outgoing ! * parameter stack is used for both but an alignment of 8 ! * must will be kept. So we must either look in pgr ! * or pst to find the correct address for this type ! * of parameter. ! */ ! if (ng < 7) { ! if (ng & 0x01) { ! /* skip r4, r6, r8 as starting points */ ! ng++; ! pgr++; ! } ! avalue[i] = pgr; ! ng+=2; ! pgr+=2; ! } else { ! if (((long)pst) & 4) pst++; ! avalue[i] = pst; ! pst+=2; ! } ! break; case FFI_TYPE_FLOAT: ! /* unfortunately float values are stored as doubles ! * in the ffi_closure_SYSV code (since we don't check ! * the type in that routine). ! */ ! /* there are 8 64bit floating point registers */ ! if (nf < 8) { ! temp = pfr->d; ! pfr->f = (float)temp; ! avalue[i] = pfr; ! nf++; ! pfr++; ! } else { /* FIXME? here we are really changing the values ! * stored in the original calling routines outgoing ! * parameter stack. This is probably a really ! * naughty thing to do but... ! */ ! avalue[i] = pst; ! nf++; ! pst+=1; ! } break; case FFI_TYPE_DOUBLE: /* On the outgoing stack all values are aligned to 8 */ ! /* there are 8 64bit floating point registers */ ! if (nf < 8) { ! avalue[i] = pfr; ! nf++; ! pfr++; ! } else { ! if (((long)pst) & 4) pst++; ! avalue[i] = pst; ! nf++; ! pst+=2; ! } break; --- 911,978 ---- case FFI_TYPE_UINT64: /* passing long long ints are complex, they must ! * be passed in suitable register pairs such as ! * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) ! * and if the entire pair aren't available then the outgoing ! * parameter stack is used for both but an alignment of 8 ! * must will be kept. So we must either look in pgr ! * or pst to find the correct address for this type ! * of parameter. ! */ ! if (ng < 7) { ! if (ng & 0x01) { ! /* skip r4, r6, r8 as starting points */ ! ng++; ! pgr++; ! } ! avalue[i] = pgr; ! ng+=2; ! pgr+=2; ! } else { ! if (((long)pst) & 4) pst++; ! avalue[i] = pst; ! pst+=2; ! } ! break; case FFI_TYPE_FLOAT: ! /* unfortunately float values are stored as doubles ! * in the ffi_closure_SYSV code (since we don't check ! * the type in that routine). ! */ ! /* there are 8 64bit floating point registers */ ! if (nf < 8) { ! temp = pfr->d; ! pfr->f = (float)temp; ! avalue[i] = pfr; ! nf++; ! pfr++; ! } else { /* FIXME? here we are really changing the values ! * stored in the original calling routines outgoing ! * parameter stack. This is probably a really ! * naughty thing to do but... ! */ ! avalue[i] = pst; ! nf++; ! pst+=1; ! } break; case FFI_TYPE_DOUBLE: /* On the outgoing stack all values are aligned to 8 */ ! /* there are 8 64bit floating point registers */ ! if (nf < 8) { ! avalue[i] = pfr; ! nf++; ! pfr++; ! } else { ! if (((long)pst) & 4) pst++; ! avalue[i] = pst; ! nf++; ! pst+=2; ! } break; *************** *** 994,998 **** int hidden ! ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, unsigned long *pst, ffi_dblfl *pfr) { --- 996,1000 ---- int hidden ! ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, unsigned long *pst, ffi_dblfl *pfr) { *************** *** 1005,1009 **** ffi_type **arg_types; long i, avn; ! ffi_cif *cif; ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; --- 1007,1011 ---- ffi_type **arg_types; long i, avn; ! ffi_cif *cif; ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; *************** *** 1022,1026 **** avn = cif->nargs; arg_types = cif->arg_types; ! /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) --- 1024,1028 ---- avn = cif->nargs; arg_types = cif->arg_types; ! /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) *************** *** 1033,1037 **** pst++; break; ! case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: --- 1035,1039 ---- pst++; break; ! case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: *************** *** 1065,1075 **** case FFI_TYPE_FLOAT: /* unfortunately float values are stored as doubles ! * in the ffi_closure_LINUX64 code (since we don't check ! * the type in that routine). ! */ ! /* there are 13 64bit floating point registers */ ! if (pfr < end_pfr) { double temp = pfr->d; --- 1067,1077 ---- case FFI_TYPE_FLOAT: /* unfortunately float values are stored as doubles ! * in the ffi_closure_LINUX64 code (since we don't check ! * the type in that routine). ! */ ! /* there are 13 64bit floating point registers */ ! if (pfr < end_pfr) { double temp = pfr->d; *************** *** 1085,1089 **** case FFI_TYPE_DOUBLE: /* On the outgoing stack all values are aligned to 8 */ ! /* there are 13 64bit floating point registers */ if (pfr < end_pfr) --- 1087,1091 ---- case FFI_TYPE_DOUBLE: /* On the outgoing stack all values are aligned to 8 */ ! /* there are 13 64bit floating point registers */ if (pfr < end_pfr) Index: ppc_closure.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/ppc_closure.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ppc_closure.S 18 Jun 2004 20:07:12 -0000 1.1 --- ppc_closure.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 4,8 **** #include <powerpc/asm.h> ! .file "ppc_closure.S" #ifndef __powerpc64__ --- 4,8 ---- #include <powerpc/asm.h> ! .file "ppc_closure.S" #ifndef __powerpc64__ *************** *** 18,29 **** # we want to build up an areas for the parameters passed # in registers (both floating point and integer) ! # so first save gpr 3 to gpr 10 (aligned to 4) stw %r3, 16(%r1) stw %r4, 20(%r1) ! stw %r5, 24(%r1) stw %r6, 28(%r1) stw %r7, 32(%r1) ! stw %r8, 36(%r1) stw %r9, 40(%r1) stw %r10,44(%r1) --- 18,29 ---- # we want to build up an areas for the parameters passed # in registers (both floating point and integer) ! # so first save gpr 3 to gpr 10 (aligned to 4) stw %r3, 16(%r1) stw %r4, 20(%r1) ! stw %r5, 24(%r1) stw %r6, 28(%r1) stw %r7, 32(%r1) ! stw %r8, 36(%r1) stw %r9, 40(%r1) stw %r10,44(%r1) *************** *** 42,61 **** # get the context pointer from the trampoline mr %r3,%r11 ! ! # now load up the pointer to the result storage addi %r4,%r1,112 ! # now load up the pointer to the saved gpr registers ! addi %r5,%r1,16 ! # now load up the pointer to the saved fpr registers */ ! addi %r6,%r1,48 ! # now load up the pointer to the outgoing parameter # stack in the previous frame # i.e. the previous frame pointer + 8 addi %r7,%r1,152 ! ! # make the call bl JUMPTARGET(ffi_closure_helper_SYSV) --- 42,61 ---- # get the context pointer from the trampoline mr %r3,%r11 ! ! # now load up the pointer to the result storage addi %r4,%r1,112 ! # now load up the pointer to the saved gpr registers ! addi %r5,%r1,16 ! # now load up the pointer to the saved fpr registers */ ! addi %r6,%r1,48 ! # now load up the pointer to the outgoing parameter # stack in the previous frame # i.e. the previous frame pointer + 8 addi %r7,%r1,152 ! ! # make the call bl JUMPTARGET(ffi_closure_helper_SYSV) *************** *** 64,68 **** # so we know how to deal with each type ! # look up the proper starting point in table # by using return type as offset addi %r5,%r1,112 # get pointer to results area --- 64,68 ---- # so we know how to deal with each type ! # look up the proper starting point in table # by using return type as offset addi %r5,%r1,112 # get pointer to results area *************** *** 109,113 **** # case FFI_TYPE_DOUBLE .Lret_type3: ! lfd %f1,0(%r5) b .Lfinish nop --- 109,113 ---- # case FFI_TYPE_DOUBLE .Lret_type3: ! lfd %f1,0(%r5) b .Lfinish nop *************** *** 116,120 **** # case FFI_TYPE_LONGDOUBLE .Lret_type4: ! lfd %f1,0(%r5) b .Lfinish nop --- 116,120 ---- # case FFI_TYPE_LONGDOUBLE .Lret_type4: ! lfd %f1,0(%r5) b .Lfinish nop *************** *** 123,127 **** # case FFI_TYPE_UINT8 .Lret_type5: ! lbz %r3,3(%r5) b .Lfinish nop --- 123,127 ---- # case FFI_TYPE_UINT8 .Lret_type5: ! lbz %r3,3(%r5) b .Lfinish nop *************** *** 191,197 **** nop ! # case done .Lfinish: ! lwz %r0,148(%r1) mtlr %r0 --- 191,197 ---- nop ! # case done .Lfinish: ! lwz %r0,148(%r1) mtlr %r0 Index: darwin_closure.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/darwin_closure.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** darwin_closure.S 18 Jun 2004 20:07:12 -0000 1.1 --- darwin_closure.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 1,4 **** /* ----------------------------------------------------------------------- ! darwin_closure.S - Copyright (c) 2002 2003 Free Software Foundation, Inc. based on ppc_closure.S --- 1,4 ---- /* ----------------------------------------------------------------------- ! darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation, Inc. based on ppc_closure.S *************** *** 28,48 **** #define L(x) x .file "darwin_closure.S" .text ! .align 2 .globl _ffi_closure_ASM .text ! .align 2 _ffi_closure_ASM: LFB1: ! mflr r0 /* extract return address */ ! stw r0, 8(r1) /* save the return address */ LCFI0: /* 24 Bytes (Linkage Area) 32 Bytes (outgoing parameter area, always reserved) 104 Bytes (13*8 from FPR) ! 8 Bytes (result) ! 168 Bytes */ stwu r1,-176(r1) /* skip over caller save area --- 28,60 ---- #define L(x) x + #if defined(__ppc64__) + #define MODE_CHOICE(x, y) y + #else + #define MODE_CHOICE(x, y) x + #endif + + #define lgu MODE_CHOICE(lwzu, ldu) + + #define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + + #define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ + .file "darwin_closure.S" .text ! .align LOG2_GPR_BYTES .globl _ffi_closure_ASM .text ! .align LOG2_GPR_BYTES _ffi_closure_ASM: LFB1: ! mflr r0 /* extract return address */ ! stw r0,8(r1) /* save the return address */ LCFI0: /* 24 Bytes (Linkage Area) 32 Bytes (outgoing parameter area, always reserved) 104 Bytes (13*8 from FPR) ! 16 Bytes (result) ! 176 Bytes */ stwu r1,-176(r1) /* skip over caller save area *************** *** 54,80 **** /* We store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area. */ ! stw r3, 200(r1) ! stw r4, 204(r1) ! stw r5, 208(r1) ! stw r6, 212(r1) ! stw r7, 216(r1) ! stw r8, 220(r1) ! stw r9, 224(r1) ! stw r10, 228(r1) /* We save fpr 1 to fpr 13. (aligned to 8) */ ! stfd f1, 56(r1) ! stfd f2, 64(r1) ! stfd f3, 72(r1) ! stfd f4, 80(r1) ! stfd f5, 88(r1) ! stfd f6, 96(r1) ! stfd f7, 104(r1) ! stfd f8, 112(r1) ! stfd f9, 120(r1) ! stfd f10, 128(r1) ! stfd f11, 136(r1) ! stfd f12, 144(r1) ! stfd f13, 152(r1) /* Set up registers for the routine that actually does the work --- 66,92 ---- /* We store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area. */ ! stw r3,200(r1) ! stw r4,204(r1) ! stw r5,208(r1) ! stw r6,212(r1) ! stw r7,216(r1) ! stw r8,220(r1) ! stw r9,224(r1) ! stw r10,228(r1) /* We save fpr 1 to fpr 13. (aligned to 8) */ ! stfd f1,56(r1) ! stfd f2,64(r1) ! stfd f3,72(r1) ! stfd f4,80(r1) ! stfd f5,88(r1) ! stfd f6,96(r1) ! stfd f7,104(r1) ! stfd f8,112(r1) ! stfd f9,120(r1) ! stfd f10,128(r1) ! stfd f11,136(r1) ! stfd f12,144(r1) ! stfd f13,152(r1) /* Set up registers for the routine that actually does the work *************** *** 151,157 **** Lret_type4: lfd f1,0(r5) b Lfinish nop - nop /* case FFI_TYPE_UINT8 */ --- 163,169 ---- Lret_type4: lfd f1,0(r5) + lfd f2,8(r5) b Lfinish nop /* case FFI_TYPE_UINT8 */ *************** *** 227,233 **** /* case done */ Lfinish: ! addi r1,r1,176 /* Restore stack pointer. */ ! lwz r0,8(r1) /* Get return address. */ ! mtlr r0 /* Reset link register. */ blr --- 239,245 ---- /* case done */ Lfinish: ! addi r1,r1,176 /* Restore stack pointer. */ ! lwz r0,8(r1) /* Get return address. */ ! mtlr r0 /* Reset link register. */ blr *************** *** 235,239 **** --- 247,255 ---- .data + #ifdef no_live_support .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms + #else + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support + #endif EH_frame1: .set L$set$0,LECIE1-LSCIE1 *************** *** 251,255 **** .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 ! .align 2 LECIE1: .globl _ffi_closure_ASM.eh --- 267,271 ---- .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 ! .align LOG2_GPR_BYTES LECIE1: .globl _ffi_closure_ASM.eh *************** *** 261,267 **** LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset ! .long LLFB1$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB1 ! .long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 --- 277,283 ---- LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset ! .g_long LLFB1$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB1 ! .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 *************** *** 276,287 **** .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 ! .align 2 LEFDE1: .data ! .align 2 LDFCM0: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 ! .align 2 Lffi_closure_helper_DARWIN$stub: .indirect_symbol _ffi_closure_helper_DARWIN mflr r0 --- 292,304 ---- .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 ! .align LOG2_GPR_BYTES LEFDE1: .data ! .align LOG2_GPR_BYTES LDFCM0: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 ! .align LOG2_GPR_BYTES Lffi_closure_helper_DARWIN$stub: + #if 1 .indirect_symbol _ffi_closure_helper_DARWIN mflr r0 *************** *** 291,304 **** addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) mtlr r0 ! lwzu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) mtctr r12 bctr - .data .lazy_symbol_pointer L_ffi_closure_helper_DARWIN$lazy_ptr: .indirect_symbol _ffi_closure_helper_DARWIN ! .long dyld_stub_binding_helper .data ! .align 2 LLFB1$non_lazy_ptr: ! .long LFB1 --- 308,321 ---- addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) mtlr r0 ! lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) mtctr r12 bctr .lazy_symbol_pointer L_ffi_closure_helper_DARWIN$lazy_ptr: .indirect_symbol _ffi_closure_helper_DARWIN ! .g_long dyld_stub_binding_helper ! #endif .data ! .align LOG2_GPR_BYTES LLFB1$non_lazy_ptr: ! .g_long LFB1 Index: sysv.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/powerpc/sysv.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sysv.S 18 Jun 2004 20:07:12 -0000 1.1 --- sysv.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 1,8 **** /* ----------------------------------------------------------------------- sysv.h - Copyright (c) 1998 Geoffrey Keating - - PowerPC Assembly glue. ! $Id$ Permission is hereby granted, free of charge, to any person obtaining --- 1,6 ---- /* ----------------------------------------------------------------------- sysv.h - Copyright (c) 1998 Geoffrey Keating ! PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining *************** *** 26,30 **** ----------------------------------------------------------------------- */ ! #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> --- 24,28 ---- ----------------------------------------------------------------------- */ ! #define LIBFFI_ASM #include <fficonfig.h> #include <ffi.h> |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:27
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/arm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/arm Modified Files: sysv.S ffi.c Log Message: updated with new version from gcc cvs Index: sysv.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/arm/sysv.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sysv.S 18 Jun 2004 20:07:10 -0000 1.1 --- sysv.S 14 May 2005 11:00:48 -0000 1.2 *************** *** 41,125 **** #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif - - .text ! # a1: ffi_prep_args ! # a2: &ecif ! # a3: cif->bytes ! # a4: fig->flags ! # sp+0: ecif.rvalue ! # sp+4: fn ! # This assumes we are using gas. ! ENTRY(ffi_call_SYSV) ! # Save registers ! stmfd sp!, {a1-a4, fp, lr} ! mov fp, sp ! # Make room for all of the new args. ! sub sp, fp, a3 ! # Place all of the ffi_prep_args in position ! mov ip, a1 ! mov a1, sp ! # a2 already set ! # And call ! mov lr, pc ! mov pc, ip ! # move first 4 parameters in registers ! ldr a1, [sp, #0] ! ldr a2, [sp, #4] ! ldr a3, [sp, #8] ! ldr a4, [sp, #12] ! # and adjust stack ! ldr ip, [fp, #8] ! cmp ip, #16 ! movge ip, #16 ! add sp, sp, ip - # call function - mov lr, pc - ldr pc, [fp, #28] ! # Remove the space we pushed for the args ! mov sp, fp ! # Load a3 with the pointer to storage for the return value ! ldr a3, [sp, #24] ! # Load a4 with the return type code ! ldr a4, [sp, #12] ! # If the return value pointer is NULL, assume no return value. ! cmp a3, #0 ! beq epilogue ! # return INT ! cmp a4, #FFI_TYPE_INT ! streq a1, [a3] ! beq epilogue ! # return FLOAT ! cmp a4, #FFI_TYPE_FLOAT #ifdef __SOFTFP__ ! streq a1, [a3] ! #else ! stfeqs f0, [a3] #endif ! beq epilogue ! # return DOUBLE or LONGDOUBLE ! cmp a4, #FFI_TYPE_DOUBLE #ifdef __SOFTFP__ ! stmeqia a3, {a1, a2} ! #else ! stfeqd f0, [a3] #endif ! epilogue: ! ldmfd sp!, {a1-a4, fp, pc} .ffi_call_SYSV_end: --- 41,207 ---- #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif ! #ifdef __ELF__ ! #define LSYM(x) .x ! #else ! #define LSYM(x) x ! #endif ! /* We need a better way of testing for this, but for now, this is all ! we can do. */ ! @ This selects the minimum architecture level required. ! #define __ARM_ARCH__ 3 ! #if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) ! # undef __ARM_ARCH__ ! # define __ARM_ARCH__ 4 ! #endif ! ! #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ ! || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ ! || defined(__ARM_ARCH_5TEJ__) ! # undef __ARM_ARCH__ ! # define __ARM_ARCH__ 5 ! #endif ! #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ ! || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ ! || defined(__ARM_ARCH_6ZK__) ! # undef __ARM_ARCH__ ! # define __ARM_ARCH__ 6 ! #endif ! #if __ARM_ARCH__ >= 5 ! # define call_reg(x) blx x ! #elif defined (__ARM_ARCH_4T__) ! # define call_reg(x) mov lr, pc ; bx x ! # if defined(__thumb__) || defined(__THUMB_INTERWORK__) ! # define __INTERWORKING__ ! # endif ! #else ! # define call_reg(x) mov lr, pc ; mov pc, x ! #endif ! #if defined(__thumb__) && !defined(__THUMB_INTERWORK__) ! .macro ARM_FUNC_START name ! .text ! .align 0 ! .thumb ! .thumb_func ! ENTRY(\name) ! bx pc ! nop ! .arm ! /* A hook to tell gdb that we've switched to ARM mode. Also used to call ! directly from other local arm routines. */ ! _L__\name: ! .endm ! #else ! .macro ARM_FUNC_START name ! .text ! .align 0 ! .arm ! ENTRY(\name) ! .endm ! #endif ! .macro RETLDM regs=, cond=, dirn=ia ! #if defined (__INTERWORKING__) ! .ifc "\regs","" ! ldr\cond lr, [sp], #4 ! .else ! ldm\cond\dirn sp!, {\regs, lr} ! .endif ! bx\cond lr ! #else ! .ifc "\regs","" ! ldr\cond pc, [sp], #4 ! .else ! ldm\cond\dirn sp!, {\regs, pc} ! .endif ! #endif ! .endm ! @ r0: ffi_prep_args ! @ r1: &ecif ! @ r2: cif->bytes ! @ r3: fig->flags ! @ sp+0: ecif.rvalue ! @ sp+4: fn ! @ This assumes we are using gas. ! ARM_FUNC_START ffi_call_SYSV ! @ Save registers ! stmfd sp!, {r0-r3, fp, lr} ! mov fp, sp ! @ Make room for all of the new args. ! sub sp, fp, r2 ! @ Place all of the ffi_prep_args in position ! mov ip, r0 ! mov r0, sp ! @ r1 already set ! @ Call ffi_prep_args(stack, &ecif) ! call_reg(ip) ! @ move first 4 parameters in registers ! ldmia sp, {r0-r3} ! ! @ and adjust stack ! ldr ip, [fp, #8] ! cmp ip, #16 ! movhs ip, #16 ! add sp, sp, ip ! ! @ call (fn) (...) ! ldr ip, [fp, #28] ! call_reg(ip) ! ! @ Remove the space we pushed for the args ! mov sp, fp ! ! @ Load r2 with the pointer to storage for the return value ! ldr r2, [sp, #24] ! ! @ Load r3 with the return type code ! ldr r3, [sp, #12] ! ! @ If the return value pointer is NULL, assume no return value. ! cmp r2, #0 ! beq LSYM(Lepilogue) ! ! @ return INT ! cmp r3, #FFI_TYPE_INT #ifdef __SOFTFP__ ! cmpne r3, #FFI_TYPE_FLOAT #endif ! streq r0, [r2] ! beq LSYM(Lepilogue) ! @ return INT64 ! cmp r3, #FFI_TYPE_SINT64 #ifdef __SOFTFP__ ! cmpne r3, #FFI_TYPE_DOUBLE #endif + stmeqia r2, {r0, r1} ! #ifndef __SOFTFP__ ! beq LSYM(Lepilogue) ! ! @ return FLOAT ! cmp r3, #FFI_TYPE_FLOAT ! stfeqs f0, [r2] ! beq LSYM(Lepilogue) ! ! @ return DOUBLE or LONGDOUBLE ! cmp r3, #FFI_TYPE_DOUBLE ! stfeqd f0, [r2] ! #endif ! ! LSYM(Lepilogue): ! RETLDM "r0-r3,fp" .ffi_call_SYSV_end: Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/arm/ffi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.c 18 Jun 2004 20:07:10 -0000 1.1 --- ffi.c 14 May 2005 11:00:48 -0000 1.2 *************** *** 109,112 **** --- 109,117 ---- ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { + /* 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) *************** *** 119,122 **** --- 124,132 ---- break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + default: cif->flags = FFI_TYPE_INT; |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:26
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/mips In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/mips Modified Files: o32.S ffitarget.h ffi.c Log Message: updated with new version from gcc cvs Index: o32.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/mips/o32.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** o32.S 18 Jun 2004 20:07:11 -0000 1.1 --- o32.S 14 May 2005 11:00:47 -0000 1.2 *************** *** 43,53 **** .ent ffi_call_O32 ffi_call_O32: ! # Prologue SUBU $sp, SIZEOF_FRAME # Frame size REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address move $fp, $sp move t9, callback # callback function pointer REG_S flags, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG($fp) # flags --- 43,57 ---- .ent ffi_call_O32 ffi_call_O32: ! $LFB0: # Prologue SUBU $sp, SIZEOF_FRAME # Frame size + $LCFI0: REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer + $LCFI1: REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address + $LCFI2: move $fp, $sp + $LCFI3: move t9, callback # callback function pointer REG_S flags, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG($fp) # flags *************** *** 70,74 **** ADDU a3, $fp, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG ! jal t9 REG_L t0, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG($fp) # load the flags word --- 74,78 ---- ADDU a3, $fp, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG ! jalr t9 REG_L t0, SIZEOF_FRAME + 3*FFI_SIZEOF_ARG($fp) # load the flags word *************** *** 137,149 **** beqz t1, noretval ! bne t2, FFI_TYPE_INT, retfloat ! jal t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t0) b epilogue retfloat: bne t2, FFI_TYPE_FLOAT, retdouble ! jal t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t0) --- 141,162 ---- beqz t1, noretval ! bne t2, FFI_TYPE_INT, retlonglong ! jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t0) b epilogue + retlonglong: + # Really any 64-bit int, signed or not. + bne t2, FFI_TYPE_UINT64, retfloat + jalr t9 + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) + REG_S v1, 4(t0) + REG_S v0, 0(t0) + b epilogue + retfloat: bne t2, FFI_TYPE_FLOAT, retdouble ! jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t0) *************** *** 152,156 **** retdouble: bne t2, FFI_TYPE_DOUBLE, noretval ! jal t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t0) --- 165,169 ---- retdouble: bne t2, FFI_TYPE_DOUBLE, noretval ! jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t0) *************** *** 158,162 **** noretval: ! jal t9 # Epilogue --- 171,175 ---- noretval: ! jalr t9 # Epilogue *************** *** 168,172 **** --- 181,371 ---- j ra + $LFE0: .end ffi_call_O32 + + + /* ffi_closure_O32. Expects address of the passed-in ffi_closure + in t0. Stores any arguments passed in registers onto the + stack, then calls ffi_closure_mips_inner_O32, which + then decodes them. + Stack layout: + + 14 - Start of parameters, original sp + 13 - ra save + 12 - fp save + 11 - $16 (s0) save + 10 - cprestore + 9 - return value high (v1) + 8 - return value low (v0) + 7 - f14 (le high, be low) + 6 - f14 (le low, be high) + 5 - f12 (le high, be low) + 4 - f12 (le low, be high) + 3 - Called function a3 save + 2 - Called function a2 save + 1 - Called function a1 save + 0 - Called function a0 save our sp, fp point here + */ + + #define SIZEOF_FRAME2 ( 14 * FFI_SIZEOF_ARG ) + + .text + .align 2 + .globl ffi_closure_O32 + .ent ffi_closure_O32 + ffi_closure_O32: + $LFB1: + # Prologue + .frame $fp, SIZEOF_FRAME2, $31 + .set noreorder + .cpload $25 + .set reorder + SUBU $sp, SIZEOF_FRAME2 + .cprestore SIZEOF_FRAME2 - 4*FFI_SIZEOF_ARG + $LCFI4: + REG_S $16, SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp) # Save s0 + REG_S $fp, SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer + REG_S ra, SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) # Save return address + $LCFI6: + move $fp, $sp + + $LCFI7: + # Store all possible argument registers. If there are more than + # four arguments, then they should be stored above where we put $7. + REG_S $4, SIZEOF_FRAME2 + 0*FFI_SIZEOF_ARG($fp) + REG_S $5, SIZEOF_FRAME2 + 1*FFI_SIZEOF_ARG($fp) + REG_S $6, SIZEOF_FRAME2 + 2*FFI_SIZEOF_ARG($fp) + REG_S $7, SIZEOF_FRAME2 + 3*FFI_SIZEOF_ARG($fp) + + # Load ABI enum to $16 + REG_L $16, 20($8) # cif pointer follows tramp. + REG_L $16, 0($16) # abi is first member. + + li $13, 1 # FFI_O32 + bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT + + # Store all possible float/double registers. + s.d $f12, SIZEOF_FRAME2 - 10*FFI_SIZEOF_ARG($fp) + s.d $f14, SIZEOF_FRAME2 - 8*FFI_SIZEOF_ARG($fp) + 1: + # Call ffi_closure_mips_inner_O32 to do the work. + la $25, ffi_closure_mips_inner_O32 + move $4, $8 # Pointer to the ffi_closure + addu $5, $fp, SIZEOF_FRAME2 - 6*FFI_SIZEOF_ARG + addu $6, $fp, SIZEOF_FRAME2 + 0*FFI_SIZEOF_ARG + addu $7, $fp, SIZEOF_FRAME2 - 10*FFI_SIZEOF_ARG + jalr $31, $25 + + # Load the return value into the appropriate register. + move $8, $2 + li $9, FFI_TYPE_VOID + beq $8, $9, closure_done + + li $13, 1 # FFI_O32 + bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT + + li $9, FFI_TYPE_FLOAT + l.s $f0, SIZEOF_FRAME2 - 6*FFI_SIZEOF_ARG($fp) + beq $8, $9, closure_done + + li $9, FFI_TYPE_DOUBLE + l.d $f0, SIZEOF_FRAME2 - 6*FFI_SIZEOF_ARG($fp) + beq $8, $9, closure_done + 1: + li $9, FFI_TYPE_SINT64 + REG_L $3, SIZEOF_FRAME2 - 5*FFI_SIZEOF_ARG($fp) + beq $8, $9, integer + li $9, FFI_TYPE_UINT64 + beq $8, $9, integer + + integer: + REG_L $2, SIZEOF_FRAME2 - 6*FFI_SIZEOF_ARG($fp) + + closure_done: + # Epilogue + move $sp, $fp + REG_L $16, SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp) # Restore s0 + REG_L $fp, SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) # Restore frame pointer + REG_L ra, SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) # Restore return address + ADDU $sp, SIZEOF_FRAME2 + j ra + $LFE1: + .end ffi_closure_O32 + + /* DWARF-2 unwind info. */ + + .section .eh_frame,"a",@progbits + $Lframe0: + .4byte $LECIE0-$LSCIE0 # Length of Common Information Entry + $LSCIE0: + .4byte 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version + .ascii "zR\0" # CIE Augmentation + .uleb128 0x1 # CIE Code Alignment Factor + .sleb128 4 # CIE Data Alignment Factor + .byte 0x1f # CIE RA Column + .uleb128 0x1 # Augmentation size + .byte 0x00 # FDE Encoding (absptr) + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1d + .uleb128 0x0 + .align 2 + $LECIE0: + $LSFDE0: + .4byte $LEFDE0-$LASFDE0 # FDE Length + $LASFDE0: + .4byte $LASFDE0-$Lframe0 # FDE CIE offset + .4byte $LFB0 # FDE initial location + .4byte $LFE0-$LFB0 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI0-$LFB0 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0x18 + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI2-$LCFI0 + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1e # $fp + .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1f # $ra + .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI3-$LCFI2 + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1e + .uleb128 0x18 + .align 2 + $LEFDE0: + $LSFDE1: + .4byte $LEFDE1-$LASFDE1 # FDE Length + $LASFDE1: + .4byte $LASFDE1-$Lframe0 # FDE CIE offset + .4byte $LFB1 # FDE initial location + .4byte $LFE1-$LFB1 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI4-$LFB1 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0x38 + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI6-$LCFI4 + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x10 # $16 + .sleb128 -3 # SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp) + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1e # $fp + .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1f # $ra + .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI7-$LCFI6 + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1e + .uleb128 0x38 + .align 2 + $LEFDE1: + #endif Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/mips/ffi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.c 18 Jun 2004 20:07:11 -0000 1.1 --- ffi.c 14 May 2005 11:00:48 -0000 1.2 *************** *** 28,31 **** --- 28,32 ---- #include <stdlib.h> + #include <sys/cachectl.h> #if _MIPS_SIM == _ABIN32 *************** *** 85,92 **** { size_t z; /* Align if necessary */ ! if (((*p_arg)->alignment - 1) & (unsigned) argp) { ! argp = (char *) ALIGN(argp, (*p_arg)->alignment); FIX_ARGP; } --- 86,98 ---- { size_t z; + unsigned short a; /* Align if necessary */ ! a = (*p_arg)->alignment; ! if (a < FFI_SIZEOF_ARG) ! a = FFI_SIZEOF_ARG; ! ! if ((a - 1) & (unsigned) argp) { ! argp = (char *) ALIGN(argp, a); FIX_ARGP; } *************** *** 268,274 **** #if _MIPS_SIM == _ABIO32 ! /* Set the flags necessary for O32 processing */ ! if (cif->rtype->type != FFI_TYPE_STRUCT) { if (cif->nargs > 0) --- 274,282 ---- #if _MIPS_SIM == _ABIO32 ! /* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT ! * does not have special handling for floating point args. ! */ ! if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32) { if (cif->nargs > 0) *************** *** 307,322 **** /* Set the return type flag */ ! switch (cif->rtype->type) { ! case FFI_TYPE_VOID: ! case FFI_TYPE_STRUCT: ! case FFI_TYPE_FLOAT: ! case FFI_TYPE_DOUBLE: ! cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); ! break; ! default: ! cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); ! break; } #endif --- 315,361 ---- /* Set the return type flag */ ! ! if (cif->abi == FFI_O32_SOFT_FLOAT) { ! switch (cif->rtype->type) ! { ! case FFI_TYPE_VOID: ! case FFI_TYPE_STRUCT: ! cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); ! break; ! ! case FFI_TYPE_SINT64: ! case FFI_TYPE_UINT64: ! case FFI_TYPE_DOUBLE: ! cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); ! break; ! case FFI_TYPE_FLOAT: ! default: ! cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); ! break; ! } ! } ! else ! { ! /* FFI_O32 */ ! switch (cif->rtype->type) ! { ! case FFI_TYPE_VOID: ! case FFI_TYPE_STRUCT: ! case FFI_TYPE_FLOAT: ! case FFI_TYPE_DOUBLE: ! cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); ! break; ! ! case FFI_TYPE_SINT64: ! case FFI_TYPE_UINT64: ! cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); ! break; ! ! default: ! cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); ! break; ! } } #endif *************** *** 443,446 **** --- 482,486 ---- #if _MIPS_SIM == _ABIO32 case FFI_O32: + case FFI_O32_SOFT_FLOAT: ffi_call_O32(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); *************** *** 460,461 **** --- 500,625 ---- } } + + #if FFI_CLOSURES /* N32 not implemented yet, FFI_CLOSURES not defined */ + #if defined(FFI_MIPS_O32) + extern void ffi_closure_O32(void); + #endif /* FFI_MIPS_O32 */ + + ffi_status + ffi_prep_closure (ffi_closure *closure, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data) + { + unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + unsigned int fn; + unsigned int ctx = (unsigned int) closure; + + #if defined(FFI_MIPS_O32) + FFI_ASSERT(cif->abi == FFI_O32 || cif->abi == FFI_O32_SOFT_FLOAT); + fn = (unsigned int) ffi_closure_O32; + #else /* FFI_MIPS_N32 */ + FFI_ASSERT(cif->abi == FFI_N32); + FFI_ASSERT(!"not implemented"); + #endif /* FFI_MIPS_O32 */ + + tramp[0] = 0x3c190000 | (fn >> 16); /* lui $25,high(fn) */ + tramp[1] = 0x3c080000 | (ctx >> 16); /* lui $8,high(ctx) */ + tramp[2] = 0x37390000 | (fn & 0xffff); /* ori $25,low(fn) */ + tramp[3] = 0x03200008; /* jr $25 */ + tramp[4] = 0x35080000 | (ctx & 0xffff); /* ori $8,low(ctx) */ + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + /* XXX this is available on Linux, but anything else? */ + cacheflush (tramp, FFI_TRAMPOLINE_SIZE, ICACHE); + + return FFI_OK; + } + + /* + * Decodes the arguments to a function, which will be stored on the + * stack. AR is the pointer to the beginning of the integer arguments + * (and, depending upon the arguments, some floating-point arguments + * as well). FPR is a pointer to the area where floating point + * registers have been saved, if any. + * + * RVALUE is the location where the function return value will be + * stored. CLOSURE is the prepared closure to invoke. + * + * This function should only be called from assembly, which is in + * turn called from a trampoline. + * + * Returns the function return type. + * + * Based on the similar routine for sparc. + */ + int + ffi_closure_mips_inner_O32 (ffi_closure *closure, + void *rvalue, unsigned long *ar, + double *fpr) + { + ffi_cif *cif; + void **avalue; + ffi_type **arg_types; + int i, avn, argn, seen_int; + + cif = closure->cif; + avalue = alloca (cif->nargs * sizeof (void *)); + + seen_int = (cif->abi == FFI_O32_SOFT_FLOAT); + argn = 0; + + if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT) + { + rvalue = (void *) ar[0]; + argn = 1; + } + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + while (i < avn) + { + if (i < 2 && !seen_int && + (arg_types[i]->type == FFI_TYPE_FLOAT || + arg_types[i]->type == FFI_TYPE_DOUBLE)) + { + avalue[i] = ((char *) &fpr[i]); + } + else + { + if (arg_types[i]->alignment == 8 && (argn & 0x1)) + argn++; + avalue[i] = ((char *) &ar[argn]); + seen_int = 1; + } + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + i++; + } + + /* Invoke the closure. */ + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + if (cif->abi == FFI_O32_SOFT_FLOAT) + { + switch (cif->rtype->type) + { + case FFI_TYPE_FLOAT: + return FFI_TYPE_INT; + case FFI_TYPE_DOUBLE: + return FFI_TYPE_UINT64; + default: + return cif->rtype->type; + } + } + else + { + return cif->rtype->type; + } + } + + #endif /* FFI_CLOSURES */ Index: ffitarget.h =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/mips/ffitarget.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffitarget.h 18 Jun 2004 20:07:11 -0000 1.1 --- ffitarget.h 14 May 2005 11:00:48 -0000 1.2 *************** *** 139,145 **** --- 139,150 ---- FFI_N32, FFI_N64, + FFI_O32_SOFT_FLOAT, #ifdef FFI_MIPS_O32 + #ifdef __mips_soft_float + FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT, + #else FFI_DEFAULT_ABI = FFI_O32, + #endif #else FFI_DEFAULT_ABI = FFI_N32, *************** *** 154,158 **** --- 159,169 ---- /* ---- Definitions for closures ----------------------------------------- */ + #if defined(FFI_MIPS_O32) + #define FFI_CLOSURES 1 + #define FFI_TRAMPOLINE_SIZE 20 + #else + /* N32/N64 not implemented yet. */ #define FFI_CLOSURES 0 + #endif /* FFI_MIPS_O32 */ #define FFI_NATIVE_RAW_API 0 |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:26
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/x86 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/x86 Modified Files: unix64.S ffi64.c Log Message: updated with new version from gcc cvs Index: unix64.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/x86/unix64.S,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** unix64.S 22 Apr 2005 15:17:51 -0000 1.2 --- unix64.S 14 May 2005 11:00:45 -0000 1.3 *************** *** 29,310 **** #include <ffi.h> - .section .rodata - .LC0: - .string "asm in progress %lld\n" - .LC1: - .string "asm in progress\n" .text - .align 2 - .globl ffi_call_UNIX64 - .type ffi_call_UNIX64,@function ! ffi_call_UNIX64: ! .LFB1: ! pushq %rbp ! .LCFI0: ! movq %rsp, %rbp ! .LCFI1: ! /* Save all arguments */ ! subq $48, %rsp ! .LCFI2: ! movq %rdi, -8(%rbp) /* ffi_prep_args */ ! movq %rsi, -16(%rbp) /* ffi_fill_return_value */ ! movq %rdx, -24(%rbp) /* ecif */ ! movq %rcx, -32(%rbp) /* cif->bytes */ ! movq %r8, -40(%rbp) /* ecif.rvalue */ ! movq %r9, -48(%rbp) /* fn */ ! /* Make room for all of the new args and the register args */ ! addl $176, %ecx ! .LCFI3: ! subq %rcx, %rsp ! .LCFI4: ! /* Setup the call to ffi_prep_args. */ ! movq %rdi, %rax /* &ffi_prep_args */ ! movq %rsp, %rdi /* stackLayout */ ! movq %rdx, %rsi /* ecif */ ! call *%rax /* ffi_prep_args(stackLayout, ecif);*/ ! /* ffi_prep_args have put all the register contents into the */ ! /* stackLayout struct. Now put the register values in place. */ ! movq (%rsp), %rdi ! movq 8(%rsp), %rsi ! movq 16(%rsp), %rdx ! movq 24(%rsp), %rcx ! movq 32(%rsp), %r8 ! movq 40(%rsp), %r9 ! movaps 48(%rsp), %xmm0 ! movaps 64(%rsp), %xmm1 ! movaps 80(%rsp), %xmm2 ! movaps 96(%rsp), %xmm3 ! movaps 112(%rsp), %xmm4 ! movaps 128(%rsp), %xmm5 ! movaps 144(%rsp), %xmm6 ! movaps 160(%rsp), %xmm7 ! /* Remove space for stackLayout so stack arguments are placed ! correctly for the call. */ ! .LCFI5: ! addq $176, %rsp ! .LCFI6: ! /* Set %rax to max. number of used SSE registers for vararg calls. ! See also: ! http://article.gmane.org/gmane.comp.python.ctypes/1702 ! http://article.gmane.org/gmane.comp.python.ctypes/1703 ! */ ! movq $8, %rax /* Call the user function. */ ! call *-48(%rbp) ! /* Make stack space for the return_value struct. */ ! subq $64, %rsp ! /* Fill in all potential return values to this struct. */ ! movq %rax, (%rsp) ! movq %rdx, 8(%rsp) ! movaps %xmm0, 16(%rsp) ! movaps %xmm1, 32(%rsp) ! fstpt 48(%rsp) ! /* Now call ffi_fill_return_value. */ ! movq %rsp, %rdi /* struct return_value */ ! movq -24(%rbp), %rsi /* ecif */ ! movq -16(%rbp), %rax /* &ffi_fill_return_value */ ! call *%rax /* call it */ ! /* And the work is done. */ ! leave ! ret ! .LFE1: ! .ffi_call_UNIX64_end: ! .size ffi_call_UNIX64,.ffi_call_UNIX64_end-ffi_call_UNIX64 ! .text ! .align 2 ! .globl float2sse ! .type float2sse,@function ! float2sse: ! /* Save the contents of this sse-float in a pointer. */ ! movaps %xmm0, (%rdi) ret ! .align 2 ! .globl floatfloat2sse ! .type floatfloat2sse,@function ! floatfloat2sse: ! /* Save the contents of these two sse-floats in a pointer. */ ! movq (%rdi), %xmm0 ! movaps %xmm0, (%rsi) ret ! ! .align 2 ! .globl double2sse ! .type double2sse,@function ! double2sse: ! /* Save the contents of this sse-double in a pointer. */ ! movaps %xmm0, (%rdi) ret ! ! .align 2 ! .globl sse2float ! .type sse2float,@function ! sse2float: ! /* Save the contents of this sse-float in a pointer. */ ! movaps (%rdi), %xmm0 ret ! .align 2 ! .globl sse2double ! .type sse2double,@function ! sse2double: ! /* Save the contents of this pointer in a sse-double. */ ! movaps (%rdi), %xmm0 ret ! .align 2 ! .globl sse2floatfloat ! .type sse2floatfloat,@function ! sse2floatfloat: ! /* Save the contents of this pointer in two sse-floats. */ ! movaps (%rdi), %xmm0 ! movq %xmm0, (%rsi) ret .align 2 ! .globl ffi_closure_UNIX64 ! .type ffi_closure_UNIX64,@function - ffi_closure_UNIX64: - .LFB2: - pushq %rbp - .LCFI10: - movq %rsp, %rbp - .LCFI11: - subq $240, %rsp - .LCFI12: - movq %rdi, -176(%rbp) - movq %rsi, -168(%rbp) - movq %rdx, -160(%rbp) - movq %rcx, -152(%rbp) - movq %r8, -144(%rbp) - movq %r9, -136(%rbp) - /* FIXME: We can avoid all this stashing of XMM registers by - (in ffi_prep_closure) computing the number of - floating-point args and moving it into %rax before calling - this function. Once this is done, uncomment the next few - lines and only the essential XMM registers will be written - to memory. This is a significant saving. */ - /* movzbl %al, %eax */ - /* movq %rax, %rdx */ - /* leaq 0(,%rdx,4), %rax */ - /* leaq 2f(%rip), %rdx */ - /* subq %rax, %rdx */ - leaq -1(%rbp), %rax - /* jmp *%rdx */ - movaps %xmm7, -15(%rax) - movaps %xmm6, -31(%rax) - movaps %xmm5, -47(%rax) - movaps %xmm4, -63(%rax) - movaps %xmm3, -79(%rax) - movaps %xmm2, -95(%rax) - movaps %xmm1, -111(%rax) - movaps %xmm0, -127(%rax) - 2: - movl %edi, -180(%rbp) - movl $0, -224(%rbp) - movl $48, -220(%rbp) - leaq 16(%rbp), %rax - movq %rax, -216(%rbp) - leaq -176(%rbp), %rdx - movq %rdx, -208(%rbp) - leaq -224(%rbp), %rsi movq %r10, %rdi movq %rsp, %rdx ! call ffi_closure_UNIX64_inner@PLT ! cmpl $FFI_TYPE_FLOAT, %eax ! je 1f ! cmpl $FFI_TYPE_DOUBLE, %eax ! je 2f ! cmpl $FFI_TYPE_LONGDOUBLE, %eax ! je 3f ! cmpl $FFI_TYPE_STRUCT, %eax ! je 4f ! popq %rax ! leave ! ret ! 1: ! 2: ! 3: ! movaps -240(%rbp), %xmm0 ! leave ! ret ! 4: ! leave ret ! .LFE2: ! ! .section .eh_frame,EH_FRAME_FLAGS,@progbits ! .Lframe0: ! .long .LECIE1-.LSCIE1 .LSCIE1: ! .long 0x0 ! .byte 0x1 ! .string "zR" ! .uleb128 0x1 ! .sleb128 -8 ! .byte 0x10 ! .uleb128 0x1 ! .byte 0x1b ! .byte 0xc ! .uleb128 0x7 ! .uleb128 0x8 ! .byte 0x90 ! .uleb128 0x1 ! .align 8 .LECIE1: .LSFDE1: ! .long .LEFDE1-.LASFDE1 .LASFDE1: ! .long .LASFDE1-.Lframe0 - .long .LFB1-. - .long .LFE1-.LFB1 - .uleb128 0x0 - .byte 0x4 # DW_CFA_advance_loc4 - .long .LCFI0-.LFB1 - .byte 0xe # DW_CFA_def_cfa_offset - .uleb128 0x10 - .byte 0x86 # DW_CFA_offset: r6 at cfa-16 - .uleb128 0x2 - .byte 0x4 # DW_CFA_advance_loc4 - .long .LCFI1-.LCFI0 - .byte 0x86 # DW_CFA_offset: r6 at cfa-16 - .uleb128 0x2 - .byte 0xd # DW_CFA_def_cfa_reg: r6 - .uleb128 0x6 .align 8 .LEFDE1: .LSFDE3: ! .long .LEFDE3-.LASFDE3 # FDE Length .LASFDE3: ! .long .LASFDE3-.Lframe0 # FDE CIE offset ! .long .LFB2-. # FDE initial location ! .long .LFE2-.LFB2 # FDE address range ! .uleb128 0x0 # Augmentation size ! .byte 0x4 # DW_CFA_advance_loc4 ! .long .LCFI10-.LFB2 ! .byte 0xe # DW_CFA_def_cfa_offset ! .uleb128 0x10 ! .byte 0x86 # DW_CFA_offset, column 0x6 ! .uleb128 0x2 ! .byte 0x4 # DW_CFA_advance_loc4 ! .long .LCFI11-.LCFI10 ! .byte 0xd # DW_CFA_def_cfa_register ! .uleb128 0x6 ! .align 8 .LEFDE3: ! #endif /* __x86_64__ */ --- 29,412 ---- #include <ffi.h> .text ! /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, ! void *raddr, void (*fnaddr)()); ! Bit o trickiness here -- ARGS+BYTES is the base of the stack frame ! for this function. This has been allocated by ffi_call. We also ! deallocate some of the stack that has been alloca'd. */ ! .align 2 ! .globl ffi_call_unix64 ! .type ffi_call_unix64,@function ! ffi_call_unix64: ! .LUW0: ! movq (%rsp), %r10 /* Load return address. */ ! leaq (%rdi, %rsi), %rax /* Find local stack base. */ ! movq %rdx, (%rax) /* Save flags. */ ! movq %rcx, 8(%rax) /* Save raddr. */ ! movq %rbp, 16(%rax) /* Save old frame pointer. */ ! movq %r10, 24(%rax) /* Relocate return address. */ ! movq %rax, %rbp /* Finalize local stack frame. */ ! .LUW1: ! movq %rdi, %r10 /* Save a copy of the register area. */ ! movq %r8, %r11 /* Save a copy of the target fn. */ ! movl %r9d, %eax /* Set number of SSE registers. */ ! ! /* Load up all argument registers. */ ! movq (%r10), %rdi ! movq 8(%r10), %rsi ! movq 16(%r10), %rdx ! movq 24(%r10), %rcx ! movq 32(%r10), %r8 ! movq 40(%r10), %r9 ! testl %eax, %eax ! jnz .Lload_sse ! .Lret_from_load_sse: ! ! /* Deallocate the reg arg area. */ ! leaq 176(%r10), %rsp /* Call the user function. */ ! call *%r11 ! /* Deallocate stack arg area; local stack frame in redzone. */ ! leaq 24(%rbp), %rsp ! movq 0(%rbp), %rcx /* Reload flags. */ ! movq 8(%rbp), %rdi /* Reload raddr. */ ! movq 16(%rbp), %rbp /* Reload old frame pointer. */ ! .LUW2: ! /* The first byte of the flags contains the FFI_TYPE. */ ! movzbl %cl, %r10d ! leaq .Lstore_table(%rip), %r11 ! movslq (%r11, %r10, 4), %r10 ! 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 */ ! .long .Lst_float-.Lstore_table /* FFI_TYPE_FLOAT */ ! .long .Lst_double-.Lstore_table /* FFI_TYPE_DOUBLE */ ! .long .Lst_ldouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ ! .long .Lst_uint8-.Lstore_table /* FFI_TYPE_UINT8 */ ! .long .Lst_sint8-.Lstore_table /* FFI_TYPE_SINT8 */ ! .long .Lst_uint16-.Lstore_table /* FFI_TYPE_UINT16 */ ! .long .Lst_sint16-.Lstore_table /* FFI_TYPE_SINT16 */ ! .long .Lst_uint32-.Lstore_table /* FFI_TYPE_UINT32 */ ! .long .Lst_sint32-.Lstore_table /* FFI_TYPE_SINT32 */ ! .long .Lst_int64-.Lstore_table /* FFI_TYPE_UINT64 */ ! .long .Lst_int64-.Lstore_table /* FFI_TYPE_SINT64 */ ! .long .Lst_struct-.Lstore_table /* FFI_TYPE_STRUCT */ ! .long .Lst_int64-.Lstore_table /* FFI_TYPE_POINTER */ ! .text ! .align 2 ! .Lst_void: ret + .align 2 ! .Lst_uint8: ! movzbq %al, %rax ! movq %rax, (%rdi) ret ! .align 2 ! .Lst_sint8: ! movsbq %al, %rax ! movq %rax, (%rdi) ret ! .align 2 ! .Lst_uint16: ! movzwq %ax, %rax ! movq %rax, (%rdi) ! .align 2 ! .Lst_sint16: ! movswq %ax, %rax ! movq %rax, (%rdi) ! ret ! .align 2 ! .Lst_uint32: ! movl %eax, %eax ! movq %rax, (%rdi) ! .align 2 ! .Lst_sint32: ! cltq ! movq %rax, (%rdi) ! ret ! .align 2 ! .Lst_int64: ! movq %rax, (%rdi) ret ! .align 2 ! .Lst_float: ! movss %xmm0, (%rdi) ! ret ! .align 2 ! .Lst_double: ! movsd %xmm0, (%rdi) ! ret ! .Lst_ldouble: ! fstpt (%rdi) ret ! .align 2 ! .Lst_struct: ! leaq -20(%rsp), %rsi /* Scratch area in redzone. */ ! ! /* We have to locate the values now, and since we don't want to ! write too much data into the user's return value, we spill the ! value to a 16 byte scratch area first. Bits 8, 9, and 10 ! control where the values are located. Only one of the three ! bits will be set; see ffi_prep_cif_machdep for the pattern. */ ! movd %xmm0, %r10 ! movd %xmm1, %r11 ! testl $0x100, %ecx ! cmovnz %rax, %rdx ! cmovnz %r10, %rax ! testl $0x200, %ecx ! cmovnz %r10, %rdx ! testl $0x400, %ecx ! cmovnz %r10, %rax ! cmovnz %r11, %rdx ! movq %rax, (%rsi) ! movq %rdx, 8(%rsi) ! ! /* Bits 12-31 contain the true size of the structure. Copy from ! the scratch area to the true destination. */ ! shrl $12, %ecx ! rep movsb ret + /* Many times we can avoid loading any SSE registers at all. + It's not worth an indirect jump to load the exact set of + SSE registers needed; zero or all is a good compromise. */ + .align 2 + .LUW3: + .Lload_sse: + movdqa 48(%r10), %xmm0 + movdqa 64(%r10), %xmm1 + movdqa 80(%r10), %xmm2 + movdqa 96(%r10), %xmm3 + movdqa 112(%r10), %xmm4 + movdqa 128(%r10), %xmm5 + movdqa 144(%r10), %xmm6 + movdqa 160(%r10), %xmm7 + jmp .Lret_from_load_sse + + .LUW4: + .size ffi_call_unix64,.-ffi_call_unix64 + .align 2 ! .globl ffi_closure_unix64 ! .type ffi_closure_unix64,@function ! ! ffi_closure_unix64: ! .LUW5: ! /* The carry flag is set by the trampoline iff SSE registers ! are used. Don't clobber it before the branch instruction. */ ! leaq -200(%rsp), %rsp ! .LUW6: ! movq %rdi, (%rsp) ! movq %rsi, 8(%rsp) ! movq %rdx, 16(%rsp) ! movq %rcx, 24(%rsp) ! movq %r8, 32(%rsp) ! movq %r9, 40(%rsp) ! jc .Lsave_sse ! .Lret_from_save_sse: movq %r10, %rdi + leaq 176(%rsp), %rsi movq %rsp, %rdx ! leaq 208(%rsp), %rcx ! call ffi_closure_unix64_inner@PLT ! /* Deallocate stack frame early; return value is now in redzone. */ ! addq $200, %rsp ! .LUW7: ! ! /* The first byte of the return value contains the FFI_TYPE. */ ! movzbl %al, %r10d ! leaq .Lload_table(%rip), %r11 ! movslq (%r11, %r10, 4), %r10 ! 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 */ ! .long .Lld_float-.Lload_table /* FFI_TYPE_FLOAT */ ! .long .Lld_double-.Lload_table /* FFI_TYPE_DOUBLE */ ! .long .Lld_ldouble-.Lload_table /* FFI_TYPE_LONGDOUBLE */ ! .long .Lld_int8-.Lload_table /* FFI_TYPE_UINT8 */ ! .long .Lld_int8-.Lload_table /* FFI_TYPE_SINT8 */ ! .long .Lld_int16-.Lload_table /* FFI_TYPE_UINT16 */ ! .long .Lld_int16-.Lload_table /* FFI_TYPE_SINT16 */ ! .long .Lld_int32-.Lload_table /* FFI_TYPE_UINT32 */ ! .long .Lld_int32-.Lload_table /* FFI_TYPE_SINT32 */ ! .long .Lld_int64-.Lload_table /* FFI_TYPE_UINT64 */ ! .long .Lld_int64-.Lload_table /* FFI_TYPE_SINT64 */ ! .long .Lld_struct-.Lload_table /* FFI_TYPE_STRUCT */ ! .long .Lld_int64-.Lload_table /* FFI_TYPE_POINTER */ ! ! .text ! .align 2 ! .Lld_void: ret ! ! .align 2 ! .Lld_int8: ! movzbl -24(%rsp), %eax ! ret ! .align 2 ! .Lld_int16: ! movzwl -24(%rsp), %eax ! ret ! .align 2 ! .Lld_int32: ! movl -24(%rsp), %eax ! ret ! .align 2 ! .Lld_int64: ! movq -24(%rsp), %rax ! ret ! ! .align 2 ! .Lld_float: ! movss -24(%rsp), %xmm0 ! ret ! .align 2 ! .Lld_double: ! movsd -24(%rsp), %xmm0 ! ret ! .align 2 ! .Lld_ldouble: ! fldt -24(%rsp) ! ret ! ! .align 2 ! .Lld_struct: ! /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, ! %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading ! both rdx and xmm1 with the second word. For the remaining, ! bit 8 set means xmm0 gets the second word, and bit 9 means ! that rax gets the second word. */ ! movq -24(%rsp), %rcx ! movq -16(%rsp), %rdx ! movq -16(%rsp), %xmm1 ! testl $0x100, %eax ! cmovnz %rdx, %rcx ! movd %rcx, %xmm0 ! testl $0x200, %eax ! movq -24(%rsp), %rax ! cmovnz %rdx, %rax ! ret ! ! /* See the comment above .Lload_sse; the same logic applies here. */ ! .align 2 ! .LUW8: ! .Lsave_sse: ! movdqa %xmm0, 48(%rsp) ! movdqa %xmm1, 64(%rsp) ! movdqa %xmm2, 80(%rsp) ! movdqa %xmm3, 96(%rsp) ! movdqa %xmm4, 112(%rsp) ! movdqa %xmm5, 128(%rsp) ! movdqa %xmm6, 144(%rsp) ! movdqa %xmm7, 160(%rsp) ! jmp .Lret_from_save_sse ! ! .LUW9: ! .size ffi_closure_unix64,.-ffi_closure_unix64 ! ! .section .eh_frame,"a",@progbits ! .Lframe1: ! .long .LECIE1-.LSCIE1 /* CIE Length */ .LSCIE1: ! .long 0 /* CIE Identifier Tag */ ! .byte 1 /* CIE Version */ ! .ascii "zR\0" /* CIE Augmentation */ ! .uleb128 1 /* CIE Code Alignment Factor */ ! .sleb128 -8 /* CIE Data Alignment Factor */ ! .byte 0x10 /* CIE RA Column */ ! .uleb128 1 /* Augmentation size */ ! .byte 0x1b /* FDE Encoding (pcrel sdata4) */ ! .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ ! .uleb128 7 ! .uleb128 8 ! .byte 0x80+16 /* DW_CFA_offset, %rip offset 1*-8 */ ! .uleb128 1 ! .align 8 .LECIE1: .LSFDE1: ! .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: ! .long .LASFDE1-.Lframe1 /* FDE CIE offset */ ! .long .LUW0-. /* FDE initial location */ ! .long .LUW4-.LUW0 /* FDE address range */ ! .uleb128 0x0 /* Augmentation size */ ! ! .byte 0x4 /* DW_CFA_advance_loc4 */ ! .long .LUW1-.LUW0 ! ! /* New stack frame based off rbp. This is a itty bit of unwind ! trickery in that the CFA *has* changed. There is no easy way ! to describe it correctly on entry to the function. Fortunately, ! it doesn't matter too much since at all points we can correctly ! unwind back to ffi_call. Note that the location to which we ! moved the return address is (the new) CFA-8, so from the ! perspective of the unwind info, it hasn't moved. */ ! .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ ! .uleb128 6 ! .uleb128 32 ! .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ ! .uleb128 2 ! .byte 0xa /* DW_CFA_remember_state */ ! ! .byte 0x4 /* DW_CFA_advance_loc4 */ ! .long .LUW2-.LUW1 ! .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ ! .uleb128 7 ! .uleb128 8 ! .byte 0xc0+6 /* DW_CFA_restore, %rbp */ ! ! .byte 0x4 /* DW_CFA_advance_loc4 */ ! .long .LUW3-.LUW2 ! .byte 0xb /* DW_CFA_restore_state */ .align 8 .LEFDE1: .LSFDE3: ! .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: ! .long .LASFDE3-.Lframe1 /* FDE CIE offset */ ! .long .LUW5-. /* FDE initial location */ ! .long .LUW9-.LUW5 /* FDE address range */ ! .uleb128 0x0 /* Augmentation size */ ! .byte 0x4 /* DW_CFA_advance_loc4 */ ! .long .LUW6-.LUW5 ! .byte 0xe /* DW_CFA_def_cfa_offset */ ! .uleb128 208 ! .byte 0xa /* DW_CFA_remember_state */ ! ! .byte 0x4 /* DW_CFA_advance_loc4 */ ! .long .LUW7-.LUW6 ! .byte 0xe /* DW_CFA_def_cfa_offset */ ! .uleb128 8 ! ! .byte 0x4 /* DW_CFA_advance_loc4 */ ! .long .LUW8-.LUW7 ! .byte 0xb /* DW_CFA_restore_state */ ! ! .align 8 .LEFDE3: ! #endif /* __x86_64__ */ Index: ffi64.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/x86/ffi64.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi64.c 18 Jun 2004 20:07:15 -0000 1.1 --- ffi64.c 14 May 2005 11:00:46 -0000 1.2 *************** *** 30,49 **** #include <stdarg.h> - /* ffi_prep_args is called by the assembly routine once stack space - has been allocated for the function's arguments */ - #ifdef __x86_64__ #define MAX_GPR_REGS 6 #define MAX_SSE_REGS 8 ! typedef struct [...968 lines suppressed...] ! avalue[i] = a; ! for (j = 0; j < n; j++, a += 8) ! { ! if (SSE_CLASS_P (classes[j])) ! memcpy (a, ®_args->sse[ssecount++], 8); ! else ! memcpy (a, ®_args->gpr[gprcount++], 8); ! } ! } } /* Invoke the closure. */ ! closure->fun (cif, rvalue, avalue, closure->user_data); ! /* Tell assembly how to perform return type promotions. */ ! return ret; } ! ! #endif /* __x86_64__ */ |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:25
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/s390 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/s390 Modified Files: ffi.c Log Message: updated with new version from gcc cvs Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/s390/ffi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.c 18 Jun 2004 20:07:12 -0000 1.1 --- ffi.c 14 May 2005 11:00:46 -0000 1.2 *************** *** 70,74 **** static void ffi_prep_args (unsigned char *, extended_cif *); - static int ffi_check_float_struct (ffi_type *); void #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) --- 70,73 ---- *************** *** 223,235 **** } ! /* Pointers are passed like UINTs of the same size. */ ! if (type == FFI_TYPE_POINTER) ! #ifdef __s390x__ ! type = FFI_TYPE_UINT64; ! #else ! type = FFI_TYPE_UINT32; ! #endif ! ! /* Now handle all primitive int/float data types. */ switch (type) { --- 222,226 ---- } ! /* Now handle all primitive int/pointer/float data types. */ switch (type) { *************** *** 252,255 **** --- 243,253 ---- p_ov[n_ov++] = *(unsigned int *) arg; break; + + case FFI_TYPE_POINTER: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = (unsigned long)*(unsigned char **) arg; + else + p_ov[n_ov++] = (unsigned long)*(unsigned char **) arg; + break; case FFI_TYPE_UINT64: |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:25
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sh In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/sh Modified Files: sysv.S ffi.c Log Message: updated with new version from gcc cvs Index: sysv.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sh/sysv.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** sysv.S 18 Jun 2004 20:07:13 -0000 1.1 --- sysv.S 14 May 2005 11:00:46 -0000 1.2 *************** *** 1,4 **** /* ----------------------------------------------------------------------- ! sysv.S - Copyright (c) 2002, 2003 Kaz Kojima SuperH Foreign Function Interface --- 1,4 ---- /* ----------------------------------------------------------------------- ! sysv.S - Copyright (c) 2002, 2003, 2004 Kaz Kojima SuperH Foreign Function Interface *************** *** 118,127 **** add #1,r3 1: - mov r15,r0 - and #7,r0 - tst r0,r0 - bt 2f - add #4,r15 - 2: mov #12,r0 cmp/hs r0,r3 --- 118,121 ---- *************** *** 554,560 **** --- 548,557 ---- #endif + bt/s 10f + mov r2, r5 mov r14,r1 add #8,r1 mov r1,r5 + 10: mov r14,r1 *************** *** 566,570 **** --- 563,575 ---- mov.l r1,@r14 + #ifdef PIC + mov.l L_got,r1 + mova L_got,r0 + add r0,r1 + mov.l L_helper,r0 + add r1,r0 + #else mov.l L_helper,r0 + #endif jsr @r0 mov r3,r4 *************** *** 580,585 **** --- 585,597 ---- 0: .align 2 + #ifdef PIC + L_got: + .long _GLOBAL_OFFSET_TABLE_ + L_helper: + .long ffi_closure_helper_SYSV@GOTOFF + #else L_helper: .long ffi_closure_helper_SYSV + #endif L_table: .short L_case_v - 0b /* FFI_TYPE_VOID */ *************** *** 684,691 **** --- 696,711 ---- .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ + #ifdef PIC + .ascii "zR\0" /* CIE Augmentation */ + #else .byte 0x0 /* CIE Augmentation */ + #endif .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */ .byte 0x11 /* CIE RA Column */ + #ifdef PIC + .uleb128 0x1 /* Augmentation size */ + .byte 0x10 /* FDE Encoding (pcrel) */ + #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0xf /* uleb128 0xf */ *************** *** 697,702 **** --- 717,729 ---- .LASFDE1: .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */ + #ifdef PIC + .4byte .LFB1-. /* FDE initial location */ + #else .4byte .LFB1 /* FDE initial location */ + #endif .4byte .LFE1-.LFB1 /* FDE address range */ + #ifdef PIC + .uleb128 0x0 /* Augmentation size */ + #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI0-.LFB1 *************** *** 746,751 **** --- 773,785 ---- .LASFDE3: .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */ + #ifdef PIC + .4byte .LFB2-. /* FDE initial location */ + #else .4byte .LFB2 /* FDE initial location */ + #endif .4byte .LFE2-.LFB2 /* FDE address range */ + #ifdef PIC + .uleb128 0x0 /* Augmentation size */ + #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI7-.LFB2 Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sh/ffi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.c 18 Jun 2004 20:07:13 -0000 1.1 --- ffi.c 14 May 2005 11:00:46 -0000 1.2 *************** *** 1,4 **** /* ----------------------------------------------------------------------- ! ffi.c - Copyright (c) 2002, 2003 Kaz Kojima SuperH Foreign Function Interface --- 1,4 ---- /* ----------------------------------------------------------------------- ! ffi.c - Copyright (c) 2002, 2003, 2004 Kaz Kojima SuperH Foreign Function Interface *************** *** 472,485 **** { unsigned int *tramp; FFI_ASSERT (cif->abi == FFI_GCC_SYSV); tramp = (unsigned int *) &closure->tramp[0]; #ifdef __LITTLE_ENDIAN__ ! tramp[0] = 0xd301d202; ! tramp[1] = 0x0009422b; #else ! tramp[0] = 0xd202d301; ! tramp[1] = 0x422b0009; #endif *(void **) &tramp[2] = (void *)closure; /* ctx */ --- 472,491 ---- { unsigned int *tramp; + unsigned short insn; FFI_ASSERT (cif->abi == FFI_GCC_SYSV); tramp = (unsigned int *) &closure->tramp[0]; + /* Set T bit if the function returns a struct pointed with R2. */ + insn = (return_type (cif->rtype) == FFI_TYPE_STRUCT + ? 0x0018 /* sett */ + : 0x0008 /* clrt */); + #ifdef __LITTLE_ENDIAN__ ! tramp[0] = 0xd301d102; ! tramp[1] = 0x0000412b | (insn << 16); #else ! tramp[0] = 0xd102d301; ! tramp[1] = 0x412b0000 | insn; #endif *(void **) &tramp[2] = (void *)closure; /* ctx */ |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:25
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sparc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/src/sparc Modified Files: v8.S ffi.c Log Message: updated with new version from gcc cvs Index: v8.S =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sparc/v8.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** v8.S 18 Jun 2004 20:07:15 -0000 1.1 --- v8.S 14 May 2005 11:00:46 -0000 1.2 *************** *** 116,120 **** #endif .LLFB2: ! save %sp, -STACKFRAME, %sp .LLCFI1: --- 116,128 ---- #endif .LLFB2: ! ! Reserve frame space for all arguments in case ! ! we need to align them on a 8-byte boundary. ! ld [%g2+FFI_TRAMPOLINE_SIZE], %g1 ! ld [%g1+4], %g1 ! sll %g1, 3, %g1 ! add %g1, STACKFRAME, %g1 ! ! %g1 == STACKFRAME + 8*nargs ! neg %g1 ! save %sp, %g1, %sp .LLCFI1: *************** *** 130,135 **** mov %g2, %o0 add %fp, -8, %o1 call ffi_closure_sparc_inner_v8 ! add %fp, 64, %o2 ! Load up the return value in the proper type. --- 138,144 ---- mov %g2, %o0 add %fp, -8, %o1 + add %fp, 64, %o2 call ffi_closure_sparc_inner_v8 ! add %fp, -16, %o3 ! Load up the return value in the proper type. *************** *** 158,161 **** --- 167,171 ---- ! FFI_TYPE_SINT64 + ! FFI_TYPE_UINT64 ld [%fp-4], %i1 Index: ffi.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/src/sparc/ffi.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ffi.c 18 Jun 2004 20:07:14 -0000 1.1 --- ffi.c 14 May 2005 11:00:46 -0000 1.2 *************** *** 471,475 **** int ffi_closure_sparc_inner_v8(ffi_closure *closure, ! void *rvalue, unsigned long *gpr) { ffi_cif *cif; --- 471,475 ---- int ffi_closure_sparc_inner_v8(ffi_closure *closure, ! void *rvalue, unsigned long *gpr, unsigned long *scratch) { ffi_cif *cif; *************** *** 506,509 **** --- 506,522 ---- avalue[i] = (void *)gpr[argn++]; } + else if ((arg_types[i]->type == FFI_TYPE_DOUBLE + || arg_types[i]->type == FFI_TYPE_SINT64 + || arg_types[i]->type == FFI_TYPE_UINT64) + /* gpr is 8-byte aligned. */ + && (argn % 2) != 0) + { + /* Align on a 8-byte boundary. */ + scratch[0] = gpr[argn]; + scratch[1] = gpr[argn+1]; + avalue[i] = scratch; + scratch -= 2; + argn += 2; + } else { |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:23
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/testsuite Modified Files: Makefile.in Log Message: updated with new version from gcc cvs Index: Makefile.in =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.in 22 Jun 2004 10:14:13 -0000 1.1 --- Makefile.in 14 May 2005 11:00:45 -0000 1.2 *************** *** 1,3 **** ! # Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ --- 1,3 ---- ! # Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ *************** *** 40,45 **** DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ! am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ ! $(top_srcdir)/../libtool.m4 $(top_srcdir)/../config/accross.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ --- 40,45 ---- DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ! am__aclocal_m4_deps = $(top_srcdir)/../config/accross.m4 \ ! $(top_srcdir)/../libtool.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ *************** *** 82,85 **** --- 82,87 ---- EGREP = @EGREP@ EXEEXT = @EXEEXT@ + FRV_FALSE = @FRV_FALSE@ + FRV_TRUE = @FRV_TRUE@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ IA64_FALSE = @IA64_FALSE@ *************** *** 89,92 **** --- 91,96 ---- INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LIBFFI_CRIS_FALSE = @LIBFFI_CRIS_FALSE@ + LIBFFI_CRIS_TRUE = @LIBFFI_CRIS_TRUE@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ *************** *** 94,97 **** --- 98,103 ---- LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ + M32R_FALSE = @M32R_FALSE@ + M32R_TRUE = @M32R_TRUE@ M68K_FALSE = @M68K_FALSE@ M68K_TRUE = @M68K_TRUE@ *************** *** 151,154 **** --- 157,162 ---- am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ + am__tar = @am__tar@ + am__untar = @am__untar@ bindir = @bindir@ build = @build@ *************** *** 159,163 **** datadir = @datadir@ exec_prefix = @exec_prefix@ - gcc_version = @gcc_version@ host = @host@ host_alias = @host_alias@ --- 167,170 ---- *************** *** 185,189 **** target_os = @target_os@ target_vendor = @target_vendor@ - tool_include_dir = @tool_include_dir@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ --- 192,195 ---- *************** *** 337,341 **** distclean-generic: ! -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: --- 343,347 ---- distclean-generic: ! -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:07
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi Modified Files: libtool-version configure.ac configure aclocal.m4 acinclude.m4 Makefile.in Makefile.am ChangeLog Added Files: version.c missing ltmain.sh ltconfig ltcf-c.sh install-sh depcomp configure.host config.sub config.guess config-ml.in Log Message: updated with new version from gcc cvs --- NEW FILE: ltcf-c.sh --- #### This script is meant to be sourced by ltconfig. # ltcf-c.sh - Create a C compiler specific configuration # # Copyright (C) 1996-2000, 2001 Free Software Foundation, Inc. # Originally by Gordon Matzigkeit <go...@gn...>, 1996 # # 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 # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='main(){return(0);}' ## Linker Characteristics case $host_os in cygwin* | mingw*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$with_gcc" != yes; then with_gnu_ld=no fi ;; esac ld_shlibs=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # See if GNU ld supports shared libraries. case $host_os in aix3* | aix4* | aix5*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then ld_shlibs=no cat <<EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. EOF fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # Samuel A. Falvo II <kc...@do...> reports # that the semantics of dynamic libraries on AmigaOS, at least up # to version 4, is to share data among multiple programs linked # with the same dynamic library. Since this doesn't match the # behavior of shared libraries on other platforms, we can use # them. ld_shlibs=no ;; beos*) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach <jr...@be...> says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw*) # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' allow_undefined_flag=unsupported always_export_symbols=yes extract_expsyms_cmds='test -f $output_objdir/impgen.c || \ sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/impgen.c~ test -f $output_objdir/impgen.exe || (cd $output_objdir && \ if test "x$BUILD_CC" != "x" ; then $BUILD_CC -o impgen impgen.c ; \ else $CC -o impgen impgen.c ; fi)~ $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def' old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib' # cygwin and mingw dlls have different entry points and sets of symbols # to exclude. # FIXME: what about values for MSVC? dll_entry=__cygwin_dll_entry@12 dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~ case $host_os in mingw*) # mingw values dll_entry=_DllMainCRTStartup@12 dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~ ;; esac # mingw and cygwin differ, and it's simplest to just exclude the union # of the two symbol sets. dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12 # recent cygwin and mingw systems supply a stub DllMain which the user # can override, but on older systems we have to supply one (in ltdll.c) if test "x$lt_cv_need_dllmain" = "xyes"; then ltdll_obj='$output_objdir/$soname-ltdll.'"$objext " ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $output_objdir/$soname-ltdll.c~ test -f $output_objdir/$soname-ltdll.$objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~' else ltdll_obj= ltdll_cmds= fi # Extract the symbol export list from an `--export-all' def file, # then regenerate the def file from the symbol export list, so that # the compiled dll only exports the symbol export list. # Be careful not to strip the DATA tag left be newer dlltools. export_symbols_cmds="$ltdll_cmds"' $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~ sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is. # If DATA tags from a recent dlltool are present, honour them! archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname-def; else echo EXPORTS > $output_objdir/$soname-def; _lt_hint=1; cat $export_symbols | while read symbol; do set dummy \$symbol; case \[$]# in 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; esac; _lt_hint=`expr 1 + \$_lt_hint`; done; fi~ '"$ltdll_cmds"' $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~ $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~ $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags' ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris* | sysv5*) if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. EOF elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; tpf*) ld_shlibs=yes ;; *) if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test "$ld_shlibs" = yes; then runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' case $host_os in cygwin* | mingw*) # dlltool doesn't understand --whole-archive et. al. whole_archive_flag_spec= ;; *) # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi ;; esac fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$with_gcc" = yes && test -z "$link_static_flag"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix4* | aix5*) hardcode_direct=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. if test "$with_gcc" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && \ strings "$collect2name" | grep resolve_lib_name >/dev/null then # We have reworked collect2 hardcode_direct=yes else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi esac shared_flag='-shared' else # not using gcc if test "$host_cpu" = ia64; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no if test $with_gnu_ld = no; then exp_sym_flag='-Bexport' no_entry_flag="" fi else # Test if we are trying to use run time linking, or normal AIX style linking. # If -brtl is somewhere in LDFLAGS, we need to do run time linking. aix_use_runtimelinking=no for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then aix_use_runtimelinking=yes break fi done exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # -bexpall does not export symbols beginning with underscore (_) always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other run time loading flags (-brtl), -berok will # link without error, but may produce a broken library. allow_undefined_flag=' ${wl}-berok' hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else if test "$host_cpu" = ia64; then if test $with_gnu_ld = no; then hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" fi else allow_undefined_flag=' ${wl}-berok' # -bexpall does not export symbols beginning with underscore (_) always_export_symbols=yes # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec=' ' build_libtool_need_lc=yes hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' # This is similar to how AIX traditionally builds it's shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes # see comment about different semantics on the GNU ld section ld_shlibs=no ;; cygwin* | mingw*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -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' fix_srcfile_path='`cygpath -w "$srcfile"`' ;; darwin* | rhapsody*) case "$host_os" in rhapsody* | darwin1.[[012]]) allow_undefined_flag='-undefined suppress' ;; *) # Darwin 1.3 on if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then allow_undefined_flag='-flat_namespace -undefined suppress' else case ${MACOSX_DEPLOYMENT_TARGET} in 10.[[012]]) allow_undefined_flag='-flat_namespace -undefined suppress' ;; 10.*) allow_undefined_flag='-undefined dynamic_lookup' ;; esac fi ;; esac # Disable shared library build on OS-X older than 10.3. case $host_os in darwin[1-6]*) can_build_shared=no ;; darwin7*) can_build_shared=yes ;; esac output_verbose_link_cmd='echo' archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags' # Don't fix this by using the ld -exported_symbols_list flag, # it doesn't exist in older darwin ld's archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported whole_archive_flag_spec='-all_load $convenience' link_all_deplibs=yes ;; freebsd1*) ld_shlibs=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | kfreebsd*-gnu) archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9* | hpux10* | hpux11*) case "$host_cpu" in ia64*) hardcode_direct=no hardcode_shlibpath_var=no archive_cmds='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' ;; *) if test $with_gcc = yes; then case "$host_os" in hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; *) archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_os in hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;; *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;; esac fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_minus_L=yes # Not in the search PATH, but as the default # location of the library. ;; esac export_dynamic_flag_spec='${wl}-E' hardcode_direct=yes ;; irix5* | irix6*) if test "$with_gcc" = yes; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: link_all_deplibs=yes ;; netbsd* | knetbsd*-gnu) if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; openbsd*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$with_gcc" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' # cc supports -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi hardcode_libdir_separator=: ;; sco3.2v5*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ;; solaris*) no_undefined_flag=' -z defs' if test "$with_gcc" = yes; then archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' else archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; esac link_all_deplibs=yes ;; sunos4*) archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv5*) no_undefined_flag=' -z text' # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' hardcode_libdir_flag_spec= hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4.2uw2*) archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=no hardcode_shlibpath_var=no hardcode_runpath_var=yes runpath_var=LD_RUN_PATH ;; sysv5uw7* | unixware7*) no_undefined_flag='${wl}-z ${wl}text' if test "$GCC" = yes; then archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' fi runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac fi ## Compiler Characteristics: PIC flags, static flags, etc if test "X${ac_cv_prog_cc_pic+set}" = Xset; then : else ac_cv_prog_cc_pic= ac_cv_prog_cc_shlib= ac_cv_prog_cc_wl= ac_cv_prog_cc_static= ac_cv_prog_cc_no_builtin= ac_cv_prog_cc_can_build_shared=$can_build_shared if test "$with_gcc" = yes; then ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_cv_prog_cc_static='-Bstatic' else lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; amigaos*) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. ac_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4' ;; beos* | irix5* | irix6* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; cygwin* | mingw* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). ac_cv_prog_cc_pic='-DDLL_EXPORT' ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files ac_cv_prog_cc_pic='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all ac_cv_prog_cc_pic= ;; sysv4*MP*) if test -d /usr/nec; then ac_cv_prog_cc_pic=-Kconform_pic fi ;; *) ac_cv_prog_cc_pic='-fPIC' ;; esac else # PORTME Check for PIC flags for the system compiler. case $host_os in aix*) # All AIX code is PIC. ac_cv_prog_cc_static="$ac_cv_prog_cc_static ${ac_cv_prog_cc_wl}-lC" ;; hpux9* | hpux10* | hpux11*) # Is there a better ac_cv_prog_cc_static that works with the bundled CC? ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" ac_cv_prog_cc_pic='+Z' ;; irix5* | irix6*) ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-non_shared' # PIC (with -KPIC) is the default. ;; cygwin* | mingw* | os2*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). ac_cv_prog_cc_pic='-DDLL_EXPORT' ;; newsos6) ac_cv_prog_cc_pic='-KPIC' ac_cv_prog_cc_static='-Bstatic' ;; osf3* | osf4* | osf5*) # All OSF/1 code is PIC. ac_cv_prog_cc_wl='-Wl,' ac_cv_prog_cc_static='-non_shared' ;; sco3.2v5*) ac_cv_prog_cc_pic='-Kpic' ac_cv_prog_cc_static='-dn' ac_cv_prog_cc_shlib='-belf' ;; solaris*) ac_cv_prog_cc_pic='-KPIC' ac_cv_prog_cc_static='-Bstatic' ac_cv_prog_cc_wl='-Wl,' ;; sunos4*) ac_cv_prog_cc_pic='-PIC' ac_cv_prog_cc_static='-Bstatic' ac_cv_prog_cc_wl='-Qoption ld ' ;; sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) ac_cv_prog_cc_pic='-KPIC' ac_cv_prog_cc_static='-Bstatic' ac_cv_prog_cc_wl='-Wl,' ;; uts4*) ac_cv_prog_cc_pic='-pic' ac_cv_prog_cc_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then ac_cv_prog_cc_pic='-Kconform_pic' ac_cv_prog_cc_static='-Bstatic' fi ;; *) ac_cv_prog_cc_can_build_shared=no ;; esac fi case "$host_os" in # Platforms which do not suport PIC and -DPIC is meaningless # on them: *djgpp*) ac_cv_prog_cc_pic= ;; *) ac_cv_prog_cc_pic="$ac_cv_prog_cc_pic -DPIC" ;; esac fi need_lc=yes if test "$enable_shared" = yes && test "$with_gcc" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. echo $ac_n "checking whether -lc should be explicitly linked in... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_archive_cmds_needs_lc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 need_lc=$ac_cv_archive_cmds_needs_lc else $rm conftest* echo "static int dummy;" > conftest.$ac_ext if { (eval echo ltcf-c.sh:need_lc: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then # Append any warnings to the config.log. cat conftest.err 1>&5 soname=conftest lib=conftest libobjs=conftest.$objext deplibs= wl=$ac_cv_prog_cc_wl compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { (eval echo ltcf-c.sh:need_lc: \"$archive_cmds\") 1>&5; (eval $archive_cmds) 2>&1 | grep " -lc " 1>&5 ; }; then need_lc=no fi allow_undefined_flag=$save_allow_undefined_flag else cat conftest.err 1>&5 fi fi $rm conftest* echo "$ac_t$need_lc" 1>&6 ;; esac fi ac_cv_archive_cmds_needs_lc=$need_lc Index: configure =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/configure,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configure 20 Oct 2004 15:53:30 -0000 1.2 --- configure 14 May 2005 11:00:50 -0000 1.3 *************** *** 311,315 **** #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LN_S RANLIB ac_ct_RANLIB LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_IRIX_TRUE MIPS_IRIX_FALSE MIPS_LINUX_TRUE MIPS_LINUX_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_WIN32_TRUE X86_WIN32_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE ARM_TRUE ARM_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE PA_TRUE PA_FALSE ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir tool_include_dir gcc_version LIBOBJS LTLIBOBJS' ac_subst_files='' --- 311,315 ---- #endif" ! ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS multi_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CFLAGS CCAS CCASFLAGS LN_S RANLIB ac_ct_RANLIB LIBTOOL MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CPP CPPFLAGS EGREP TESTSUBDIR_TRUE TESTSUBDIR_FALSE AM_RUNTESTFLAGS MIPS_IRIX_TRUE MIPS_IRIX_FALSE MIPS_LINUX_TRUE MIPS_LINUX_FALSE SPARC_TRUE SPARC_FALSE X86_TRUE X86_FALSE X86_WIN32_TRUE X86_WIN32_FALSE ALPHA_TRUE ALPHA_FALSE IA64_TRUE IA64_FALSE M32R_TRUE M32R_FALSE M68K_TRUE M68K_FALSE POWERPC_TRUE POWERPC_FALSE POWERPC_AIX_TRUE POWERPC_AIX_FALSE POWERPC_DARWIN_TRUE POWERPC_DARWIN_FALSE ARM_TRUE ARM_FALSE LIBFFI_CRIS_TRUE LIBFFI_CRIS_FALSE FRV_TRUE FRV_FALSE S390_TRUE S390_FALSE X86_64_TRUE X86_64_FALSE SH_TRUE SH_FALSE SH64_TRUE SH64_FALSE PA_TRUE PA_FALSE ALLOCA HAVE_LONG_DOUBLE TARGET TARGETDIR toolexecdir toolexeclibdir LIBOBJS LTLIBOBJS' ac_subst_files='' [...1062 lines suppressed...] --- 8584,8602 ---- continue fi ! # Extract the definition of DEPDIR, am__include, and am__quote ! # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` ! # Find all dependency output files, they are included files with ! # $(DEPDIR) in their names. We invoke sed twice because it is the ! # simplest approach to changing $(DEPDIR) to its actual value in the ! # expansion. ! for file in `sed -n " ! s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. --- NEW FILE: missing --- #! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2004-09-07.08 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard <pi...@ir...>, 1996. # This program 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, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to <bug...@gn...>." exit 0 ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit 0 ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case "$1" in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: Index: Makefile.in =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/gcc/libffi/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.in 18 Jun 2004 20:07:08 -0000 1.1 --- Makefile.in 14 May 2005 11:00:50 -0000 1.2 *************** *** 1,3 **** ! # Makefile.in generated by automake 1.8.5 from Makefile.am. # @configure_input@ --- 1,3 ---- ! # Makefile.in generated by automake 1.9.3 from Makefile.am. # @configure_input@ *************** *** 47,70 **** @ALPHA_TRUE@am__append_6 = src/alpha/ffi.c src/alpha/osf.S [...1284 lines suppressed...] + -rm -f src/sparc/$(am__dirstamp) + -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) -rm -f src/x86/$(am__dirstamp) *************** *** 1397,1400 **** --- 1228,1232 ---- distclean: distclean-multi distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ *************** *** 1424,1427 **** --- 1256,1260 ---- -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic --- NEW FILE: config-ml.in --- # Configure fragment invoked in the post-target section for subdirs # wanting multilib support. # # Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 # Free Software Foundation, Inc. # # 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 # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # # Please report bugs to <gcc...@gn...> # and send patches to <gcc...@gn...>. # It is advisable to support a few --enable/--disable options to let the # user select which libraries s/he really wants. # # Subdirectories wishing to use multilib should put the following lines # in the "post-target" section of configure.in. # # if [ "${srcdir}" = "." ] ; then # if [ "${with_target_subdir}" != "." ] ; then # . ${with_multisrctop}../../config-ml.in # else # . ${with_multisrctop}../config-ml.in # fi # else # . ${srcdir}/../config-ml.in # fi # # # Things are complicated because 6 separate cases must be handled: # 2 (native, cross) x 3 (absolute-path, relative-not-dot, dot) = 6. # # srcdir=. is special. It must handle make programs that don't handle VPATH. # To implement this, a symlink tree is built for each library and for each # multilib subdir. # # The build tree is layed out as # # ./ # newlib # m68020/ # newlib # m68881/ # newlib # # The nice feature about this arrangement is that inter-library references # in the build tree work without having to care where you are. Note that # inter-library references also work in the source tree because symlink trees # are built when srcdir=. # # Unfortunately, trying to access the libraries in the build tree requires # the user to manually choose which library to use as GCC won't be able to # find the right one. This is viewed as the lesser of two evils. # # Configure variables: # ${with_target_subdir} = "." for native, or ${target_alias} for cross. # Set by top level Makefile. # ${with_multisrctop} = how many levels of multilibs there are in the source # tree. It exists to handle the case of configuring in the source tree: # ${srcdir} is not constant. # ${with_multisubdir} = name of multilib subdirectory (eg: m68020/m68881). # # Makefile variables: # MULTISRCTOP = number of multilib levels in source tree (+1 if cross) # (FIXME: note that this is different than ${with_multisrctop}. Check out.). # MULTIBUILDTOP = number of multilib levels in build tree # MULTIDIRS = list of multilib subdirs (eg: m68000 m68020 ...) # (only defined in each library's main Makefile). # MULTISUBDIR = installed subdirectory name with leading '/' (eg: /m68000) # (only defined in each multilib subdir). # FIXME: Multilib is currently disabled by default for everything other than # newlib. It is up to each target to turn on multilib support for the other # libraries as desired. # Autoconf incoming variables: # srcdir, host, ac_configure_args # # We *could* figure srcdir and host out, but we'd have to do work that # our caller has already done to figure them out and requiring these two # seems reasonable. # Note that `host' in this case is GCC's `target'. Target libraries are # configured for a particular host. Makefile=${ac_file-Makefile} ml_config_shell=${CONFIG_SHELL-/bin/sh} ml_realsrcdir=${srcdir} # Scan all the arguments and set all the ones we need. ml_verbose=--verbose for option in ${ac_configure_args} do # strip single quotes surrounding individual options case $option in \'*\') eval option=$option ;; esac case $option in --*) ;; -*) option=-$option ;; esac case $option in --*=*) optarg=`echo $option | sed -e 's/^[^=]*=//'` ;; esac case $option in --disable-*) enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'` eval $enableopt=no ;; --enable-*) case "$option" in *=*) ;; *) optarg=yes ;; esac enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` eval $enableopt="$optarg" ;; --norecursion | --no-recursion) ml_norecursion=yes ;; --silent | --sil* | --quiet | --q*) ml_verbose=--silent ;; --verbose | --v | --verb*) ml_verbose=--verbose ;; --with-*) case "$option" in *=*) ;; *) optarg=yes ;; esac withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'` eval $withopt="$optarg" ;; --without-*) withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'` eval $withopt=no ;; esac done # Only do this if --enable-multilib. if [ "${enable_multilib}" = yes ]; then # Compute whether this is the library's top level directory # (ie: not a multilib subdirectory, and not a subdirectory like newlib/src). # ${with_multisubdir} tells us we're in the right branch, but we could be # in a subdir of that. # ??? The previous version could void this test by separating the process into # two files: one that only the library's toplevel configure.in ran (to # configure the multilib subdirs), and another that all configure.in's ran to # update the Makefile. It seemed reasonable to collapse all multilib support # into one file, but it does leave us with having to perform this test. ml_toplevel_p=no if [ -z "${with_multisubdir}" ]; then if [ "${srcdir}" = "." ]; then # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. # ${with_target_subdir} = "." for native, otherwise target alias. if [ "${with_target_subdir}" = "." ]; then if [ -f ${ml_realsrcdir}/../config-ml.in ]; then ml_toplevel_p=yes fi else if [ -f ${ml_realsrcdir}/../../config-ml.in ]; then ml_toplevel_p=yes fi fi else # Use ${ml_realsrcdir} instead of ${srcdir} here to account for ${subdir}. if [ -f ${ml_realsrcdir}/../config-ml.in ]; then ml_toplevel_p=yes fi fi fi # If this is the library's top level directory, set multidirs to the # multilib subdirs to support. This lives at the top because we need # `multidirs' set right away. if [ "${ml_toplevel_p}" = yes ]; then multidirs= for i in `${CC-gcc} --print-multi-lib 2>/dev/null`; do dir=`echo $i | sed -e 's/;.*$//'` if [ "${dir}" = "." ]; then true else if [ -z "${multidirs}" ]; then multidirs="${dir}" else multidirs="${multidirs} ${dir}" fi fi done # Target libraries are configured for the host they run on, so we check # $host here, not $target. case "${host}" in arc-*-elf*) if [ x$enable_biendian != xyes ] then old_multidirs=${multidirs} multidirs="" for x in ${old_multidirs}; do case "${x}" in *be*) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi ;; arm-*-*) if [ x"$enable_fpu" = xno ] then old_multidirs=${multidirs} multidirs="" for x in ${old_multidirs}; do case "${x}" in *fpu*) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi if [ x"$enable_26bit" = xno ] then old_multidirs=${multidirs} multidirs="" for x in ${old_multidirs}; do case "${x}" in *26bit*) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi if [ x"$enable_underscore" = xno ] then old_multidirs=${multidirs} multidirs="" for x in ${old_multidirs}; do case "${x}" in *under*) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi if [ x"$enable_interwork" = xno ] then old_multidirs=${multidirs} multidirs="" for x in ${old_multidirs}; do case "${x}" in *interwork*) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi if [ x$enable_biendian = xno ] then old_multidirs="${multidirs}" multidirs="" for x in ${old_multidirs}; do case "$x" in *le* ) : ;; *be* ) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi if [ x"$enable_nofmult" = xno ] then old_multidirs="${multidirs}" multidirs="" for x in ${old_multidirs}; do case "$x" in *nofmult* ) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi ;; m68*-*-*) if [ x$enable_softfloat = xno ] then old_multidirs="${multidirs}" multidirs="" for x in ${old_multidirs}; do case "$x" in *soft-float* ) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi if [ x$enable_m68881 = xno ] then old_multidirs="${multidirs}" multidirs="" for x in ${old_multidirs}; do case "$x" in *m68881* ) : ;; *) multidirs="${multidirs} ${x}" ;; esac done fi if [ x$enable_m68000 = xno ] then old... [truncated message content] |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:07
|
Update of /cvsroot/ctypes/ctypes/source/gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc Removed Files: move-if-change missing ltmain.sh ltconfig ltcf-c.sh install-sh configure config.sub config.if config.guess config-ml.in Log Message: updated with new version from gcc cvs --- move-if-change DELETED --- --- ltconfig DELETED --- --- ltcf-c.sh DELETED --- --- configure DELETED --- --- missing DELETED --- --- config.guess DELETED --- --- config-ml.in DELETED --- --- config.sub DELETED --- --- ltmain.sh DELETED --- --- config.if DELETED --- --- install-sh DELETED --- |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:03
|
Update of /cvsroot/ctypes/ctypes/source/gcc/gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/gcc Removed Files: version.c Log Message: updated with new version from gcc cvs --- version.c DELETED --- |
From: Andreas D. <ad...@us...> - 2005-05-14 11:01:01
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2506/gcc/libffi/CVS.gcc Added Files: Root Repository Entries.Log Entries Log Message: updated with new version from gcc cvs --- NEW FILE: Entries.Log --- A D/include//// A D/src//// A D/testsuite//// --- NEW FILE: Root --- :ext:an...@sa...:/cvsroot/gcc --- NEW FILE: Repository --- gcc/libffi --- NEW FILE: Entries --- /.cvsignore/1.1/Tue Jun 15 07:42:07 2004// /ChangeLog/1.235/Tue May 10 01:35:13 2005/-ko/ /ChangeLog.libgcj/1.6/Thu Jan 15 03:41:46 2004// /ChangeLog.v1/1.1.1.1/Sun Aug 8 13:27:19 1999/-ko/ /LICENSE/1.2/Tue Oct 21 19:01:53 2003/-ko/ /Makefile.am/1.39/Mon Apr 18 17:08:48 2005/-ko/ /Makefile.in/1.50/Mon Apr 18 17:08:48 2005/-ko/ /README/1.5/Sun Jan 25 06:58:33 2004/-ko/ /acinclude.m4/1.5/Tue Nov 23 04:11:28 2004// /aclocal.m4/1.13/Mon Mar 21 18:01:35 2005/-ko/ /configure/1.77/Tue May 10 01:35:15 2005/-ko/ /configure.ac/1.13/Fri Apr 29 13:15:01 2005// /configure.host/1.1/Mon Aug 30 15:43:00 2004// /fficonfig.h.in/1.10/Tue Jun 15 14:47:54 2004/-ko/ /libtool-version/1.2/Sat Jun 26 20:37:03 2004// /stamp-h.in/1.1.1.1/Sun Aug 8 13:27:19 1999/-ko/ D |
From: Andreas D. <ad...@us...> - 2005-05-14 10:55:28
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.special/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1803/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.special/CVS.gcc added to the repository |
From: Andreas D. <ad...@us...> - 2005-05-14 10:54:20
|
Update of /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.call/CVS.gcc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1696/CVS.gcc Log Message: Directory /cvsroot/ctypes/ctypes/source/gcc/libffi/testsuite/libffi.call/CVS.gcc added to the repository |