installed a workaround for a bug in libffi where it does not mark
executable code with the PROT_EXEC protection flag.
This commit is contained in:
parent
7fee24e09e
commit
12f41f4a8a
2
c32
2
c32
|
@ -2,7 +2,7 @@
|
|||
|
||||
./configure \
|
||||
--prefix=$HOME/.opt32 \
|
||||
CFLAGS="-m32 -I$HOME/.opt32/include -I$HOME/.opt32/lib/libffi-3.0.6/include" \
|
||||
CFLAGS="-m32 -I$HOME/.opt32/include -I$HOME/.opt32/lib/libffi-3.0.8/include" \
|
||||
LDFLAGS="-m32 -L$HOME/.opt32/lib" \
|
||||
&& make clean \
|
||||
&& make
|
||||
|
|
4
c64
4
c64
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
./configure --prefix=/Users/ikarus/.opt \
|
||||
CFLAGS="-m64 -I $HOME/.opt64/include -I $HOME/.opt64/lib/libffi-3.0.6/include" \
|
||||
./configure --prefix=$HOME/.opt64 \
|
||||
CFLAGS="-m64 -I $HOME/.opt64/include -I $HOME/.opt64/lib/libffi-3.0.8/include" \
|
||||
LDFLAGS="-m64 -L$HOME/.opt64/lib" \
|
||||
&& make clean \
|
||||
&& make
|
||||
|
|
11
config.h.in
11
config.h.in
|
@ -6,6 +6,11 @@
|
|||
/* use flat segment and dirty vectors (not used yet) */
|
||||
#undef FLAT_TABLES
|
||||
|
||||
/* Mark code returned by libffi executable because libffi does not do that
|
||||
yet. This so far is only important on Snow Leopard in 64-bit mode but we
|
||||
mark it on all darwins anyways. */
|
||||
#undef HACK_FFI
|
||||
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#undef HAVE_ASSERT_H
|
||||
|
||||
|
@ -153,9 +158,6 @@
|
|||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#undef NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
|
@ -186,9 +188,6 @@
|
|||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
|
|
|
@ -2996,15 +2996,6 @@ fi
|
|||
VERSION=0.0.4-rc1
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define PACKAGE "$PACKAGE"
|
||||
_ACEOF
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define VERSION "$VERSION"
|
||||
_ACEOF
|
||||
|
||||
# Some tools Automake needs.
|
||||
|
||||
ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
|
||||
|
@ -4931,6 +4922,11 @@ case "$target_os" in
|
|||
;;
|
||||
*cygwin*)
|
||||
LDFLAGS="-Wl,-E -Wl,--export-all-symbols $LDFLAGS"
|
||||
;;
|
||||
*darwin*)
|
||||
|
||||
$as_echo "#define HACK_FFI 1" >>confdefs.h
|
||||
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
AC_PREREQ(2.59)
|
||||
AC_INIT(ikarus, 0.0.4-rc1, aghuloum@cs.indiana.edu)
|
||||
AC_CANONICAL_SYSTEM
|
||||
AM_INIT_AUTOMAKE(ikarus, 0.0.4-rc1)
|
||||
AM_INIT_AUTOMAKE(ikarus, 0.0.4-rc1, gnu)
|
||||
AC_CONFIG_SRCDIR([src/])
|
||||
|
||||
|
||||
|
@ -26,6 +26,13 @@ case "$target_os" in
|
|||
*cygwin*)
|
||||
LDFLAGS="-Wl,-E -Wl,--export-all-symbols $LDFLAGS"
|
||||
;;
|
||||
*darwin*)
|
||||
AC_DEFINE(HACK_FFI, 1,
|
||||
[Mark code returned by libffi executable because
|
||||
libffi does not do that yet. This so far is only
|
||||
important on Snow Leopard in 64-bit mode but we
|
||||
mark it on all darwins anyways.])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_CHECK_SIZEOF(void *)
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
#undef DEBUG_FFI
|
||||
|
||||
#ifdef HACK_FFI
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
static void*
|
||||
alloc(size_t n, int m) {
|
||||
void* x = calloc(n, m);
|
||||
|
@ -435,6 +439,20 @@ ikrt_prepare_callback(ikptr data, ikpcb* pcb){
|
|||
ikptr cifptr = ref(data, off_vector_data + 0 * wordsize);
|
||||
void* codeloc;
|
||||
ffi_closure* closure = ffi_closure_alloc(sizeof(ffi_closure), &codeloc);
|
||||
|
||||
#ifdef HACK_FFI
|
||||
{
|
||||
long code_start = align_to_prev_page(codeloc);
|
||||
long code_end =
|
||||
align_to_next_page(FFI_TRAMPOLINE_SIZE+(-1)+(long)codeloc);
|
||||
int rv = mprotect((void*)code_start, code_end - code_start,
|
||||
PROT_READ|PROT_WRITE|PROT_EXEC);
|
||||
if(rv) {
|
||||
fprintf(stderr, "Error mprotecting code page!\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ffi_cif* cif = (ffi_cif*) ref(cifptr, off_pointer_data);
|
||||
|
||||
callback_locative* loc = malloc(sizeof(callback_locative));
|
||||
|
|
Loading…
Reference in New Issue