diff options
author | Bernard Cafarelli <voyageur@gentoo.org> | 2008-06-30 13:08:51 +0000 |
---|---|---|
committer | Bernard Cafarelli <voyageur@gentoo.org> | 2008-06-30 13:08:51 +0000 |
commit | ea05af62d4e36604fadfe4b9b9403069b4871466 (patch) | |
tree | f9f8112989d1f3f961bba5eaf26c8bc630b0336a /gnustep-base | |
parent | Version bump and old version cleanup (diff) | |
download | historical-ea05af62d4e36604fadfe4b9b9403069b4871466.tar.gz historical-ea05af62d4e36604fadfe4b9b9403069b4871466.tar.bz2 historical-ea05af62d4e36604fadfe4b9b9403069b4871466.zip |
Fix libbfi support on amd64, bug #189205
Package-Manager: portage-2.2_rc1/cvs/Linux 2.6.25-gentoo-r4 x86_64
Diffstat (limited to 'gnustep-base')
-rw-r--r-- | gnustep-base/gnustep-base/ChangeLog | 6 | ||||
-rw-r--r-- | gnustep-base/gnustep-base/Manifest | 5 | ||||
-rw-r--r-- | gnustep-base/gnustep-base/files/gnustep-base-1.16.1-libffi_fix.patch | 640 | ||||
-rw-r--r-- | gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild | 8 |
4 files changed, 655 insertions, 4 deletions
diff --git a/gnustep-base/gnustep-base/ChangeLog b/gnustep-base/gnustep-base/ChangeLog index 3c0925cfda7a..e42d52f35bf6 100644 --- a/gnustep-base/gnustep-base/ChangeLog +++ b/gnustep-base/gnustep-base/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for gnustep-base/gnustep-base # Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/gnustep-base/gnustep-base/ChangeLog,v 1.68 2008/06/19 14:37:34 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/gnustep-base/gnustep-base/ChangeLog,v 1.69 2008/06/30 13:08:50 voyageur Exp $ + + 30 Jun 2008; Bernard Cafarelli <voyageur@gentoo.org> + +files/gnustep-base-1.16.1-libffi_fix.patch, gnustep-base-1.16.1.ebuild: + Fix libbfi support on amd64, bug #189205 *gnustep-base-1.16.1 (19 Jun 2008) diff --git a/gnustep-base/gnustep-base/Manifest b/gnustep-base/gnustep-base/Manifest index fc20b3e18c1c..774014b40bb7 100644 --- a/gnustep-base/gnustep-base/Manifest +++ b/gnustep-base/gnustep-base/Manifest @@ -1,9 +1,10 @@ AUX 50-gnustep-revdep 35 RMD160 f9508891da2de58ef884baabf9206577653a409b SHA1 40e21ae24078afb92067f51ca82722f20b742512 SHA256 e0bde19a964f2ae01855b4353c3d2af7b0b0ca25231827798ebfea16e435d3a2 +AUX gnustep-base-1.16.1-libffi_fix.patch 20197 RMD160 3c247213f0e90d84b1280cf7b57e3b6cab2baaba SHA1 0c1af11da6db40aaa7e3f63dd71ce284ce4b655f SHA256 76262c6145df9d6e02ce234b1a753f3cf4eb9e78625c4568a7003a80e1400f47 DIST gnustep-base-1.14.1.tar.gz 2368190 RMD160 43dc9fd0be2e0c35a9c4730843a284ca344859f1 SHA1 b1a280d7d9d729537a64ebfab7e304cf161c7f40 SHA256 ba8747db113f2d32d4666bb04aa06a092c153484e0943a43ad142b200939517d DIST gnustep-base-1.14.3.tar.gz 2369272 RMD160 bf4d23acc75e3a762b71e74441959458246b262f SHA1 9867424fcefce914ac1d4dfcdca616673e9267d7 SHA256 07dcc4b750d2402fb4e2495c4afa806b6c6d277ecf2546748e9417db89fc7702 DIST gnustep-base-1.16.1.tar.gz 2473011 RMD160 90b46830f1bb0ffbd7cd16f81a6e1facc940fb0c SHA1 f714cc3a338d9a08d852fcf79a49786f2faeb0f5 SHA256 5a8cc78d4bf6f700e1217580bc4882cd3083672ffce0d60139db7f5178ea2a87 EBUILD gnustep-base-1.14.1.ebuild 2559 RMD160 908eb647d841291dea757592471cde88c9e51ace SHA1 72042a9360d119a32ea14625be206c77ad3dd1f5 SHA256 17d8590cde11dfc8ae212990c1855f764c876c98026c26edf0681af45a653253 EBUILD gnustep-base-1.14.3.ebuild 2563 RMD160 1226d9c6d7db4b8c5b68aeb157182412e8701d3a SHA1 1888bd5135b17da3a45a26028287329e7d9c006c SHA256 9f4c1284f229e3ed2df571d20673012c4efc90e636318e7ec8fe6e19ff1ae32c -EBUILD gnustep-base-1.16.1.ebuild 2642 RMD160 f2e113fe9b3b22d69de38012a33a68bebfa892b6 SHA1 37e75499ad35e2f0e231c67f02e4403882b8b0cc SHA256 75f3296cefffb24df745d73ec1561b294e415c19cfaacd58e98cb7e1c272722c -MISC ChangeLog 15339 RMD160 7bfd46111a5ec353f8fe0e3ba7f5ac06edb68b74 SHA1 2cc2ef21d5fec0ef244c7cb3b71500f5a3eb235a SHA256 cd9f708f4fdfc82234b8799b9bd3fe19f34af390a48bf42fb82c6d4c1df371f9 +EBUILD gnustep-base-1.16.1.ebuild 2730 RMD160 4c665d9804da1dbb19a07cfb5b5d696780c1c083 SHA1 27d87367a8ffcd6d7ac42c06ab5456dfcb874d98 SHA256 4bfcb28fea4b83607ed848b741df44db4302a77fc51cfd9f6fb28e6824c09b97 +MISC ChangeLog 15513 RMD160 dfc2cdcd72cccff49bcc26f32baed4a075e785f8 SHA1 0bc057c061782f8a89efa17e5246c3d6156ba974 SHA256 1e25f22164367639e7121ac69802f1756591c3b5eb24a41abef232a9657c75c0 MISC metadata.xml 670 RMD160 5d5b88faf28b66aa5d5d3efd6fe5844e980604c9 SHA1 9582400efd6733f27beaf47fa801065838d86955 SHA256 e08343661cc7ecb6d963be62092a270a45f8af0201c9523d1feeddfa09a417fa diff --git a/gnustep-base/gnustep-base/files/gnustep-base-1.16.1-libffi_fix.patch b/gnustep-base/gnustep-base/files/gnustep-base-1.16.1-libffi_fix.patch new file mode 100644 index 000000000000..11c098f9156a --- /dev/null +++ b/gnustep-base/gnustep-base/files/gnustep-base-1.16.1-libffi_fix.patch @@ -0,0 +1,640 @@ +diff -Naur gnustep-base-1.16.1.orig/configure gnustep-base-1.16.1/configure +--- gnustep-base-1.16.1.orig/configure 2008-06-30 14:54:14.000000000 +0200 ++++ gnustep-base-1.16.1/configure 2008-06-30 14:54:20.000000000 +0200 +@@ -13140,7 +13140,7 @@ + + + #-------------------------------------------------------------------- +-# These functions needed by NSData.m ++# These functions needed by NSData.m and GSFFIInvocation.m + #-------------------------------------------------------------------- + + for ac_func in mkstemp +@@ -13425,6 +13425,240 @@ + done + + ++for ac_func in mprotect ++do ++as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` ++{ echo "$as_me:$LINENO: checking for $ac_func" >&5 ++echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } ++if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. ++ For example, HP-UX 11i <limits.h> declares gettimeofday. */ ++#define $ac_func innocuous_$ac_func ++ ++/* System header to define __stub macros and hopefully few prototypes, ++ which can conflict with char $ac_func (); below. ++ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since ++ <limits.h> exists even on freestanding compilers. */ ++ ++#ifdef __STDC__ ++# include <limits.h> ++#else ++# include <assert.h> ++#endif ++ ++#undef $ac_func ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char $ac_func (); ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined __stub_$ac_func || defined __stub___$ac_func ++choke me ++#endif ++ ++int ++main () ++{ ++return $ac_func (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest$ac_exeext && ++ $as_test_x conftest$ac_exeext; then ++ eval "$as_ac_var=yes" ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ eval "$as_ac_var=no" ++fi ++ ++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++ac_res=`eval echo '${'$as_ac_var'}'` ++ { echo "$as_me:$LINENO: result: $ac_res" >&5 ++echo "${ECHO_T}$ac_res" >&6; } ++if test `eval echo '${'$as_ac_var'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++done ++ ++ ++for ac_header in sys/mman.h ++do ++as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` ++if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then ++ { echo "$as_me:$LINENO: checking for $ac_header" >&5 ++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } ++if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++fi ++ac_res=`eval echo '${'$as_ac_Header'}'` ++ { echo "$as_me:$LINENO: result: $ac_res" >&5 ++echo "${ECHO_T}$ac_res" >&6; } ++else ++ # Is the header compilable? ++{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 ++echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++$ac_includes_default ++#include <$ac_header> ++_ACEOF ++rm -f conftest.$ac_objext ++if { (ac_try="$ac_compile" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_compile") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest.$ac_objext; then ++ ac_header_compiler=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_compiler=no ++fi ++ ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 ++echo "${ECHO_T}$ac_header_compiler" >&6; } ++ ++# Is the header present? ++{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 ++echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } ++cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++#include <$ac_header> ++_ACEOF ++if { (ac_try="$ac_cpp conftest.$ac_ext" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 ++ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } >/dev/null && { ++ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || ++ test ! -s conftest.err ++ }; then ++ ac_header_preproc=yes ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ ac_header_preproc=no ++fi ++ ++rm -f conftest.err conftest.$ac_ext ++{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 ++echo "${ECHO_T}$ac_header_preproc" >&6; } ++ ++# So? What about this header? ++case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in ++ yes:no: ) ++ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 ++echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 ++echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ++ ac_header_preproc=yes ++ ;; ++ no:yes:* ) ++ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 ++echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 ++echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 ++echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 ++echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 ++echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} ++ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 ++echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ++ ++ ;; ++esac ++{ echo "$as_me:$LINENO: checking for $ac_header" >&5 ++echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } ++if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ eval "$as_ac_Header=\$ac_header_preproc" ++fi ++ac_res=`eval echo '${'$as_ac_Header'}'` ++ { echo "$as_me:$LINENO: result: $ac_res" >&5 ++echo "${ECHO_T}$ac_res" >&6; } ++ ++fi ++if test `eval echo '${'$as_ac_Header'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++ ++done ++ ++ + #-------------------------------------------------------------------- + # These functions needed by NSTask.m + #-------------------------------------------------------------------- +diff -Naur gnustep-base-1.16.1.orig/configure.ac gnustep-base-1.16.1/configure.ac +--- gnustep-base-1.16.1.orig/configure.ac 2008-06-30 14:54:14.000000000 +0200 ++++ gnustep-base-1.16.1/configure.ac 2008-06-30 14:54:20.000000000 +0200 +@@ -1496,11 +1496,13 @@ + AC_CHECK_FUNCS(times) + + #-------------------------------------------------------------------- +-# These functions needed by NSData.m ++# These functions needed by NSData.m and GSFFIInvocation.m + #-------------------------------------------------------------------- + AC_CHECK_FUNCS(mkstemp) + AC_CHECK_FUNCS(shmctl) + AC_CHECK_FUNCS(mmap) ++AC_CHECK_FUNCS(mprotect) ++AC_CHECK_HEADERS(sys/mman.h) + + #-------------------------------------------------------------------- + # These functions needed by NSTask.m +diff -Naur gnustep-base-1.16.1.orig/Headers/Additions/GNUstepBase/config.h.in gnustep-base-1.16.1/Headers/Additions/GNUstepBase/config.h.in +--- gnustep-base-1.16.1.orig/Headers/Additions/GNUstepBase/config.h.in 2008-06-30 14:54:15.000000000 +0200 ++++ gnustep-base-1.16.1/Headers/Additions/GNUstepBase/config.h.in 2008-06-30 14:54:20.000000000 +0200 +@@ -334,6 +334,9 @@ + /* Define to 1 if you have the `mmap' function. */ + #undef HAVE_MMAP + ++/* Define to 1 if you have the `mprotect' function. */ ++#undef HAVE_MPROTECT ++ + /* Define to 1 if you have the `nanosleep' function. */ + #undef HAVE_NANOSLEEP + +@@ -467,6 +470,9 @@ + /* Define to 1 if you have the <sys/ioctl.h> header file. */ + #undef HAVE_SYS_IOCTL_H + ++/* Define to 1 if you have the <sys/mman.h> header file. */ ++#undef HAVE_SYS_MMAN_H ++ + /* Define to 1 if you have the <sys/mount.h> header file. */ + #undef HAVE_SYS_MOUNT_H + +diff -Naur gnustep-base-1.16.1.orig/Source/cifframe.h gnustep-base-1.16.1/Source/cifframe.h +--- gnustep-base-1.16.1.orig/Source/cifframe.h 2008-06-30 14:54:14.000000000 +0200 ++++ gnustep-base-1.16.1/Source/cifframe.h 2008-06-30 14:54:20.000000000 +0200 +@@ -52,6 +52,8 @@ + + extern cifframe_t *cifframe_from_info (NSArgumentInfo *info, int numargs, + void **retval); ++extern unsigned retval_offset_from_info (NSArgumentInfo *info, int numargs); ++ + extern void cifframe_set_arg(cifframe_t *cframe, int index, void *buffer, + int size); + extern void cifframe_get_arg(cifframe_t *cframe, int index, void *buffer, +diff -Naur gnustep-base-1.16.1.orig/Source/cifframe.m gnustep-base-1.16.1/Source/cifframe.m +--- gnustep-base-1.16.1.orig/Source/cifframe.m 2008-06-30 14:54:14.000000000 +0200 ++++ gnustep-base-1.16.1/Source/cifframe.m 2008-06-30 14:54:20.000000000 +0200 +@@ -246,6 +246,75 @@ + return cframe; + } + ++/* NB. this must match the code in cifframe_from_info() so that it ++ * returns the offset for the returne value in the cframe. ++ */ ++unsigned ++retval_offset_from_info (NSArgumentInfo *info, int numargs) ++{ ++ unsigned size = sizeof(cifframe_t); ++ unsigned align = __alignof(double); ++ unsigned type_offset = 0; ++ unsigned offset = 0; ++ int i; ++ ffi_type *arg_types[numargs]; ++ ffi_type *rtype; ++ ++ /* FIXME: in cifframe_type, return values/arguments that are structures ++ have custom ffi_types with are allocated separately. We should allocate ++ them in our cifframe so we don't leak memory. Or maybe we could ++ cache structure types? */ ++ rtype = cifframe_type(info[0].type, NULL); ++ if (rtype == 0 || (rtype->size == 0 && rtype->elements == NULL)) ++ { ++ return 0; ++ } ++ ++ for (i = 0; i < numargs; i++) ++ { ++ arg_types[i] = cifframe_type(info[i+1].type, NULL); ++ } ++ ++ if (numargs > 0) ++ { ++ if (size % align != 0) ++ { ++ size += align - (size % align); ++ } ++ type_offset = size; ++ /* Make room to copy the arg_types */ ++ size += sizeof(ffi_type *) * numargs; ++ if (size % align != 0) ++ { ++ size += align - (size % align); ++ } ++ offset = size; ++ size += numargs * sizeof(void*); ++ if (size % align != 0) ++ { ++ size += (align - (size % align)); ++ } ++ for (i = 0; i < numargs; i++) ++ { ++ if (arg_types[i]->elements) ++ size += cifframe_guess_struct_size(arg_types[i]); ++ else ++ size += arg_types[i]->size; ++ ++ if (size % align != 0) ++ { ++ size += (align - size % align); ++ } ++ } ++ } ++ ++ if (size % align != 0) ++ { ++ size += (align - size % align); ++ } ++ return size; ++} ++ + void + cifframe_set_arg(cifframe_t *cframe, int index, void *buffer, int size) + { +diff -Naur gnustep-base-1.16.1.orig/Source/GSFFIInvocation.m gnustep-base-1.16.1/Source/GSFFIInvocation.m +--- gnustep-base-1.16.1.orig/Source/GSFFIInvocation.m 2008-06-30 14:54:14.000000000 +0200 ++++ gnustep-base-1.16.1/Source/GSFFIInvocation.m 2008-06-30 14:54:20.000000000 +0200 +@@ -31,6 +31,7 @@ + #import <objc/objc-api.h> + #import "cifframe.h" + #import "mframe.h" ++#import "GSPrivate.h" + + #ifndef INLINE + #define INLINE inline +@@ -146,6 +147,7 @@ + cifframe_t *cframe; + ffi_closure *cclosure; + NSMethodSignature *sig; ++ GSCodeBuffer *memory; + + sig = [receiver methodSignatureForSelector: sel]; + +@@ -185,7 +187,9 @@ + worry about freeing it */ + cframe = cifframe_from_info([sig methodInfo], [sig numberOfArguments], NULL); + /* Autorelease the closure through GSAutoreleasedBuffer */ +- cclosure = (ffi_closure *)GSAutoreleasedBuffer(sizeof(ffi_closure)); ++ ++ memory = [GSCodeBuffer memoryWithSize: sizeof(ffi_closure)]; ++ cclosure = [memory buffer]; + if (cframe == NULL || cclosure == NULL) + { + [NSException raise: NSMallocException format: @"Allocating closure"]; +@@ -195,6 +199,7 @@ + { + [NSException raise: NSGenericException format: @"Preping closure"]; + } ++ [memory protect]; + + return (IMP)cclosure; + } +@@ -248,23 +253,28 @@ + frame: (cifframe_t *)frame + signature: (NSMethodSignature*)aSignature + { ++ int i; ++ + _sig = RETAIN(aSignature); + _numArgs = [aSignature numberOfArguments]; + _info = [aSignature methodInfo]; + _cframe = frame; + ((cifframe_t *)_cframe)->cif = *cif; + ++ /* Copy the arguments into our frame so that they are preserved ++ * in the NSInvocation if the stack is changed before the ++ * invocation is used. ++ */ + #if MFRAME_STRUCT_BYREF +-{ +- int i; +- /* Fix up some of the values. Do this on all processors that pass +- structs by reference. Is there an automatic way to determine this? */ + for (i = 0; i < ((cifframe_t *)_cframe)->nargs; i++) + { + const char *t = _info[i+1].type; + + if (*t == _C_STRUCT_B || *t == _C_UNION_B || *t == _C_ARY_B) + { ++ /* Fix up some of the values. Do this on all processors that pass ++ structs by reference. ++ Is there an automatic way to determine this? */ + memcpy(((cifframe_t *)_cframe)->values[i], *(void **)vals[i], + ((cifframe_t *)_cframe)->arg_types[i]->size); + } +@@ -274,14 +284,22 @@ + ((cifframe_t *)_cframe)->arg_types[i]->size); + } + } +-} + #else +- ((cifframe_t *)_cframe)->values = vals; ++ for (i = 0; i < ((cifframe_t *)_cframe)->nargs; i++) ++ { ++ memcpy(((cifframe_t *)_cframe)->values[i], vals[i], ++ ((cifframe_t *)_cframe)->arg_types[i]->size); ++ } + #endif + _retval = retp; + return self; + } + ++- (void) _storeRetval ++{ ++ _retval = _cframe + retval_offset_from_info (_info, _numArgs); ++} ++ + /* + * This is implemented as a function so it can be used by other + * routines (like the DO forwarding) +diff -Naur gnustep-base-1.16.1.orig/Source/GSPrivate.h gnustep-base-1.16.1/Source/GSPrivate.h +--- gnustep-base-1.16.1.orig/Source/GSPrivate.h 2008-06-30 14:54:14.000000000 +0200 ++++ gnustep-base-1.16.1/Source/GSPrivate.h 2008-06-30 14:54:20.000000000 +0200 +@@ -498,5 +498,19 @@ + GSPrivateUnloadModule(FILE *errorStream, + void (*unloadCallback)(Class, struct objc_category *)) GS_ATTRIB_PRIVATE; + ++ ++/* Memory to use to put executabel code in. ++ */ ++@interface GSCodeBuffer : NSObject ++{ ++ unsigned size; ++ void *buffer; ++} +++ (GSCodeBuffer*) memoryWithSize: (unsigned)_size; ++- (void*) buffer; ++- (id) initWithSize: (unsigned)_size; ++- (void) protect; ++@end ++ + #endif /* _GSPrivate_h_ */ + +diff -Naur gnustep-base-1.16.1.orig/Source/NSInvocation.m gnustep-base-1.16.1/Source/NSInvocation.m +--- gnustep-base-1.16.1.orig/Source/NSInvocation.m 2008-06-30 14:54:14.000000000 +0200 ++++ gnustep-base-1.16.1/Source/NSInvocation.m 2008-06-30 14:54:20.000000000 +0200 +@@ -31,6 +31,7 @@ + #include "Foundation/NSInvocation.h" + #include "GSInvocation.h" + #include "config.h" ++#include "GSPrivate.h" + #include <mframe.h> + #if defined(USE_LIBFFI) + #include "cifframe.h" +@@ -38,6 +39,105 @@ + #include "callframe.h" + #endif + ++#if defined(HAVE_SYS_MMAN_H) ++#include <sys/mman.h> ++#endif ++ ++@interface NSInvocation (Private) ++/* Tell the invocation to store return values locally rather than writing ++ * themto the stack location specified when the invocation was produced ++ */ ++- (void) _storeRetval; ++@end ++ ++@implementation GSCodeBuffer ++ +++ (GSCodeBuffer*) memoryWithSize: (unsigned)_size ++{ ++ return [[[self alloc] initWithSize: _size] autorelease]; ++} ++ ++- (void*) buffer ++{ ++ return buffer; ++} ++ ++- (void) dealloc ++{ ++ if (size > 0) ++ { ++#if defined(HAVE_MMAP) ++ munmap(buffer, size); ++#elif defined(__MINGW32__) ++ VirtualFree(buffer, 0, MEM_RELEASE); ++#else ++ free(buffer); ++#endif ++ } ++ [super dealloc]; ++} ++ ++- (id) initWithSize: (unsigned)_size ++{ ++#if defined(HAVE_MMAP) ++#ifndef MAP_ANONYMOUS ++#define MAP_ANONYMOUS MAP_ANON ++#endif ++#if defined(HAVE_MPROTECT) ++ /* We have mprotect, so we create memory as writable and change it to ++ * executable later (writable and executable may not be possible at ++ * the same time). ++ */ ++ buffer = mmap (NULL, _size, PROT_READ|PROT_WRITE, ++ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); ++#else ++ /* We do not have mprotect, so we have to try to create writable and ++ * executable memory. ++ */ ++ buffer = mmap (NULL, _size, PROT_READ|PROT_WRITE|PROT_EXEC, ++ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); ++#endif /* HAVE_MPROTECT */ ++ if (buffer == (void*)-1) buffer = (void*)0; ++#elif defined(__MINGW32__) ++ buffer = VirtualAlloc(NULL, _size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); ++#else ++ buffer = malloc(_size); ++#endif /* HAVE_MMAP */ ++ ++ if (buffer == (void*)0) ++ { ++ NSLog(@"Failed to map %u bytes for execute: %@", _size, [NSError _last]); ++ buffer = 0; ++ [self dealloc]; ++ self = nil; ++ } ++ else ++ { ++ size = _size; ++ } ++ return self; ++} ++ ++/* Ensure that the protection on the buffer is such that it will execute ++ * on any architecture. ++ */ ++- (void) protect ++{ ++#if defined(__MINGW32__) ++ DWORD old; ++ if (VirtualProtect(buffer, size, PAGE_EXECUTE, &old) == 0) ++ { ++ NSLog(@"Failed to protect memory as executable: %@", [NSError _last]); ++ } ++#elif defined(HAVE_MPROTECT) ++ if (mprotect(buffer, size, PROT_READ|PROT_EXEC) == -1) ++ { ++ NSLog(@"Failed to protect memory as executable: %@", [NSError _last]); ++ } ++#endif ++} ++@end ++ + static Class NSInvocation_abstract_class; + static Class NSInvocation_concrete_class; + +@@ -1054,6 +1154,7 @@ + - (void) forwardInvocation: (NSInvocation*)anInvocation + { + invocation = anInvocation; ++ [invocation _storeRetval]; + } + - (NSMethodSignature*) methodSignatureForSelector: (SEL)aSelector + { +@@ -1068,3 +1169,10 @@ + return invocation; + } + @end ++ ++@implementation NSInvocation (Private) ++- (void) _storeRetval ++{ ++ return; // subclass should implemente where necessary ++} ++@end diff --git a/gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild b/gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild index 9c36fba39c6b..4c80bf8752c7 100644 --- a/gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild +++ b/gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild,v 1.1 2008/06/19 14:37:34 voyageur Exp $ +# $Header: /var/cvsroot/gentoo-x86/gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild,v 1.2 2008/06/30 13:08:50 voyageur Exp $ inherit gnustep-base @@ -36,6 +36,12 @@ pkg_setup() { fi } +src_unpack() { + gnustep-base_src_unpack + + epatch "${FILESDIR}"/${P}-libffi_fix.patch +} + src_compile() { egnustep_env |