changeset 12:abff420b5df4

-
author Gregor Richards <Richards@codu.org>
date Mon, 14 Dec 2009 14:28:39 -0500
parents 76eb4d6b0cd6 (current diff) 9b2ed3c8adc6 (diff)
children a5825771cac3
files
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/elfload/src/bbuffer.c	Mon Dec 14 14:28:20 2009 -0500
+++ b/elfload/src/bbuffer.c	Mon Dec 14 14:28:39 2009 -0500
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 
 #include "../config.h"
 
@@ -22,10 +23,10 @@
             loc -= offset;
         }
 
-        ret = mmap(loc, sz, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED,
+        ret = mmap(loc, sz, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON|MAP_FIXED,
                    -1, 0);
     } else {
-        ret = mmap(NULL, sz, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
+        ret = mmap(NULL, sz, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON,
                    -1, 0);
     }
 
--- a/elfload/src/elfload.c	Mon Dec 14 14:28:20 2009 -0500
+++ b/elfload/src/elfload.c	Mon Dec 14 14:28:39 2009 -0500
@@ -60,7 +60,13 @@
 #if defined(HAVE_DLFCN_H)
         if (strcmp(nm, "libhost_.so") == 0) {
             /* the entire host */
-            f->prog = dlopen(NULL, RTLD_NOW|RTLD_GLOBAL);
+            f->prog = dlopen(
+#ifdef __APPLE__
+                    "libc.dylib"
+#else
+                    NULL
+#endif
+                    , RTLD_NOW|RTLD_GLOBAL);
         } else {
             f->prog = dlopen(nm + 8, RTLD_NOW|RTLD_GLOBAL);
         }