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 | 753f4e8973767a5bce1818784694f88d7e9a61e4 (patch) | |
tree | 3e701a442b9f032df0585e7b81808ecad4f74f1d /gnustep-base | |
parent | Version bump and old version cleanup (diff) | |
download | gentoo-2-753f4e8973767a5bce1818784694f88d7e9a61e4.tar.gz gentoo-2-753f4e8973767a5bce1818784694f88d7e9a61e4.tar.bz2 gentoo-2-753f4e8973767a5bce1818784694f88d7e9a61e4.zip |
Fix libbfi support on amd64, bug #189205
(Portage version: 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/files/gnustep-base-1.16.1-libffi_fix.patch | 640 | ||||
-rw-r--r-- | gnustep-base/gnustep-base/gnustep-base-1.16.1.ebuild | 8 |
3 files changed, 652 insertions, 2 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/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 |