Blame SOURCES/0002-Add-compiler-option-for-ENABLE_USER_CODEMEM.patch

814ac5
From bded311d32daa2339055341a7f1c1782ff39d047 Mon Sep 17 00:00:00 2001
814ac5
From: Fabian Deutsch <fabian.deutsch@gmx.de>
814ac5
Date: Sun, 1 Jan 2012 21:41:04 +0100
814ac5
Subject: [PATCH 2/2] Add compiler option for ENABLE_USER_CODEMEM.
814ac5
814ac5
This option disbales non-user-dependent path checking at compile time. If enabled, only paths corresponding to a user are checked.
814ac5
814ac5
Signed-off-by: Fabian Deutsch <fabian.deutsch@gmx.de>
814ac5
---
814ac5
 configure.ac     |    4 ++++
814ac5
 orc/Makefile.am  |    3 +++
814ac5
 orc/orccodemem.c |    2 ++
814ac5
 3 files changed, 9 insertions(+), 0 deletions(-)
814ac5
814ac5
diff --git a/configure.ac b/configure.ac
814ac5
index 00e1916..4daee88 100644
814ac5
--- a/configure.ac
814ac5
+++ b/configure.ac
814ac5
@@ -176,6 +176,10 @@ AM_CONDITIONAL(ENABLE_BACKEND_ARM, test "x$ENABLE_BACKEND_ARM" = "xyes")
814ac5
 AM_CONDITIONAL(ENABLE_BACKEND_C64X, test "x$ENABLE_BACKEND_C64X" = "xyes")
814ac5
 AM_CONDITIONAL(ENABLE_BACKEND_MIPS, test "x$ENABLE_BACKEND_MIPS" = "xyes")
814ac5
 
814ac5
+AC_ARG_ENABLE(user-codemem,
814ac5
+  AC_HELP_STRING([--enable-user-codemem],[Force codemem allocation to be user dependent (default is no)]),
814ac5
+    [], [enable_user_codemem=no])
814ac5
+AM_CONDITIONAL(ENABLE_USER_CODEMEM, test "x$enable_user_codemem" = "xyes")
814ac5
 
814ac5
 AC_DEFINE(ORC_EXPORTS, 1, [Defined for compiling internal code])
814ac5
 
814ac5
diff --git a/orc/Makefile.am b/orc/Makefile.am
814ac5
index 26263e0..887d36b 100644
814ac5
--- a/orc/Makefile.am
814ac5
+++ b/orc/Makefile.am
814ac5
@@ -9,6 +9,9 @@ liborc_@ORC_MAJORMINOR@_la_LDFLAGS = \
814ac5
 	-no-undefined -export-symbols-regex 'orc_'
814ac5
 liborc_@ORC_MAJORMINOR@_la_CFLAGS = $(ORC_CFLAGS) \
814ac5
 	-DORC_ENABLE_UNSTABLE_API
814ac5
+if ENABLE_USER_CODEMEM
814ac5
+liborc_@ORC_MAJORMINOR@_la_CFLAGS += -DORC_FORCE_USER_CODEMEM
814ac5
+endif
814ac5
 
814ac5
 liborc_@ORC_MAJORMINOR@_la_SOURCES = \
814ac5
 	orc.c \
814ac5
diff --git a/orc/orccodemem.c b/orc/orccodemem.c
814ac5
index 295a880..4a91e3e 100644
814ac5
--- a/orc/orccodemem.c
814ac5
+++ b/orc/orccodemem.c
814ac5
@@ -280,12 +280,14 @@ orc_code_region_allocate_codemem (OrcCodeRegion *region)
814ac5
 {
814ac5
   const char *tmpdir;
814ac5
 
814ac5
+#ifndef ORC_FORCE_USER_CODEMEM
814ac5
   tmpdir = getenv ("TMPDIR");
814ac5
   if (tmpdir && orc_code_region_allocate_codemem_dual_map (region,
814ac5
         tmpdir, FALSE)) return;
814ac5
 
814ac5
   if (orc_code_region_allocate_codemem_dual_map (region,
814ac5
         "/tmp", FALSE)) return;
814ac5
+#endif
814ac5
 
814ac5
   tmpdir = getenv ("XDG_RUNTIME_DIR");
814ac5
   if (tmpdir && orc_code_region_allocate_codemem_dual_map (region,
814ac5
-- 
814ac5
1.7.7.6
814ac5