This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: closure api problems


Aaron Patterson wrote:
On Mon, Nov 16, 2009 at 09:53:38PM +0100, Andreas Tobler wrote:
Andrew Haley wrote:
Aaron Patterson wrote:
On Mon, Nov 16, 2009 at 07:45:36PM +0000, Andrew Haley wrote:
Aaron Patterson wrote:
I'm running 64bit OS X (Snow Leopard).  Any help would be greatly
appreciated!
I think Snow Leopard forbids exec permission on data memory.
You need to make sure that FFI_MMAP_EXEC_WRIT is set in closures.c.
That seems to fix it.  Is it safe to define that constant for all
platforms?  Or just Snow Leopard?
We could do it for all Sarwin.
;)

I think darwin10+ is enough.

Are you planning a permanent fix for master?
Not me, because I can't test it. Patches welcome.
Something like this could be ok, untested. You need an autoconfig run.

[deuterium:~/Desktop/libffi-3.0.9rc3] andreast% diff -u
configure.ac.orig configure.ac
--- configure.ac.orig	2009-11-16 21:50:16.000000000 +0100
+++ configure.ac	2009-11-16 21:51:22.000000000 +0100
@@ -275,7 +275,7 @@
 fi

 case "$target" in
-    i?86-apple-darwin10* | *-*-freebsd* | *-*-openbsd*)
+    *-apple-darwin10* | *-*-freebsd* | *-*-openbsd*)
 	AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1,
 		  [Cannot use malloc on this target, so, we revert to
 		   alternative means])




I have to admit that I suck with autotools, /but/, this doesn't seem to be working for me. autoconf 2.64 from macports seems to choke:

  $ autoconf
  configure.ac:23: error: m4_copy: won't overwrite defined macro:
  _AC_ARG_VAR_PRECIOUS
  configure.ac:23: the top level
  autom4te: /opt/local/bin/gm4 failed with exit status: 1

Autoconf 2.61 that ships with Snow Leopard works, but it seems like the
constant isn't being defined.  I'm guessing the constant isn't defined
since the sample program still gives a bus error.

Where should I look for that constant to confirm the autoconf worked?

Again, thanks so much for the help.


I then propose to apply the following diff to configure, assuming you're working with the rc3 tar ball:


[deuterium:~/Desktop/libffi-3.0.9rc3] andreast% diff -u configure.orig configure
--- configure.orig 2009-11-16 22:19:42.000000000 +0100
+++ configure 2009-11-16 22:19:57.000000000 +0100
@@ -20292,7 +20292,7 @@
fi


 case "$target" in
-    i?86-apple-darwin10* | *-*-freebsd* | *-*-openbsd*)
+    *-apple-darwin10* | *-*-freebsd* | *-*-openbsd*)

$as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h


It doesn't make sense to get grey hairs from this tool. We will manage the issues here.


Thanks for testing!
Andreas



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]