Clean out prebuilt object files.

Add trampoline patch to force use of mmap() to get executable memory.
This commit is contained in:
Jerry James 2012-01-10 13:01:58 -07:00
parent 173d1ebd60
commit 978f9ba006
2 changed files with 56 additions and 3 deletions

42
ffcall-trampoline.patch Normal file
View File

@ -0,0 +1,42 @@
--- ./callback/trampoline_r/trampoline.c.orig 2009-04-27 09:24:05.000000000 -0600
+++ ./callback/trampoline_r/trampoline.c 2012-01-10 12:03:02.752466354 -0700
@@ -67,10 +67,6 @@ extern void (*tramp_r) (); /* trampoline
#ifndef CODE_EXECUTABLE
/* How do we make the trampoline's code executable? */
-#if defined(HAVE_MACH_VM) || defined(__convex__) || defined(HAVE_WORKING_MPROTECT) || defined(HAVE_SYS_M88KBCS_H)
-/* mprotect() [or equivalent] the malloc'ed area. */
-#define EXECUTABLE_VIA_MPROTECT
-#else
#ifdef HAVE_MMAP
/* Use an mmap'ed page. */
#define EXECUTABLE_VIA_MMAP
@@ -90,7 +86,6 @@ extern void (*tramp_r) (); /* trampoline
#endif
#endif
#endif
-#endif
#include <stdio.h> /* declares fprintf() */
--- ./trampoline/trampoline.c.orig 2008-09-26 14:19:37.000000000 -0600
+++ ./trampoline/trampoline.c 2012-01-10 12:02:33.027731322 -0700
@@ -67,10 +67,6 @@ extern void (*tramp) (); /* trampoline p
#ifndef CODE_EXECUTABLE
/* How do we make the trampoline's code executable? */
-#if defined(HAVE_MACH_VM) || defined(__convex__) || defined(HAVE_WORKING_MPROTECT) || defined(HAVE_SYS_M88KBCS_H)
-/* mprotect() [or equivalent] the malloc'ed area. */
-#define EXECUTABLE_VIA_MPROTECT
-#else
#ifdef HAVE_MMAP
/* Use an mmap'ed page. */
#define EXECUTABLE_VIA_MMAP
@@ -90,7 +86,6 @@ extern void (*tramp) (); /* trampoline p
#endif
#endif
#endif
-#endif
#include <stdio.h> /* declares fprintf() */

View File

@ -2,7 +2,7 @@
Name: ffcall
Version: 1.10
Release: 6.20100903cvs%{?dist}
Release: 7.20100903cvs%{?dist}
Summary: Libraries for foreign function call interfaces
Group: System Environment/Libraries
@ -14,6 +14,9 @@ URL: http://www.gnu.org/software/libffcall/
# export -D 2010-09-04 ffcall
# tar cJf ffcall-20100903cvs.tar.xz ffcall
Source0: ffcall-20100903cvs.tar.xz
# This patch will not be sent upstream. It removes the possibility of using
# mprotect() to make memory executable, as that runs afoul of SELinux.
Patch0: ffcall-trampoline.patch
%description
@ -29,9 +32,13 @@ packages are:
%prep
%setup -q -n ffcall
%patch0
# Remove prebuilt object files
find . -name \*.o | xargs rm -f
%build
export CFLAGS="$RPM_OPT_FLAGS -fPIC"
export CFLAGS="$RPM_OPT_FLAGS -fPIC -DMAP_VARIABLE=2"
%configure
make # %{?_smp_mflags}
@ -55,7 +62,11 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
%changelog
* Mon Jan 9 2012 Jerry James <loganjerry@gmail.com>
* Tue Jan 10 2012 Jerry James <loganjerry@gmail.com> - 1.10-7.20100903cvs
- Clean out prebuilt object files
- Add trampoline patch to force use of mmap() to get executable memory
* Mon Jan 9 2012 Jerry James <loganjerry@gmail.com> - 1.10-6.20100903cvs
- Update to CVS 20100903
- Minor spec file cleanups