This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Question about libffi closure


On Wed, Nov 19, 2003 at 03:40:32PM -0500, Jeff Sturm wrote:
> On Wed, 19 Nov 2003, Andreas Jaeger wrote:
> > So, how shall we fix the testsuite?
> >
> > Should we do instead of:
> >
> >   static ffi_closure cl;
> >   ffi_closure *pcl = &cl;
> >
> > use:
> >   ffi_closure *pcl;
> >
> >   pcl = mmap (NULL, sizeof(ffi_closure), PROT_READ|PROT_EXEC,
> >               MAP_PRIVATE|MAP_ANONYMOUS, fd, 0);
> 
> mprotect might be easier, and can be preprocessed out wherever it isn't
> supported.

mmap with PROT_EXEC is certainly preferrable, unless you call mprotect
on something you've allocated with mmap yourself.
You can very easily write various methods of allocating
executable chunk of memory depending on preprocessor macros,
using mprotect wouldn't make this much easier.

	Jakub


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